# MDIC (Comércio Exterior) MCP for AI Agents AI Agent Connect

> MDIC (Comércio Exterior) MCP gives your agent direct access to official Brazilian trade statistics. It lets you list datasets, search for specific export or import packages, and query raw data from the government's open data portal without manual downloads.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_1xOtTiA1YhXf8erYNsnS7Vh8JrZt1rOsIN1Nw0KP/ai-agent-connect
- **Tags:** brazil-trade, export-import, economic-data, ckan-api, trade-statistics

## Description

This Connector connects your AI client to the Brazilian Ministry of Development, Industry, Trade and Services (MDIC) open data portal. Instead of hunting through government websites or manually downloading bulky CSV files to your desktop, you can just ask your agent to pull the numbers for you. It handles the heavy lifting of navigating the CKAN-based infrastructure, allowing you to find specific trade packages like comex-stat or exportacao-municipios. You can inspect the metadata of these datasets to see what's included before you pull the actual data. When you need specific rows or filtered statistics, the agent can query the datastore directly using specific parameters. This means you get the raw data you need for your reports or analysis right in your chat interface. It's a lot faster than the old way of bookmarking links and hoping the file isn't corrupted. By adding this to your Vinkius catalog, you turn a tedious data gathering task into a simple conversation with your agent.

## Tools

### get_package
Pulls the full metadata and description for a selected trade dataset. You can use this to verify what data is included before querying.

### get_resource
Retrieves the specific metadata and download links for a data file. It's the fastest way to get the source link for a specific resource.

### search_datastore
Queries the actual data rows within a resource using SQL-like parameters. This allows you to pull specific filtered results directly.

### search_packages
Finds specific datasets based on keywords like 'comex' or 'exportação'. It makes it easy to locate the exact package you need.

### list_packages
Lists every dataset currently available in the MDIC portal. This helps you see the full scope of available trade metrics.

## Prompt Examples

**Prompt:** 
```
Find me the latest datasets for Brazilian exports.
```

**Response:** 
```
I've searched the MDIC portal and found several relevant datasets. The most relevant ones are:

* **exportacao-municipios-detalhada** (detailed municipality exports)
* **comex-stat-exportacao** (monthly export stats)

Would you like to see the metadata for one of these?
```

**Prompt:** 
```
What's inside the comex-stat package?
```

**Response:** 
```
The **comex-stat** package contains 12 different resources. Here are the highlights:

* **Exportações Mensais (CSV)**
* **Importações Mensais (CSV)**
* ...and 10 others.

I can pull the metadata for any of these if you want to see the specific columns and descriptions.
```

**Prompt:** 
```
Give me the first 5 rows of the export data.
```

**Response:** 
```
I've queried the datastore for you. Here are the first 5 rows:

| Year | Month | Product_Code | Value_FOB |
|---|---|---|---|
| 2023 | 01 | 8517 | 1,200,000 |
| 2023 | 02 | 8517 | 1,150,000 |
| 2023 | 03 | 8517 | 1,300,000 |
| 2023 | 04 | 8517 | 1,250,000 |
| 2023 | 05 | 8517 | 1,400,000 |

Would you like me to summarize these values or look for a different product code?
```

## Capabilities

### List Brazilian trade datasets
Get a full list of all available trade packages from the MDIC portal.

### Search for specific trade packages
Find datasets using keywords like 'comex' or 'exportação' to narrow down your search.

### Inspect dataset metadata
Get detailed descriptions and resource lists for specific trade datasets before pulling data.

### Query specific data rows
Retrieve filtered rows from a resource using specific parameters in the datastore.

### Access resource download links
Get the metadata and direct links for individual data files within a package.

## Use Cases

### Finding monthly export trends
An analyst needs to know the top export products for a specific month. They ask the agent to search for 'comex-stat' and query the first 10 rows.

### Researching municipality exports
A researcher wants to see which municipalities export the most. They use the tool to find 'exportacao-municipios' and inspect the metadata.

### Checking for new dataset availability
A BI lead needs to check if a new dataset is available. They use the tool to list all packages and look for recent trade updates.

### Querying specific product codes
An economist wants to see the volume of a specific product code. They query the datastore directly to get the most recent value.

## Benefits

- Skip the manual download process by using search_datastore to pull specific rows directly into your chat.
- Find the right data faster by using search_packages to filter the government's vast catalog of trade datasets.
- Verify data contents before downloading with get_package, which provides full metadata and descriptions.
- Save time on data discovery by using list_packages to see the entire scope of available Brazilian trade metrics.
- Get direct access to download links via get_resource when you need to move the raw file to another system.

## How It Works

The bottom line is you get official Brazilian trade stats in your chat instead of downloading spreadsheets.

1. Subscribe to the MDIC (Comércio Exterior) MCP in your Vinkius dashboard.
2. Connect your AI client and provide an API key if you need higher rate limits.
3. Ask your agent to find, inspect, or query Brazilian trade data.

## Frequently Asked Questions

**Can I use the MDIC (Comércio Exterior) MCP to find Brazilian trade data?**
Yes, this Connector connects your agent directly to the official MDIC portal, allowing you to find and query trade statistics without leaving your workspace.

**Does the MDIC (Comércio Exterior) MCP support export and import stats?**
It does. You can search for specific packages like 'comex-stat' to get detailed monthly export and import figures.

**How do I get specific rows of data using the MDIC (Comércio Exterior) MCP?**
Your agent can query the datastore directly. You just describe the filters you need, like a specific year or product code, and it pulls the rows for you.

**Can I see what's in a dataset before downloading it with the MDIC (Comércio Exterior) MCP?**
Yes, you can use the Connector to inspect the metadata of any package to see the available resources and descriptions before you decide to pull the data.

**Is the MDIC (Comércio Exterior) MCP good for economic research?**
It's a great tool for economists who need official government data. It saves you from the tedious process of manual data gathering from the government website.

**Does the MDIC (Comércio Exterior) MCP require a manual download?**
No, the Connector lets your agent fetch the data directly into your conversation, though it can also provide download links if you need the original file.

**Can I search for specific trade terms like 'soybean' or 'iron ore'?**
Yes! Use the `search_packages` tool with your query string. It will return all datasets matching those terms within the MDIC portal.

**How do I access the actual data rows inside a CSV resource?**
Use the `search_datastore` tool by providing the `resource_id`. You can also apply filters and limits to retrieve exactly the data points you need.

**Is it possible to see the file format and download URL for a dataset?**
Yes. The `get_package` tool returns a list of resources, and `get_resource` provides specific metadata including the format (CSV, XLSX, etc.) and the direct download URL.