1. AI and MCP
  2. Connect your agent

In every example, replace YOUR_API_KEY with the organization’s rawKey. Use a homologation key while testing.

  • Claude Code

  • Claude Desktop

  • Cursor

  • VS Code

  • Codex

  • Gemini CLI

Run in your terminal:

claude mcp add --transport http treeunfe https://mcp.treeunfe.com.br/mcp --header "x-api-key: YOUR_API_KEY"

To check it, open Claude Code and type /mcp. The treeunfe server should show as connected.

Use --scope project to save the setup to the project’s .mcp.json and share it with your team. In that case, don’t save the key in the file: use ${TREEUNFE_API_KEY} and set the environment variable on each machine.

​
Other clients

Any client that supports remote MCP over HTTP works. Configure:

FieldValue
URLhttps://mcp.treeunfe.com.br/mcp
TransportHTTP (Streamable HTTP)
Headerx-api-key: YOUR_API_KEY or Authorization: Bearer YOUR_API_KEY

Connectors that only support OAuth sign-in (with no header field) can’t connect to the Treeunfe MCP directly yet. In that case, use mcp-remote as in the Claude Desktop example, if the client allows local servers.

​
Test the connection

Once connected, ask the agent for something read-only:

List the Treeunfe tools you have available.
Look up the last 5 invoices issued this month.

If the agent says it has no access, check:

  • that the key is correct and active;
  • that the organization is active (inactive organizations get 403);
  • that the key has the scopes for what you asked (nfe:read to look up, nfe:emit to issue).