Inspiration

Small retail shops in India process hundreds of micro-transactions via UPI (Unified Payments Interface) daily. However, reconciling these digital payments with actual sales invoices and calculating monthly GST (Goods and Services Tax) liabilities remains a manual, error-prone, end-of-day nightmare. Building on my background in developing agentic workflows, I wanted to create an accessible, voice-first solution. The goal was to build a virtual financial auditor that allows business owners to manage complex financial data pipelines entirely through natural language, skipping the spreadsheets altogether.

What it does

Built specifically for the Alexa+ track, VyaparSathi is an AI-driven back-office agent powered by a custom Model Context Protocol (MCP) server. It enables shop owners to seamlessly reconcile unstructured UPI payment messages against pending sales invoices. Instead of clicking through dashboards, a user can simply ask their Alexa+ agent to "audit today's pending invoices" or "reconcile my UPI statements."The agent utilizes three core MCP tools to pull real-time data, match orphaned transactions, and calculate tax liabilities on the fly. For instance, the GST tool calculates the exact tax split for the business owner using the standard Indian tax framework:$$\text{Total GST} = \sum_{i=1}^{n} \left( \text{Invoice_Amount}_i \times \frac{\text{GST_Rate}_i}{100} \right)$$Where the state and central tax liabilities are divided equally:$\text{CGST} = \text{SGST} = \frac{\text{Total GST}}{2}$

How we built it

As a solo developer, I engineered the backend from scratch using Python 3.11 and the official mcp Python SDK. The architecture relies on FastAPI to handle the Streamable HTTP (Server-Sent Events) transport required by the Alexa+ MCP client.

To ensure the data layer didn't block the asynchronous event loop, I integrated a MongoDB database using the motor async driver. All data schemas—mapping unstructured UPI text to structured invoice objects—were strictly validated using Pydantic V2.

To tackle the AWS Builder Challenge, the entire application was containerized using Docker and Docker Compose. I deployed the stack to an AWS EC2 instance, utilizing an Nginx reverse proxy to securely expose the FastAPI server over HTTPS with a Let's Encrypt SSL certificate, which is a strict requirement for Alexa+ endpoints.

Challenges we ran into

MCP SSE Transport via Reverse Proxy: Configuring Nginx to handle Server-Sent Events (SSE) was a major hurdle. Nginx's default behavior is to buffer chunked data, which caused the Alexa+ client connection to stall and time out. I had to explicitly disable buffering (proxy_buffering off; and chunked_transfer_encoding off;) and strip the connection headers to maintain the live HTTP stream.

AWS Security Group Configurations: During the SSL certificate generation with Certbot, the standalone server kept timing out. I had to debug and reconfigure the AWS EC2 Security Groups to ensure Port 80 was properly exposed to the internet for the Let's Encrypt ACME challenge.

Async Event Loop Blocking: Initially, synchronous database operations were causing the FastAPI server to drop incoming MCP tool requests. Refactoring the entire database layer to use motor.motor_asyncio was challenging but critical for maintaining the high-performance non-blocking nature of the server.

Accomplishments that we're proud of

Successfully deploying a fully functional, self-hosted MCP server to AWS EC2 within the hackathon time constraints. Furthermore, writing a strict Pydantic schema that accurately maps unstructured, real-world UPI transaction text to structured database invoices without relying on brittle regex scraping was a significant technical milestone.

What we learned

This project was an incredible deep dive into the Model Context Protocol (MCP) specification. I gained extensive practical knowledge in managing persistent Server-Sent Event connections, handling network routing inside Docker bridge networks, and applying proper MLOps practices for deploying AI agent backends to the cloud.

What's next for VyaparSathi: AI Back-Office Agent

The next phase is integrating a Retrieval-Augmented Generation (RAG) pipeline to allow business owners to query their historical tax filings (PDFs) naturally. I also plan to add an automated WhatsApp integration tool to the MCP server, enabling the agent to proactively send payment reminders for overdue invoices.

Share this project:

Updates

Submission history