# Stackin [Health: Active]

**Category:** 💰 Finance & Fintech  
**Repository:** https://github.com/stackin-io/stackin-mcp-plugin  
**GitHub Stars:** 1  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/stackin

## Description
Issue and manage Brazilian fiscal documents: NF-e for goods, NFS-e for services.

## Tools
Capabilities this server exposes over MCP:

- **issue_invoice** — Issue a Brazilian fiscal document: NFS-e or NF-e.

This produces a legal fiscal document. Confirm the data with the
user before calling when you inferred any field.

Send unit_price with quantity when the user quotes a price per
unit, amount when they quote the line; both must agree.

nfse is a service invoice, one line per document (more is 422
NFSE_SINGLE_ITEM): the address is optional and service_code (LC
116/2003 item.subitem) falls back to the company's fiscal
profile. The nfse group fills the DPS (competence, ISS, federal
taxes, deductions, substitution and the rest) with only what the
user gave, never a guess. nbs is confirmed with the user:
suggest_nbs lists the candidates. An MEI cannot send what the
nfse group's description lists as refused for it. nfe is for goods, and the SEFAZ rejects
a partial one: ncm and cfop on every item and the full
recipient_address. Call validate_invoice_payload first when any of
that was inferred.

A complementary, adjustment or return NF-e sets purpose and names
the original in referenced_keys; a return the company receives
back sets direction in. An export has recipient_address state EX
with country_code, the export group, and foreign_id for a passport.

Look the recipient up with list_clients and pass its id as
client_id. A new recipient is saved as a client after issuance.

Pass idempotency_key, one per business event, when a retry is
possible: the same key and payload replays the first answer.
Without one, a retry after a lost response issues again, burning
another credit and number that only a cancellation within its
deadline undoes. Nothing generates the key for you.

Tell the user each of the result's warnings
(MEI_ACTIVITY_NOT_ALLOWED, ACTIVITY_NOT_REGISTERED,
MEI_NO_ICMS_ACTIVITY, APPROXIMATE_TAXES_MISSING, IBS_CBS_RECOMMENDED
and the other *_RECOMMENDED). block_activity_mismatch makes the first two
a 422, nothing sent.

Before a company's first document, get_company_readiness says
whether it can issue at all.

- **consult_invoice** — Look up an invoice's current status. Read-only.

After an OUTCOME_UNKNOWN issuance, consult its document_id: the
dps_id of an nfse, the access_key of an nfe. A 404 on a dps_id
means nothing was issued.

- **cancel_invoice** — Cancel an authorized invoice.

Legal cancellation, with fiscal and accounting effect, inside a window
the NFS-e authorizer enforces for the municipality. Ask the human to confirm before calling; never call it
speculatively. The reason reaches the tax authority verbatim and must
be at least 15 characters.

Pass idempotency_key to make a retry safe: repeating the same key with
the same access key and reason replays the first answer instead of
cancelling a second time. Reuse the key only when retrying that exact
call; a genuinely new cancellation needs a new key, or none. Nothing
generates one for you — two calls without a key are two cancellations.

- **get_invoice_pdf** — Return the printable rendering of a document, as a PDF.

Works for both types — a DANFE for nfe, a DANFSe for nfse. The PDF
comes back base64-encoded in content_base64, with its size in
size_bytes; the XML, not this, is the legally valid document. A
PDF above 2 MB is not inlined: the answer says to download it from
the API instead. A 502 from here means the authorizer is
unavailable, not that the invoice is wrong.

- **reissue_invoice** — Retry a rejected invoice after the data that caused the rejection
was fixed.

Takes the local invoice_id, not the access key: a rejected document
never got one. Consumes a credit like a new issuance, so it takes
an idempotency_key for the same reason issue_invoice does. An
authorized invoice is corrected or cancelled, never reissued.

- **correct_invoice** — File an electronic correction letter (CC-e) against an NF-e.

NF-e only: there is no correction letter for an NFS-e, where a wrong
document is cancelled and issued again.

It corrects wording and non-fiscal fields only. It cannot change
values, taxes, the recipient or the products — those still require
cancelling and issuing again, and telling the user a CC-e will fix
an amount is wrong in a way they only discover at an audit.

Each letter supersedes the previous one and the SEFAZ keeps at most
20 per document. The text reaches the tax authority verbatim.

- **invalidate_numbering** — Declare an NF-e numbering range reserved but never used.

