Skip to main content
BT

BTG Pactual

v0.1.0-alpha.2OAuth2alpha

BR investment bank with retail digital banking (BTG+). Investment-bank flavor: Pix + boleto + accounts PLUS investment positions, portfolio summary, fund subscribe/redeem. OAuth2 + mTLS. Alpha — devportal contract-gated.

12 tools5 env vars🇧🇷 Brazilalpha — pending validation

What your agent can do

BTG Pactual gives your agent 12 tools it calls directly — pick the ones it needs, in Claude, Cursor, or any MCP client.

  • get_oauth_tokenMint or return a cached OAuth2 client_credentials bearer token for the BTG Developer Portal. Exposed so agents can inspect token freshness; normal tool calls obtain tokens implicitly.
  • create_pix_cobCreate an immediate Pix charge (cob) with QR code. Returns the txid, copy-paste EMV payload, and location URL. BACEN Pix v2 standard surface.
  • get_pix_cobRetrieve an immediate Pix charge (cob) by its txid.
Example call
// Your agent calls a tool directly — no glue code.
// CodeSpar's managed tier handles OAuth2, token rotation and rate limits.
const result = await session.call("get_oauth_token", { /* ... */ });

Install

terminal
$ npm install @codespar/mcp-btg@alpha

Quickstart

Add this entry to your claude_desktop_config.json (or any MCP-compatible client config).

claude_desktop_config.json
{
  "mcpServers": {
    "btg": {
      "command": "npx",
      "args": [
        "-y",
        "@codespar/mcp-btg@alpha"
      ],
      "env": {
        "BTG_CLIENT_ID": "<your_btg_client_id>",
        "BTG_CLIENT_SECRET": "<your_btg_client_secret>",
        "BTG_CERT_PATH": "<your_btg_cert_path>",
        "BTG_KEY_PATH": "<your_btg_key_path>"
      }
    }
  }
}

After restart, your agent can call any of the 12 tools below — try get_oauth_token first.

Environment variables · 5

Required to authenticate the server. Stored encrypted when using CodeSpar managed hosting.

BTG_CLIENT_ID
required

BTG OAuth client_id issued via the Developer Portal after contract onboarding.

BTG_CLIENT_SECRET
requiredsecret

BTG OAuth client_secret.

BTG_CERT_PATH
required

Absolute path to the mTLS client certificate (.crt or .pem). BACEN mandates mTLS for Pix v2; BTG enforces it across product families.

BTG_KEY_PATH
requiredsecret

Absolute path to the mTLS private key (.key or .pem).

BTG_ENV
optional

Environment: 'sandbox' or 'production'. Defaults to 'sandbox'.

Available tools · 12

Each tool is independent — your agent loads only what it needs to reduce context and response time.

READget_oauth_token
Mint or return a cached OAuth2 client_credentials bearer token for the BTG Developer Portal. Exposed so agents can inspect token freshness; normal tool calls obtain tokens implicitly.
WRITEcreate_pix_cob
Create an immediate Pix charge (cob) with QR code. Returns the txid, copy-paste EMV payload, and location URL. BACEN Pix v2 standard surface.
READget_pix_cob
Retrieve an immediate Pix charge (cob) by its txid.
WRITEcreate_boleto
Issue a boleto via BTG Cobrança. Returns nosso_numero, linha_digitável, barcode, and PDF URL.
READget_boleto
Retrieve a boleto by its BTG identifier (id or nosso_numero).
READget_account_balance
Retrieve the available balance for a BTG+ checking account (conta corrente). Returns available, blocked, and total balances in BRL.
READget_account_statement
Retrieve account statement transactions for a given period. Paginated.
READlist_investment_positions
List the counterparty's investment positions held at BTG, scoped to fixed-income asset classes (CDB, LCI, LCA, LF, LFSN, debêntures, CRI, CRA). Each position includes issuer, indexer (CDI/IPCA/Prefixado), gross value, net value (after IR/IOF), and maturity.

Compatible frameworks

MCP is a protocol — any framework that speaks it can mount this server.

Claude Agent SDKAnthropic
OpenAI AgentsOpenAI
Vercel AI SDKVercel
LangChainLangChain
LlamaIndexLlamaIndex
CrewAICrewAI
MastraMastra
Any MCP clientProtocol

Frequently asked questions

Run `npx -y @codespar/mcp-btg` and add the config block above to your MCP client — Claude, Cursor, VS Code, or any MCP-compatible client. No build step, no SDK required. Prefer hosted? CodeSpar's managed tier runs it for you with auth handled.
BTG Pactual — MCP server · 12 tools | CodeSpar