Why connect MT5 to your editor
If you build trading tools, reports or bots, your editor's agent works better with real data in reach. With FiveSocket connected, it can look up your account's symbols, contract sizes and history while it writes the code that uses them, instead of guessing.
- Check the exact symbol names and volume steps your broker uses before you hard-code them.
- Pull a page of real deals to design a journal or a tax report against.
- Read recent candles to test an idea before you write a strategy around it.
What you need
- Cursor, or VS Code with GitHub Copilot Chat in agent mode.
- An MT5 login, its password, and the exact server name shown in your MT5 terminal. Any broker that offers MT5 works, and demo accounts link the same way.
- A FiveSocket account with the MT5 account linked. Link your MT5 account and try it free, no card: 24 hours or 100 calls, whichever comes first. Then a 7-day free trial, card required. Cancel anytime. The trial includes one connected MT5 account.
Cursor
Add this entry to .cursor/mcp.json in a project, or to ~/.cursor/mcp.json to use it in every project. No token goes in the file.
{
"mcpServers": {
"fivesocket": {
"url": "https://api.fivesocket.com/mcp"
}
}
}Save the file
Cursor picks up the new server and lists FiveSocket in its MCP settings.
Sign in
Choose to sign in to FiveSocket. Your browser opens FiveSocket, where you approve read only or read and trade.
Ask the agent
In Agent chat, ask it to list your FiveSocket accounts.
VS Code
Add this to .vscode/mcp.json in a workspace, or run MCP: Add Server from the Command Palette, choose HTTP and paste the address.
{
"servers": {
"fivesocket": {
"type": "http",
"url": "https://api.fivesocket.com/mcp"
}
}
}Start the server from the file or the MCP servers view. VS Code opens your browser to sign in to FiveSocket. Then open Copilot Chat, switch to agent mode and check that the FiveSocket tools are enabled.
Read only is a good default for coding
An agent working on your code does not need to trade. Use https://api.fivesocket.com/mcp/read in either file, and trading tools do not exist for that connection. Everything else in this guide stays the same.
If you do approve trading on the full address, orders must also fit a per-account policy with exact symbols and a maximum order size. Coding agents can run many tool calls in a row, so keep trading for a demo account.
Trading leveraged FX and CFDs carries a high risk of losing money quickly. Try any new setup on a demo account first. FiveSocket connects software to your account, and neither FiveSocket nor an AI assistant's output is investment advice.
Prompts to try in the editor
- List my FiveSocket accounts, then write a TypeScript type for the balance response you get back.
- Read the symbol details for EURUSD, XAUUSD and US30 on my demo account and generate a config file with their volume steps.
- Pull my closed trades from last month and sketch a CSV export with one row per trade.
- Fetch the last 200 hourly candles for GBPUSD and write a unit test fixture from them.
The agent reads live account data, so treat what it pulls into your code as real account information and keep it out of public repositories.
If it does not work
- The server shows as needing sign-in: open the editor's MCP settings and start the sign-in again. Finish it in the browser window that opens.
- The agent does not use the tools: check that FiveSocket is enabled for the chat, and in VS Code that you are in agent mode.
- The agent says there are no accounts: link the MT5 account in FiveSocket first, under Accounts.
- The first call is slow: the first read after a quiet spell logs in to your broker, which can take several seconds.
MCP or the REST API
MCP is for the agent in your editor. The program you are writing should call the REST API with its own scoped API key instead. Both read the same accounts. See the MT5 REST API
Frequently asked questions
- Do I put an API key in mcp.json?
- No. The file holds only the address. Cursor and VS Code sign in with OAuth in your browser and keep the short-lived token themselves.
- Does it work in other editors?
- Any editor or agent that can add a remote MCP server by URL and sign in with OAuth can use the same address.
- Can the agent place trades?
- Only on https://api.fivesocket.com/mcp, only after you approve the trading permission, and only within the account's symbol and size policy. Use https://api.fivesocket.com/mcp/read for reads only.
- How much does it cost?
- Plans start at $9.99 a month for one MT5 account. Link your MT5 account and try it free, no card: 24 hours or 100 calls, whichever comes first. Then a 7-day free trial, card required. Cancel anytime. The trial includes one connected MT5 account.