NF-e numbering has to be continuous, so a gap left by a failed
issuance is explained to the SEFAZ with this — not with a new
document. Irreversible: a number declared unused can never be used.

Only for numbers that were never authorized. An authorized document
is cancelled, never invalidated. Confirm the range with the user and
read it back before calling: the range is inclusive, and one digit
wrong burns numbers the company still needs.

The SDK refuses a backwards range and a reason outside 15-255
characters before anything is transmitted.

- **list_invoices** — List the invoices this company issued, newest first.

One document type at a time: pass nfse for services or nfe for
goods. A company that issues both has to be asked twice.

Use it for "my last invoices", "what was rejected today", and to find
a document whose access key the user does not have at hand. Read-only.

An authorized document is stored as issued, which is the value the
rows carry; authorized is accepted as a synonym and asks for the
same thing.

Every row carries both identifiers the other tools need: id, which
reissue_invoice takes, and access_key, which consult_invoice,
cancel_invoice and get_invoice_pdf take. A rejected
row has an id and no access key — the authorizer never assigned one.

- **get_invoice_submissions** — Show every attempt made for one invoice and what came back.

This is the tool that answers "why was it rejected". consult_invoice
gives the status; this gives the tax authority's own code, its
message, and the request and response exactly as they went over the
wire. Read-only.

It takes the invoice_id, like reissue_invoice — a rejected document
has no access key to look it up by. Get the id from list_invoices.

The rows are attempts, not documents: a reissued invoice has more
than one, oldest first, and only the last describes the current
state. Quote the authority's message rather than paraphrasing it;
the code is what the user will search for.

- **invoice_stats** — Count this company's documents, and compare recent days.

The answer to "how many invoices this month", "how much did I
bill" and "is rejection going up": totals by document type and
by status over everything, then issued and rejected counts and
the amount for the last `days` beside the `days` before them,
and one row per day. In the connection's environment only.
Read-only.

- **list_invalidations** — List the NF-e numbering ranges this company already declared
unused, newest first.

Read it before invalidate_numbering: a range reported twice is
refused, and one that overlaps a past report means the gap was
already explained. Each row has the series, the inclusive range,
the reason, the SEFAZ status and its protocol. Read-only.

- **validate_invoice_payload** — Dry-run issue_invoice: the API runs issuance's pre-authority
checks (company blockers; NCM, CEST, IBS/CBS and presumed-credit
tables; layout and cross-field rules). Nothing is sent, numbered,
stored or charged. Malformed fields come back first, without the
API.

It does not replace issuing: the authorizer can still reject what
passes (recipient registration, a number already used).

- **list_received_invoices** — List NF-e documents other companies issued against this one.

The mirror of list_invoices: that one shows what this company issued,
this one what it received. Read-only.

It reads what the API already collected and never calls the tax
authority; collection runs every six hours and
sync_received_invoices asks now. Each row carries the issuer, the
amount, has_full_document and, once one was filed, the
manifestation; final_answer_due means only an awareness was filed.
Before a manifestation the authority sends a summary only; the full
document arrives after one.

Past the plan's monthly allowance each new one costs credit
(get_usage).

The result carries sync, how fresh the list is. When sync.status is
cooling_down or failing, tell the user the list may be incomplete
and when the next read is possible (sync.next_sync_at). When
sync.competing_reader is true, give sync.hint: another system (an
ERP, the accountant) reads the same CNPJ with the same certificate
and only the customer can stop it. Do not call
sync_received_invoices before sync.next_sync_at: asking early
renews the block.

- **sync_received_invoices** — Ask the tax authority now for NF-e issued against this company.

Collection already runs every six hours. After a read that finds
nothing more the authority imposes a one-hour wait; inside it this
is refused with the time to retry (next_sync_at, the same instant
list_received_invoices reports in sync). Never retry in a loop, and
never ask before that instant: asking early renews the block.

- **manifest_received_invoice** — Declare this company's position on a document issued against it.

Legally binding and irreversible once the tax authority accepts it —
ask the human to confirm before calling, and read back which
document and which of the four positions is being filed.

Denying a document (210220) or declaring the operation did not
happen (210240) is an accusation against whoever issued it. Never
pick either because the user sounds unsure — ask.

210200 confirms the operation happened, 210210 acknowledges the
document exists, 210220 denies knowing it, and 210240 states the
operation was not carried out. Only 210240 takes a reason, and it
requires one; the others are refused if a reason is sent.

