MCP integration
Connect AI assistants like Claude and Cursor to your TrackMyShares portfolio using the Model Context Protocol (MCP).
The Model Context Protocol (MCP) is an open standard that lets AI assistants interact with external tools and data sources. With the TrackMyShares MCP integration, you can query your portfolios, add transactions, generate tax reports, and more, all through natural language conversations with your AI assistant.
What you can do
Once connected, your AI assistant can:
- View portfolios and holdings with current market prices
- Add, update, and delete transactions (buys, sells, dividends)
- Get stock quotes and search for symbols
- Generate tax reports with capital gains and dividend income breakdowns
- Check rebalancing status and get trade recommendations
- View performance charts with benchmark comparisons
- See your dividend calendar with projected payments
Supported clients
The MCP integration works with any client that supports the Model Context Protocol, including:
- Claude Desktop (Anthropic)
- Claude Code (CLI)
- Cursor (AI code editor)
Setting it up
1. Generate an API key
- Go to Settings > MCP integration in your dashboard
- Click Create new API key
- Give it a descriptive name (e.g. "Claude Desktop")
- Copy the key immediately, as it won't be shown again
2. Copy the configuration
After creating your key, you'll see a ready-to-use JSON configuration snippet on the settings page. It looks like this:
{
"mcpServers": {
"trackmyshares": {
"url": "https://trackmyshares.com/api/mcp",
"headers": {
"x-api-key": "your-api-key-here"
}
}
}
}
3. Connect your client
Claude Desktop: Open Settings > Developer > Edit Config, and paste the configuration into claude_desktop_config.json.
Claude Code: Add the configuration to your Claude Code settings or project-level .mcp.json file.
Cursor: Open Settings > MCP and add a new server using the URL and API key from your configuration.
Once connected, you can start asking your AI assistant questions like "What's my portfolio worth?" or "Add a buy of 10 shares of AAPL at $195."
Available tools
The integration provides the following tools, grouped by category:
Portfolio
| Tool | Description |
|---|---|
list_portfolios | List all your portfolios |
get_portfolio | Get portfolio with holdings and current prices |
get_consolidated_portfolio | Consolidated view across portfolios |
Transactions
| Tool | Description |
|---|---|
list_transactions | List transactions for a holding |
get_lots | Get tax lots (cost basis breakdown) |
add_transaction | Add a BUY/SELL/DIVIDEND transaction |
update_transaction | Update an existing transaction |
delete_transaction | Delete a transaction |
batch_import_transactions | Import multiple transactions at once |
Market data
| Tool | Description |
|---|---|
get_stock_quote | Get current stock quote |
search_stocks | Search for stocks by name or symbol |
Rebalancing
| Tool | Description |
|---|---|
get_rebalancing_status | Portfolio rebalancing status and score |
get_rebalancing_recommendations | Trade recommendations to rebalance |
set_rebalancing_targets | Set target allocation percentages |
Tax
| Tool | Description |
|---|---|
get_tax_report | Capital gains and dividend income report |
get_tax_loss_harvesting | Tax loss harvesting opportunities |
Reports
| Tool | Description |
|---|---|
get_portfolio_performance | Performance chart with benchmark comparison |
get_dividend_calendar | Projected dividend payments calendar |
Security
- API keys are hashed and stored securely. The raw key is only shown once when created.
- Pro plan required. The MCP integration is only available to Pro subscribers.
- Confirmation required for changes. Destructive actions like adding or deleting transactions require explicit confirmation before they are executed. Your AI assistant will preview the change and ask you to confirm.
- You can revoke keys at any time from the MCP settings page if a key is compromised or no longer needed.
- You can create up to 3 API keys, so you can use separate keys for different clients and revoke them independently.