xp-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| XP_MCP_DB_PATH | No | Custom path for the SQLite database file. Defaults to ~/.xp-mcp/data.db |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| import_xperformance_pdfA | Import the XPerformance PDF (XP's official portfolio report). Extracts patrimônio total, reference date, and per-asset position rows (quantity, market value, %allocation, indexer, maturity). Idempotent: re-importing the same file updates existing positions. Returns import counts, warnings, and a preview of up to 10 positions. |
| import_extract_csvA | Import a CSV exported from XP Investimentos (Posicao Consolidada, Extrato). Idempotent: re-importing the same file updates existing positions instead of duplicating. Returns counts, warnings, and a preview of the first 5 parsed positions. |
| get_positionsA | List all positions in the portfolio. Optional filter by asset_class. Returns each position with quantity, avg/current price, invested vs market value, and unrealized P&L. Values in BRL (Brazilian Reais). |
| calculate_allocation_driftA | Compare current portfolio allocation against a target defined in ~/.xp-mcp/allocation.json. Returns per-class drift in percentage points and BRL, with suggested BUY/SELL actions to rebalance. Optional 'target_path' argument overrides the default location. Optional 'tolerance_pp' field in the JSON treats drifts within the band as 'ok' (no action). |
| set_advisor_profileA | Save (overwrite) the advisor profile at ~/.xp-mcp/advisor-profile.json. Required fields: risk_tolerance (1-10), horizon_years (>0), objective ('income'|'growth'|'balanced'). Optional: outbound_enabled (default false), excluded_classes, excluded_tickers, notes, brapi_token. Enabling outbound_enabled=true requires accept_disclaimer=true on the call. |
| get_advisor_profileA | Read the advisor profile from ~/.xp-mcp/advisor-profile.json. Returns exists:false when the file is not yet configured; reports schema errors in the errors array. |
| get_market_dataA | Fetch quotes and/or fundamentals from brapi.dev for 1-50 tickers, with SQLite caching. Requires outbound_enabled=true in the advisor profile. Per-ticker partial failures are reported in results[].error without failing the whole call. cache_ttl_minutes overrides the default TTL (60 quote / 1440 fundamentals). |
| screen_assetsA | Rank B3 assets (FII | ACAO | ETF) against criteria (sort_by, filters, limit). Fetches the universe and per-ticker quote+fundamentals from brapi.dev (cached). Profile's excluded_classes/excluded_tickers are merged with the call's exclude_tickers. Output is educational analysis, not investment advice. |
| get_portfolio_summaryA | Aggregate stats + reconciliation gap for the portfolio. Returns total market value, per-class breakdown (% and BRL), top 5 positions, total/per-class P&L, FGC coverage, maturity buckets (short/medium/long), and the gap between the declared patrimônio total (from the last XPerformance PDF) vs computed total. Zero outbound HTTP. No inputs. |
| import_bank_extract_pdfA | Import a PDF exported from XP's Conta Digital Extrato (digital account statement). Filters for transfers between digital account and investment account only (deposits = APORTE, withdrawals = RESGATE). Idempotent: re-importing the same file skips duplicates. Persists to the cash_flows table. |
| get_cash_flowsA | List cash flows (APORTE/RESGATE) with optional date range and kind filters. Returns up to |
| suggest_buysA | Suggest BUY actions per underweight asset class based on the advisor profile. Composes drift + screening per class (FII/ACAO/ETF) using a fixed objective × asset_class criteria matrix; non-screenable classes (TESOURO/RF/FUNDO) surface in skipped_classes with reason. Requires outbound_enabled=true. Output is educational analysis, not investment advice. |
| calculate_twrA | Time-weighted return (TWR) over the XPerformance import history. Removes the effect of when you contributed/withdrew — pure portfolio performance metric, GIPS-compliant. Uses Modified Dietz between consecutive imports and chains sub-periods geometrically. Requires ≥ 2 XPerformance imports. Returns period_return, annualized return, per-sub-period breakdown, and quality warnings (sparse history, large cash flows, stale tail). |
| calculate_mwrB | Money-weighted return (MWR / IRR) — the rate that reflects when you put money in vs. out. Computed via bisection over signed cash flows including synthetic initial/terminal NAV. Requires ≥ 2 XPerformance imports. Returns mwr_period, mwr_annualized, cash_flow_breakdown, convergence diagnostics, and warnings. |
| get_crypto_quoteA | Spot crypto quotes in BRL via Mercado Bitcoin (e.g. BTC, ETH, SOL). Per-ticker partial failure: one unknown symbol doesn't fail the batch. 15-minute cache, outbound-gated. Quote only — crypto is not yet a tracked portfolio asset_class. |
| set_crypto_positionA | Manually track a crypto holding (e.g. BTC, ETH). Fetches the current BRL quote (multi-source: Mercado Bitcoin → Foxbit → Binance) and stores a snapshot market value (quantity × current price) as a CRIPTO position, which then flows into get_portfolio_summary and calculate_allocation_drift. quantity=0 removes the holding (idempotent). Re-run to refresh the value. Outbound-gated. Snapshot only — no cost basis / P&L is recorded. |
| get_transactionsA | List trade transactions (buys/sells) with optional ticker, asset_class, and date-range filters. Returns up to |
| get_dividendsA | List dividend/JCP payouts with optional ticker, asset_class, kind, and date-range filters. Returns up to |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |