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.
README
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
| Tool | Description |
|---|---|
fidelity_login |
Log in with username/password + TOTP or SMS 2FA |
fidelity_submit_2fa |
Complete SMS 2FA with the code from your phone |
fidelity_get_accounts |
List all accounts with names, numbers, balances |
fidelity_get_positions |
Get all holdings across all accounts |
fidelity_get_quote |
Get current price for a stock/ETF symbol |
fidelity_place_order |
Buy/sell stocks (dry-run by default) |
fidelity_transfer |
Transfer cash between Fidelity accounts |
fidelity_status |
Check if browser session is active |
fidelity_save_session |
Manually save session state |
fidelity_logout |
Close 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:
- Go to Fidelity Security Settings > Authenticator app > Connect
- Click "Can't scan the code?" to reveal the TOTP secret (a base32 string)
- Copy the secret into
FIDELITY_TOTP_SECRET - Also add it to your authenticator app (Google Authenticator, Authy, etc.) and verify the code with Fidelity to activate
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
FIDELITY_USERNAME |
Yes | - | Fidelity login username |
FIDELITY_PASSWORD |
Yes | - | Fidelity login password |
FIDELITY_TOTP_SECRET |
No | - | TOTP secret for automatic 2FA |
FIDELITY_HEADLESS |
No | true |
Set to false to see the browser |
FIDELITY_SESSION_DIR |
No | ~/.fidelity-mcp |
Where to save session files |
FIDELITY_SESSION_TITLE |
No | default |
Session file identifier (for multiple accounts) |
FIDELITY_TIMEOUT |
No | 30000 |
Default 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_orderpreviews orders without executing unless you setdry_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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。