Skip to main content

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 API
  • get_account_info: Get account information
  • search_markets: Search for markets (e.g., EURUSD, AAPL)
  • get_prices: Get prices for a specific instrument
  • get_positions: Get all open positions
  • create_position: Create a new trading position
  • close_position: Close an open position
  • update_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 key
  • CAPITAL_PASSWORD: Your Capital.com password
  • CAPITAL_IDENTIFIER: Your Capital.com email/identifier

Optional Environment Variables

  • CAPITAL_MCP_DEBUG: Set to 1 to enable debug logging
  • FASTMCP_LOG_LEVEL: Set to DEBUG, INFO, WARNING, ERROR, or CRITICAL to control logging level

Running Manually

You can run the MCP server manually with various options:

capital-com-mcp --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

Resources

Metadata

Release files for capital-com-mcp-server 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for capital-com-mcp-server 0.1.6
File Size Uploaded
capital_com_mcp_server-0.1.6.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for capital-com-mcp-server 0.1.6
File Interpreter ABI Platform
capital_com_mcp_server-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / capital_com_mcp_server-0.1.6.tar.gz

Download URL capital_com_mcp_server-0.1.6.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
df418592a665a7f30ad36ab6dc1f7735a72465a63e6d223d72cdb643c184688f
BLAKE2b-256 checksum
How to use checksums
128c21d2c98c787289b53c71ae85e6a45e1d9cf86ffc1c86cf88700c5f979f78
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 May 6, 2025.

Transparency log

Release files / capital_com_mcp_server-0.1.6-py3-none-any.whl

Download URL capital_com_mcp_server-0.1.6-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
468886d6af670812ce7bc4c20663f4a64d7e21848b0d550f55ab5eb8ddd5c307
BLAKE2b-256 checksum
How to use checksums
5412b849c1f1543548dbdfacb08b7d43e3b2256faa61b62208106b6f387fea9a
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 May 6, 2025.

Transparency log

Release history Release notifications | RSS feed

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page