Skip to main content
Glama

agrobr-mcp

PyPI Tests License: MIT Python 3.11+

MCP server that gives LLMs access to real-time Brazilian agricultural data — prices, crop estimates, climate, deforestation and more from 10 public sources from agrobr.

Demo


Install

Version 0.2.0 requires agrobr >=2.0.0,<3 and MCP Python SDK >=2.0.0,<3.

pip install agrobr-mcp

Related MCP server: Base dos Dados MCP

Setup

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "agrobr": {
      "command": "python",
      "args": ["-m", "agrobr_mcp"]
    }
  }
}

Cursor

Settings > MCP Servers > Add:

{
  "agrobr": {
    "command": "python",
    "args": ["-m", "agrobr_mcp"]
  }
}

Claude Code

claude mcp add agrobr python -- -m agrobr_mcp

If the above fails due to -m flag parsing, create a wrapper script:

Linux/macOS: echo 'python -m agrobr_mcp' > run.sh && chmod +x run.sh && claude mcp add agrobr ./run.sh

Windows: echo python -m agrobr_mcp > run.bat && claude mcp add agrobr run.bat

Docker

docker build -t agrobr-mcp .
docker run --rm -i agrobr-mcp

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "agrobr": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "agrobr-mcp"]
    }
  }
}

Tools

14 tools available out of the box:

Prices & Market

Tool

Description

preco_diario

Daily spot prices for agricultural commodities (CEPEA/ESALQ)

futuros_b3

Daily settlement prices for agricultural futures on B3 exchange (latest published session by default)

exportacao

Agricultural exports summed by month, by product and state of origin (Comex Stat; ABIOVE fallback)

Production & Crop

Tool

Description

estimativa_safra

Crop estimate by state, latest season with data by default (CONAB/IBGE)

producao_anual

Historical annual production by state (IBGE PAM)

balanco

Supply and demand balance — stock, consumption, exports (CONAB)

progresso_safra

Weekly planting and harvesting progress by state (CONAB)

serie_historica_safra

Historical crop series by season — area, production, yield; last 10 years by default (CONAB)

rebanho

Livestock herds and animal products by state, latest published year by default (IBGE PPM)

Climate & Environment

Tool

Description

clima

Climate data by state — temperature, precipitation, radiation (NASA POWER)

desmatamento

Deforestation polygons (PRODES for the previous calendar year, falling back one more year when empty) and alerts (DETER, last 15 days) by biome, with optional year and state filters, up to 2,000 records (INPE)

queimadas

Fire hotspots of one day by municipality and biome, reference satellite (INPE)

Meta

Tool

Description

listar_produtos

List valid products for each tool

health_check

Check status of all data sources


Example queries

"Qual o preço da soja nos últimos 5 dias?"
"Estimativa de safra de milho por estado"
"Progresso da colheita de soja"
"Dados de desmatamento na Amazônia"
"Quais produtos estão disponíveis?"

How it works

User (natural language)
    │
MCP Client (Claude Desktop / Cursor / Claude Code)
    │
agrobr-mcp (this server — thin layer, text formatting)
    │
agrobr library (data collection, parsing, caching)
    │
19 public APIs (CEPEA, CONAB, IBGE, INPE, B3, NASA POWER…)

agrobr-mcp is a thin wrapper. All data logic lives in the agrobr library.


Development

git clone https://github.com/bruno-portfolio/agrobr-mcp.git
cd agrobr-mcp
pip install -e ".[dev]"

# Run tests
pytest tests/ -m "not integration" -v

# Lint
ruff check src/ tests/
ruff format src/ tests/

License

MIT


PT-BR

O que é o agrobr-mcp?

Servidor MCP que dá acesso a dados agrícolas brasileiros em tempo real para LLMs. Preços, safras, clima, desmatamento e mais — tudo de fontes públicas como CEPEA, CONAB, IBGE, INPE e B3.

Instalação

A versão 0.2.0 requer agrobr >=2.0.0,<3 e MCP Python SDK >=2.0.0,<3.

pip install agrobr-mcp

Configuração

Adicione ao seu client MCP (Claude Desktop, Cursor ou Claude Code) conforme as instruções acima.

Docker

docker build -t agrobr-mcp .
docker run --rm -i agrobr-mcp

14 tools disponíveis

  • preco_diario — Preço spot de commodities agrícolas (CEPEA/ESALQ)

  • futuros_b3 — Ajustes diários de futuros agrícolas na B3 (por padrão, o último pregão publicado)

  • exportacao — Exportações agrícolas somadas por mês, por produto e UF de origem (Comex Stat; ABIOVE como reserva)

  • estimativa_safra — Estimativa de safra por UF, por padrão a safra mais recente com dado (CONAB/IBGE)

  • producao_anual — Produção histórica por UF (IBGE PAM)

  • balanco — Balanço de oferta e demanda (CONAB)

  • progresso_safra — Progresso semanal de plantio e colheita (CONAB)

  • serie_historica_safra — Série histórica por safra: área, produção e produtividade; por padrão os últimos 10 anos (CONAB)

  • rebanho — Rebanhos e produção animal por UF, por padrão o ano mais recente publicado (IBGE PPM)

  • clima — Dados climáticos por UF (NASA POWER)

  • desmatamento — Polígonos de desmatamento (PRODES do ano anterior ao corrente, recuando mais um ano se vier vazio) e alertas (DETER, últimos 15 dias) por bioma, com filtros opcionais de ano e UF, até 2.000 registros (INPE)

  • queimadas — Focos de calor de um dia por município e bioma, satélite de referência (INPE)

  • listar_produtos — Lista produtos válidos por tool

  • health_check — Status das fontes de dados

