Mandi Price Advisor MCP Server
Sends price alerts to users via Telegram Bot API when threshold is crossed.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Mandi Price Advisor — MCP Server
An MCP server that gives farmers and traders daily mandi (wholesale market) commodity prices across India, lets them compare markets, and — critically — sets price alerts that message them on Telegram when a threshold is crossed.
This goes beyond fetch-only MCP wrappers: the scheduler acts on the user's behalf over time, making the system genuinely agentic.
Architecture
Claude / any MCP client
│ tools · resources · prompts
▼
MCP Server (Streamable HTTP)
├── Tools: get_mandi_price, compare_markets, get_price_trend,
│ set_price_alert, list_my_alerts, cancel_alert
├── Resources: mandi://commodity/{name}/state/{state}/latest
│ mandi://commodity/{name}/market/{market}/history
└── Prompts: daily_selling_advisory
│
├── SQLite (cache, alerts, price history)
├── api.data.gov.in (verified mandi dataset)
└── APScheduler → Telegram Bot APIKey design decision: Price facts are always fetched from data.gov.in or read from a validated SQLite cache — never generated or interpolated by an LLM. The LLM's only job is understanding the user's request and phrasing the response.
Related MCP server: Agmarknet MCP Server
Data Source (Verified)
Field | Value |
Dataset | Current Daily Price of Various Commodities from Various Markets (Mandi) |
Publisher | Ministry of Agriculture and Farmers Welfare |
Resource ID |
|
Endpoint |
|
Fields |
|
Update cadence | Once per day (not real-time) |
Get a free API key instantly at data.gov.in — no approval wait.
Quick Start
1. Install dependencies
cd mandi-advisor-mcp
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS/Linux
pip install -r requirements.txt2. Configure environment
copy .env.example .env # Windows
# cp .env.example .env # macOS/LinuxEdit .env:
DATA_GOV_IN_API_KEY=your_key_from_datagovin
TELEGRAM_BOT_TOKEN=your_token_from_BotFather3. Set up Telegram
Message @BotFather on Telegram →
/newbotCopy the bot token into
.envMessage your bot
/start— the bot replies with yourchat_id(background polling starts automatically when the server runs)Use that
chat_idwhen callingset_price_alert
4. Run the MCP server
python -m mcp_server.serverServer starts on http://0.0.0.0:8000 with Streamable HTTP transport. The alert scheduler and Telegram /start bot polling run in the background.
5. Connect from Cursor / Claude Desktop
Add to your MCP client config:
{
"mcpServers": {
"mandi-advisor": {
"url": "http://localhost:8000/mcp"
}
}
}MCP Surface
Tools
Tool | Description |
| Latest min/max/modal price for a commodity, optionally by state/market |
| Compare modal prices across states to find the best market |
| Modal price trend over N days from cached history |
| Action tool — Telegram alert when threshold is crossed |
| List active alerts for a chat ID |
| Cancel an alert by ID |
Resources
mandi://commodity/{commodity}/state/{state}/latestmandi://commodity/{commodity}/market/{market}/history
Prompts
daily_selling_advisory(commodity, location?, state?, market?)— "Should I sell today?" briefing grounded in fetched data
Alert Behavior
User calls
set_price_alert(commodity="Onion", market="Pune", threshold_price=2000, direction="above", telegram_chat_id="123456")Alert stored in SQLite
Scheduler (every 6h) batch-fetches prices for all watched commodity/market pairs
On threshold cross → Telegram message sent, alert marked fired (one-shot)
Example notification:
🔔 Price Alert: Onion at Pune market is now ₹2,100/quintal (as of 2026-07-27), above your ₹2,000 alert.
Running Tests
pytest eval/ -vTests cover:
API response parsing and httpx-mocked fetch/caching
Alert threshold edge cases (
above/below, exact threshold, missing data)Cache hit/expiry behavior
End-to-end scheduler with mocked Telegram
MCP tool registration and prompt location resolution
Telegram
/startbot handler
Deployment
Deploy to Railway, Render, or similar always-on host (alerts require a persistent scheduler).
Docker:
docker build -t mandi-advisor-mcp .
docker run -p 8000:8000 --env-file .env mandi-advisor-mcpRailway / Render: use the included railway.toml or render.yaml with the Dockerfile.
python -m mcp_server.serverSet environment variables on the host. Recommended: ALERT_CHECK_INTERVAL_HOURS=6, CACHE_TTL_SECONDS=21600, TELEGRAM_POLLING_ENABLED=true.
Disclaimers
Prices are sourced from the Government of India's daily mandi price dataset and update once per day, not in real time. Always confirm final prices at the actual market before making a selling decision.
This tool does not execute trades or transactions — it only informs and alerts.
Project Structure
mandi-advisor-mcp/
├── mcp_server/ # MCP tools, resources, prompts, server entrypoint
├── data_layer/ # data.gov.in client, SQLite, alert logic
├── scheduler/ # APScheduler alert checker
├── notifications/ # Telegram Bot API wrapper
├── eval/ # Tests and API response fixtures
└── requirements.txtLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Crypto perpetual-futures market data from 22 venues, each value with its venue, time and age — plus alerts in Telegram or a webhook that your AI sets up with you.
PriceInIndia is a price-comparison assistant for products sold in India. Ask about any product — phones, laptops, cameras, appliances and more — and it searches live listings from Amazon, Flipkart, Croma, Reliance Digital and 50+ other Indian retailers, then shows current prices and the best available offer as interactive product cards with direct links to buy from the retailer. You can also browse product categories to explore. Prices are in INR and come from live listings, so they can change quickly. PriceInIndia is for shopping research only — it does not sell products or process payments.
India shopping search engine and price tracker: price history, price drops and price comparison.
UK supermarket prices across 13 stores: price items and lists, see history, save lists, set alerts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides real-time crop price data from Indian government sources and agricultural web search capabilities. Enables AI chatbots to access comprehensive agricultural market information and news for farming-related queries.-
- AlicenseAqualityDmaintenanceProvides LLMs with real-time access to Indian agricultural commodity prices across 3,000+ markets via the government's Agmarknet database.25MIT
- FlicenseNot gradedqualityCmaintenanceProvides agricultural product price monitoring, price index tracking, and daily/weekly/monthly market report queries to support price fluctuation identification and market trend analysis.1-
- FlicenseNot gradedqualityBmaintenanceEnables searching and comparing product prices across major Indian quick-commerce and e-commerce platforms, ranking results by landed price, returning product links, storing price history, and providing 15–30 day price direction forecasts with best-buy recommendations.-