Unofficial MCP server for the Capital.com Open API — safe, guarded LLM trading (two-phase, allowlists, demo-first) with FastMCP. 42 tools for market data, accounts & trading. Not affiliated with Capital.com.
Capital.com MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Self-hosted **Model Context Protocol (MCP)** server for the **Capital.com Open
API**, written in Python on FastMCP. It
exposes **42 safe, guarded trading and market-data tools** — two-phase
execution, allowlists, demo-first — to any MCP client, over stdio or HTTP. Built
on the tested capitalcom-cli
broker engine (SDK).
**Works with** Claude Desktop · Claude Code · Cursor · VS Code (Copilot) ·
Windsurf · ChatGPT — any MCP client.
> ⚠️ **Unofficial & educational.** Not affiliated with Capital.com. Trading is
> risky and this is not financial advice. Trading is **disabled by default**;
> all trades are two-phase (preview → confirm → execute) with allowlists and
> size/rate limits. Start on a **demo** account. Apache-2.0 licensed.
Install
No clone required — uvx runs it in an isolated, throwaway environment and
always fetches the latest tested release:
Or install a persistent command with pipx:
Pinning for production / real-money use
uvx capitalcom-mcp always runs the **latest** published release. That is fine
for trying it out, but for production or real-money use, **pin the exact
version** so an unexpected update can't change tool behavior under you:
The CLI form is uvx capitalcom-mcp==0.3.4 run …. Pin to a version you have
reviewed, and bump deliberately after reading the CHANGELOG.
1. Add your credentials (once)
Get an API key in the Capital.com app: **Settings → API integrations** (make a
**demo** key first). Then run the wizard — it writes a 0600 file and prints
the exact client snippet:
This writes ~/.config/capital-mcp/.env. Verify any time (no secrets printed):
Inspect the full effective configuration (redacted, offline) or confirm your
credentials actually authenticate:
Prefer a secret manager? Set CAP_API_KEY_CMD / CAP_IDENTIFIER_CMD /
CAP_API_PASSWORD_CMD to a command that prints the secret (e.g.
op read op://vault/..., pass ...). The secret is fetched at launch and never
written to disk or to your client config.
2. Add the server to your client
Every client uses the same command/args/env shape. Pasting
"CAP_ENV_FILE": " " keeps secrets out of the client file; or
put CAP_API_KEY/CAP_IDENTIFIER/CAP_API_PASSWORD directly in env.
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) /
%APPDATA%\Claude\claude_desktop_config.json (Windows):
Claude Code
Cursor
~/.cursor/mcp.json (global) or .cursor/mcp.json (project):
VS Code (Copilot)
.vscode/mcp.json — note the root key is servers and type: "stdio":
Windsurf
~/.codeium/windsurf/mcp_config.json:
ChatGPT
ChatGPT requires a **remote** server (stdio is not supported) — see
Remote / VPS hosting. Once your server is reachable over
HTTPS, enable **Developer Mode** (Settings → Connectors → Advanced) and add the
server URL ending in /mcp. ChatGPT **Deep Research** connectors call two
read-only tools, search and fetch, which this server implements; full custom
tools require Developer Mode.
Remote / VPS hosting
Run with streamable-HTTP instead of stdio:
Or via env (handy in systemd): CAP_MCP_TRANSPORT=http, CAP_MCP_HOST,
CAP_MCP_PORT. Put it behind a TLS-terminating reverse proxy for any public use.
What's inside — tools, resources & prompts
This server exposes **42 tools**, **4 resources**, and **7 guided prompts**. All
tool names are prefixed cap_ except the two ChatGPT Deep Research adapters
(search, fetch). Mutating tools require confirm=true; trades are two-phase.
The full surface is a stable contract — see API stability.
Session & account
| Tool | What it does |
| --- | --- |
| cap_session_status | Current login/session state. |
| cap_session_login | Authenticate (optionally force=true). |