1. AI and MCP
  2. Treeunfe MCP

MCP (Model Context Protocol) is an open standard that lets AI agents, such as Claude, Cursor, VS Code Copilot, Codex, and Gemini, use external tools. With the Treeunfe MCP, the agent issues, looks up, and cancels your company’s invoices from a natural-language request:

Issue a sales NF-e for customer 11222333000181,
with 1 unit of product PROD-001, and give me the access key and the DANFE.

The agent checks the checklist, builds the payload, issues the invoice, and checks the result, using the same rules as the issuer app and the API.

​
Server URL

https://mcp.treeunfe.com.br/mcp

The server uses the HTTP (Streamable HTTP) transport. Clients that connect to remote servers do not need a local install.

​
Sign-in

The MCP uses OAuth sign-in with your issuer-app account:

  1. You add the server address to your AI client.
  2. The client opens the issuer-app sign-in page (nfe.treeunfe.com.br).
  3. You sign in and authorize access.
  4. The client stores the access and renews it on its own.

Access applies only to your account’s company. To cut off a client, disconnect the server in it.

​
Permissions

During authorization, the client asks for the permissions (scopes) it needs:

ScopeAllows
mcpUse the MCP server.
nfe:readLook up NF-e, items, XML, DANFE, and events.
nfe:emitIssue NF-e and register cancellation, CC-e, and number invalidation.
nfse:readLook up NFS-e.
nfse:emitIssue, cancel, and substitute NFS-e.

​
Environment

The API MCP always operates in production. At sign-in, Treeunfe associates the agent with the company in that environment.

To issue a test invoice, with no fiscal value, use a HOMOLOGACAO API Key in your program. See Quickstart.

What the agent issues through the MCP goes out in production, with fiscal value. Ask it to show the customer, the items, the CFOP, and the amounts before you authorize the send.

​
Working safely with agents

A connected agent can create real invoices. Before you let the agent issue:

  • Require confirmation before issuing, cancelling, or invalidating numbers. Set the client to ask for your approval before those tools.
  • Check the invoice data. Ask the agent to show the customer, the items, the CFOP, and the amounts before sending.
  • Review connections. Disconnect the server from clients you no longer use.

​
Next steps