- **get_received_invoice_xml** — Return the full XML (procNFe) of an NF-e issued against this
company. Read-only and never charged.

Only when list_received_invoices shows has_full_document; for a
summary the answer says to manifest first. An XML above 500 KB is
not inlined: the answer says to download it from the API instead.

- **lookup_fiscal_code** — Resolve one code of one classification, when you know both.

Use this to confirm a code before putting it on a document —
an NCM that does not exist is rejected by the tax authority
after issuing, which costs a cancellation.

A code that is not there answers 404. That means the code is
wrong, not that the lookup failed; do not retry it.

`metadata` differs per kind and is passed through as published:
utrib on an NCM, ncm_code on a CEST, tax_type on a CST, and
nothing at all on an ISS service.

- **search_fiscal_codes** — Find a code from a description, or page through a table.

This is the tool for "what NCM is a keyboard" — the one the
user actually asks. Prefer it over guessing a code from memory:
the tables change, and a plausible wrong code is worse than a
lookup.

Leaving `kind` unset searches every classification of that
country at once, which is the most expensive call here. Set it
whenever the question already names one.

Rows come back ordered by kind then code; there is no sort
argument, and asking for one changes nothing.

- **list_fiscal_kinds** — Which classifications this country has data for, right now.

Ask this before assuming a classification exists. The answer
grows as the source data does, so a name absent here is absent
today rather than absent forever.

- **lookup_taxpayer** — Look up one taxpayer by exact tax id, to confirm who it is.

Use it to check a recipient's name before issuing against them.
It takes the id exactly — punctuation is fine, but there is no
search by name, by prefix or by state, and there will not be:
the registry holds the names and addresses of real people.

A 404 does not mean the company does not exist. The registry
reloads monthly from the RFB's dump, so a recently registered
CNPJ is simply not in it yet. Say that to the user rather than
reporting the tax id as invalid, and never turn a 404 here into
a validation rule.

- **search_cities** — Find a municipality's IBGE code from its name.

Issuing resolves city_code from city and state by itself, so this
is for the name that matches more than one city, or an address
the API answered CITY_NOT_FOUND for. Returns at most 20, each
with its code, name and state; ask the user which one when more
than one fits. Read-only.

- **calculate_ibs_cbs** — Simulate IBS/CBS per item and in total. Issues nothing.

Not a fiscal document: say so to the user. Rates left out use
the official 2026 ones in 2026; outside 2026 they are required.

- **suggest_nbs** — List the NBS codes NFS-e Anexo VIII pairs with a service code.

Suggestions, not a decision: show them to the user and put an nbs
on the item only after they pick one. Each carries the cIndOp and
cClassTrib Anexo VIII lists for it, which belong in the item's
ibs_cbs group only when the user also confirms them. Empty when
the annex lists none.

- **list_authorized_companies** — List the companies this connection may act for, and what it may
do on each.

Call it before acting when the user has more than one company, or
when a tool answered that it needs a company. Each row carries the
company_id (UUID) and tax_id (CNPJ or CPF) the other tools accept as
company_id or company_tax_id, and the permissions granted there.

One connection may cover several companies; when it covers only
one, the other tools need no company at all. Read-only.

- **get_usage** — The plan's allowances, what is used and the credit left.

Read it before saying an action is free. Read-only.

- **get_company_readiness** — Whether the company can issue right now, and if not, what to fix.

Call it before a company's first document, and when issuing
fails for a reason that is not the document's. ready is false
with missing naming the cause; by_document_type has it per nfe
and nfse, each blocker with the fields at fault and each warning
a default being declared; fix_url is the dashboard screen for
the first blocker.

What to do with it:
- address: offer to fill it in here. Read the company's own
  registry row with lookup_taxpayer, show the user the address,
  and call update_company once they confirm.
- state_registration: ask the user for the IE, then
  update_company.
- certificate, certificate_expired, certificate_unreadable, plan:
  only the dashboard fixes them; give the user fix_url.
- update_company refused for lack of company:write: give fix_url
  and tell the user to reconnect Stackin to allow company
  settings.

Do not call it again until something changed — an update_company,
or the user saying they fixed it: the answer will be the same.
Also the certificate's expiry, the tax regime (CRT), the state,
the default série per document type and what the registry
suggests for the fiscal fields. Read-only.

- **update_company** — Fill in or fix the company's own address and fiscal fields —
what get_company_readiness reports missing.