mcp-name: io.github.bruno-portfolio/agrobr

Available Tools

14 tools
balancoB

Supply and demand balance (stock, consumption, exports).

    Products: soja, milho, arroz, feijao, trigo, algodao.

    Args:
        produto: Crop name (e.g. "soja", "milho")
    

Inputs: produto (required). Returns: result

climaA

Recent climate data by state (temperature, precipitation, radiation, humidity, wind).

    Valid states: AC, AL, AM, AP, BA, CE, DF, ES, GO, MA, MG, MS,
    MT, PA, PB, PE, PI, PR, RJ, RN, RO, RR, RS, SC, SE, SP, TO.

    Args:
        uf: State abbreviation (e.g. "MT", "PR", "RS")
        ano: Year (default: current year)
        agregacao: "diario" or "mensal" (default: "mensal")
    

Inputs: uf (required), ano, agregacao. Returns: result

desmatamentoA

Deforestation polygons and alerts by biome.

    Biomes: amazonia, cerrado, mata_atlantica, caatinga, pampa, pantanal.
    Systems: prodes (polygons for the previous calendar year, falling back
    one more year when empty), deter (alerts of the last 15 days).
    At most 2000 records are read; the response reports any cut.

    Args:
        bioma: Biome name (e.g. "amazonia", "cerrado")
        sistema: "prodes" (annual) or "deter" (alerts)
        ano: Year (PRODES mapping year, used as given without falling back;
            DETER calendar year). Default: see above.
        uf: State abbreviation filter (e.g. "PA", "MT"). Empty = whole biome.
    

Inputs: uf, ano, bioma, sistema. Returns: result

estimativa_safraB

Current crop season estimate by state (area, production, yield).

    Products: soja, milho, arroz, feijao, trigo, algodao.

    Args:
        produto: Crop name (e.g. "soja", "milho")
        safra: Crop season in "YYYY/YY" format (default: latest season with data)
    

Inputs: produto (required), safra. Returns: result

exportacaoB

Brazilian agricultural exports summed by month (Comex Stat; ABIOVE fallback).

    Products: soja, milho, cafe, algodao, acucar, farelo_soja, oleo_soja.
    The Comex Stat query can take about a minute.

    Args:
        produto: Product (e.g. "soja", "farelo_soja")
        ano: Year (default: current year)
        uf: State of origin (e.g. "MT"). Empty = Brazil.
    

Inputs: produto (required), uf, ano. Returns: result

futuros_b3B

Daily settlement prices for agricultural futures on B3 exchange.

    Contracts: boi, milho, cafe_arabica, cafe_conillon, etanol, soja_cross, soja_fob.

    Args:
        contrato: Futures contract name (e.g. "milho", "boi")
        data: Date in "YYYY-MM-DD" format (default: latest published session)
    

Inputs: contrato (required), data. Returns: result

health_checkA

Check the status of agrobr data sources.

Returns which APIs are responding and which have issues. Useful to diagnose when a tool returns an error.

Inputs: no named parameters. Returns: result

listar_produtosA

List valid products/parameters for each agrobr-mcp tool.

    Useful to discover which values to pass before calling another tool.
    If no tool is specified, lists all.

    Args:
        tool: Tool name (e.g. "preco_diario"). Empty = all tools.
    

Inputs: tool. Returns: result

preco_diarioA

Daily spot prices for Brazilian agricultural commodities (CEPEA/ESALQ).

    Products: soja, milho, boi, bezerro, cafe, cafe_robusta, trigo, algodao.

    Args:
        produto: Commodity name (e.g. "soja", "milho", "boi")
        dias: Number of recent days to return (default: 5, max: 60)
    

Inputs: produto (required), dias. Returns: result

producao_anualB

Historical annual crop production by state (IBGE PAM).

    Products: soja, milho, arroz, feijao, trigo, algodao, cafe, cacau, cana, mandioca, laranja.

    Args:
        produto: Crop name (e.g. "soja", "milho")
        ano: Reference year (default: previous year)
    

Inputs: produto (required), ano. Returns: result

progresso_safraB

Weekly planting and harvesting progress by state.

    Products: algodao, arroz, feijao_1, milho_1, milho_2, soja, trigo.

    Args:
        produto: Crop name (e.g. "soja", "milho_1")
        uf: State abbreviation filter (e.g. "MT", "PR"). Empty = all states.
    

Inputs: produto (required), uf. Returns: result

queimadasB

