Chat with Claude Desktop about your XP Investimentos positions without sending data to a third party
Import XP CSV and PDF exports into a local SQLite database that an MCP client can query
Compare your portfolio against a target allocation and get buy and sell suggestions in reais
Screen Brazilian stocks and real estate funds by yield, P/B, P/E, and ROE through brapi.dev
XP has no single export, so you must collect PDFs and CSVs by hand and configure Claude Desktop to launch the MCP server.
xp-mcp is a small server that lets you chat with Claude Desktop about your XP Investimentos brokerage portfolio. XP is a large Brazilian broker, and the project follows the Model Context Protocol, so any MCP-compatible client can use it. It runs on your own machine, stores everything in a local SQLite database, and never connects to XP or sends your positions to a third party. The way data gets in is manual. XP does not have a single export-everything button, so the README walks through a few options: the XPerformance PDF, the consolidated position CSV, the Hub XP export, the broker notes, and the movement extract. You feed those files to the server, and it parses them into the database. The CSV reader handles different separators like semicolon, comma, tab, and pipe, and recognizes common XP column names such as Quantidade, Quantidade total, Preco medio, and Valor aplicado. Once your data is loaded, Claude can call MCP tools to answer questions. Tools include listing positions grouped by asset class, filtering CDBs by maturity, getting a portfolio summary, and importing more files. There is also an allocation drift tool that compares the current portfolio against a target allocation you set in a JSON config and reports how far each class is from its target, with rough buy and sell amounts in Brazilian reais. A second group of tools is opt-in and reaches the internet. With a brapi.dev token you can fetch quotes and fundamentals for B3-listed tickers, and screen Brazilian real estate funds, stocks, and ETFs by dividend yield, price to book, price to earnings, return on equity, and market cap. There is also an advisor profile that stores risk tolerance, horizon, and objectives so the assistant can give consistent advice across chats. The stack is TypeScript with the MCP SDK, better-sqlite3, pdf-parse, papaparse, and zod. It talks to Claude Desktop over standard input and output as JSON-RPC, with no open network ports. The project is MIT licensed and labelled as an MVP. The author notes that the same approach should work for other Brazilian custodians that allow file exports, like Rico, NuInvest, Inter, and Avenue, and welcomes contributions.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.