MCP Hub
Back to servers

claude-fidelity-mcp

Enables interaction with Fidelity Investments brokerage accounts using Playwright browser automation to manage balances, positions, and trades. It supports secure 2FA authentication and session persistence for seamless account management via Claude.

glama
Updated
Apr 1, 2026

claude-fidelity-mcp

MCP server for interacting with Fidelity Investments brokerage accounts from Claude / Claude Code.

Since Fidelity has no public retail API, this uses Playwright browser automation (Firefox) to control Fidelity's web interface, with stealth measures and session persistence to minimize re-authentication.

Features

  • Login with 2FA - Supports automatic TOTP (authenticator app) and interactive SMS verification
  • Session persistence - Saves cookies/localStorage so you don't re-login every time
  • Account listing - View all accounts with names, numbers, and balances
  • Portfolio positions - Get all holdings across accounts (ticker, quantity, price, value)
  • Stock quotes - Get current and extended-hours prices
  • Order placement - Buy/sell stocks with market or limit orders (dry-run by default)
  • Transfers - Move cash between Fidelity accounts
  • Penny stock handling - Auto-switches to limit orders for stocks under $1
  • Extended hours - Automatically enables and adjusts for pre/post-market trading

Tools

ToolDescription
fidelity_loginLog in with username/password + TOTP or SMS 2FA
fidelity_submit_2faComplete SMS 2FA with the code from your phone
fidelity_get_accountsList all accounts with names, numbers, balances
fidelity_get_positionsGet all holdings across all accounts
fidelity_get_quoteGet current price for a stock/ETF symbol
fidelity_place_orderBuy/sell stocks (dry-run by default)
fidelity_transferTransfer cash between Fidelity accounts
fidelity_statusCheck if browser session is active
fidelity_save_sessionManually save session state
fidelity_logoutClose browser and save session

Setup

1. Install dependencies

npm install
npx playwright install firefox

2. Build

npm run build

3. Configure

Add to your global Claude config (~/.claude.json) or project config (.claude/mcp.json):

{
  "mcpServers": {
    "fidelity": {
      "command": "node",
      "args": ["/path/to/claude-fidelity-mcp/build/index.js"],
      "env": {
        "FIDELITY_USERNAME": "your-username",
        "FIDELITY_PASSWORD": "your-password",
        "FIDELITY_TOTP_SECRET": "your-totp-secret",
        "FIDELITY_HEADLESS": "true",
        "FIDELITY_TIMEOUT": "30000"
      }
    }
  }
}

4. Set up TOTP (recommended)

For fully automatic login without manual 2FA prompts:

  1. Go to Fidelity Security Settings > Authenticator app > Connect
  2. Click "Can't scan the code?" to reveal the TOTP secret (a base32 string)
  3. Copy the secret into FIDELITY_TOTP_SECRET
  4. Also add it to your authenticator app (Google Authenticator, Authy, etc.) and verify the code with Fidelity to activate

Environment Variables

VariableRequiredDefaultDescription
FIDELITY_USERNAMEYes-Fidelity login username
FIDELITY_PASSWORDYes-Fidelity login password
FIDELITY_TOTP_SECRETNo-TOTP secret for automatic 2FA
FIDELITY_HEADLESSNotrueSet to false to see the browser
FIDELITY_SESSION_DIRNo~/.fidelity-mcpWhere to save session files
FIDELITY_SESSION_TITLENodefaultSession file identifier (for multiple accounts)
FIDELITY_TIMEOUTNo30000Default timeout in milliseconds

Project Structure

src/
  index.ts        # MCP server entry point + tool registrations
  browser.ts      # Playwright browser lifecycle, stealth, session persistence
  auth.ts         # Login flow, TOTP/SMS 2FA handling
  accounts.ts     # Account listing, balances, transfers
  positions.ts    # Portfolio positions via CSV download
  trading.ts      # Quotes and order placement
  types.ts        # TypeScript interfaces

Notes

  • Dry-run by default - fidelity_place_order previews orders without executing unless you set dry_run: false
  • Browser automation - This relies on Fidelity's web UI, which may change. If tools break, selectors may need updating
  • Security - Credentials are stored in your Claude config. Never commit them to version control
  • Rate limiting - Avoid rapid repeated calls; Fidelity may flag automated access

Reviews

No reviews yet

Sign in to write a review