Before calling it: read the company's own registry row with
lookup_taxpayer (its CNPJ), show the user the address you are
about to write, and call only after they confirm it. Never
invent or guess a field; leave out what neither the registry nor
the user gave. The state cannot change here.

The registry row keeps street_type, street, number and
neighborhood under metadata.address and the CEP as postal_code.
Its city_code is the Receita's code (4 digits), not IBGE, and it
has no city name: get the name with
lookup_fiscal_code(kind="city", code=<city_code>) and send it as
municipality_name, or send search_cities' 7-digit code as
municipality_code.

The fiscal fields (tax_regime, simples_nacional, simples_apuracao,
simples_apuracao_ibs_cbs, state_registration, service_code,
municipal_registration, special_tax_regime, iss_rate and the
approximate_tax_*_percent ones) decide what every future document
declares and owes: send them only when the user states them,
never from a registry suggestion alone. They are the company
owner's alone. An empty string clears municipal_registration,
iss_rate and the approximate_tax_*_percent ones.

Only what is sent changes. Answers with the readiness fields
plus the address and fiscal fields as stored: when ready is
true the company can issue, with no need to ask
get_company_readiness again. Needs company:write.

- **list_clients** — Find the company's saved clients.

Look a recipient up here before typing one into issue_invoice:
when it is already saved, pass its id as client_id and the name,
document and address come from the registry. Most recently used
first unless sort_by says otherwise. Read-only.

- **get_client** — Read one saved client, with its full address. Read-only.
- **save_client** — Save a client in the company's registry, or update a saved one.

It records a recipient for later issuances; it issues nothing.
A document already saved is refused with the existing client's
id — call get_client or pass that id here to update it instead.
Confirm the data with the user when any of it was inferred.

- **deactivate_client** — Hide a saved client; reactivate_client brings it back.
- **reactivate_client** — Bring a deactivated client back to the registry.
- **list_items** — Find the products and services in the company's catalog.

Look a line up here before typing it into issue_invoice: when it
is saved, pass its id as item_id and the description, price and
fiscal codes come from the catalog. Most recently used first.
Read-only.

- **get_item** — Read one catalog item with its fiscal fields. Read-only.
- **save_item** — Save a product or service in the catalog, or update a saved one.

Without item_id it creates, or updates the item with the same
external_reference (else the same code): sending it twice never
makes two. Nothing fiscal is required to save; an NF-e still
needs ncm and cfop when issued. It issues nothing. Confirm the
data with the user when any of it was inferred.

- **deactivate_item** — Hide a catalog item; reactivate_item brings it back.
- **reactivate_item** — Bring a deactivated item back into the company's catalog.
- **explain_rejection** — Explain why a rejected document was refused and what to change.

get_invoice_submissions has the authority's reply as sent; this
reads it for someone who does not speak SEFAZ: the code, the
message verbatim, what it means, the steps to fix it, the field
at fault and, when there is one, a suggested value. Quote the
code and the message to the user; they are what they will search
for. A suggested value is confirmed with the user before
reissue_invoice, never applied on its own.

transient means the authority was unavailable, not the data
wrong. A document that is not rejected is refused (409).
Read-only.

- **classify_item** — Suggest an NCM, CFOP, CST/CSOSN, CEST or service code for one
item. A suggestion to confirm with the user — never issue on it
blindly.

Every code in a candidate was read from the published tables, but
the NCM and the CFOP decide the tax owed, and a plausible wrong
one is authorized by the SEFAZ and only caught at an audit. Show
the primary candidate, its confidence and the alternatives, say
it is a suggestion, and put a code on an item only after the user
confirms it — whatever the confidence. lookup_fiscal_code can
confirm one code against the table.

When missing_information is not empty, ask the user those
questions and call again with the answers in the matching
arguments. Changes nothing.

- **list_webhooks** — List where this company's events are delivered.

One row per endpoint: its id (what delete_webhook takes), URL,
events and whether it is active. Secrets are never returned.
Needs webhook:manage. Read-only.

- **create_webhook** — Register a URL to receive this company's document events.

Every document authorized, rejected, cancelled or corrected, and
every received NF-e first stored (received_invoice.stored) or
whose full XML arrived (received_invoice.full_document), is then
sent there, signed with the secret. Confirm the URL with the user
before calling: it is where their fiscal data goes. The API refuses a URL that is not HTTPS or points at a
private network. Needs webhook:manage.

