D365 F&O MCP Server

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

npm License: MIT Node.js TypeScript Tests

Core coverage Total coverage

Grounded AI development for Dynamics 365 Finance & Operations β€” works with GitHub Copilot and Claude Code

Install in VS Code Install in VS Code Insiders Add to Cursor

These connect an editor to a server that is already deployed β€” see Quick Start if you still need to set one up.


Why

AI assistants excel at C#, Python, and JavaScript. X++ is different: your D365FO codebase is private, deeply customized, and invisible to every model β€” so AI confidently generates code that doesn't compile.

This server pre-indexes your entire D365FO installation (580 000+ symbols across standard, ISV, and custom models) and exposes it as 26 specialized MCP tools. Every signature, every CoC wrapper, every label, every form pattern β€” verified against your real metadata before the AI writes a single line.

Solution Architecture

Task Without this server With this server
Method signatures Guessed β†’ compile errors Exact, from your codebase
Existing CoC wrappers Manual AOT search extension_info(mode="coc") in < 50 ms
New forms Hand-written XML, broken patterns Cloned from reference forms, validated against the pattern catalog
Labels Hardcoded strings Right @SYS/@MODULE key found instantly
Security chains Hours of manual tracing Role β†’ Duty β†’ Privilege β†’ Entry Point in one call
Generated code Hallucinated fields and types Every reference proven against the index, gated before write

Capabilities

Feature Description
πŸ” Full-codebase intelligence 580K+ symbols indexed: classes, tables, forms, EDTs, enums, labels (20M+ rows), security artifacts β€” FTS5 search in < 10 ms
πŸ›‘οΈ Grounded generation Fail-closed gates: prepare issues grounding tokens, validate_code(mode="references") proves every identifier, validate_code(mode="syntax") enforces best practices β€” hallucinated code never reaches disk
🧩 Form pattern engine Complete catalog of Microsoft form patterns and sub-patterns: recommends the right pattern, clones reference forms with datasource re-binding, deterministically expands patterns that have no reference form, auto-repairs a form's missing required controls, validates structure and blocks invalid writes
✍️ Safe metadata writes C# bridge uses Microsoft's own IMetadataProvider β€” no string-replacement XML corruption, automatic .rnrproj registration, one-call undo
πŸ—οΈ SDLC integration MSBuild compilation with structured diagnostics, DB sync, xppbp best practices, SysTestRunner β€” all from chat
πŸ“ X++ knowledge base Queryable rules: select grammar, CoC authoring, financial dimensions, the posting engine (LedgerVoucher), number sequences, SysExtension, Electronic Reporting, AX2012β†’D365FO migration β€” prevents deprecated APIs

Pattern-grounded form development

Forms are the hardest artifact to generate correctly β€” each pattern dictates required containers, ordering, and allowed sub-patterns. The form pattern engine makes it a guided pipeline:

flowchart LR
    A["object_patterns<br/>(domain=form, action=analyze)"] --> B["object_patterns<br/>(domain=form, action=spec)"]
    B --> C["generate_object<br/>objectType=form, cloneFrom"]
    C --> D["object_patterns<br/>(domain=form, action=validate) FP001–FP010"]
    D -->|clean| E["d365fo_file<br/>(action=create) write + project"]
    D -->|errors| C

Structural violations (wrong order, missing container, disallowed control) block the write β€” recommendations only warn. Mined pattern statistics from your own environment ground every suggestion in reality.


Quick Start

Installing on your own D365FO VM β€” the usual case. One line in PowerShell installs Node.js if it is missing, installs the server from npm, and runs the setup wizard, which asks where the index should live and builds the C# bridge for you:

irm https://raw.githubusercontent.com/dynamics365ninja/d365fo-mcp-server/main/install.ps1 | iex

Already have Node.js 24+? Then the one-liner has nothing to bootstrap and you can skip it:

npm install -g d365fo-mcp
d365fo-mcp setup

Re-running either is safe. An installation made before the npm package existed is a git checkout, and both are left exactly where they are and updated in place.

Your team already runs a shared server? Then you install nothing β€” point your editor at it:

npx d365fo-mcp connect https://your-server.azurewebsites.net

Both paths in full β€” prerequisites, editor configuration for every scenario, the required instruction file, and how to verify grounding actually works: docs/QUICK_START.md


Azure Deployment

One shared instance for the whole team β€” the metadata index lives in Blob Storage and downloads automatically on startup.

Deploy to Azure

Deployment guide: docs/SETUP_AZURE.md Β· CI/CD automation: docs/PIPELINES.md


Documentation

Getting started Reference Operations
Quick Start β€” connect or install All 26 tools Azure deployment
Setup scenarios A–F .mcp.json reference DevOps pipelines
Claude Code setup Architecture Testing
Usage examples β€” real tool chains C# Bridge Custom / ISV models
Workspace detection SQLite vs Bridge
Backlog β€” deferred work & ideas Coverage β€” what the badge counts

License

MIT