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 ServerWhere 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.
| Name | Required | Description | Default |
|---|---|---|---|
| commodity | Yes | ||
| state | No | ||
| top_n | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, so the description bears full responsibility. It discloses that results are sorted by modal price (cheapest first), which is useful. However, it does not mention whether the operation is read-only, any authentication needs, or potential side effects. The disclosure is adequate but not comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise: two short sentences plus a standalone line. Every sentence adds value, with no redundancy. It is front-loaded with the core action and then provides a key benefit.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has an output schema (existing but not shown), so return details are not required. However, the description lacks explanation for 'modal price' and does not clarify the meaning of 'top_n' or 'state'. For a relatively simple tool, it covers the primary use but misses minor contextual details.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description only indirectly references the 'commodity' parameter by mentioning 'a commodity.' The 'state' and 'top_n' parameters are not explained at all. With 0% schema description coverage, the description should compensate but does not, leaving the agent to infer semantics for two of three parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Compare prices of a commodity across different markets,' specifying the action (compare), resource (prices of a commodity), and scope (across markets). It distinguishes from siblings like get_commodity_price (single price) and list_markets (just listing) by focusing on comparative pricing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'Great for finding the cheapest mandi' implies a specific use case, but there is no explicit guidance on when to use this tool versus alternatives (e.g., get_price_summary for aggregated stats). No exclusions or conditions are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_commodity_priceB
Get current daily wholesale prices for a specific commodity.
Returns min, max, and modal prices from today's Agmarknet data.
| Name | Required | Description | Default |
|---|---|---|---|
| commodity | Yes | ||
| state | No | ||
| district | No | ||
| market | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden but only states it returns min, max, and modal prices from today's data. It does not disclose behavior if data is missing, freshness guarantees, or any rate limits. This gap leaves the agent uncertain about edge cases.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short, front-loaded sentences that efficiently communicate the tool's purpose and output. No waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite an output schema existence, the description lacks explanation of optional parameters and behavioral details. Given 4 parameters and no annotations, the description is insufficiently complete for agents to reliably invoke the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, yet the description only refers to a 'specific commodity' without explaining the state, district, or market parameters. The required commodity parameter lacks format or example, failing to add value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves current daily wholesale prices for a specific commodity, specifying returns of min, max, and modal prices from Agmarknet data. It distinguishes itself from sibling tools like compare_markets or list_commodities by focusing on price retrieval for a single commodity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for getting commodity prices but does not provide explicit guidance on when to use this tool versus alternatives like compare_markets or get_price_summary. No exclusions or conditions are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_price_summaryB
Get a statistical summary of a commodity's price across all markets.
Returns average, lowest, and highest prices across matching markets.
| Name | Required | Description | Default |
|---|---|---|---|
| commodity | Yes | ||
| state | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description bears full responsibility for behavioral disclosure. It mentions the return type (summary) but omits side effects, permissions, or behavior on missing data. The tool is likely read-only, but the description does not confirm.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with purpose, and all words contribute. It is concise but could be slightly more structured (e.g., listing returned fields explicitly).
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple with 2 parameters and an output schema, so the description need not detail returns. However, it misses explaining that 'state' is optional and affects market filtering. Overall, it provides a minimal but adequate context for a straightforward tool, falling short on optional parameters.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It mentions 'commodity' implicitly and that results span 'all markets', but fails to clarify the 'state' parameter is optional or explain parameter formats. This adds minimal value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool returns a statistical summary (average, lowest, highest) of a commodity's price across all markets. It uses specific verbs and resources, and the purpose is distinguishable from sibling tools like get_commodity_price or compare_markets.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool vs alternatives. The description implies it's for aggregate statistics across markets but doesn't mention circumstances or prerequisites, leaving the agent to infer usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_commoditiesC
List available commodities in today's Agmarknet data.
| Name | Required | Description | Default |
|---|---|---|---|
| search | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries full burden. It does not disclose authentication needs, rate limits, or the nature of the data (e.g., live vs cached). The search parameter's effect is not explained, and the output format is not hinted, even though an output schema exists.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence with no extraneous words. However, it sacrifices completeness for brevity, missing key details about parameters and behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has one optional parameter and an output schema, the description is insufficient. It does not mention the search filter, output structure (e.g., list of commodity names/objects), or temporal scope (today's data). Sibling tools are not referenced, so the agent lacks context for correct use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, and the description does not explain the purpose of the 'search' parameter. While the schema shows it is an optional string that can be null, the description adds no semantic value, such as indicating it filters commodities by name.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'List' and the resource 'available commodities in today's Agmarknet data', which distinguishes it from sibling tools like list_markets (which lists markets) and others focused on prices. However, it could be more precise about the temporal scope (e.g., 'current date's data') to avoid ambiguity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool vs alternatives like list_markets or get_commodity_price. There is no mention of prerequisites, limitations, or comparison to siblings, leaving the agent without decision support.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_marketsC
List available markets (mandis) in today's Agmarknet data.
| Name | Required | Description | Default |
|---|---|---|---|
| state | No | ||
| commodity | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description does not disclose important behavioral traits such as filtering behavior (despite parameters), data freshness (today only), or any limitations. No annotations are present, so the description should compensate but fails.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very short and to the point, but it omits crucial details about parameters and usage context. It is concise but not sufficiently informative.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is too brief. It does not cover the filtering functionality hinted by the parameters, nor does it differentiate from sibling tools. The output schema exists but is not mentioned. Overall, it lacks completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description does not describe or even mention the parameters (state, commodity). Since schema coverage is 0%, the description should explain what these parameters do, but it does not.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action (list), the resource (markets/mandis), and the data context (today's Agmarknet data). It is distinct from sibling tools like list_commodities and get_commodity_price.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No usage context or comparison to alternatives is provided. The description does not help the agent decide when to choose list_markets over its siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v0.1.0- First observed
compare_markets - First observed
get_commodity_price - First observed
get_price_summary - First observed
list_commodities - First observed
list_markets
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.
Structured access to 10 major Indian legal texts (BNS, IPC, etc) for AI agents.
Primary-source commodities data for AI agents — EIA, FRED, CFTC, USDA, USGS via x402 on Base.
Agent-first marketplace for real-world assets — agro and energy first; humans approve every write.
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.-
- AlicenseNot gradedqualityDmaintenanceProvides real-time and historical Indian stock market data from NSE and BSE exchanges with 66 tools covering quotes, options chains, corporate actions, IPOs, and market analytics for LLM-powered financial analysis.42 npm12MIT
- FlicenseNot gradedqualityDmaintenanceEnables plain English queries about US agricultural data, including historical crop statistics from NASS QuickStats and current cash grain prices from AMS Market News.-