
D365FO MCP Server
io.github.mafzaal由 GitHub 账号 mafzaal 发布v0.3.6更新于 Oct 24, 2026
A community-driven Microsoft Dynamics 365 Finance & Operations MCP server
概览
一个社区版 MCP 服务器,让助手查询、创建、更新和删除 Microsoft Dynamics 365 Finance & Operations 中的记录,并浏览其元数据。
- 可以做什么
- 测试连接,读取环境、版本和服务器性能信息,重置性能计数器,并管理环境配置文件,包括导入导出配置及保存在配置文件或 Azure Key Vault 中的凭据。查询、读取、创建、更新和删除 D365 F&O 实体记录,调用 OData 操作和 JSON 服务端点。搜索实体、操作和枚举,读取实体架构和已安装模块,并按多种语言解析标签。对元数据数据库执行 SELECT 查询,查看架构、表和统计信息。启动、监控、取消和查看元数据同步会话。下载销售确认单、采购订单、发票等 SRS 报表。
- 适用场景
- 当助手需要操作 Dynamics 365 Finance & Operations 环境时使用:检查数据实体和元数据、执行 OData 查询、维护记录,或获取发票、采购订单等标准业务单据。
- 运行要求
- 通过 uvx 从 PyPI 包 d365fo-client 本地运行,或使用 ghcr.io 容器镜像(该方式需要 Docker)。需要能访问 D365 F&O 环境的网络以及 D365FO_BASE_URL。认证使用 Azure 默认凭据链,或通过 D365FO_CLIENT_ID、D365FO_CLIENT_SECRET 和 D365FO_TENANT_ID 使用服务主体,也可使用 Azure Key Vault 设置。
安装
在 SourceWeft 中
- 打开 控制台中的 D365FO MCP Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Dynamics 365 Finance & Operations MCP Server
Production-ready Model Context Protocol (MCP) server that exposes the full capabilities of Microsoft Dynamics 365 Finance & Operations (D365 F&O) to AI assistants and other MCP-compatible tools. This enables sophisticated Dynamics 365 integration workflows through standardized protocol interactions.
[GitHub watchers] [GitHub forks] [GitHub stars]
🚀 One-Click Installation for VS Code:
[Install with UVX in VS Code] [Install with UVX in VS Code Insiders]
🐳 Docker Installation for VS Code:
[Install with Docker in VS Code] [Install with Docker in VS Code Insiders]
☁️ Deploy to Azure Container Apps:
Deploy the MCP server as a secure, internet-accessible HTTP endpoint with OAuth or API Key authentication. Perfect for web integrations and remote AI assistant access.
Option 1: Using Bash Script (Recommended)
Option 2: Using ARM Template
- Download azure-deploy.json
- Go to Azure Portal → Deploy a custom template
- Click "Build your own template in the editor"
- Paste the contents of
azure-deploy.json - Fill in the parameters and deploy
Also includes a comprehensive Python client library for Microsoft Dynamics 365 Finance & Operations with OData endpoints, metadata operations, label management, and CLI tools.
MCP Server Overview
The d365fo-client includes a production-ready Model Context Protocol (MCP) server (d365fo-fastmcp-server) built on the FastMCP framework that exposes the full capabilities of D365 Finance & Operations to AI assistants and other MCP-compatible tools.
The server provides multi-transport support (stdio, HTTP, SSE) with enhanced performance and deployment flexibility.
Key Features
- 49 comprehensive tools covering all major D365 F&O operations across 9 functional categories
- 12 resource types with comprehensive metadata exposure and discovery capabilities
- 2 prompt templates for advanced workflow assistance
- Multi-transport support (FastMCP): stdio, HTTP, Server-Sent Events (SSE)
- Production-ready implementation with proper error handling, authentication, and security validation
- Enhanced performance (FastMCP): 40% faster startup, 15% lower memory usage
- Advanced profile management supporting multiple environments with secure credential storage
- Database analysis capabilities with secure SQL querying and metadata insights
- Session-based synchronization with detailed progress tracking and multiple sync strategies
- Multi-language support with label resolution and localization capabilities
- Enterprise security with Azure AD integration, Key Vault support, and audit logging
New in v0.3.0
- 🔧 Pydantic Settings Model: Type-safe environment variable management with validation for 35+ configuration options
- 📂 Custom Log File Support:
D365FO_LOG_FILEenvironment variable for flexible log file paths - 🔄 Legacy Config Migration: Automatic detection and migration of legacy configuration files
- 🌐 Environment Variable Standardization: All MCP HTTP variables now use
D365FO_prefix for consistency - ⚡ Enhanced FastMCP Server: Improved startup configuration, error handling, and graceful shutdown
- 🔀 MCP Return Type Standardization: All MCP tools now return dictionaries instead of JSON strings for better type safety
- 🛠️ Enhanced Configuration: Support for
.envfiles and comprehensive environment variable documentation
Quick Start
Installation and Setup
FastMCP Server (Recommended)
The modern FastMCP implementation provides enhanced performance and multiple transport options:
Key Benefits:
- Optimized performance with FastMCP framework
- Efficient resource usage through optimized architecture
- Multi-transport support: stdio, HTTP, Server-Sent Events (SSE)
- Enhanced error handling with better async/await support
- Production ready with web transports for API integration
Integration with AI Assistants
VS Code Integration (Recommended)
FastMCP Server with Default Credentials:
Add to your VS Code mcp.json for GitHub Copilot with MCP:
Option 2: Explicit Credentials For environments requiring service principal authentication:
Option 3: Docker Integration For containerized environments and enhanced isolation:
Benefits of Docker approach:
- Complete environment isolation and reproducibility
- No local Python installation required
- Consistent runtime environment across different systems
- Automatic dependency management with pre-built image
- Enhanced security through containerization
- Persistent data storage via Docker volume (
d365fo-mcp)
Prerequisites:
- Docker installed and running
- Access to Docker Hub or GitHub Container Registry
- Network access for pulling the container image
Claude Desktop Integration
FastMCP Server: Add to your Claude Desktop configuration:
Traditional MCP Server (Alternative):
Benefits of uvx approach:
- Always uses the latest version from the repository
- No local installation required
- Automatic dependency management
- Works across different environments
Web Integration with FastMCP
The FastMCP server provides HTTP and SSE transports for web application integration:
HTTP Transport for Web APIs
SSE Transport for Real-time Applications
Alternative: Programmatic Usage
Custom MCP Clients
Connect using any MCP-compatible client library:
Docker Deployment
For containerized environments and production deployments:
Pull the Docker Image:
Standalone Docker Usage:
Docker Compose Example:
Docker Benefits:
- Complete environment isolation and reproducibility
- No local Python installation required
- Consistent runtime environment across different systems
- Built-in dependency management
- Enhanced security through containerization
- Persistent data storage via Docker volumes
- Easy integration with orchestration platforms (Kubernetes, Docker Swarm)
Architecture Benefits
For AI Assistants
- Standardized Interface: Consistent MCP protocol access to D365 F&O
- Rich Metadata: Self-describing entities and operations
- Type Safety: Schema validation for all operations
- Error Context: Detailed error information for troubleshooting
For Developers
- Minimal Integration: Standard MCP client libraries
- Comprehensive Coverage: Full D365 F&O functionality exposed
- Performance Optimized: Efficient connection and caching strategies
- Well Documented: Complete API documentation and examples
For Organizations
- Secure Access: Enterprise-grade authentication (Azure AD, Managed Identity)
- Audit Logging: Complete operation tracking and monitoring
- Scalable Design: Connection pooling and session management
- Maintenance Friendly: Clear architecture and comprehensive test coverage
Troubleshooting
Common Issues
Connection Failures
Authentication Issues
Performance Issues
Getting Help
- Logs: Check
~/.d365fo-mcp/logs/mcp-server.logfor detailed error information - Environment: Use
d365fo_get_environment_infotool to check system status - Documentation: See MCP Implementation Summary for technical details
- Issues: Report problems at GitHub Issues
MCP Tools
The server provides 49 comprehensive tools organized into functional categories:
Connection & Environment Tools (2 tools)
d365fo_test_connection- Test connectivity and authentication with performance metrics and error diagnosticsd365fo_get_environment_info- Get comprehensive environment details including versions, configurations, and capabilities
CRUD Operations Tools (7 tools)
d365fo_query_entities- Simplified OData querying with 'eq' filtering, wildcard patterns, field selection, and paginationd365fo_get_entity_record- Retrieve specific records by key with expansion options and ETag supportd365fo_create_entity_record- Create new entity records with validation and business logic executiond365fo_update_entity_record- Update existing records with partial updates and optimistic concurrency controld365fo_delete_entity_record- Delete entity records with referential integrity checking and cascading rulesd365fo_call_action- Execute OData actions and functions for complex business operationsd365fo_call_json_service- Call generic JSON service endpoints with parameter support and response handling
Metadata Discovery Tools (6 tools)
d365fo_search_entities- Search entities by pattern with category filtering and full-text search capabilitiesd365fo_get_entity_schema- Get detailed entity schemas with properties, relationships, and label resolutiond365fo_search_actions- Search available OData actions with binding type and parameter informationd365fo_search_enumerations- Search system enumerations with keyword-based filteringd365fo_get_enumeration_fields- Get detailed enumeration member information with multi-language supportd365fo_get_installed_modules- Retrieve information about installed modules and their configurations
Label Management Tools (2 tools)
d365fo_get_label- Get single label text by ID with multi-language support and fallback optionsd365fo_get_labels_batch- Get multiple labels efficiently with batch processing and performance optimization
Profile Management Tools (14 tools)
d365fo_list_profiles- List all configured D365FO environment profiles with status informationd365fo_get_profile- Get detailed configuration information for specific profilesd365fo_create_profile- Create new environment profiles with comprehensive authentication optionsd365fo_update_profile- Modify existing profile configurations with partial update supportd365fo_delete_profile- Remove environment profiles with proper cleanup and validationd365fo_set_default_profile- Designate a specific profile as the default for operationsd365fo_get_default_profile- Retrieve information about the currently configured default profiled365fo_validate_profile- Validate profile configurations for completeness and security complianced365fo_test_profile_connection- Test connectivity and authentication for specific profilesd365fo_clone_profile- Clone existing profiles with customization options for new environmentsd365fo_search_profiles- Search profiles by pattern with filtering and sorting capabilitiesd365fo_get_profile_names- Get simplified list of available profile names for quick referenced365fo_import_profiles- Import profile configurations from external sources or backupsd365fo_export_profiles- Export profile configurations for backup or deployment purposes
Database Analysis Tools (4 tools)
d365fo_execute_sql_query- Execute SELECT queries against metadata database with security validationd365fo_get_database_schema- Get comprehensive database schema information including relationshipsd365fo_get_table_info- Get detailed information about specific database tables with sample datad365fo_get_database_statistics- Generate database statistics and analytics for performance monitoring
Synchronization Tools (5 tools)
d365fo_start_sync- Initiate metadata synchronization with various strategies and session trackingd365fo_get_sync_progress- Monitor detailed progress of sync sessions with time estimatesd365fo_cancel_sync- Cancel running sync sessions with graceful cleanupd365fo_list_sync_sessions- List all active sync sessions with status and progress informationd365fo_get_sync_history- Get history of completed sync sessions with success/failure status and statistics
SRS Reporting Tools (6 tools)
d365fo_download_srs_report- Download SQL Server Reporting Services (SRS) reports with parameter supportd365fo_download_sales_confirmation- Download sales confirmation reports in various formatsd365fo_download_purchase_order- Download purchase order documents with formatting optionsd365fo_download_customer_invoice- Download customer invoice reports with customizationd365fo_download_free_text_invoice- Download free text invoice documentsd365fo_download_debit_credit_note- Download debit and credit note reports
Performance Monitoring Tools (3 tools)
d365fo_get_server_performance- Get server performance metrics and statisticsd365fo_get_server_config- Get server configuration information and system settingsd365fo_reset_performance_stats- Reset performance statistics and counters for fresh monitoring
📖 For detailed information about all MCP tools including usage examples and best practices, see the Comprehensive MCP Tools Introduction.
🤖 For AI agents and assistants, see the AI Agent Guide for structured workflows, best practices, and automation patterns.
MCP Resources
The server exposes four types of resources for discovery and access:
Entity Resources
Access entity metadata and sample data:
Metadata Resources
Access system-wide metadata:
Environment Resources
Access environment status and information:
Query Resources
Access predefined and templated queries:
Database Resources (New in V2)
Access metadata database queries:
Usage Examples
Basic Tool Execution
Entity Schema Discovery
Environment Information
Authentication & Configuration
Default Credentials (Recommended)
Uses Azure Default Credential chain (Managed Identity, Azure CLI, etc.):
Explicit Credentials
For service principal authentication:
Azure Key Vault Integration (New in v0.2.3)
For secure credential storage using Azure Key Vault:
Advanced Configuration
New in v0.3.0: Comprehensive environment variable management with type safety and validation using Pydantic settings.
Create a configuration file or set additional environment variables:
Environment File Support: You can also create a .env file in your project directory with these variables for development convenience.
Python Client Library
Features
- 🔗 OData Client: Full CRUD operations on D365 F&O data entities with composite key support
- 📊 Metadata Management V2: Enhanced caching system with intelligent synchronization and FTS5 search
- 🏷️ Label Operations V2: Multilingual label caching with performance improvements and async support
- 🔍 Advanced Querying: Support for all OData query parameters ($select, $filter, $expand, etc.)
- ⚡ Action Execution: Execute bound and unbound OData actions with comprehensive parameter handling
- �️ JSON Services: Generic access to D365 F&O JSON service endpoints (/api/services pattern)
- �🔒 Authentication: Azure AD integration with default credentials, service principal, and Azure Key Vault support
- 💾 Intelligent Caching: Cross-environment cache sharing with module-based version detection
- 🌐 Async/Await: Modern async/await patterns with optimized session management
- 📝 Type Hints: Full type annotation support with enhanced data models
- 🤖 MCP Server: Production-ready Model Context Protocol server with 49 tools and 4 resource types
- 🖥️ Comprehensive CLI: Hierarchical command-line interface for all D365 F&O operations
- 🧪 Multi-tier Testing: Mock, sandbox, and live integration testing framework (17/17 tests passing)
- 📋 Metadata Scripts: PowerShell and Python utilities for entity, enumeration, and action discovery
- 🔐 Enhanced Credential Management: Support for Azure Key Vault and multiple credential sources
- 📊 Advanced Sync Management: Session-based synchronization with detailed progress tracking
- 🔧 NEW v0.3.0: Pydantic settings model with type-safe environment variable validation
- 📂 NEW v0.3.0: Custom log file path support and flexible logging configuration
- 🔄 NEW v0.3.0: Automatic legacy configuration migration and compatibility layer
Installation
Note: The package includes MCP (Model Context Protocol) dependencies by default, enabling AI assistant integration. Both d365fo-client CLI and d365fo-fastmcp-server commands will be available after installation.
Breaking Change in v0.2.3: Environment variable names have been updated for consistency:
AZURE_CLIENT_ID→D365FO_CLIENT_IDAZURE_CLIENT_SECRET→D365FO_CLIENT_SECRETAZURE_TENANT_ID→D365FO_TENANT_ID
Please update your environment variables accordingly when upgrading.
Python Client Quick Start
Command Line Interface (CLI)
d365fo-client provides a comprehensive CLI with hierarchical commands for interacting with Dynamics 365 Finance & Operations APIs and metadata. The CLI supports all major operations including entity management, metadata discovery, and system administration.
Usage
Command Categories
Entity Operations
Metadata Operations
Version Information
Label Operations
JSON Service Operations
Global Options
--base-url URL— Specify D365 F&O environment URL--profile NAME— Use named configuration profile--output FORMAT— Output format: json, table, csv, yaml (default: table)--verbose— Enable verbose output for debugging--timeout SECONDS— Request timeout (default: 30)
Configuration Profiles
Create reusable configurations in ~/.d365fo-client/config.yaml:
Examples
For a complete command reference:
Basic Usage
Using Convenience Function
Configuration
Environment Variable Management (New in v0.3.0)
The d365fo-client now includes a comprehensive Pydantic settings model for type-safe environment variable management:
Key Benefits:
- Type Safety: Automatic validation and type conversion for all 35+ environment variables
- IDE Support: Full IntelliSense and autocompletion for configuration options
- Environment Files: Support for
.envfiles in development - Comprehensive Defaults: Sensible defaults for all configuration options
- Validation: Built-in validation for URLs, ports, timeouts, and other settings
Authentication Options
Legacy Configuration Migration (New in v0.3.0)
The d365fo-client automatically detects and migrates legacy configuration files:
- Automatic Detection: Identifies legacy configuration patterns (missing
verify_ssl, outdated field names) - Field Migration: Updates
cache_dir→metadata_cache_dir,auth_mode→use_default_credentials - Backup Creation: Creates backup of original configuration before migration
- Seamless Upgrade: Ensures smooth transition from older versions without manual intervention
Core Operations
CRUD Operations
Advanced Querying
Action Execution
JSON Service Operations
Metadata Operations
Label Operations
Error Handling
Development
Setting up Development Environment
Project Structure
Configuration Options
Cache Directory Behavior
By default, the client uses platform-appropriate user cache directories:
- Windows:
%LOCALAPPDATA%\d365fo-client(e.g.,C:\Users\username\AppData\Local\d365fo-client) - macOS:
~/Library/Caches/d365fo-client(e.g.,/Users/username/Library/Caches/d365fo-client) - Linux:
~/.cache/d365fo-client(e.g.,/home/username/.cache/d365fo-client)
You can override this by explicitly setting metadata_cache_dir:
Testing
This project includes comprehensive testing at multiple levels to ensure reliability and quality.
Unit Tests
Run standard unit tests for core functionality:
Integration Tests
The project includes a sophisticated multi-tier integration testing framework:
Quick Start
Test Levels
-
Mock Server Tests - Fast, isolated tests against a simulated D365 F&O API
- No external dependencies
- Complete API simulation
- Ideal for CI/CD pipelines
-
Sandbox Tests ⭐ (Default) - Tests against real D365 F&O test environments
- Validates authentication
- Tests real API behavior
- Requires test environment access
-
Live Tests - Optional tests against production environments
- Final validation
- Performance benchmarking
- Use with caution
Configuration
Set up integration testing with environment variables:
Available Commands
Test Coverage
Integration tests cover:
- ✅ Connection & Authentication - Azure AD integration, SSL/TLS validation
- ✅ Version Methods - Application, platform, and build version retrieval
- ✅ Metadata Operations - Entity discovery, metadata API validation
- ✅ Data Operations - CRUD operations, OData query validation
- ✅ Error Handling - Network failures, authentication errors, invalid requests
- ✅ Performance - Response time validation, concurrent operations
For detailed information, see Integration Testing Documentation.
Test Results
Recent sandbox integration test results:
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
uv run pytest) - Run integration tests (
.\tests\integration\integration-test-simple.ps1 test-sandbox) - Format code (
uv run black . && uv run isort .) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for a list of changes and version history.
Support
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
Related Projects
- Microsoft Dynamics 365
- OData
- Azure Identity
- Model Context Protocol (MCP) - For AI assistant integration
来源:README.md,提交 b19cd02
工具
0版本历史
1- v0.3.6最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分