Capital.com MCP Server
This is a Model Context Protocol (MCP) server that exposes the Capital.com trading API as tools that can be used by Amazon Q, Claude Desktop, and other LLMs that support the MCP protocol.
Available Tools
The following tools are exposed by the MCP server:
authenticate: Authenticate with Capital.com APIget_account_info: Get account informationsearch_markets: Search for markets (e.g., EURUSD, AAPL)get_prices: Get prices for a specific instrumentget_positions: Get all open positionscreate_position: Create a new trading positionclose_position: Close an open positionupdate_position: Update an existing position (stop loss, take profit)get_watchlists: Get all watchlists
Configuration
Required Environment Variables
The MCP server requires the following environment variables:
CAPITAL_BASE_URL: The Capital.com API base URL (e.g.,https://demo-api-capital.backend-capital.com)CAPITAL_API_KEY: Your Capital.com API keyCAPITAL_PASSWORD: Your Capital.com passwordCAPITAL_IDENTIFIER: Your Capital.com email/identifier
Optional Environment Variables
CAPITAL_MCP_DEBUG: Set to1to enable debug loggingFASTMCP_LOG_LEVEL: Set toDEBUG,INFO,WARNING,ERROR, orCRITICALto control logging level
Running Manually
You can run the MCP server manually with various options:
capital-com-mcp-server --help
Available options:
--sse: Use SSE transport--port PORT: Port to run the server on (default: 8080)--debug: Enable debug logging--log-dir LOG_DIR: Directory to store log files
Example Usage
Searching for Markets
You: Search for Apple stock on Capital.com
AI: I'll search for Apple stock on Capital.com for you.
[Uses capital-com-mcp-server___search_markets tool]
I found Apple Inc. (AAPL) on Capital.com. Here are the details:
- Epic: AAPL
- Market name: Apple Inc.
- Current bid price: $184.25
- Current ask price: $184.30
- Market status: OPEN
Getting Account Information
You: What's my account balance on Capital.com?
AI: Let me check your Capital.com account information.
[Uses capital-com-mcp-server___get_account_info tool]
Your Capital.com account information:
- Account ID: ABC123456
- Account type: Demo
- Currency: USD
- Balance: $10,000.00
- Available funds: $9,500.00
- Margin used: $500.00
Creating a Position
You: Buy 10 shares of Apple stock
AI: I'll create a buy position for Apple stock on Capital.com.
[Uses capital-com-mcp-server___create_position tool]
Successfully created a BUY position for Apple Inc. (AAPL):
- Deal ID: DEF789012
- Size: 10 shares
- Opening price: $184.30
- Position status: OPEN
Prerequisites for using with LLMs
Make sure you have uv installed on your system:
curl -LsSf https://astral.sh/uv/install.sh | sh
Using with Amazon Q
-
Create an
mcp.jsonconfiguration file in your Amazon Q configuration directory (~/.aws/amazonq/mcp.json):{ "mcpServers": { "capital-com-mcp-server": { "command": "uvx", "args": ["capital-com-mcp-server"], "env": { "CAPITAL_BASE_URL": "https://demo-api-capital.backend-capital.com", "CAPITAL_API_KEY": "your_api_key_here", "CAPITAL_PASSWORD": "your_password_here", "CAPITAL_IDENTIFIER": "your_email@example.com", "FASTMCP_LOG_LEVEL": "ERROR" } } } }
-
Run Amazon Q with:
q chat -
Amazon Q will automatically start the MCP server and connect to it.
Using with Claude Desktop
-
In Claude Desktop, go to Settings > Developer section and click on "Edit Config"
-
This will open the configuration file. Add the following to the JSON:
{ "mcpServers": { "capital-com-mcp-server": { "command": "uvx", "args": ["capital-com-mcp-server"], "env": { "CAPITAL_BASE_URL": "https://demo-api-capital.backend-capital.com", "CAPITAL_API_KEY": "your_api_key_here", "CAPITAL_PASSWORD": "your_password_here", "CAPITAL_IDENTIFIER": "your_email@example.com", "FASTMCP_LOG_LEVEL": "ERROR" } } } }
Resources
Metadata
Release files for capital-com-mcp-server 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| capital_com_mcp_server-0.1.8.tar.gz | 11.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| capital_com_mcp_server-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.6 kB
Release files / capital_com_mcp_server-0.1.8.tar.gz
| Download URL | capital_com_mcp_server-0.1.8.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd035c694d3f298ab8ddcc9590e3cbdd4a7a60e635c699f064d422130b29d840
|
|
BLAKE2b-256 checksum How to use checksums |
41f41cc572f254f4ca1df5294a0ee742d93f54618f53561a1281307a8aa7f4fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2025.
Transparency logRelease files / capital_com_mcp_server-0.1.8-py3-none-any.whl
| Download URL | capital_com_mcp_server-0.1.8-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c57f4a827241e849783147fce3baf8ac9cf6f249b5e3dd3a241a5ec90848ba68
|
|
BLAKE2b-256 checksum How to use checksums |
d565eaf66ed62a34679a013cc788af04ac3960c12026fabb8198bcf48a95a913
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2025.
Transparency log