cvm-mcp
v0.2.0One MCP server for the whole CVM open-data repository (dados.cvm.gov.br)
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
search_company
Find the CVM code (`cd_cvm`) of a company by name, CNPJ, ticker or code. Accent- and case-insensitive. This is the entry point for every corporate tool: they key on `cd_cvm`, never on the ticker.
| Parameter | Type | Description |
|---|---|---|
query * | string | Company name, partial name, CNPJ, ticker or CVM code. E.g. 'petrobras', 'PETR4'. |
limit | integer | Maximum companies to return. |
status | Registry situation filter, e.g. 'ATIVO' or 'CANCELADO'. |
resolve
Resolve any identifier to the CVM keys (cd_cvm, CNPJ, ticker, name).
| Parameter | Type | Description |
|---|---|---|
query * | string | A ticker (PETR4), a CNPJ, a cd_cvm or a company name. |
list_companies
Browse the CVM company registry, optionally filtered by sector.
| Parameter | Type | Description |
|---|---|---|
limit | integer | Page size. |
offset | integer | Rows to skip (paging). |
sector | Partial sector name, e.g. 'Energia'. | |
status | Registry situation, e.g. 'ATIVO'. |
get_tickers
Map tickers (PETR4, VALE3) to CVM codes and company names.
| Parameter | Type | Description |
|---|---|---|
cvm_codes | Optional CVM codes. | |
limit | integer | Maximum rows. |
ticker | Filter by trading code, e.g. 'PETR4'. | |
year | FCA reference year (2018+). Default: latest available. |
list_account_codes
List the curated account codes and role names understood by this server.
| Parameter | Type | Description |
|---|---|---|
doc_type | Optional filter: BPA, BPP, DRE, DFC_MI, DVA. |
get_financial_statements
Full statement lines for one or more companies, as CSV. One row per reported account, with the raw value (`VL_CONTA`) and the value in reais (`VL_CONTA_BRL`).
| Parameter | Type | Description |
|---|---|---|
cvm_codes * | array | CVM codes (see search_company). |
data_type | string | 'dfp' = annual, 'itr' = quarterly. |
doc_type | string | One or more of BPA, BPP, DRE, DFC_MD, DFC_MI, DMPL, DVA, or '*'. |
first_year | First fiscal year. | |
format | string | 'con' = consolidated, 'ind' = individual, or '*'. |
last_year | Last fiscal year. | |
max_rows | integer | Safety cap on returned rows. |
get_account_history
Follow one account over time for one or more companies (a compact series).
| Parameter | Type | Description |
|---|---|---|
account * | string | Account to follow: a CD_CONTA code ('3.01'), a role ('revenue', 'net_income', 'total_assets', 'equity', 'ebit') or, with by='name', a label fragment. |
cvm_codes * | array | CVM codes of the companies. |
by | string | How to read `account`. |
data_type | string | 'dfp' = annual, 'itr' = quarterly. |
doc_type | string | BPA, BPP, DRE, DFC_MI, DFC_MD, DVA or DMPL. |
first_year | First fiscal year. | |
format | string | 'con' or 'ind'. |
last_year | Last fiscal year. | |
max_rows | integer | Safety cap on returned rows. |
get_statement_summary
Compact headline view of one company-year: totals, equity, revenue, profit. Returns the top-level accounts with a `role` column (`total_assets`, `equity`, `revenue`, `ebit`, `net_income`, ...).
| Parameter | Type | Description |
|---|---|---|
cvm_code * | integer | CVM code of the company. |
data_type | string | 'dfp' = annual, 'itr' = quarterly. |
depth | integer | Account nesting: 0 = totals only, 1 = headline (default). |
doc_type | string | Documents to summarize. Default 'BPA,BPP,DRE'. |
format | string | 'con' = consolidated, 'ind' = individual. |
year | Fiscal year. Default: current year. |
list_fre_tables
List the 36 FRE corporate tables understood by this server.
| Parameter | Type | Description |
|---|---|---|
detail | boolean | Include curated key columns. |
get_fre_table
Read rows from one FRE table, filtered by company and year. The generic workhorse; prefer the curated helpers when they fit.
| Parameter | Type | Description |
|---|---|---|
table * | string | Table slug from list_fre_tables, e.g. 'posicao_acionaria'. |
cd_cvm | Optional CVM code. | |
columns | Optional subset of columns. | |
first_year | First reference year. | |
last_year | Last reference year. | |
max_rows | integer | Maximum rows returned. |
version | string | 'last' (default), 'first' or 'all'. |
get_company_overview
Show which FRE tables have data for one company-year. Downloads and parses the whole year once (the first call can take a while).
| Parameter | Type | Description |
|---|---|---|
cd_cvm * | integer | CVM code from search_company. |
year * | integer | Reference year. |
get_compensation
Compensation of the board, officers and fiscal council.
| Parameter | Type | Description |
|---|---|---|
cd_cvm * | integer | CVM code from search_company. |
year * | integer | Reference year. |
detail | string | 'orgao' = total by body, 'max_min_avg' = ranges, 'variavel' = bonus. |
version | string | 'last' (default), 'first' or 'all'. |
get_board
Board, officers and fiscal council composition.
| Parameter | Type | Description |
|---|---|---|
cd_cvm * | integer | CVM code from search_company. |
year * | integer | Reference year. |
version | string | 'last' (default), 'first' or 'all'. |
get_capital
Share capital events: amounts, approvals and share counts.
| Parameter | Type | Description |
|---|---|---|
cd_cvm * | integer | CVM code from search_company. |
year * | integer | Reference year. |
version | string | 'last' (default), 'first' or 'all'. |
get_insider_trades
Transactions by controllers, officers and board members (CVM/VLMO). Returns who traded, the role, the movement type, date, quantity, unit price and volume. This is the insider-trading signal dataset (Instruction 358).
| Parameter | Type | Description |
|---|---|---|
company * | string | Company: cd_cvm, CNPJ or name (partial). E.g. 'petrobras' or '9512'. |
first_year | First year (2018+). | |
last_year | Last year. | |
max_rows | integer | Maximum rows. |
operation | Optional 'Credito' (buy) or 'Debito' (sell). | |
role | Optional role filter, e.g. 'Diretor', 'Conselho', 'Controlador'. |
insider_summary
Net insider buying/selling by year and role (aggregate of VLMO).
| Parameter | Type | Description |
|---|---|---|
company * | string | cd_cvm, CNPJ or company name. |
first_year | First year (2018+). | |
last_year | Last year. |
governance_practices
Explain-or-comply governance report: each practice and whether it was adopted.
| Parameter | Type | Description |
|---|---|---|
company * | string | cd_cvm, CNPJ or company name. |
year * | integer | Reference year (2018+). |
adopted | Optional filter: 'Sim', 'Nao' or 'Parcialmente'. | |
chapter | Optional chapter filter, e.g. 'Acionistas'. | |
max_rows | integer | Maximum rows. |
governance_score
Adoption rate of the recommended governance practices, overall and by chapter.
| Parameter | Type | Description |
|---|---|---|
company * | string | cd_cvm, CNPJ or company name. |
year * | integer | Reference year (2018+). |
get_dfp_document
Filing metadata and the download link of the full document. The link points to the CVM ZIP with the complete filing: an XML with the statement numbers, a PDF with the *notas explicativas* and the company data. Use `get_dfp_notes` to read the notes without handling the file yourself.
| Parameter | Type | Description |
|---|---|---|
cvm_codes * | array | CVM codes (see search_company). |
year * | integer | Reference year of the filing (YYYY). |
data_type | string | 'dfp' = annual, 'itr' = quarterly. |
get_dfp_notes
Read the explanatory notes of one company/year. Without `note` and `pages`, lists the detected numbered notes (number, title, pages). The first call for a company/year downloads the filing PDF (~15 MB) and extracts its text; later calls read the local cache.
| Parameter | Type | Description |
|---|---|---|
cvm_code * | integer | CVM code of the company. |
year * | integer | Reference year of the filing (YYYY). |
data_type | string | 'dfp' = annual, 'itr' = quarterly. |
max_chars | integer | Cap on the returned text. |
note | Number of the note to read (omit to list the notes). | |
pages | Raw page selection of the PDF, e.g. '25' or '25-31'. Use it when the notes could not be split into numbered sections. |
search_dfp_notes
Search the extracted text of the filing, returning snippets with pages. Searches every page (not only the detected notes) so a hit is never lost to a segmentation failure. Each match carries the PDF page and, when known, the number of the note it belongs to.
| Parameter | Type | Description |
|---|---|---|
cvm_codes * | array | CVM codes to search (see search_company). |
term * | string | Text to look for (accent and case insensitive). |
year * | integer | Reference year of the filing (YYYY). |
context | integer | Characters of context around each hit. |
data_type | string | 'dfp' = annual, 'itr' = quarterly. |
limit | integer | Maximum number of snippets. |
search_fund
Find a fund or class and get the CNPJ used by every fund tool. The CVM keys fund data on the *class* CNPJ. The result carries a `family` (`fi`, `fii`, `fidc`, `fiagro`, `fip`) that tells which monthly report covers it — `get_fund_nav` routes automatically.
| Parameter | Type | Description |
|---|---|---|
query * | string | Fund/class name (partial), CNPJ or CVM fund code. E.g. 'itau', '42737077000199'. |
limit | integer | Maximum matches. |
get_fund_flows
Monthly subscriptions, redemptions and net flow for one FI fund. Only FIF/FAPI report daily subscriptions and redemptions (Informe Diário). FII, FIDC and FIAGRO do not publish a flow series in the monthly report.
| Parameter | Type | Description |
|---|---|---|
fund * | string | Fund name (partial) or class CNPJ. |
first_period | First month. | |
last_period | Last month. Default: latest. |
get_fund_portfolio
Holdings of any fund, routed to the right dataset. * FIF/FIAGRO: CDA portfolio (asset, issuer, quantity, market value, cost). * FII: balance-sheet composition (properties, CRI, FII quotas, cash...). * FIDC: credit portfolio by segment (industrial, real estate, payroll...). The output is long-form: one row per `component`, with its value in BRL.
| Parameter | Type | Description |
|---|---|---|
fund * | string | Fund name (partial) or class CNPJ. |
block | string | FI only: '1'..'8' for one CDA block, 'all' for every block. |
max_rows | integer | Maximum rows. |
period | Month (YYYY-MM). Default: latest available. |
get_fidc_report
Credit-fund dashboard: assets, portfolio, net asset value and delinquency. `inadimplencia_pct` is the overdue credit over the total credit portfolio (tables I.2A.2 and I.2 of the FIDC monthly report).
| Parameter | Type | Description |
|---|---|---|
fund * | string | FIDC name (partial) or class CNPJ. |
first_period | First month (YYYY-MM). | |
last_period | Last month. Default: latest. |
rank_funds
Rank FI funds in one month by net asset value, net flow, return or unitholders.
| Parameter | Type | Description |
|---|---|---|
fund_type | Optional fund type filter, e.g. 'CLASSES - FIF'. | |
limit | integer | Rows returned. |
metric | string | Ranking metric. |
period | Month (YYYY-MM). Default: latest. |
list_datasets
List every CVM dataset this server understands. This is the entry point: each dataset has an `id`, a period granularity and one or more tables. Table ids are what `describe_dataset` and `run_query` use; SQL views are named `<dataset>__<table>`.
| Parameter | Type | Description |
|---|---|---|
detail | boolean | Include the table list of each dataset. |
domain | Optional domain filter: companies, funds, offerings, enforcement, registry. |
describe_dataset
Show the tables, cached periods and columns of one dataset. Columns come from the local cache; if a table was never queried, `columns` is empty — call the corresponding data tool once to populate it. With `detail=True`, `column_details` explains units and pitfalls (e.g. `VL_CONTA` vs `VL_CONTA_BRL`, or FRE percentages).
| Parameter | Type | Description |
|---|---|---|
dataset * | string | Dataset id from list_datasets, e.g. 'dfp', 'fi_inf_diario'. |
detail | boolean | Include curated column meanings (description, unit, caveats). Use this before writing run_query SQL. |
table | Optional table inside the dataset. |
cache_status
What is already downloaded and parsed locally, per dataset.
load_dataset
Download and parse a dataset/period into the local cache. This is the non-destructive counterpart of `refresh_cache`: it reuses archives that are still fresh and only builds the partitions that are missing. Call it before `run_query` so the SQL layer has the tables (and periods) it needs, and use `describe_dataset(detail=True)` for column meanings. Heavy optional tables (`dfp`/`itr` ``parecer``) are skipped unless named in ``table`` or ``include_optional`` is true.
| Parameter | Type | Description |
|---|---|---|
dataset * | string | Dataset id from list_datasets, e.g. 'dfp', 'fi_inf_diario'. |
include_optional | boolean | Also build the heavy optional tables (DFP/ITR `parecer`, which is free text and ~15 MB per year). |
period | Year (YYYY) or month (YYYYMM); comma-separated values are accepted. Defaults to the latest published period. Use '*' for every period. | |
table | Optional table; omit for all tables in the dataset. |
refresh_cache
Force a re-download and rebuild of cached partitions. CVM rewrites the current period in place, so use this when the latest month looks stale.
| Parameter | Type | Description |
|---|---|---|
dataset * | string | Dataset id from list_datasets. |
period | Year (YYYY) or month (YYYYMM). Omit to refresh everything cached. | |
table | Optional table; omit for all tables. |
run_query
Run SQL across cached CVM tables (DuckDB engine). Use it for questions that combine datasets, for aggregates the curated tools do not expose, and to inspect a table before writing a longer query. Only SELECT/WITH is allowed; the result is capped by `limit`.
| Parameter | Type | Description |
|---|---|---|
sql * | string | A single read-only SELECT/WITH query. Views are named <dataset>__<table>, e.g. dfp__dre_con, fi_inf_diario__informe, vlmo__transacoes. Only cached periods exist. |
limit | integer | Maximum rows returned. |
search_offerings
Search registered, exempt and restricted public offerings since 1988.
| Parameter | Type | Description |
|---|---|---|
asset_type | Asset type, e.g. 'ACOES', 'DEBENTURES', 'COTAS', 'CRI'. | |
first_date | First registration date (YYYY-MM-DD). | |
issuer | Issuer name (partial). | |
last_date | Last registration date (YYYY-MM-DD). | |
limit | integer | Maximum rows. |
rite | Rite, e.g. 'ICVM 400' or 'RCVM 160'. |
issuance_volume
Total offering volume, grouped by year, asset type, issuer, lead or rite. `valor_total` is as reported by CVM; amounts from different decades are not inflation-adjusted.
| Parameter | Type | Description |
|---|---|---|
asset_type | Optional asset type filter. | |
first_date | First registration date (YYYY-MM-DD). | |
group_by | string | Dimension to aggregate by. |
last_date | Last registration date (YYYY-MM-DD). | |
limit | integer | Rows returned. |
rite | Optional rite filter. |
league_table
Rank lead underwriters by total offering volume (the ECM/DCM league table).
| Parameter | Type | Description |
|---|---|---|
asset_type | Optional asset type filter. | |
first_date | First registration date (YYYY-MM-DD). | |
last_date | Last registration date (YYYY-MM-DD). | |
limit | integer | Underwriters returned. |
rite | Optional rite filter. |