Skip to main content
Glama
mobogojo

fidelity-mcp

by mobogojo

fidelity-mcp

DISCLAIMER: This project is not affiliated with, endorsed by, or associated with Fidelity Investments or FMR LLC. Use at your own risk. See DISCLAIMER.md for full legal notice.

A Model Context Protocol (MCP) server that gives Claude and other AI agents read/write access to your Fidelity Investments account via Playwright browser automation.

Fidelity does not offer a public API. This server works by capturing your authenticated browser session (via fidelity_login.py) and reusing it in a headless Playwright browser to read positions, balances, and transaction history — and to place orders.

Features

Tool

Description

get_fidelity_balance

Account balances and withdrawal availability

get_fidelity_positions

Open positions (ticker, quantity, price, value)

get_fidelity_activity

Recent transaction history (buys, sells, dividends)

place_fidelity_stock_sell_limit

Place a limit SELL order (Day or GTC) — dry-run by default

check_fidelity_session

Verify session file is present and populated

Related MCP server: MCP Macaco Playwright

Requirements

  • Python 3.11+

  • Windows (Playwright's Firefox must run natively — WSL users see WSL note below)

  • A Fidelity account

Installation

pip install -r requirements.txt
playwright install firefox

Quick Start

Step 1 — Capture your session

Run the interactive login script. A Firefox window opens — log in normally (use your password manager, 2FA, etc.). When you reach the Fidelity dashboard, press ENTER in the terminal.

python fidelity_login.py

This saves fidelity_session/Fidelity.json. Keep this file private — it grants access to your account. It is already in .gitignore.

Step 2 — Test the server

python fidelity_server.py

Step 3 — Add to Claude Code

In your project's .mcp.json:

{
  "mcpServers": {
    "fidelity": {
      "command": "python",
      "args": ["path/to/fidelity_server.py"]
    }
  }
}

Then use it in Claude Code:

check_fidelity_session
get_fidelity_balance
get_fidelity_positions
get_fidelity_activity(days=7)

# Dry run first (default):
place_fidelity_stock_sell_limit(symbol="AAPL", quantity=10, limit_price=200, account="YOUR_ACCOUNT_NUMBER", dry_run=True)

# Execute for real:
place_fidelity_stock_sell_limit(symbol="AAPL", quantity=10, limit_price=200, account="YOUR_ACCOUNT_NUMBER", dry_run=False)

WSL + Claude Code

If you run Claude Code on Windows but use WSL for MCP servers, Playwright's Firefox must run on the Windows side. Use a shell bridge:

launch.sh (place next to fidelity_server.py):

#!/bin/bash
exec cmd.exe /c "C:\\Python314\\python.exe C:\\path\\to\\fidelity_server.py"

.mcp.json:

{
  "mcpServers": {
    "fidelity": {
      "command": "wsl.exe",
      "args": ["bash", "/mnt/c/path/to/launch.sh"]
    }
  }
}

Session Expiry

Fidelity sessions typically last several hours to a day. When a tool returns:

No accounts found or session expired. Run fidelity_login.py to re-authenticate.

Re-run fidelity_login.py and restart the MCP server (or /mcp restart in Claude Code).

Environment Variables

Variable

Default

Description

FIDELITY_SESSION_DIR

fidelity_session

Directory for the session JSON file

Security

  • fidelity_session/ is in .gitignorenever commit it

  • The session file is equivalent to being logged in — protect it like a password

  • The server runs fully locally; no data is sent to any third party

How it works

  1. fidelity_login.py opens a real Firefox window using Playwright

  2. You log in normally — Fidelity sees a real browser session

  3. After login, ctx.storage_state() captures all cookies and localStorage to a JSON file

  4. fidelity_server.py loads that state into a headless Firefox to reuse the session

  5. Positions/balances use fidelity-api by kennyboy106

  6. Activity scraping and order placement use direct Playwright page automation

Dependencies

License

MIT — see LICENSE


Not affiliated with Fidelity Investments. See DISCLAIMER.md.

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mobogojo/fidelity-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server