Documentation

Last updated on 20. 11. 2026 by clonex / Ivan Hudec

Connect Q to other programs (MCP)

MCP (Model Context Protocol) is an open standard that lets an AI assistant use the tools of another program. StrategyQuant uses it in both directions. This page is about one of them: Q connecting to other MCP servers and using their tools in the chat, next to its own.

That can be the MCP server built into MetaTrader 5, TradingView’s MCP server, or a small community server you run on your own computer. Once a server is added, you don’t call its tools yourself. You ask in plain words, “show my open positions in MetaTrader”, and Q picks the right tool.

Letting an AI client of your own, such as Claude Code, drive StrategyQuant is a different feature and not covered here.

Note!

The /mcp command is answered by StrategyQuant itself and costs no AI credits. A normal chat turn that uses a server’s tools costs credits like any other turn.

Step 1: See what is connected

Type /mcp in the chat and press Enter twice: the first Enter accepts the suggestion, the second sends it.

/mcp in the Q chat with no servers added: the message, the table of /mcp commands and the how-to lines

With no servers added yet, the chat shows “No external MCP servers are configured.”, the list of /mcp commands and a short how-to for MetaTrader 5 and TradingView. There is no step list, and the credit balance doesn’t move.

Once you have servers, /mcp lists each one: whether it is a web server or a local program, its address or command, its state (connected, offline with the reason, or disabled) and how many tools it offers. /mcp help prints every form of the command.

Step 2: Add MetaTrader 5

MetaTrader 5 has its own MCP server for the terminal: account, orders, positions and the terminal itself. Switch it on in MetaTrader first:

  1. In MetaTrader 5, open Tools > Options > MCP.
  2. Enable the internal server and generate an API key.

Then add it to Q with one line, with your key at the end:

/mcp add mt5 http://127.0.0.1:22346/mcp <api key>

You don’t have to remember the address. In StrategyQuant, open Settings (the cog in the top bar) > MCP Server…. Most of that dialog is about connecting your own AI client to StrategyQuant. Its section The other direction: give Q the tools of another MCP server has a ready-made /mcp add line for MetaTrader 5 with a Copy button.

The MetaTrader 5 line in Settings > MCP Server..., with its Copy button

The dialog’s section for this direction: the /mcp add line for MetaTrader 5 with its Copy button, and a pointer to docs/mcp/external-servers.md.

Copy the line, paste it in the chat and replace <api key> with the key from MetaTrader.

MetaTrader’s own MCP dialog has a Copy button too. Press it on the Claude Code form and paste the result after /mcp add-json. The servers keep the names from that block; type /mcp to see them and use those names in the other /mcp commands.

Now ask for something only MetaTrader knows:

Show my open positions in MetaTrader

Note!

Whether an AI may trade at all is MetaTrader’s own setting: its MCP options have separate switches for trading, network and command-line access. On the Q side, enableTools can limit the server to the tools you want (Step 5). Leave trading off if you only want Q to read your account.

Step 3: Add TradingView

TradingView’s MCP server gives Q market data, the screener, news, fundamentals, calendars, watchlists and alerts. It needs no API key: you log in with your TradingView account. It needs an Essential plan or higher; a trial has no MCP access.

/mcp add tradingview https://mcp.tradingview.com/mcp
/mcp login tradingview

Your browser opens TradingView’s authorization page. Sign in and allow the access. The page then says Q is logged in, and /mcp lists the server as connected.

From then on you can ask, for example:

Download the last 2000 H1 bars of EURUSD from TradingView and import them

The login is kept across restarts. /mcp logout tradingview forgets it.

Step 4: Any other MCP server

The same command adds any server that speaks MCP:

Command What it does
/mcp lists your servers with their state and number of tools
/mcp add <name> <url> [token] adds a server on the web or on your network, with its token if it needs one
/mcp add <name> <command> [args…] adds a local server that Q starts as a program on your computer
/mcp add-json [name] <json> adds one server, or a whole {"mcpServers": {…}} block copied from another app
/mcp tools <name> the tools a server offers, with their descriptions
/mcp enable <name>, /mcp disable <name> switches a server on or off and keeps its entry
/mcp remove <name> deletes a server
/mcp reconnect [name] connects again, for example after you restarted the server
/mcp login <name>, /mcp logout <name> logs in to a server that wants an account instead of a token
/mcp help this list

Step 5: Where your servers are kept

Your servers are stored in internal/web/SQAI/mcp-servers.json in the StrategyQuant folder. It uses the standard mcpServers format that MetaTrader 5 and Claude Code also produce, so a block can be copied between them unchanged. Two settings are worth knowing:

  • enableTools in a server’s entry limits it to the tools you list, for example only reading the account: "enableTools": ["account_info", "positions_get", "symbol_info"]. /mcp tools <name> shows the names. Without it, the chat gets all of the server’s tools.
  • ${ENV_VAR} in an entry is filled in from your environment, so a token doesn’t have to sit in the file.

The /mcp table masks tokens and environment values, and logins are never shown.

The command line too

The command-line chat, sqcli -q, reads the same list and accepts the same /mcp command. A server added in the panel works in the console, and the other way round.

Troubleshooting

/mcp shows the server as offline, “the server wants a login”. The server wants an account, not a token. Type /mcp login <name>.

The server shows “login needed”. A login was refused or revoked. Log in again with /mcp login <name>.

MetaTrader 5 is offline. MetaTrader must be running with its MCP server enabled. Check the address and the key in MetaTrader’s MCP options, then type /mcp reconnect <name> (mt5 if you added it with the one-line command).

Q can read the account but won’t place an order. Trading is off in MetaTrader’s MCP options, or enableTools leaves out the order tools.

A server asks for a client id and secret. Some servers only accept apps registered with them by hand. Q can’t log in to those. Use a token if the server offers one.

Where to go from here

What it costs. /mcp and all its forms cost nothing. A chat turn that uses a server’s tools costs about 35 credits on average with GPT-6.1 Terra (real usage, October–November 2026); most turns cost less. Sonnet 5 and Opus 5.5 cost several times as much.

Was this article helpful? The article was useful The article was not useful

0 Comments
Oldest
Newest Most Voted