
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 分