Inspiration
Many small farmers sell on the day they reach the mandi. Prices can swing 5-30% within a few weeks, and perishable crops like tomato spoil in days. Most farmers can't read charts or dashboards, but they can talk to a voice assistant. I wanted to build something that gives a clear decision, "sell now" or "wait", and the reason behind it.
What it does
Mandi Mitra is a self-hosted MCP server for Alexa+ with five tools: crop list, recent price trend, a 14-day ML price forecast, a 3-day rain outlook, and a sell-or-wait recommendation.
Ask "Should I sell my onions now?" or, in Hindi, "क्या मैं आलू रोकूं?" and it answers by voice with a clear action and a reason.
How I built it
- ML model: a gradient-boosting model (scikit-learn) learns next-day price moves from lagged prices and seasonality, then forecasts 14 days ahead. It is tested on held-out data and the server reports the 7-day error.
- Advice logic: the forecast is combined with each crop's shelf life (tomato 4 days, onion 45, wheat 180). It says "wait" only if the price is expected to rise 3% or more inside the storage window. Perishable crops are sold before heavy rain (rain data from Open-Meteo).
- MCP server: Python MCP SDK, Streamable HTTP, endpoint
/mcp. - Alexa+ experience: I took the simulated-experience path. A web app plays the role of Alexa+ with speech in and out in English and Hindi. It talks to the server over real MCP calls, and the interface shows every tool call.
Challenges
- Making the advice trustworthy, not just a forecast: the model is tested on held-out data, respects shelf life, and says plainly when no price rise is expected.
- The MCP Python SDK's 2.x release renamed key classes and broke most tutorials, so I pinned the stable 1.x version.
- The bundled demo prices are synthetic sample data so the project runs offline. The loader accepts real market price CSV exports (date, crop, price).
What I learned
How MCP servers expose tools to voice assistants, how to turn a forecast into a decision a non-technical user can act on, and how much shelf life and weather change the right answer.
What's next
Real per-mandi prices, more crops and languages, WhatsApp/SMS alerts, and Amazon Bedrock for free-form questions.
Built With
- alexa-plus
- css3
- html
- javascript
- machine-learning
- mcp
- model-context-protocol
- numpy
- open-meteo
- pandas
- python
- scikit-learn
- starlette
- uvicorn
- web-speech-api
Log in or sign up for Devpost to join the conversation.