explaingit

satsuj1n/xp-mcp

11TypeScriptAudience · developerComplexity · 3/5ActiveLicenseSetup · moderate

TLDR

Local MCP server that parses XP Investimentos broker exports into SQLite so Claude Desktop can answer questions about your Brazilian portfolio, allocation drift, and fund screening.

Mindmap

mindmap
  root((xp-mcp))
    Inputs
      XP PDF and CSV exports
      Target allocation JSON
      brapi.dev token
    Outputs
      Portfolio summary
      Allocation drift report
      Fund screening results
    Use Cases
      Chat about your XP portfolio
      Track allocation versus target
      Screen B3 stocks and FIIs
    Tech Stack
      TypeScript
      MCP SDK
      SQLite
      pdf-parse

Things people build with this

USE CASE 1

Chat with Claude Desktop about your XP Investimentos positions without sending data to a third party

USE CASE 2

Import XP CSV and PDF exports into a local SQLite database that an MCP client can query

USE CASE 3

Compare your portfolio against a target allocation and get buy and sell suggestions in reais

USE CASE 4

Screen Brazilian stocks and real estate funds by yield, P/B, P/E, and ROE through brapi.dev

Tech stack

TypeScriptMCPSQLitepdf-parsepapaparsezod

Getting it running

Difficulty · moderate Time to first run · 30min

XP has no single export, so you must collect PDFs and CSVs by hand and configure Claude Desktop to launch the MCP server.

MIT lets you use, modify, and ship this in commercial or closed products as long as you keep the copyright notice.

In plain English

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.

Copy-paste prompts

Prompt 1
Set up xp-mcp with Claude Desktop and import an XPerformance PDF plus a consolidated position CSV
Prompt 2
Write a target allocation JSON for a 60/30/10 stocks bonds FII split and run the drift tool
Prompt 3
Add a brapi.dev token to xp-mcp and screen Brazilian FIIs with dividend yield above 10 percent
Prompt 4
Extend xp-mcp parsers to also read NuInvest broker note PDFs in the same SQLite schema
Prompt 5
Audit the MCP tool list in xp-mcp and propose one new tool for tax-lot tracking on B3 trades
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.