How to set up the Capital.com MCP Server

Have more questions? Submit a request

The Capital.com MCP Server lets your AI assistant talk to your trading account directly. Market data, position checks, trade previews – all in plain language, without leaving your AI tool.

What you'll need

  • A Capital.com account
  • Your Capital.com API key
  • Your custom API password
  • 2FA enabled 

Note: you can manage the above from inside your account settings.

Mobile is not currently supported.

What is the Capital.com MCP Server?

The MCP Server is software that runs in the background on your computer. It acts as a secure bridge between your AI assistant and your Capital.com account.

Once connected, your AI assistant can:

  • Search available markets across forex, shares, commodities and indices
  • Show your open positions, working orders and account balance
  • Pull historical prices and other market data
  • Preview and place trades – with your confirmation required every time

You remain fully responsible for any trading decisions made using the MCP Server. Always review trade previews carefully before confirming.

Things to check before you start 

Check that you have everything you need installed. If the answer to any of the following questions is “No”, you’ll need to follow the link provided before carrying on. 

CheckYesNo
Do you have a Capital.com account?Keep goingCreate an account
Have you installed your preferred AI tool?Keep goingSome suggestions: Claude Code, Claude Desktop, Codex, Cursor, Windsurf. 
Are you on Mac or Windows?Keep goingMobile is not currently supported

Claude Desktop: Quick set up guide

If you don’t need detailed instructions, here's the short version for Claude Chat on Desktop.

  1. Obtain your API credentials 
  • Login to your capital.com account settings page and obtain your api password.
  1. Download the MCP from Github

  1. Open the MCPB bundle
  • Double-click the bundle to launch it, or simply drag the file into your Claude Desktop window.
  1. Input your API credentials
  • Claude Desktop will request your API details. Input these and select ‘Install’. Don’t forget to enable the MCP.
  1. Restart Claude
  • Fully quit and reopen the application, then test the link by asking: ‘List my accounts’.

Full set up guide 

Step 1 – Create your API credentials

From inside your Capital.com account:

  1. Enable 2FA if you haven't already. Settings → Two-Factor Authentication.
  2. Generate a new API key. Settings → API Integrations → Generate API Key.
  3. Give your key a label - eg MCP Server.
  4. Set your API Password.

Read this before you type anything: You are creating a brand new password, specifically for API access. It’s not linked to your Capital.com login password. It’s best to choose something you'll remember and write it down. Don’t re-use your login password here. Mixing up your login password with your API password is a common setup mistake.

  1. Enter your 2FA code and click Generate.
  2. Copy your API key and reconfirm your API Password. Both are shown only once. You'll need them later. When this screen is closed they will disappear.

Keep these private. Don’t paste them into chat interfaces, share them with other people, or store them in a shared document. Anyone with these values can access your trading account via the API.

 

Step 2 – Download the MCP

The Capital.com MCP server is open source and lives in a public GitHub repository. Before your AI tool can use it, you need a copy of the code on your machine.

Download the MCP code to your local machine from https://github.com/capital-com-sv/capital-mcp 

 

Step 3 – Connect your MCP to your AI tool

Each AI tool connects to the MCP slightly differently. We have explained connecting to Claude Desktop here, but for connections to other platforms read here

For Claude Desktop, double-click the mcpb file to launch it, or simply drag the file into your Claude Desktop window.

You will see the below popup on your Claude Desktop application. Install the MCP and enable it.

Step 4 – Input your credentials and set up your environment

Input your credentials you obtained from step 1 into the configuration fields

ValueWhere it comes from
API KeyYour API key from Step 1
CAP_IDENTIFIERYour Capital.com email address
CAP_API_PASSWORDYour custom API password from Step 1
Step 5 – Restart your AI tool and test the connection

Restart your AI tool and try the below prompts individually to check your connection is working

Login to my Capital.com account

List my accounts

Search for bitcoin markets

 

How to place a trade

Every trade through the MCP Server follows 3 mandatory steps. The server enforces this – you can’t skip ahead.

