D365 F&O MCP Server

D365 F&O MCP Server

Enables AI-assisted X++ development for Dynamics 365 Finance and Operations by pre-indexing the entire codebase and providing 54 specialized tools for metadata lookup, code generation, and best practice validation.

Category
访问服务器

README

D365 F&O MCP Server

<div align="center">

54 AI tools that know every X++ class, table, method, and EDT in your D365FO codebase

License: MIT Node.js TypeScript

Built for D365FO developers who write X++ in Visual Studio — not for generic web dev

</div>


Why this exists

AI coding assistants excel at C#, Python, and JavaScript — languages with rich public training data. X++ is different. Your D365FO codebase is private, highly customized, and deeply interconnected: thousands of CoC extensions layered over standard Microsoft code, ISV packages adding their own tables and classes, custom EDTs that drive field validation across dozens of forms. No AI has seen any of it.

The result is AI that confidently generates code that doesn't compile: wrong method signatures, missing parameters, fields that don't exist on the table, CoC chains broken because the AI didn't know an extension already wrapped the method.

This MCP server solves that by pre-indexing your entire D365FO installation — hundreds of thousands of symbols across standard and custom models — and exposing it as 54 specialized tools. Works with GitHub Copilot and Claude Code CLI. Before generating any X++ code, the AI can look up exact method signatures, check what CoC extensions already exist, trace security hierarchies, find label translations, and understand the full shape of your data model. The result is code that compiles on the first try and integrates correctly with your existing customizations.

Solution Architecture

Without this server With this server
AI guesses method signatures → compile errors Exact signatures pulled from your actual codebase
"Does CustTable.validateWrite() have any CoC wrappers?" requires manual AOT search find_coc_extensions answers in < 50 ms
ISV and custom model extensions invisible to AI All models fully indexed and searchable
Security hierarchy takes hours to trace manually get_security_coverage_for_object traces Role → Duty → Privilege → Entry Point instantly
AI generates hardcoded strings instead of label references search_labels finds the right @SYS/@MODULE label key immediately
"Which tables reference CustTable?" requires digging through AOT relations get_table_relations returns every FK relation and cardinality in one call
EDT base types and field lengths are a constant lookup get_edt_details returns the full EDT definition including extends chain
AI doesn't know which SysOperation framework class to extend search_classes with a description filter surfaces the right base class
New CoC extension may silently duplicate an existing one find_coc_extensions reveals all existing wrappers before you write a line
Menu item to form mapping requires navigating the AOT manually get_menu_item_details resolves the full path from menu item to form to data source

Key Capabilities

  • Massive Metadata Index: Instantly looks up signatures, tables, enums, EDTs across standard and ISV code out of hundreds of thousands of objects.
  • Smart Object Generation: AI-driven tools build XML structures exactly matching D365 standard patterns (SimpleList, Forms, Tables).
  • X++ Knowledge Base: Queryable knowledge base of D365FO patterns, best practices, and AX2012→D365FO migration guidance — prevents deprecated API usage.
  • Code Review & Git Diff: Reviews uncommitted workspace changes locally matching D365 Best Practice metrics directly against Copilot chat.
  • D365 SDLC Native Integration: Triggers local MSBuild, sync.exe database updates, SysTestRunner tests, and xppbp.exe best practice validations smoothly behind the scenes.
  • XML Parsing without Corruption: Intelligently mutates AxTable and AxForm files locally avoiding the common string replacement corruption associated with VS agents.

Quick Start

Full step-by-step guide with all scenarios: docs/QUICK_START.md

Prerequisites — install required software via d365fo.tools:

Install-D365SupportingSoftware -Name vscode,python,node.js
git clone https://github.com/dynamics365ninja/d365fo-mcp-server.git
cd d365fo-mcp-server
npm install

# Build the C# bridge (required on Windows D365FO VMs for file create/modify)
cd bridge\D365MetadataBridge
dotnet build -c Release
cd ..\..                         # Back to repo root

copy .env.example .env           # Set PACKAGES_PATH, CUSTOM_MODELS, LABEL_LANGUAGES, ...
npm run extract-metadata         # Extract XML from D365FO packages
npm run build-database           # Build SQLite index
npm run dev

UDE / Power Platform Tools? Run npm run select-config instead of setting PACKAGES_PATH manually.


Connect to GitHub Copilot

1. Enable MCP servers in Copilot at github.com/settings/copilot/features

2. In Visual Studio: Tools → Options → GitHub → Copilot → check Enable MCP server integration in agent mode

3. Create %USERPROFILE%\.mcp.json (covers all solutions on the machine, recommended) or place .mcp.json next to a specific .sln file:

