The MCP Server for API Comexstat provides access to Brazilian foreign trade statistics and related auxiliary data. With this server, you can:
- Query Trade Data: Retrieve export/import statistics with detailed filters, fields, and metrics
- Access Municipal Data: Get trade information specific to Brazilian municipalities
- Examine Historical Records: View historical trade data from 1989-1996
- Check Update Status: Get the date of the last data update
- Retrieve Auxiliary Tables: Access lists and details for states, cities, countries, economic blocks, and trade codes (Harmonized System, NBM)
- Perform Custom Queries: Create detailed queries with various parameters including flow type, period, filters, and metrics
- List Available Parameters: View available years, filters, fields, and metrics for constructing queries
MCP Server for Comexstat API
This project implements an MCP (Model Context Protocol) server for the Comexstat API, allowing AI models like Claude to interact directly with Brazil's foreign trade data.
Overview
The MCP Comexstat server provides tools to query Brazilian export and import statistics, including:
- General export and import data
- Data by municipalities
- Historical data (1989-1996)
- Auxiliary tables with codes and descriptions
Features
- Implemented using @modelcontextprotocol/sdk
- Typing with TypeScript
- Data validation with Zod
- Support for communication via stdin/stdout (MCP standard)
- Robust API error handling and responses
Installation
Quick Use
Available Tools
The MCP server provides the following tools:
General Data
getLastUpdate()
- Gets the date the data was last updatedgetAvailableYears()
- Lists the years available for querygetAvailableFilters()
- Lists available filtersgetFilterValues(filter, language?)
- Gets values for a specific filtergetAvailableFields()
- Lists the fields available for detailinggetAvailableMetrics()
- Lists available metricsqueryData(options)
- Performs detailed queries with the following parameters:flow
: "export" | "import"period
: { from: "YYYY-MM", to: "YYYY-MM" }monthDetail
: booleanfilters
: Array of filters (optional)details
: Array of fields for detailingmetrics
: Array of metricslanguage
: string (optional, default: "pt")
Data by Municipalities
queryMunicipalitiesData(options)
- Query data focusing on municipalities
Historical Data
queryHistoricalData(options)
- Query historical data (1989-1996)
Auxiliary Tables
getStates()
- List Brazilian statesgetStateDetails(ufId)
- Details of a specific stategetCities()
- List of citiesgetCityDetails(cityId)
- Details of a specific citygetCountries(search?)
- List countriesgetCountryDetails(countryId)
- Details of a specific countrygetEconomicBlocks(options?)
- List economic blocksgetHarmonizedSystem(options?)
- Harmonized System (HS)getNBM(options?)
- Brazilian Nomenclature of GoodsgetNBMDetails(coNbm)
- Details of a specific NBM code
Usage Example
Integration with Claude
To use the MCP server with Claude Desktop:
- Add the configuration to the
claude_desktop_config.json
file: - On Claude Desktop, use the command:
Development
License
MIT
You must be authenticated.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
mcp-comexstat
Related MCP Servers
- JavaScriptMIT License
- PythonApache 2.0
- TypeScriptMIT License
- PythonMIT License