1. Preview

Ask your AI assistant to preview a trade:

Preview buying 1.5 SILVER with stop at 24.50

The assistant returns a full trade proposal and a unique preview_id. Read every detail before you proceed.

2. Review

Before confirming, check:

  • Is the instrument correct? (Codes are case-sensitive: SILVER not silver)
  • Is the position size what you intended?
  • Are the stop and limit levels correct?
  • Does the risk look right for your account size?

If anything looks wrong, stop. Ask for a new preview with corrected parameters.

3. Confirm

Only send this if you're satisfied with the preview:

Execute position with preview_id abc123 confirm=true

A trade can't be placed without a valid preview_id. Each ID can only be used once and expires after execution.

 

Before switching to a live account

Complete this checklist first:

unchecked All 3 test prompts in Step 5 returned valid data

unchecked You've successfully previewed and confirmed at least one trade in demo mode

unchecked You understand what each field in the trade preview means

unchecked You've changed CAP_ENV to live and CAP_ALLOW_TRADING to true intentionally

unchecked You've read Capital.com's Terms and Conditions and Electronic Trading Terms

To restrict which markets the server can trade, add instrument codes to CAP_ALLOWED_EPICS (for example: SILVER,GOLD,EURUSD). Leave it empty to allow all markets on your account.

 

What can I ask my AI assistant?

Check your account

Login to my account

List my accounts

Check my Capital.com connection health

Research markets

Search for bitcoin markets

Show me EURUSD market details

Get 1-hour historical prices for GOLD

Review your portfolio

Show my open positions

List my working orders

Review my portfolio exposure

Place a trade (demo mode first)

Preview buying 1.5 SILVER with stop at 24.50

Create a trade proposal for GOLD with 1% risk

Execute position with preview_id abc-123 confirm=true

Close position DEAL_ID confirm=true

 

Troubleshooting

Run the health check first. Ask your AI assistant: Check my Capital.com connection health. The response will usually tell you what's wrong.

What you seeMost likely causeFix
"Authentication failed" or "Session expired"CAP_API_PASSWORD is set to your login password instead of the custom API password you created in Step 1Use the password you created during API key generation, not your website login password
"Rate limit exceeded"Too many requests sent quicklyWait 30–60 seconds and try again
zsh: event not found (Mac only)Your API password contains an exclamation mark (!)Wrap the password value in single quotes in the config: 'yourPassword!Here'
"Server not responding" / server won't startWrong Python path or server didn't install correctlyOpen Terminal and run python -m capital_mcp.server directly – the error message will be readable
Fewer than 36 tools showingServer started but config has an errorCheck: (1) all placeholders replaced with real values, (2) no missing " { } , characters, (3) Python path points to the venv folder, not system Python
No response to any promptConfig file not saved or AI assistant not fully restartedFully quit and reopen your AI assistant – don't just close the window
"401 Unauthorized"API key expired or revokedGo to Settings → API Integrations in Capital.com and generate a new key
"Environment mismatch"CAP_ENV set to live but credentials are for a demo accountUpdate CAP_ENV in your config file to match your account type

Still stuck? Submit a support request and include: which AI assistant you're using, your operating system, and the full error message.

 

FAQ

Do I need a paid AI assistant plan? Some AI assistants require a paid subscription to use MCP features. Claude Desktop, for example, requires a paid plan to enable MCP connectors. The Capital.com MCP Server itself is free.

Do I need a live trading account? No. The server works with a demo account and that's where we recommend you start.

Is my Capital.com login password the same as CAP_API_PASSWORD? No. These are separate. CAP_API_PASSWORD is a new password you create specifically when generating your API key. Using your login password here will cause authentication to fail.

Can the AI place a trade without my knowing? No. Every trade requires a preview step followed by a separate confirmation message containing confirm=true. The server can't execute a trade without both. The preview ID is single-use and expires immediately after execution.

What is CAP_ALLOW_TRADING and should I change it? It's a safety switch. When set to false, the server can show you market data and account information but can't place any trades. Only change it to true once you've tested everything in demo mode and you're ready to trade with real money.

