MQL5 EA MCP Server
The MQL5 EA MCP Server is a local, offline tool for MQL5 developers that provides documentation lookup, search, and compilation error diagnosis — entirely without external API calls or internet access.
Smart Query (Recommended) – Intelligently query for MQL5 functions, classes, concepts, or compile errors; returns concise answers in quick (~500 tokens) or detailed (~1500 tokens) mode.
Search – Search MQL5 documentation by function name, class name, or keywords across the MQL5 Reference, Algo Book, and Neural Networks Book.
Get Document – Retrieve the full content of a specific documentation page by filename, title,
docId, or alias.Browse Categories – Navigate the documentation index by category, dynamically generated from the actual index.
Diagnose Compile Error – Parse MQL5 compile logs from MetaEditor, identify file/line/column/error codes, and suggest relevant documentation and fixes.
Log Error – Record encountered compile errors and their solutions into a local error database for future reference.
List Common Errors – View the most frequently encountered compile errors, sorted by occurrence frequency.
Manage Error DB – Export, import, or view statistics of the local error database, with optional anonymization for sharing.
Click on "Deploy 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., "@MQL5 EA MCP Server How to send a market order with OrderSend?"
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.
MQL5 EA MCP Server
MCP server tra cứu tài liệu MQL5 cục bộ. Server lập chỉ mục từ MQL5_HELP, MQL5_Algo_Book và Neural_Networks_Book, sau đó cung cấp các công cụ tìm kiếm, truy vấn nhanh, đọc tài liệu, duyệt danh mục và chẩn đoán lỗi biên dịch.
Tất cả dữ liệu chạy cục bộ. Không cần dịch vụ mạng, không gửi tài liệu hay lỗi biên dịch ra ngoài.
Tính năng chính
Tìm kiếm tài liệu MQL5 bằng SQLite FTS5.
Hỗ trợ ba nguồn tài liệu: Reference, Algo Book và Neural Networks Book.
smart_querytrả lời gọn theo hàm, class, khái niệm hoặc lỗi thường gặp.diagnose_errorphân tích log compile từ MetaEditor/terminal và gợi ý API liên quan.Error DB cục bộ giúp lưu lại lỗi và cách sửa để dùng lại về sau.
browsesinh danh mục từ index thật, không dùng danh sách hard-code.Output của
smart_queryvàgetđược giới hạn độ dài để tiết kiệm token.
Related MCP server: Dedalus MCP Documentation Server
Cài đặt nhanh
Yêu cầu:
Node.js 18 trở lên.
Claude Desktop, Cursor, Codex hoặc MCP client tương thích.
Ví dụ cấu hình MCP:
{
"mcpServers": {
"mql5-ea": {
"command": "npx",
"args": ["-y", "mql5-ea-mcp@1.4.1"]
}
}
}Khi phát triển local:
npm install
npm run build
npm run build:index
node build/index.jsDữ liệu cục bộ
Docs index:
~/.mql5-ea-mcp/indexes/docs-v<schema>-<corpus-hash>.sqliteError DB:
~/.mql5-ea-mcp/mql5_errors.db
Khi publish, package npm chứa sẵn SQLite index. Lần chạy đầu chỉ copy index này vào cache người dùng; các truy vấn sau không scan hay parse tài liệu HTML. Khi nâng phiên bản corpus, server tự tạo cache mới theo manifest; cache cũ có thể xóa an toàn khi không còn cần.
Biến môi trường dành cho development/test:
MQL5_EA_DATA_DIR: thay thư mục chứadocs_index.sqlitevà manifest đã build.MQL5_EA_CACHE_DIR: thay thư mục cache index cục bộ.
Danh sách tool
smart_queryTruy vấn thông minh. Dùng cho hàm, class, lỗi compile, câu hỏi "cách làm" và khái niệm.searchTìm tài liệu theo title, filename, alias, category, summary và nội dung.getĐọc tài liệu chi tiết theodocId, đường dẫn, title hoặc alias.browseDuyệt danh mục sinh từ docs index.diagnose_errorParse log biên dịch MQL5, chỉ ra file/dòng/cột/mã lỗi, thêm migration hints và tài liệu liên quan.log_errorGhi lỗi đã gặp vào error DB cục bộ.list_common_errorsXem lỗi thường gặp theo tần suất.manage_error_dbExport/import/thống kê error DB.
Ví dụ sử dụng
Tra cứu nhanh:
smart_query(query="OrderSend MqlTradeRequest", mode="quick")Tra cứu chi tiết:
smart_query(query="CopyBuffer indicator handle", mode="detailed")Tìm chương trong sách:
search(query="datetime session filters", limit=5)
search(query="GPT transformer self attention", limit=5)Tìm ONNX trong MQL5 Reference:
search(query="ONNX model inference", limit=5)Chẩn đoán log compile:
diagnose_error(
log="ma_cross_ea.mq5(155,39) : error 256: undeclared identifier 'ResultCode'",
limit=5
)Gợi ý dùng tool
Với đa số tình huống, hãy bắt đầu bằng smart_query. Nếu cần xem nhiều kết quả, dùng search. Nếu đã biết chính xác tài liệu cần đọc, dùng get. Khi có cả đoạn log compile, dùng diagnose_error thay vì hỏi từng lỗi rời rạc.
ONNX thuộc MQL5_HELP, không thuộc Neural_Networks_Book. Với Neural book, dùng các query như GPT transformer self attention, perceptron, attention, OpenCL neural network.
Hướng dẫn bổ sung
QUICK_START_SMART_QUERY.md: hướng dẫn bắt đầu nhanh.SMART_QUERY_GUIDE.md: hướng dẫn chi tiết vềsmart_query.AI_USAGE_GUIDE.md: cách dùng với trợ lý lập trình khi sửa lỗi compile.ERROR_COLLECTION_GUIDE.md: cách dùng error DB cục bộ.
Kiểm thử và build
npm run build
npm run build:index
npm testKết quả mong đợi:
TypeScript build thành công.
Vitest pass toàn bộ test.
build/được refresh sau khi sửa TypeScript.data/docs_index.sqlitevàdata/docs_index.manifest.jsonđược tạo trước khi đóng gói/phát hành.
Ghi chú phát triển
Project dùng
better-sqlite3, SQLite FTS5, Cheerio và Vitest.package-lock.jsonhiện không được commit vì.gitignoređang ignore lockfile.Error DB là dữ liệu người dùng, không lưu trong repo.
Tài liệu HTML chỉ là input cho release build. Chạy
npm pack --dry-runđể kiểm tra tarball chỉ chứabuild/,data/, README và LICENSE.
Available Tools
8 toolsbrowseC
Duyệt danh mục tài liệu MQL5 từ index thực tế.
Inputs: limit, category.
diagnose_errorC
Phân tích log lỗi biên dịch MQL5, gợi ý nguyên nhân và tài liệu liên quan.
Inputs: log (required), limit.
getA
Lấy nội dung chi tiết của tài liệu được chỉ định (đầy đủ HTML, ~3000 tokens). Để có câu trả lời rút gọn, hãy dùng smart_query.
Inputs: filename (required).
list_common_errorsA
📊 Liệt kê các lỗi biên dịch MQL5 thường gặp nhất (sắp xếp theo tần suất xuất hiện). Giúp nhanh chóng nắm bắt các vấn đề thường gặp.
Inputs: limit.
log_errorA
📝 Ghi nhận lỗi biên dịch MQL5 vào cơ sở dữ liệu cục bộ. Dùng để thu thập các lỗi thường gặp và giải pháp, giúp tra cứu nhanh khi gặp lại lỗi đó.
Inputs: error_code (required), error_message (required), solution, file_path, +1 more.
manage_error_dbC
🔧 Quản lý cơ sở dữ liệu lỗi: Xuất/nhập bản ghi lỗi, xem thông tin thống kê. Hỗ trợ chia sẻ cơ sở dữ liệu lỗi trong nhóm.
Inputs: action (required), data, anonymize.
searchA
Tìm kiếm tài liệu MQL5 (tên hàm, tên lớp, từ khóa). Trả về danh sách tài liệu, cần gọi tiếp công cụ get để lấy nội dung. Để có câu trả lời trực tiếp, hãy dùng smart_query.
Inputs: query (required), limit.
smart_queryA
🎯 Công cụ truy vấn thông minh (Khuyến nghị): Nhập thông tin lỗi, tên hàm hoặc câu hỏi để tự động tìm kiếm và trả về câu trả lời rút gọn. Hoàn toàn chạy cục bộ, không tốn chi phí API, tiết kiệm hơn 80% token. Thích hợp cho: Chẩn đoán lỗi, tra cứu hàm, học nhanh.
Inputs: query (required), mode.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
There is overlap between get, search, and smart_query for retrieving documentation, and between diagnose_error, list_common_errors, log_error, and manage_error_db for error handling. However, each tool has a distinct focus (full content, list, summary, diagnosis, listing common, logging, management) so boundaries are fuzzy but not catastrophic.
Tool names mix styles: some are verb_noun (diagnose_error, list_common_errors, log_error, manage_error_db), while others are single verbs (browse, get, search) or adjective_noun (smart_query). The verb 'get' is overly generic. No consistent pattern.
With 8 tools, the server is well-scoped for its purpose of MQL5 documentation and error assistance. Not excessive nor too thin, each tool serves a clear role.
The tool set covers browsing, searching, retrieving documentation, error diagnosis, error logging, and database management. Missing features like updating or contributing to docs, but core workflows are complete and agents can accomplish common tasks without dead ends.
Related MCP Connectors
MCP server for querying Forkast documentation
Read-only MCP server over the developer docs for the portfolio's JSON API, MCP, A2A and NLWeb.
Stimulsoft Reports & Dashboards docs MCP server. Semantic search for all platforms.
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides AI coding assistants with local access to 4500+ MQL5 documentation files and supplementary ebooks via MCP, enabling efficient search, browsing, and error diagnosis for MQL5 development.25MIT
- AlicenseAqualityDmaintenanceAn MCP server that serves documentation and enables AI-powered search, Q\&A, and document analysis for developer tools and guides.54MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for documentation search that automatically indexes web documentation sites and provides semantic, full-text, or hybrid search capabilities.7 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server providing 100% offline access to QuantConnect/Lean documentation with semantic search, code validation, repair, and scaffolding tools for AI coding assistants.2MIT