Search guides
ai5 minPRO

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

  1. Go to Settings > MCP integration in your dashboard
  2. Click Create new API key
  3. Give it a descriptive name (e.g. "Claude Desktop")
  4. 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

ToolDescription
list_portfoliosList all your portfolios
get_portfolioGet portfolio with holdings and current prices
get_consolidated_portfolioConsolidated view across portfolios

Transactions

ToolDescription
list_transactionsList transactions for a holding
get_lotsGet tax lots (cost basis breakdown)
add_transactionAdd a BUY/SELL/DIVIDEND transaction
update_transactionUpdate an existing transaction
delete_transactionDelete a transaction
batch_import_transactionsImport multiple transactions at once

Market data

ToolDescription
get_stock_quoteGet current stock quote
search_stocksSearch for stocks by name or symbol

Rebalancing

ToolDescription
get_rebalancing_statusPortfolio rebalancing status and score
get_rebalancing_recommendationsTrade recommendations to rebalance
set_rebalancing_targetsSet target allocation percentages

Tax

ToolDescription
get_tax_reportCapital gains and dividend income report
get_tax_loss_harvestingTax loss harvesting opportunities

Reports

ToolDescription
get_portfolio_performancePerformance chart with benchmark comparison
get_dividend_calendarProjected 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.