What does CAP_ALLOWED_EPICS do? It limits which instruments the server can trade. Leave it empty to allow all markets on your account. Add a comma-separated list (for example: SILVER,GOLD,EURUSD) to restrict it.

I see fewer than 36 tools in my AI assistant. What's wrong? Ask your AI assistant: Check my Capital.com connection health. The most common causes are a formatting error in the JSON config, or the Python path pointing to system Python instead of the venv folder.

Is my trading data safe? The server runs locally on your computer. Your credentials are stored in your local config file only and are never sent to third parties. All communication with Capital.com uses HTTPS encryption.

Can I use this on two computers? Yes. Repeat Step 2 on the second machine using the same API credentials from Step 1.

Can I connect to more than one Capital.com account? The server connects to one account at a time. To switch, update the 4 CAP_ values in your config file and restart your AI assistant.

 

Disclaimer — Use of Public API with Third-Party Tools

Third-Party Integration

This page describes how clients may connect the Public API to third-party software, tools, or integrations, including those powered by artificial intelligence or large language models ("LLMs"). Any such third-party software, tool, or integration is independent of and does not form part of Capital.com's services. Capital.com does not control, develop, endorse, or accept any liability for any third-party software, its functionality, outputs, or any outcomes arising from its use. Any use of third-party tools or integrations in connection with the Public API is entirely at your own risk. You are responsible for reviewing the terms, privacy policies, and data-handling practices of any third-party tool you choose to use.

Use of the Public API

Your use of the Public API is entirely at your own discretion and risk. Capital.com makes the Public API available for informational and trading purposes but does not recommend, endorse, or encourage any particular use, integration, or trading strategy. You are solely responsible for how you access and use the API, including the parameters of any orders submitted, the configuration of any connected tools or systems, and the interpretation of any data received. Capital.com accepts no liability for losses or unintended outcomes arising from your use of the API, whether accessed directly or through third-party tools. API availability, functionality, and specifications may be modified, rate-limited, suspended, or discontinued at any time without prior notice. Your use of the Public API is subject to Capital.com's Terms and Conditions and Electronic Trading Terms, which you should read carefully before using the API.

Execution-Only Service and No Investment Advice

Capital.com provides its services on an execution-only basis. Trading financial instruments involves significant risk of loss. Nothing on this page, in the Public API, or in any third-party software or integration constitutes investment advice, a personal recommendation, or a solicitation to buy or sell any financial instrument. This includes any output, signal, suggestion, or analysis generated by AI, LLM-based, or other automated tools. All trading decisions, including any automated or algorithmic activity, are made at your own risk and remain your sole responsibility.

Risks of Automated and Algorithmic Trading

Use of the Public API in connection with automated or algorithmic trading tools carries additional risks, including: rapid execution of orders without human review or intervention; system errors, software failures, or connectivity issues; execution at prices materially different from those expected; and unintended or erroneous orders resulting from misconfigured tools or parameters. Capital.com is not responsible for any losses arising from such risks or from the interaction between its systems and any third-party tools. Past performance and any outputs generated by automated tools are not indicative of future results.

Prohibited Use

The Public API and any connected tools must not be used to manipulate the platform, exploit pricing or latency, engage in market abuse, or obtain any unfair advantage. Capital.com reserves the right to restrict, suspend, or terminate API access and/or your account where it reasonably considers that such misuse has occurred or is likely to occur. Clients must not permit any third party to exercise discretionary control over their account.

Your Responsibilities

You are responsible for ensuring that your use of the platform, the Public API, and any third-party tools or integrations complies with Capital.com's Terms and Conditions and all applicable laws and regulations in your jurisdiction. You should carefully consider whether automated trading tools are appropriate for your circumstances, experience, and risk tolerance before using them. Capital.com strongly recommends that you test any automated tools or integrations thoroughly using a demo account before connecting them to a live trading environment.

Articles in this section

Was this article helpful?
0 out of 0 found this helpful