{
  "servers": {
    "d365fo-azure": {
      "url": "https://your-server.azurewebsites.net/mcp/"
    },
    "d365fo-local": {
      "command": "node",
      "args": ["K:\\d365fo-mcp-server\\dist\\index.js"],
      "env": {
        "MCP_SERVER_MODE": "write-only",
        "D365FO_SOLUTIONS_PATH": "K:\\VSProjects\\MySolution",
        "D365FO_WORKSPACE_PATH": "K:\\AosService\\PackagesLocalDirectory\\YourPackageName\\YourModelName"
      }
    }
  }
}

4. Copy the Copilot instruction files so Copilot knows the D365FO workflow rules:

# Place .github in a parent folder shared by all your D365FO solutions, e.g.:
Copy-Item -Path ".github" -Destination "C:\source\repos\" -Recurse

Tip: Visual Studio 2022 searches for .github\copilot-instructions.md upward from the solution folder, so one copy in a common parent directory covers all solutions underneath — no need to copy it into every solution separately.

Full config options (UDE paths, explicit projectPath, solutionPath): docs/MCP_CONFIG.md


Connect to Claude Code CLI

Claude Code uses a different config format from Copilot — "mcpServers" key, explicit "type" field, and "alwaysLoad": true to prevent tool deferral.

1. Install Claude Code CLI: npm install -g @anthropic-ai/claude-code

2. Register the server (writes to ~/.claude.json):

# Azure-hosted
claude mcp add-json --scope user d365fo-mcp-tools '{"type":"http","url":"https://your-server.azurewebsites.net/mcp/","alwaysLoad":true}'

# Local stdio
claude mcp add-json --scope user d365fo-mcp-tools '{"type":"stdio","command":"node","args":["K:\\d365fo-mcp-server\\dist\\index.js"],"env":{"DB_PATH":"K:\\d365fo-mcp-server\\data\\xpp-metadata.db","LABELS_DB_PATH":"K:\\d365fo-mcp-server\\data\\xpp-metadata-labels.db","D365FO_SOLUTIONS_PATH":"K:\\repos\\MySolution\\projects","D365FO_WORKSPACE_PATH":"K:\\AosService\\PackagesLocalDirectory\\YourPackageName\\YourModelName"},"alwaysLoad":true}'

alwaysLoad: true loads the d365fo tool list at session start, preventing Claude from routing X++ lookups to other connected code intelligence tools or built-in search.

3. Copy CLAUDE.md to the parent folder of your D365FO solutions:

Copy-Item -Path "K:\d365fo-mcp-server\CLAUDE.md" -Destination "C:\source\repos\"

Full Claude Code setup guide (all scenarios, project-scoped .mcp.json, troubleshooting): docs/CLAUDE_CODE_SETUP.md


Azure Deployment

Host on Azure App Service so the whole team shares one instance — nobody needs the server running locally.

Deployment Modes

Resource Configuration Monthly cost
App Service Basic B3 4 vCPU, 7 GB RAM ~$52
Blob Storage ~2.5–3.5 GB (symbols + labels, without/with UnitTest models) ~$3
Total ~$55 / month

The database downloads from Azure Blob Storage automatically on startup.

Setup guide: docs/SETUP.md · CI/CD pipeline: docs/PIPELINES.md

Deploy to Azure


Documentation

File Contents
docs/QUICK_START.md Start here — 5 steps to get running, all .mcp.json parameters, logging
docs/SETUP.md Detailed installation, configuration, all deployment scenarios A–F
docs/MCP_CONFIG.md .mcp.json reference — workspace paths, UDE, project settings, all env vars
docs/MCP_TOOLS.md All 54 tools with parameters and example prompts
docs/USAGE_EXAMPLES.md Practical examples: search, CoC, SysOperation, security
docs/CUSTOM_EXTENSIONS.md ISV / custom model configuration and multi-model extraction
docs/WORKSPACE_DETECTION.md How the server auto-detects your D365FO project, model, and package path
docs/ARCHITECTURE.md Technical architecture, dual-database design, cache invalidation
docs/BRIDGE.md C# Metadata Bridge reference — mandatory on Windows VMs for all write operations
docs/SETUP_AZURE.md Deploy the server to Azure App Service (admin/DevOps guide)
docs/PIPELINES.md Automated metadata extraction and deployment via Azure DevOps
docs/TESTING.md Running tests, test structure, mock guidelines, coverage
docs/SQLITE_DEPENDENCY.md SQLite vs C# Bridge — which tools use which data source
docs/CLAUDE_CODE_SETUP.md Connecting Claude Code CLI — .mcp.json + CLAUDE.md setup

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选