Fire hotspots of one day by municipality and biome (INPE Queimadas).

    Counts the reference satellite (AQUA_M-T), the basis of INPE's official
    statistics; other satellites repeat detections of the same fire.

    Args:
        uf: State abbreviation (e.g. "MT", "PA")
        data: Date in "YYYY-MM-DD" format (default: yesterday)
    

Inputs: uf (required), data. Returns: result

rebanhoB

Livestock herds and animal products by state (IBGE PPM).

    Products: bovino, bubalino, equino, suino_total, suino_matrizes, caprino, ovino, galinaceos_total, galinhas, galinhas_poedeiras, codornas, leite, ovos_galinha, ovos_codorna, mel, casulos, la.

    Args:
        produto: Herd or product (e.g. "bovino", "leite")
        ano: Reference year (default: latest published)
    

Inputs: produto (required), ano. Returns: result

serie_historica_safraB

Historical crop series by season (CONAB): area, production and yield.

    Products: algodao, algodao_caroco, algodao_pluma, amendoim, amendoim_1, amendoim_2, arroz, arroz_irrigado, arroz_sequeiro, aveia, cafe, cafe_arabica, cafe_conilon, cana, cana_area_total, canola, centeio, cevada, feijao, feijao_1, feijao_2, feijao_3, feijao_caupi, feijao_caupi_1, feijao_caupi_2, feijao_caupi_3, feijao_cores, feijao_cores_1, feijao_cores_2, feijao_cores_3, feijao_preto, feijao_preto_1, feijao_preto_2, feijao_preto_3, gergelim, girassol, mamona, milho, milho_1, milho_2, milho_3, soja, sorgo, trigo, triticale.

    Args:
        produto: Crop name (e.g. "soja", "milho_2")
        uf: State abbreviation (e.g. "PR"). Empty = Brazil, summed over the states.
        ano_inicio: Start year of the first season (default: 10 years ago)
    

Inputs: produto (required), uf, ano_inicio. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 14 tools

    Disambiguation4/5

    Each tool targets a distinct dataset (spot prices, futures, exports, crop estimates, livestock, deforestation, fires, climate) and descriptions clarify the resource. Some crop-production tools overlap conceptually (estimativa_safra, producao_anual, serie_historica_safra, progresso_safra, balanco), but their data granularity differs and descriptions help distinguish them.

    Naming Consistency4/5

    All tool names use snake_case, mostly Portuguese noun phrases, giving a predictable pattern. Minor deviations exist: health_check is English and listar_produtos uses a verb while most others are nouns, but the set remains largely consistent.

    Tool Count5/5

    14 tools for a broad Brazilian agricultural data API is well-scoped within the ideal 3–15 range. Each tool maps to a distinct data domain (prices, crops, livestock, environment, metadata), with no obvious redundancy or trivial padding.

    Completeness4/5

    The surface covers prices, futures, exports, crop estimates/production/history/progress, supply-demand balance, livestock, deforestation, fire, and climate, plus discovery and health checks. Minor gaps such as import data or finer sub-state granularity remain, but core workflows are well covered.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    • AI-powered commodity price forecasts and Brazil trade intelligence via MCP. Access Brazilian exports and imports from MDIC/ComexStat since 2000, by HS4, HS6 and NCM code, partner country, USD FOB and kilograms — plus crop production, supply & demand, climate data and production forecasts for major commodities including soybeans, coffee, corn, beef and cocoa. Compare trade flows, markets, countries and time periods with like-for-like windows. Every answer identifies the measurement period and data source. 15 read-only tools. Metered in credits. Connect directly via Streamable HTTP — no installation required: https://mcp.kyrodata.com/mcp Authentication: Bearer key or OAuth 2.1 (PKCE). Official MCP registry: com.kyrodata/kyrodata

      https://mcp.kyrodata.com/mcp
    • The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.

      https://mcp.mercadopago.com/mcp
    • The Dappier MCP server connects LLMs and AI agents to real-time, rights-cleared, proprietary data from trusted sources across various domains. It provides specialized knowledge through real-time web search, financial stock market and crypto data access, AI-powered content recommendations from premium publishers, and structured outputs with sub-300ms response times, enabling AI systems to respond to current events and trends.

      https://mcp.dappier.com/mcp
    • MCP server connecting AI agents to non-custodial staking data across 130+ networks.

      https://mcp.everstake.com

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that connects AI agents to over 200 tools across 27 Brazilian public APIs, covering economic, legislative, transparency, and judicial data. It enables users to query and cross-reference extensive government datasets from sources like IBGE, the Central Bank, and the Brazilian Congress.
      22
      7
      1,861
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      This MCP server provides AI-optimized access to Brazil's largest open data platform, Base dos Dados, enabling dataset search and direct BigQuery SQL execution for Brazilian public datasets.
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP Server for accessing 36 Brazilian public data sources and 1 agent, enabling AI agents to query government data on economy, legislation, transparency, judiciary, elections, environment, health, and more.
      6
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that connects AI agents to 28 Brazilian public APIs, providing tools to query government data on economy, legislation, transparency, judiciary, elections, environment, health, and more.
      MIT