Agmarknet MCP Server
This server provides access to Indian agricultural commodity wholesale price data from Agmarknet, enabling you to query and analyze mandi (regulated market) prices across India.
Get commodity prices (
get_commodity_price): Retrieve daily wholesale min, max, and modal prices for a specific commodity, optionally filtered by state, district, or market.Compare markets (
compare_markets): Compare prices of a commodity across different mandis, ranked cheapest-first by modal price, optionally filtered by state and limited to a top N results.Get price summary (
get_price_summary): Get a statistical summary (average, lowest, and highest prices) for a commodity across all matching markets, optionally filtered by state.List commodities (
list_commodities): Browse all available commodities in the dataset, with an optional search term to narrow results.List markets (
list_markets): Browse all available mandis (regulated markets) reporting data, optionally filtered by state and/or commodity.
Note: The
mainbranch serves today's data only and includes a built-in sample dataset usable without an API key. Thefeat/ceda-api-migrationbranch offers an additionalget_price_trendtool and historical data back to 2000.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Agmarknet MCP Server Where is the cheapest place to buy onions in Maharashtra?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Agmarknet MCP Server
A Model Context Protocol (MCP) server that gives LLMs (like Claude) access to Indian agricultural commodity prices — daily wholesale min/max/modal rates across thousands of mandis (regulated markets) and hundreds of commodities.
Ask a model "Where were tomatoes cheapest in Pune last month?" and it answers from real market data.
Pick your implementation
The project lives on two branches with different data sources. They expose the same kind of tools; choose by your data needs.
|
| |
Data source | data.gov.in Agmarknet | CEDA Agri Market API (Ashoka University) |
API key |
|
|
Without a key | Serves a small sample dataset so the tools work out of the box — for flavour only, not live prices | Will not run — a key is required |
To use real data | Add the key to | Add the key to |
Data coverage | Current day only (when the live API is reachable) | Historical, 2000–present (lags ~a few months) |
Price trends | ✗ | ✅ |
Reliability | data.gov.in is frequently down / WAF-blocked | Stable |
Tools | 5 | 6 |
Best for | Trying the tools instantly on sample data | Real analysis — trends and accurate prices |
TL;DR: Want to see the server work with no live API? Use
main(it ships with sample data). Want real, reliable commodity data and trends? Usefeat/ceda-api-migration.
Switch with git checkout main or git checkout feat/ceda-api-migration.
Related MCP server: Agricultural AI MCP Server
Setup
Install (same for both branches)
git clone https://github.com/Krishna-Baldwa/agmarket-mcp.git
cd agmarknet-mcp
git checkout feat/ceda-api-migration # or: git checkout main
python -m venv .venv
source .venv/bin/activate
pip install -e .Configure the API key
cp .env.example .envOn feat/ceda-api-migration (CEDA):
Get a free key from the CEDA Data Portal.
Set
CEDA_API_KEY=<your key>in.env. Done — the server uses real data.
On main (data.gov.in):
Out of the box it serves a small sample dataset (no key needed) so you can see the tools respond.
To switch to real data.gov.in data:
Get a free key at data.gov.in and set
DATA_GOV_IN_API_KEY=<your key>in.env.In
src/agmarknet_mcp/server.py, change the client to live mode:api_client = AgmarknetClient(use_mock=False) # was use_mock=True
Connect to Claude Desktop
Add this to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json; The easiest way to get to it is from inside the app rather than hunting through folders: open Claude Desktop → Settings → Developer tab → click Edit Config. That opens the file directly (and creates it if it doesn't exist yet).), using the env var for your branch:
{
"mcpServers": {
"agmarknet": {
"command": "/absolute/path/to/agmarknet-mcp/.venv/bin/python",
"args": ["-m", "agmarknet_mcp.server"],
"env": {
"CEDA_API_KEY": "your_api_key_here"
}
}
}
}(On main, use "DATA_GOV_IN_API_KEY" instead — or omit env to run on sample data.)
Restart Claude Desktop and ask:
"Compare tomato prices across mandis in Pune district."
"What's the 60-day onion price trend in Maharashtra?" (CEDA branch)
Test without an LLM
npx @modelcontextprotocol/inspector python -m agmarknet_mcp.serverTools
feat/ceda-api-migration (CEDA — real historical data)
Tool | What it does |
| Min/max/modal prices — latest available date, or a specific |
| Rank a district's mandis cheapest-first. |
| Average / cheapest / dearest on the latest date. |
| Daily-average price, window average, high/low, and % change over N days. |
| List tracked commodities, optionally filtered. |
| List the mandis reporting a commodity in a district. |
Tools accept names, not numeric ids (see Design). state is required; district narrows to individual mandis (omit for a state-wide aggregate).
main (data.gov.in + sample fallback)
Tool | What it does |
| Daily min/max/modal price for a commodity. |
| Rank markets cheapest-first. |
| Average / cheapest / dearest across markets. |
| List commodities in the current dataset. |
| List reporting mandis. |
Design (CEDA branch)
The CEDA API is id-based: commodities, states, districts, and markets are all numeric ids, and /prices returns ids, not names. LLMs and humans think in names, so the server's core job is translation:
Name → ID resolution. Tools accept
"Tomato","Maharashtra","Pune"; the client resolves them to ids (case-insensitive, unique-substring matching) before calling the API, and raises a clear error for unknown/ambiguous names so the model can self-correct.ID → name enrichment. Raw price rows (which carry only
market_id) are translated back into readable records before reaching the model.Cached reference data. Commodities, geographies, and markets are fetched once and reused.
Tolerant validation.
pydanticvalidates every response. The API changes shape by granularity (state-level queries omitdistrict_id/market_id), which the models handle explicitly.
Module layout
server.py— FastMCP server: defines the tools and handles the stdio/JSON-RPC lifecycle.api.py— the API client (CedaClienton CEDA;AgmarknetClientwith sample fallback onmain).models.py—pydanticmodels for the API's raw shapes and the domain objects the tools return.
Data sources
main: Directorate of Marketing & Inspection (DMI), Govt. of India, via data.gov.in.CEDA branch: CEDA Agri Market Data, "Centre for Economic Data & Analysis, Ashoka University" — built on the same Agmarknet data, 2000–present. Free to download, display or include the data in other products for non-commercial purposes.
License
Available Tools
5 toolscompare_marketsA
Compare prices of a commodity across different markets.
Returns markets sorted by modal price (cheapest first). Great for finding the cheapest mandi.
Inputs: commodity (required), state, top_n. Returns: result
get_commodity_priceB
Get current daily wholesale prices for a specific commodity.
Returns min, max, and modal prices from today's Agmarknet data.
Inputs: commodity (required), state, district, market. Returns: result
get_price_summaryB
Get a statistical summary of a commodity's price across all markets.
Returns average, lowest, and highest prices across matching markets.
Inputs: commodity (required), state. Returns: result
list_commoditiesC
List available commodities in today's Agmarknet data.
Inputs: search. Returns: result
list_marketsC
List available markets (mandis) in today's Agmarknet data.
Inputs: state, commodity. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: listing commodities/markets, fetching prices, comparing across markets, and summarizing prices. No overlaps.
All tool names follow a consistent verb_noun pattern (e.g., list_commodities, get_commodity_price).
Five tools is appropriate for the domain of agricultural market price lookups, covering listing, retrieval, comparison, and summary without excess.
The tools cover the core operations for daily wholesale prices: listing available data points, retrieving individual prices, comparing markets, and getting statistical summaries. No obvious gaps for the stated scope.
Maintenance
Related MCP Connectors
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
Live crypto + IDX stock market intelligence for AI agents — 19 tools, no API key.
19 market-data tools for AI agents: company KYC, SEC filings, patents, auctions, tenders
Primary-source commodities data for AI agents — EIA, FRED, CFTC, USDA, USGS via x402 on Base.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides access to real-time and historical Indian stock data via Yahoo Finance API, enabling local LLMs to retrieve stock information through MCP-compatible agents like Claude Desktop and Cursor.2-
- 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.-

Plantos MCP Serverofficial
AlicenseNot gradedqualityFmaintenanceEnables AI assistants to analyze farm locations, retrieve soil and weather data, access commodity market prices, and chat with an agricultural advisor for farming recommendations.MIT- AlicenseAqualityBmaintenanceEnables AI agents to fetch Indian mutual-fund NAVs and NSE market data, calculate GST and income-tax amounts, and look up RBI policy rates, with provenance blocks for citations. Works with any MCP client over stdio or HTTP.17MIT