MCP MetaTrader 4 Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP MetaTrader 4 ServerWhat's my current account balance and open positions?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP MetaTrader 4 Server
A Model Context Protocol (MCP) server that provides cross-platform integration with MetaTrader 4 trading platform over network.
Author: 8nite (8nite@qmlab.io)
Features
Account Information: Get real-time account details (balance, equity, margin, etc.)
Market Data: Retrieve current market prices for trading symbols
Order Management: Place market and pending orders
Position Management: View and close open positions
Trading History: Access historical trading data
Backtesting: Run backtests on Expert Advisors with detailed configuration
Expert Advisor Management: List and manage available EAs
File-Based Fallback: Robust status and results tracking when API endpoints fail
EA Development: Remote EA creation, editing, sync, and compilation with error reporting
Cross-Platform: Linux MCP server connects to Windows MT4 via HTTP
Related MCP server: mcp-mt5
Architecture
The integration uses HTTP communication between the MCP server and MT4:
MCP Server (Linux - Node.js/TypeScript) - Provides tools for Claude Code
HTTP Bridge (Windows - Node.js) - Converts HTTP requests to file I/O
MT4 Expert Advisor (Windows - MQL4) - Handles trading operations
Network Communication - JSON-based data exchange via HTTP API
Setup
1. Install MCP Server (Linux Machine - 192.168.50.X)
npm install
npm run build2. Install HTTP Bridge (Windows Machine - 192.168.50.161)
Copy the
windows-server/folder to your Windows machineInstall Node.js on Windows if not already installed
Navigate to the
windows-serverfolder and run:
npm install
npm startThe HTTP bridge will start on port 8080
3. Install MT4 Expert Advisor (Windows Machine)
Option A: Ultimate MCP EA (Recommended)
Copy
mcp/MCP_Ultimate.mq4to your MT4MQL4/Experts/folderCompile the Expert Advisor in MetaEditor
Attach the Expert Advisor to any chart in MT4
Configure EA inputs:
EnableFileReporting: true (for enhanced reporting)EnableBacktestTracking: true (for backtest monitoring)EnableVisualMode: true (for on-chart status indicators)Configure market data tracking options as needed
Ensure "Allow DLL imports" is enabled in MT4 settings
Option B: Unified EA (Legacy)
Copy
MT4_Files/MCPBridge_Unified.mq4to your MT4MQL4/Experts/folderFollow same compilation and attachment process
Enhanced functionality but not as comprehensive as Ultimate version
Option C: Basic EA (Legacy)
Copy
MT4_Files/MCPBridge.mq4to your MT4MQL4/Experts/folderFollow same compilation and attachment process
Limited to basic MCP functionality without enhanced reporting
4. Configure Claude Code (Linux Machine)
Add the MCP server to your Claude Code configuration:
claude mcp add mt4-server npm run startOr configure manually with custom IP:
MT4_HOST=192.168.50.161 MT4_PORT=8080 claude mcp add mt4-server npm run startOr in your MCP settings:
{
"mcpServers": {
"mt4-server": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"MT4_HOST": "192.168.50.161",
"MT4_PORT": "8080"
}
}
}
}Usage
Once configured, you can use these tools in Claude Code:
Get Account Information
Use the get_account_info tool to see my MT4 account detailsGet Market Data
Get current market data for EURUSD using get_market_dataPlace Orders
Place a BUY order for 0.1 lots of EURUSD with stop loss at 1.0850 and take profit at 1.0950View Positions
Show me all my open positions using get_positionsClose Position
Close position with ticket number 12345Run Backtest
Run a backtest on MACD Sample Expert Advisor for EURUSD H1 from 2024-01-01 to 2024-12-31 with initial deposit 10000List Expert Advisors
Show me all available Expert Advisors for backtestingGet Backtest Results
Get the results from the last backtest with detailed informationMonitor Backtest Status
Check the current status of a running backtestEA Development Workflow
List Local EAs
Show me all EAs in the active development folderSync EA to MT4
Upload MyStrategy EA to MetaTrader for compilationCompile EA
Compile MyStrategy EA and show any errors or warningsCreate New EA from Template
cd ea-strategies
./develop.sh new MyNewStrategy SimpleMA_Template.mq4
./develop.sh edit MyNewStrategyFile Structure
├── src/
│ └── index.ts # MCP server implementation
├── mcp/ # MCP infrastructure files
│ └── MCP_Ultimate.mq4 # Ultimate unified MCP Bridge with all features
├── strategies/ # User trading strategies (git ignored)
│ └── [User strategy EAs] # Custom trading strategies for personal use
├── ea-strategies/ # EA development workspace (git ignored)
│ ├── templates/ # EA templates and examples
│ ├── active/ # EAs under development
│ ├── compiled/ # Successfully compiled EAs
│ ├── logs/ # Compilation logs and error reports
│ ├── develop.sh # Development helper script
│ └── README.md # EA development guide
├── MT4_Files/ # Legacy MCP files
│ ├── MCPBridge_Unified.mq4 # Unified MCP Bridge with enhanced reporting
│ └── MCPBridge.mq4 # Legacy MCP Bridge (basic functionality)
├── dist/ # Compiled JavaScript
├── MCPBridge_Unified_Guide.md # Complete setup guide for unified EA
├── bridge-endpoints-needed.md # Required HTTP bridge endpoints
├── package.json
└── tsconfig.jsonData Files
The Expert Advisor creates these files in MT4's MQL4/Files/ folder:
account_info.txt- Account informationmarket_data_[SYMBOL].txt- Market data for each symbolpositions.txt- Open positionsorder_commands.txt- Incoming order commandsclose_commands.txt- Position close commands
File-Based Reporting (New Feature)
For enhanced backtest monitoring, EAs can write to the reports directory:
mt4_reports/backtest_status.json- Real-time backtest status and progressmt4_reports/backtest_results.json- Detailed backtest results and statisticsmt4_reports/backtest_report.html- Optional HTML report for detailed analysis
The MCP server automatically falls back to reading these files when API endpoints are unavailable.
Configuration: Set MT4_REPORTS_PATH environment variable to customize the reports directory (default: /tmp/mt4_reports)
Security Notes
This integration is for educational/personal use
Never share your MT4 login credentials
Test thoroughly on a demo account before using with real money
The file-based communication is simple but not encrypted
Limitations
File I/O based communication has some latency
Limited to MT4 platform capabilities
Requires MT4 to be running with the Expert Advisor attached
No real-time streaming data (periodic updates only)
Troubleshooting
MCP Server not responding: Check that MT4 is running with the Expert Advisor
No market data: Ensure the symbols are available in your MT4 Market Watch
Orders not executing: Verify that automated trading is enabled in MT4
File access errors: Check MT4 data path configuration and file permissions
Backtest status/results not available:
Check if API endpoints are responding (server will auto-fallback to files)
Ensure EA is writing to
mt4_reports/directory using the provided templateVerify
MT4_REPORTS_PATHenvironment variable is set correctly
File-based fallback not working: Ensure reports directory exists and has proper permissions
Environment Variables
MT4_HOST: IP address of Windows machine running MT4 (default: 192.168.50.161)MT4_PORT: Port number for HTTP bridge (default: 8080)MT4_REPORTS_PATH: Directory path for EA report files (default: /tmp/mt4_reports)
EA Integration Guide
To enable file-based reporting in your Expert Advisors:
Copy the
EA_FileReporting_Template.mq4code into your EACall
WriteBacktestStatus()periodically during backtestingCall
WriteBacktestResults()when backtest completesEnsure MT4 has write permissions to the reports directory
The MCP server will automatically detect and use these files when API endpoints fail.
MCP Ultimate EA Features
MCP_Ultimate.mq4 is the most comprehensive MCP solution combining all functionality:
Key Features
Complete MCP Bridge Functions: Account info, market data, order management
Enhanced Backtest Reporting: Real-time status and comprehensive results with JSON format
Visual Indicators: On-chart status display showing MCP connection and performance
Advanced Market Data Tracking: Configurable tracking for major/minor/exotic pairs and commodities
Comprehensive Logging: Detailed operation logs with automatic rotation
Live Trading Support: Works seamlessly for both backtesting and live trading
File-Based Fallback: Automatic fallback to file-based reporting when API endpoints fail
Debug and Performance Monitoring: Real-time operation counters and performance metrics
Configuration Options
MCP Bridge Settings: Update intervals, reporting toggles, visual mode
Reporting Configuration: JSON format, detailed logs, maximum log files
Market Data Settings: Selectable tracking for different currency pair types
Quick Setup
Use
mcp/MCP_Ultimate.mq4for complete functionalityConfigure all options in EA inputs based on your needs
Full MCP functionality with enhanced visual feedback and monitoring
Organization Benefits
MCP Infrastructure: All MCP-related files in
mcp/folderStrategy Separation: User strategies in
strategies/folder (git ignored)Development Workspace: EA development tools in
ea-strategies/(git ignored)Legacy Support: Previous versions maintained in
MT4_Files/for compatibility
See MCPBridge_Unified_Guide.md for detailed setup instructions on legacy versions.
Available Tools
14 toolsclose_positionC
Close an open position
| Name | Required | Description | Default |
|---|---|---|---|
| ticket | Yes | Position ticket number |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Close') but doesn't clarify if this is a destructive mutation, requires specific permissions, has side effects (e.g., affecting account balance), or what happens on success/failure. This leaves significant gaps for a tool that likely modifies state.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a likely state-modifying operation (closing a position), the description is incomplete. With no annotations, no output schema, and minimal behavioral context, it fails to address key aspects like what the tool returns, error conditions, or dependencies on other tools (e.g., needing an open position from 'get_positions').
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the 'ticket' parameter documented as 'Position ticket number'. The description doesn't add any meaning beyond this, such as explaining what a ticket number is or where to find it. The baseline score of 3 is appropriate since the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Close') and target ('an open position'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_positions' or 'place_order' in terms of when to use each, which prevents a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'place_order' (which might handle closing) or 'get_positions' (which lists positions). There's no mention of prerequisites, such as needing an open position to close, or exclusions for when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
compile_eaC
Compile an EA on MetaTrader 4 and get compilation results
| Name | Required | Description | Default |
|---|---|---|---|
| ea_name | Yes | Name of the EA to compile (without .mq4 extension) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the tool compiles and returns results but doesn't disclose critical traits like whether it's a read-only or mutating operation, potential side effects (e.g., file modifications), error handling, or performance considerations (e.g., compilation time).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It is appropriately sized and front-loaded, making it easy to grasp quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a compilation tool with no annotations and no output schema, the description is insufficient. It lacks details on what compilation entails (e.g., source code processing, error reporting), the format of results, or how it integrates with other tools like 'run_backtest', leaving significant gaps for an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, clearly documenting the single parameter 'ea_name' with its type and format. The description adds no additional parameter semantics beyond implying compilation involves an EA, so it meets the baseline of 3 without compensating for any gaps.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Compile') and resource ('an EA on MetaTrader 4') with the outcome ('get compilation results'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'sync_ea' or 'sync_ea_from_file' which might involve similar EA-related operations, preventing a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., if the EA must exist locally), exclusions, or how it relates to siblings like 'list_local_eas' or 'run_backtest', leaving usage context unclear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_account_infoB
Get MetaTrader 4 account information
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a 'Get' operation, implying read-only behavior, but doesn't specify whether it requires authentication, has rate limits, returns real-time or cached data, or what format the information is in. This leaves significant gaps for a tool that retrieves account data.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's front-loaded and wastes no space, making it highly concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of retrieving account information in a trading context, the description is inadequate. With no annotations, no output schema, and no details on what specific information is returned (e.g., balance, equity, margin), the agent lacks sufficient context to use this tool effectively compared to siblings.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add any parameter details, which is appropriate here, but since there are no parameters to explain, it doesn't fully compensate for any gaps, so it scores just below the maximum.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Get') and resource ('MetaTrader 4 account information'), making the purpose unambiguous. However, it doesn't distinguish this tool from potential siblings like 'get_positions' or 'get_history', which might also retrieve account-related data, so it doesn't reach the highest score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_positions' and 'get_history' that might overlap in retrieving account-related information, there's no indication of context, prerequisites, or exclusions for usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_backtest_resultsC
Get results from the last backtest
| Name | Required | Description | Default |
|---|---|---|---|
| detailed | No | Include detailed trade-by-trade results |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves results but does not describe key behaviors: whether it returns only the most recent backtest, if it requires authentication, potential rate limits, or error conditions. The description is too minimal to inform safe and effective use.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence that directly states the tool's function without unnecessary words. It is front-loaded and efficient, though it could be more structured by including key usage details. The brevity is appropriate but borders on under-specification.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of backtesting tools and the lack of annotations and output schema, the description is incomplete. It does not explain what 'results' include (e.g., summary statistics, charts), how it relates to sibling tools, or behavioral aspects like idempotency. For a tool that likely returns critical financial data, this leaves significant gaps for an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with one parameter ('detailed') fully documented in the schema. The description adds no parameter semantics beyond what the schema provides (e.g., it does not clarify what 'last backtest' means in relation to the parameter). With high schema coverage, the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the tool's purpose ('Get results from the last backtest'), which is clear but vague. It specifies the verb ('Get') and resource ('results from the last backtest'), but does not distinguish it from sibling tools like 'get_backtest_status' or explain what constitutes 'results' (e.g., performance metrics, trade logs). This leaves ambiguity about the exact output.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites (e.g., that a backtest must have been run first), exclusions, or comparisons to sibling tools like 'get_backtest_status' or 'run_backtest'. This lack of context makes it unclear when this tool is appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_backtest_statusB
Get the current status of a running backtest
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but only states it retrieves status without behavioral details. It doesn't disclose whether this is read-only (implied but not explicit), if it requires authentication, rate limits, error handling, or what happens if no backtest is running. The description is minimal and lacks critical operational context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, direct sentence with no wasted words. It front-loads the core purpose ('Get the current status') efficiently. Every word earns its place, making it highly concise and well-structured for its simplicity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, no output schema, and a simple zero-parameter tool, the description is incomplete. It doesn't explain what 'status' returns (e.g., a string, object, or progress indicator), error conditions, or how it interacts with siblings like 'run_backtest'. For a tool in a backtesting context, more operational detail would help the agent use it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here. Baseline is 4 for zero parameters, as the schema fully covers the absence of inputs.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Get') and target ('current status of a running backtest'), making the purpose evident. It distinguishes from siblings like 'get_backtest_results' by focusing on status rather than results. However, it doesn't specify what 'status' entails (e.g., progress percentage, error state), leaving some ambiguity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when a backtest is running, but provides no explicit guidance on when to use this versus alternatives like 'get_backtest_results' or 'run_backtest'. No prerequisites (e.g., needing a backtest ID) or exclusions are mentioned, leaving the agent to infer context from tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_historyD
Get trading history
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Number of days to look back |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure but offers no information beyond the basic action. It doesn't describe whether this is a read-only operation, what data format is returned, if there are rate limits, authentication needs, or any side effects, making it inadequate for a tool with potential complexity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
While concise with just three words, the description is under-specified rather than efficiently structured. It lacks front-loaded critical information and fails to earn its place by adding value beyond the tool name, making it ineffective despite its brevity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations and no output schema, the description is incomplete for a tool that retrieves trading history. It doesn't explain what 'trading history' entails (e.g., transactions, orders, performance), the return format, or any behavioral traits, leaving significant gaps for the agent to infer.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the 'days' parameter clearly documented as 'Number of days to look back' with a default of 7. The description adds no additional meaning beyond what the schema provides, so it meets the baseline of 3 where the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Get trading history' is a tautology that merely restates the tool name 'get_history' with minimal elaboration. It specifies the resource ('trading history') but lacks a clear, specific verb beyond 'get' and doesn't differentiate from sibling tools like 'get_account_info' or 'get_positions' that also retrieve trading-related data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention context, prerequisites, or exclusions, and fails to reference sibling tools like 'get_account_info' for account details or 'get_positions' for current positions, leaving the agent with no usage direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_market_dataC
Get current market data for a symbol
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Trading symbol (e.g., EURUSD, GBPUSD) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves 'current market data' but doesn't specify what that includes (e.g., price, volume, bid/ask), latency, rate limits, authentication needs, or error handling. This leaves significant gaps for an agent to understand how the tool behaves in practice.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core functionality ('Get current market data') without unnecessary words. Every part of the sentence contributes directly to understanding the tool's purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'market data' entails (e.g., structured fields like price or time), potential errors, or how results are returned. For a tool in a financial trading context with siblings that handle similar data, more context is needed to ensure proper usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the 'symbol' parameter clearly documented as a trading symbol with examples. The description adds no additional parameter semantics beyond what the schema provides, such as format constraints or validation rules, so it meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Get') and resource ('current market data for a symbol'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_history' or 'get_backtest_results', which might also retrieve market-related data but with different scopes or timeframes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether the symbol must be active or subscribed), exclusions, or comparisons to siblings like 'get_history' (which might retrieve historical data) or 'get_positions' (which might show current holdings).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_positionsB
Get all open positions
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. 'Get all open positions' implies a read operation but doesn't specify whether this requires authentication, returns real-time or cached data, includes pagination, or handles errors. For a tool with zero annotation coverage, this leaves significant behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly concise at three words: 'Get all open positions.' It's front-loaded with the core action and resource, contains zero wasted words, and efficiently communicates the essential purpose without unnecessary elaboration.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter read tool with no output schema, the description is minimally adequate but leaves important context gaps. It doesn't specify what 'open positions' means in this domain (trading/financial context suggested by sibling tools), what format the data returns, or whether there are any constraints on usage. The description meets basic requirements but could be more complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters with 100% schema description coverage, so the schema already fully documents the parameter situation. The description doesn't need to compensate for any parameter gaps, and it appropriately doesn't mention parameters that don't exist. A baseline of 4 is appropriate for zero-parameter tools.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Get all open positions' clearly states the verb ('Get') and resource ('open positions'), making the tool's purpose immediately understandable. However, it doesn't distinguish this from potential sibling tools like 'get_account_info' or 'get_history' that might also retrieve position-related data, preventing a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_account_info' and 'get_history' that might overlap in retrieving position data, there's no indication of when this specific tool is appropriate or what distinguishes it from other retrieval operations.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_expertsB
List available Expert Advisors for backtesting
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists items but doesn't describe what 'available' means (e.g., remote vs. local, filtered by permissions), whether it's paginated, or what the output format looks like. This leaves significant gaps for a tool with zero annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'available' entails, how results are returned, or any behavioral traits like rate limits or permissions. For a tool with no structured data support, this minimal description leaves too many contextual gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, and the schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, but it could have mentioned any implicit filters or scopes (e.g., by user or status). Baseline for zero parameters is 4, as it's inherently complete in this dimension.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('List') and resource ('available Expert Advisors for backtesting'), making the purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'list_local_eas', which appears to be a similar listing function, preventing a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'list_local_eas' or other sibling tools. It lacks context about prerequisites, timing, or exclusions, leaving the agent with minimal usage direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_local_easC
List EAs in the local development folders
| Name | Required | Description | Default |
|---|---|---|---|
| folder | No | Which folder to list | active |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('List') but doesn't describe what 'List' entails (e.g., format of returned data, pagination, error handling, or whether it's a read-only operation). For a tool with zero annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with no wasted information, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'EAs' are, what data is returned, or how the listing behaves, leaving gaps in understanding for a tool that interacts with local development resources. More context is needed for adequate completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the single parameter 'folder' fully documented (including enum values and default). The description doesn't add any parameter details beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage without extra value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('List') and resource ('EAs in the local development folders'), providing a specific action and target. However, it doesn't distinguish this tool from sibling tools like 'list_experts' or explain what differentiates 'EAs' from 'experts' in this context, preventing a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'list_experts' or other sibling tools. It mentions 'local development folders' but doesn't specify use cases, prerequisites, or exclusions, leaving the agent with minimal contextual direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
place_orderC
Place a trading order in MetaTrader 4
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Trading symbol | |
| operation | Yes | Order operation type | |
| lots | Yes | Position size in lots | |
| price | No | Order price (for pending orders) | |
| stop_loss | No | Stop loss price | |
| take_profit | No | Take profit price | |
| comment | No | Order comment |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It states the tool places an order, implying a write/mutation operation, but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or what happens on success/failure (e.g., order confirmation). This leaves significant gaps for a trading tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action, making it easy to parse, and every part of the sentence contributes essential information, earning a top score for conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a trading order tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., side effects, error cases), usage context, and expected outcomes, which are critical for safe and effective tool invocation in a financial trading environment.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, providing clear documentation for all 7 parameters, so the description doesn't need to add parameter details. The description doesn't provide additional semantic context beyond the schema, such as explaining parameter interactions (e.g., 'price' is only for pending orders as noted in schema) or trading conventions, meeting the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Place') and resource ('a trading order in MetaTrader 4'), making the purpose immediately understandable. However, it doesn't distinguish this tool from its siblings like 'close_position' or 'get_positions' beyond the basic verb, which would require more specific differentiation for a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention prerequisites like account connection status, or contrast with sibling tools like 'close_position' for exiting trades or 'get_positions' for viewing open orders, leaving the agent without contextual usage cues.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_backtestC
Run a backtest on an Expert Advisor
| Name | Required | Description | Default |
|---|---|---|---|
| expert | Yes | Expert Advisor name (without .ex4 extension) | |
| symbol | Yes | Trading symbol (e.g., EURUSD, GBPUSD) | |
| timeframe | Yes | Timeframe for backtesting | |
| from_date | Yes | Start date (YYYY-MM-DD format) | |
| to_date | Yes | End date (YYYY-MM-DD format) | |
| initial_deposit | No | Initial deposit amount | |
| model | No | Testing model | Every tick |
| optimization | No | Enable optimization | |
| parameters | No | Expert Advisor parameters as key-value pairs |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Run a backtest') but doesn't explain what happens during execution—such as whether it's synchronous/asynchronous, how long it might take, error handling, or what output to expect. This is a significant gap for a complex operation with 9 parameters.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to understand at a glance.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex tool with 9 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain the backtesting process, result format, error conditions, or how it relates to sibling tools. More context is needed to help an agent use this tool effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, such as explaining interactions between parameters or providing usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Run' and the resource 'backtest on an Expert Advisor', providing a specific action. However, it doesn't differentiate from sibling tools like 'get_backtest_results' or 'get_backtest_status', which are related but distinct operations.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like 'get_backtest_results' or 'get_backtest_status'. The description lacks context about prerequisites, such as needing a compiled Expert Advisor or historical data availability.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sync_eaC
Upload EA file to MetaTrader 4 for compilation
| Name | Required | Description | Default |
|---|---|---|---|
| ea_name | Yes | Name of the EA file (without .mq4 extension) | |
| ea_content | Yes | MQL4 source code content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. While 'upload' implies a write operation, it doesn't specify whether this requires authentication, what happens if the EA already exists, whether compilation is automatic, or what the expected outcome is. The description lacks critical behavioral context for a tool that modifies system state.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero wasted words. It's appropriately sized for a tool with two parameters and gets straight to the point without unnecessary elaboration.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool that uploads and potentially compiles code (a write operation with system impact), the description is insufficient. With no annotations, no output schema, and minimal behavioral disclosure, it leaves critical gaps about authentication requirements, error conditions, compilation process, and expected outcomes that an agent would need to use this tool effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 100% schema description coverage, the input schema already fully documents both parameters. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain format requirements, constraints, or relationships between parameters that aren't already covered.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Upload EA file') and target ('to MetaTrader 4 for compilation'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from its sibling tool 'sync_ea_from_file', which appears to handle a similar function with different input sources.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'sync_ea_from_file' or 'compile_ea'. There's no mention of prerequisites, context requirements, or exclusion criteria for tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sync_ea_from_fileC
Sync an existing EA file to MetaTrader 4
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the EA file to sync | |
| ea_name | No | Name for the EA (optional, will extract from filename if not provided) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'sync' but does not explain what this entails—whether it overwrites, updates, or merges data, or if it requires specific permissions or has side effects. This leaves key behavioral traits unspecified.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, direct sentence with no unnecessary words, making it highly concise and front-loaded. It efficiently communicates the core action without any fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It does not cover what 'sync' means operationally, what happens on success or error, or how it interacts with MetaTrader 4, leaving significant gaps in understanding for a tool that performs a potentially complex operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, so the parameters are well-documented there. The description does not add any additional meaning beyond the schema, such as explaining the sync process or file format requirements, but the schema provides adequate baseline information.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('sync') and the resource ('an existing EA file to MetaTrader 4'), making the purpose understandable. However, it does not distinguish this tool from its sibling 'sync_ea', which might cause confusion about their differences.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like 'sync_ea' or 'compile_ea'. The description lacks context about prerequisites, such as needing an existing EA file or when this operation is appropriate, leaving usage unclear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Most tools have distinct purposes, but there is some overlap between 'sync_ea' and 'sync_ea_from_file' which could cause confusion about when to use each. Other tools like 'close_position', 'get_positions', and 'place_order' are clearly differentiated for trading operations.
All tool names follow a consistent verb_noun pattern with snake_case, such as 'get_account_info', 'run_backtest', and 'list_experts'. This predictability makes it easy for agents to understand and navigate the toolset.
With 14 tools, the server covers a comprehensive range of MetaTrader 4 operations including account management, trading, backtesting, and EA development. This count is well-scoped for the domain without being overwhelming.
The toolset provides strong coverage for trading, backtesting, and EA management, but lacks tools for modifying or canceling orders, which could be a minor gap in trading workflows. Overall, it supports core CRUD-like operations effectively.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
MCP server exposing the Backtest360 engine API as tools for AI agents.
Open-source MCP server for Zerodha Kite Connect. Portfolio, market data, backtesting, alerts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI applications to interact with MetaTrader 5 terminals via WebSocket MCP protocol for trading operations and account management.4
- AlicenseBqualityCmaintenanceModel Context Protocol server for the MetaTrader 4/5 build pipeline, enabling LLM-driven compilation, deployment, backtesting, and log tailing without UI interaction.3513MIT
- AlicenseNot gradedqualityBmaintenanceAn MCP server for operating headless MetaTrader 5 terminals — over SSH, from your agent.MIT
- AlicenseNot gradedqualityCmaintenanceA local-first MCP server that bridges AI coding agents with MetaTrader 5 for inspection, market data, MQL5 development, compiling, Strategy Tester review, workspace sync, logs, audit trails, demo trading, and carefully gated live trading.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/8nite/metatrader-4-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server