mcpField
M
mcp-btg

mcp-btg

Local
github.com/codesparFinance275Updated 4w ago

About mcp-btg

mcp-btg is an MCP server for BTG Pactual covering Pix, boleto, bank account data and investment products such as CDB, LCI, LCA and funds. It is in alpha, and its endpoint paths have not yet been checked against the provider's portal spec. It targets merchants and fintechs onboarded with BTG and authenticates with both OAuth2 and mTLS.

Key features

  1. 01Pix immediate charge creation and lookup
  2. 02Boleto issuance and retrieval
  3. 03Checking account balance and statement queries
  4. 04Fixed-income and investment position listing
  5. 05Fund subscription, redemption and fund listing
  6. 06OAuth2 client credentials with mTLS

Use cases

  1. 01Generating a Pix charge through an agent and checking payment status
  2. 02Querying account balances and statements for a fintech workflow
  3. 03Listing fixed-income positions such as CDB, LCI and LCA

MCP support

This project is an MCP server that exposes 12 tools to MCP clients for Pix, boleto, account and investment operations.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"codespar-mcp-btg": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-btg"
],
"env": {
"BTG_CLIENT_ID": "<BTG_CLIENT_ID>",
"BTG_CLIENT_SECRET": "<BTG_CLIENT_SECRET>",
"BTG_CERT_PATH": "<BTG_CERT_PATH>",
"BTG_KEY_PATH": "<BTG_KEY_PATH>",
"BTG_ENV": "<BTG_ENV>"
}
}
}
}
Run commandnpx -y @codespar/mcp-btg
Environment variables to set
BTG_CLIENT_IDBTG OAuth client_id issued via the Developer Portal after contract onboarding.
BTG_CLIENT_SECRETSecretBTG OAuth client_secret.
BTG_CERT_PATHAbsolute path to the mTLS client certificate (.crt or .pem). BACEN mandates mTLS for Pix v2; BTG enforces it across product families.
BTG_KEY_PATHSecretAbsolute path to the mTLS private key (.key or .pem).
BTG_ENVEnvironment: 'sandbox' or 'production'. Defaults to 'sandbox'.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@codespar/mcp-btg0.1.0-alpha.3

Tools

12

Saved tool list · updated 2w ago

This tool takes no parameters.

Details

From the project README

@codespar/mcp-btg

MCP server for BTG Pactual — Brazil's (and LatAm's) largest investment bank.

BTG runs a digital banking + investments stack (BTG+) on top of an institutional brokerage backbone. Merchants and fintechs integrate to BTG for the combination of Pix/boleto rails and an investment-account API surface (CDB, LCI, LCA, debêntures, funds) that no retail bank exposes at this depth.

Status: alpha (0.1.0-alpha.1)

BTG's Developer Portal is contract-gated — the full OpenAPI specs are only visible to onboarded counterparties. The endpoint paths in this server are best-guesses based on (a) BACEN Pix v2 standard paths, (b) BTG's public marketing pages, and (c) conventions shared with other Brazilian banks. Every unverified path is flagged TODO(verify) in the source.

Pin to exact versions during 0.1.x; paths will be corrected to match the portal spec once an onboarded counterparty can validate.

Tools (12)

ToolPurpose
get_oauth_tokenMint or return a cached OAuth2 client_credentials bearer token for the BTG Developer Portal.
create_pix_cobCreate an immediate Pix charge (cob) with QR code.
get_pix_cobRetrieve an immediate Pix charge (cob) by its txid.
create_boletoIssue a boleto via BTG Cobrança.
get_boletoRetrieve a boleto by its BTG identifier (id or nosso_numero).
get_account_balanceRetrieve the available balance for a BTG+ checking account (conta corrente).
get_account_statementRetrieve account statement transactions for a given period.
list_investment_positionsList the counterparty's investment positions held at BTG, scoped to fixed-income asset classes (CDB, LCI, L...
get_portfolio_summaryConsolidated portfolio summary across all asset classes held at BTG (fixed income, funds, equities, treasur...
list_funds_availableList funds available for distribution on BTG's platform.
subscribe_to_fundSubscribe (aplicar) to a fund on BTG's distribution platform.
redeem_from_fundRedeem (resgatar) from a fund.

Install

npm install @codespar/[email protected]

Environment

BTG_CLIENT_ID="..."       # OAuth client_id from BTG's Developer Portal
BTG_CLIENT_SECRET="..."   # OAuth client_secret
BTG_CERT_PATH="/abs/path/to/client.crt"   # mTLS client certificate
BTG_KEY_PATH="/abs/path/to/client.key"    # mTLS private key
BTG_ENV="sandbox"                          # or "production" (default: sandbox)

Authentication

Two factors are both required on every call:

  1. OAuth2 client_credentials — the server calls the token endpoint, caches the bearer until ~60s before expiry, and attaches Authorization: Bearer <token> to downstream calls.
  2. mTLS — BACEN mandates mutual TLS for Pix v2, and BTG enforces it across product families (banking + investments). The server loads the client certificate and private key from the paths you set, builds a Node https.Agent, and routes every request through it.

You obtain the cert + key bundle from the BTG Developer Portal after contract onboarding. They are distinct from the OAuth credentials.

Run

# stdio (default)
npx @codespar/mcp-btg

# HTTP transport
MCP_HTTP=true MCP_PORT=3000 npx @codespar/mcp-btg

Caveats

  • Paths are unverified. See the TODO(verify) markers in src/index.ts. Onboarded counterparties should validate against their portal-issued OpenAPI spec and open a PR.
  • Sandbox host is a guess. BTG issues a sandbox subdomain per counterparty; override by editing BASE_URL if your provisioned sandbox URL differs.
  • Investments surface (CDB/LCI/LCA/debêntures/funds) is differentiated vs. retail-bank MCPs in this repo, but the field shapes will move once the OpenAPI spec is byte-verified.

Enterprise

Need governance, budget limits, and audit trails for agent payments? CodeSpar Enterprise adds policy engine, payment routing, and compliance templates on top of these MCP servers.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.