ANVISA Medicines
by pipeworx-io
README.md
# @pipeworx/anvisa-medicines
Brazil's register of medicines authorised by ANVISA, the national health regulator: about 40,000 registrations with brand name, active ingredient, registration holder, registration number, status, regulatory category (similar, generic, new, herbal, homeopathic and others), registration date and expiry month. Search in Portuguese or English, accents ignored.
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1957+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.
## Tools
- `anvisa_drug_search(query, by?, status?, limit?)` finds registrations by words in the brand name or active ingredient (`by: "any"`, the default), only the brand name, only the ingredient, or the holder's name. Every word must match the start of a word, so `dipiron` finds dipirona. Results list active registrations first, newest first, each with the status as the register states it (`Ativo` or `Inativo`) plus an English reading, and the category with an English name. `status: "active"` or `"inactive"` filters. An English ingredient spelling that differs from the Portuguese only at the end (amoxicillin / amoxicilina) is found on its word stem and the answer says so (`matched_on_stems`).
- `anvisa_drug_get(id)` the full record: holder and CNPJ, therapeutic class, process number, registration date, expiry month, and how many register rows state each status. The id is the registration number, or an id starting with `x` for the registrations that have no number (low-risk and dynamised products, mostly).
```
anvisa_drug_search({query: "dipirona", limit: 5})
-> 559 matches; DORFLEX DOR DE CABEÇA, Ativo, Similar, registered 2026-11-09, expires 2036-11
anvisa_drug_get({id: "186200018"})
-> NOVALGINA, holder, category Similar (English "Similar"), status Ativo
anvisa_drug_search({query: "paracetamol", by: "ingredient", status: "active"})
-> found: true, total_matches 141 (against the November 2026 copy)
```
Every answer carries `data_as_of`, `source_file_date`, `answered_from` (always `stored_copy`) and an attribution line. A search with no match returns `found: false` with an `empty_reason`; an unknown id returns `found: false, reason: "unknown_id"`.
## Auth
Keyless.
## Data sources
- ANVISA (Agência Nacional de Vigilância Sanitária), registered medicines open data. ANVISA publishes the register only as one bulk open-data file (about 46 MB, 11 columns), refreshed monthly, and its online consultation service refuses requests from our network, so a stored copy answers every call and a weekly job refreshes it. There is no live fallback: before the first load, or if the copy cannot be read, both tools return `found: false, reason: "stored_copy_unavailable"` with a plain message, never an empty result. A refresh that would shrink the register by more than 20 percent, or that finds a changed column layout, is refused and the previous copy stays.
### Licence note
The register's open-data page states no licence of its own. ANVISA's institutional site states: "Todo o conteúdo deste site está publicado sob a licença Creative Commons Atribuição-SemDerivações 3.0 Não Adaptada" (all content of this site is published under Creative Commons Attribution-NoDerivatives 3.0 Unported). That licence allows copying and redistributing the unmodified work with attribution, and does not forbid redistribution, so the copy is built; but it is a statement about the site, not about this dataset, so treat the terms as unconfirmed rather than granted. Every answer says who the source is; the register's values are kept as published (merged by registration number, nothing corrected), and the English readings of category and status are marked as added by Pipeworx.
### What the copy holds, and what to watch
- **One record per registration.** The file has one row per presentation (about 230,000 rows, 40,000 distinct registrations) and carries no presentation column. Rows are merged on the registration number; the answer shows `rows_stating_active` and `rows_stating_inactive`.
- **Status can disagree between rows.** For about 2,600 registrations some rows say Ativo and some Inativo. Those carry `status: "Misto"` with the counts, appear under both status filters, and sort between the active and inactive groups. The register does not say why a registration is Inativo (cancelled, lapsed or replaced).
- **Registrations without a number** (about 7,300, mostly low-risk and homeopathic products) get an `x` id derived from their other fields. That id stays stable only while those fields are unchanged.
- **Expiry is a month.** The register gives month and year; `expiry_passed` compares it with the current month. Sixteen rows carry an expiry the register writes in an unreadable form; those show no expiry.
- **Lost characters stay lost.** Some names reach us with accented letters already replaced by `?` (for example "N?O DECLARADO"); the record says so rather than guessing.
- **Not a prescribing reference.** The register says what is registered, not what is on sale, priced or safe to take.
- **Fields are positional in the stored objects** (see the header of `src/index.ts`, `scripts/lib/anvisa-parse.mjs` and `scripts/lib/drug-store.mjs`); the test suite builds its fixtures with the loader's own modules and reads them through the pack.
## Quick Start
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
```json
{
"mcpServers": {
"anvisa-medicines": {
"url": "https://gateway.pipeworx.io/anvisa-medicines/mcp"
}
}
}
```
### What this endpoint actually serves
`tools/list` at `https://gateway.pipeworx.io/anvisa-medicines/mcp` returns the tools in the table
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
gateway-wide set. So the tool count you see is larger than this table: a
single-pack endpoint currently lists roughly 30 shared tools alongside the
pack's own. The connection's `initialize` response states its exact scope, and
is the authoritative answer for a given day.
This is deliberate, not multiplexing by accident. The meta-tools are what let a
scoped connection answer a question this pack does not cover — via
`ask_pipeworx`, which routes across the whole catalog — without you adding a
second MCP server. There is currently no way to mount a pack endpoint without
them; if the extra schemas cost you more context than the routing is worth,
connect to the full gateway once rather than to several pack endpoints.
Or connect to the full Pipeworx gateway to get every pack's tools listed
directly, instead of just this one's:
```json
{
"mcpServers": {
"pipeworx": {
"url": "https://gateway.pipeworx.io/mcp"
}
}
}
```
Both URLs reach the same gateway and the same 1957+ data sources. The
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
reaches all of them from either one.
## No MCP client? Call it over HTTP
```bash
curl -X POST https://gateway.pipeworx.io/v1/tools/anvisa_drug_search \
-H 'Content-Type: application/json' \
-d '{"query":"dipirona","limit":5}'
```
No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/anvisa_drug_search`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.
## Run it from npm
`@pipeworx/mcp-anvisa-medicines` is a local stdio bridge to the Pipeworx gateway: your MCP client
starts it with `npx`, and it forwards every call to the same
`https://gateway.pipeworx.io/anvisa-medicines/mcp` endpoint shown above. It needs network access;
there is no offline mode.
```json
{
"mcpServers": {
"anvisa-medicines": {
"command": "npx",
"args": ["-y", "@pipeworx/mcp-anvisa-medicines"]
}
}
}
```
Without a key it calls anonymously, capped at 50 calls a day. A free account
raises that to 200 a day: get a key at https://pipeworx.io/signup and add
`"env": { "PIPEWORX_API_KEY": "<your key>" }` to the server entry.
The key is sent as a Bearer token, the same way a hosted connection sends it,
so calls are metered and billed exactly as they are there.
It lists **only** this pack's tools by default. Set `PIPEWORX_META_TOOLS=1` to
also list `ask_pipeworx` and the other gateway-wide tools.
Behind an HTTPS proxy: Node's built-in `fetch` does not read `HTTPS_PROXY` by
default. Newer Node releases honour it when `NODE_USE_ENV_PROXY=1` is set; check
your Node version's documentation.
## Using with ask_pipeworx
Instead of calling tools directly, you can ask questions in plain English —
this works on the pack endpoint above as well as on the full gateway:
```
ask_pipeworx({ question: "your question about Anvisa Medicines data" })
```
The gateway picks the right tool and fills the arguments automatically.
## More
- [Docs and guides](https://pipeworx.io/docs)
- [pipeworx.io](https://pipeworx.io)
## License
MIT