Calling it twice registers two endpoints, and each receives every
event: list_webhooks first.

- **delete_webhook** — Stop delivering events to one endpoint.

The user's integration stops hearing about new documents from
that moment, so confirm which endpoint with them first. What was
already delivered stays in list_webhook_deliveries. An id this
company does not have is refused (404). Needs webhook:manage.

- **list_webhook_deliveries** — Show every delivery attempt, newest first.

The answer to "is my webhook receiving": each row has the event,
its status, how many attempts, what the endpoint answered
(response_status), the last error and when it was delivered or
will be tried again. Needs webhook:manage. Read-only.


## Claude Desktop Quick Installation
Remote MCP endpoint (confidence: high). Install path detected from listing signals. Add as a URL/SSE server in your client:

```json
"mcpServers": {
  "stackin": {
    "url": "https://mcp.stackin.io/mcp"
  }
}
```

## Documentation

## What Stackin does

Stackin exposes Brazilian fiscal-document operations through the Model Context Protocol. It supports NF-e for goods and NFS-e for services, connecting requests to SEFAZ and municipal NFS-e services through the hosted endpoint `https://mcp.stackin.io/mcp`.

The server covers the document lifecycle: issuing, checking status, cancelling, retrying rejected submissions, downloading printable PDFs, and filing correction letters for NF-e. It can also explain rejected submissions using the tax authority's response code and message. Read-only tools list issued and received invoices, inspect submission attempts, report usage, and show which companies a connection can act for.

Additional tools support fiscal-code searches, exact taxpayer lookups, and a saved-client registry. Received NF-e workflows include synchronization, viewing documents issued against a company, and filing a manifestation.

## How it works

The connection uses streamable HTTP. Clients can authenticate with OAuth 2.1 using PKCE and dynamic client registration, or send a static API key as a bearer token. A key created through Stackin carries its environment, while authorized connections can cover one or several companies. When several companies are available, the relevant `company_id` or tax identifier must be selected for the operation.

Invoice identifiers have different roles. Issued documents expose an access key for consultation, cancellation, and PDF retrieval. Rejected submissions have a local invoice ID but no access key; reissue and submission-history tools use that local ID instead.

Idempotency keys should be supplied for issuance, reissue, and cancellation when a retry could occur. Reusing the same key with the same request replays the original result rather than creating another fiscal action. The key is not generated by Stackin.

## Setup and configuration

Connect an MCP client to:

```text
https://mcp.stackin.io/mcp
```

For bearer authentication, send:

```text
Authorization: Bearer <STACKIN_API_KEY>
```

API keys can be generated through `app.stackin.io`. OAuth clients may omit the authorization header initially and follow the server's authentication challenge. Claude Code can install the repository plugin, which points to the hosted server and includes workflow skills. ChatGPT and Codex can use the hosted app connection, while Cursor can configure the endpoint in its MCP settings.

## Tools and capabilities

- Issue NF-e or NFS-e documents after validating the required information.
- Consult status, list issued or received invoices, and inspect submission attempts.
- Cancel authorized invoices, retry rejected ones, or correct eligible NF-e fields with a CC-e.
- Retrieve DANFE or DANFSe PDF output; PDFs are returned as base64 when small enough to inline.
- Validate payload structure and search or resolve NCM, CFOP, CEST, CST, and ISS-related classifications.
- Manage saved clients, taxpayer lookups, company selection, usage data, and received-invoice manifestations.

## Limitations and notes

Issuing, cancelling, invalidating numbering, and manifesting received documents can have legal or accounting consequences. Confirm inferred data with the user before issuing, and obtain explicit confirmation before cancellation, numbering invalidation, or manifestation. NF-e requires NCM and CFOP for every item plus a complete recipient address; validation checks local field rules but does not replace the authorizer's fiscal checks.

Correction letters apply only to NF-e and cannot change amounts, taxes, recipients, or products. An NFS-e correction instead requires cancellation and a new issuance. A cancellation reason is sent verbatim and must contain at least 15 characters. Number invalidation is irreversible, and the inclusive range must contain only never-authorized numbers.

The legally valid document is the XML, not the rendered PDF. PDFs larger than 2 MB are not inlined. Received-invoice collection runs every six hours; an immediate synchronization can be rate-limited for one hour after an empty read. Fiscal-code and taxpayer lookup results should be treated according to their returned status rather than inferred from a missing match.

_Full upstream README: https://allmcps.com/mcp/stackin/readme_

