MCP Dynamics 365 Commerce Server
Enables AI assistants to interact with Dynamics 365 Commerce systems through 125+ tools covering customer management, sales orders, cart operations, product searches, inventory tracking, and store operations. Provides comprehensive mock data for development and testing purposes.
README
MCP Dynamics 365 Commerce Server
A Model Context Protocol (MCP) server that provides tools for interacting with Dynamics 365 Commerce Retail Server Customer Consumer APIs. This server enables AI assistants to perform commerce operations through a comprehensive set of tools organized by controller.
Features
This MCP server provides 125+ tools organized into 19+ controllers, covering the main Dynamics 365 Commerce API endpoints:
🛍️ Customer Controller (10 tools)
customer_get_order_shipments_history- Get order shipments history for a customercustomer_create_entity- Create a new customer entitycustomer_update_entity- Update an existing customer entitycustomer_get_order_history- Get order history for a customercustomer_search- Search for customers by various criteriacustomer_get_purchase_history- Get purchase history for a customercustomer_get_by_account_numbers- Get customers list from account numberscustomer_get_customer_search_fields- Get customer search fields for the storecustomer_search_by_fields- Search for customers by specified fieldscustomer_post_nontransactional_activity_loyalty_points- Post non-transactional loyalty points
📦 Sales Order Controller (24 tools)
salesorder_get_receipts- Get receipts for a sales order based on form types for printingsalesorder_get_gift_receipts- Get gift receipts for specific sales line numberssalesorder_get_by_receipt_id- Get sales orders by receipt identifiersalesorder_search_sales_transactions_by_receipt_id- Search sales transactions by receipt IDsalesorder_search- Search for orders matching given search criteriasalesorder_search_orders- Search for orders matching order search criteriasalesorder_get_invoices_by_sales_id- Get sales invoices by sales identifiersalesorder_get_order_invoices- Get open order invoices by customer accountsalesorder_get_invoices- Get open invoices by search criteriasalesorder_get_invoiced_sales_lines_by_sales_ids- Get invoiced sales lines by sales order IDssalesorder_create_picking_list- Create a picking list for a sales order (deprecated)salesorder_create_picking_list_for_items- Create picking list for selected sales order linessalesorder_get_picking_lists- Get picking lists for an order from headquarterssalesorder_create_packing_slip- Create a packing slipsalesorder_get_sales_order_details_by_transaction_id- Get sales order details by transaction IDsalesorder_get_sales_order_details_by_sales_id- Get sales order details by sales IDsalesorder_get_sales_order_details_by_quotation_id- Get sales order details by quotation IDsalesorder_get_entity_by_key- Get sales order by transaction identifiersalesorder_create_entity- Upload a booked sales order with tender linessalesorder_checkin_for_order_pickup- Check in for order pickupsalesorder_get_invoice_details- Get invoice details by search criteriasalesorder_send_receipt- Send transaction receipt to electronic addressessalesorder_get_order_by_channel_reference_lookup_criteria- Get sales order by channel reference IDsalesorder_search_sales_transactions_by_receipt_id_paged- Search sales transactions by receipt ID with paging
🛒 Cart Controller (55 tools)
cart_checkout- Checkout the cart with payment processingcart_add_cart_lines- Add cart lines (items) to the cartcart_void_cart_lines- Void cart lines in the cartcart_update_cart_lines- Update existing cart lines in the cartcart_refill_gift_card- Add balance to a gift cardcart_issue_gift_card- Issue a new gift cardcart_cashout_gift_card- Cash out a gift cardcart_add_tender_line- Add a cart tender linecart_add_preprocessed_tender_line- Add pre-processed tender linecart_validate_tender_line_for_add- Validate tender line before addingcart_update_tender_line_signature- Update cart tender line signaturecart_void_tender_line- Void a cart tender linecart_suspend_with_journal- Suspend cart and make journal entrycart_resume- Resume a suspended cartcart_resume_from_receipt_id- Resume cart from receipt IDcart_recall_order- Recall customer ordercart_add_invoiced_sales_lines_to_cart- Add invoiced sales lines to cartcart_recall_quote- Recall quotecart_recall_sales_invoice- Recall sales invoicecart_add_order_invoice- Add order invoice to cartcart_add_invoices- Add invoices to cartcart_recalculate_order- Recalculate customer ordercart_update_commission_sales_group- Update commission sales groupcart_delivery_preferences- Get cart delivery preferencescart_get_line_delivery_options- Get line delivery optionscart_get_line_delivery_options_by_channel_id- Get line delivery options by channelcart_get_payments_history- Get payments historycart_get_delivery_options- Get delivery optionscart_update_line_delivery_specifications- Update line delivery specificationscart_add_charge- Add charge to cartcart_override_charge- Override charge amountcart_add_cart_line_charge- Add charge to cart linecart_override_cart_line_charge- Override cart line chargecart_update_delivery_specification- Update delivery specificationcart_override_cart_line_price- Override cart line pricecart_get_promotions- Get cart promotionscart_add_discount_code- Add discount codecart_remove_discount_codes- Remove discount codescart_remove_cart_lines- Remove cart linescart_search- Search carts by criteriacart_get_card_payment_accept_point- Get card payment accept pointcart_retrieve_card_payment_accept_result- Retrieve card payment accept resultcart_add_coupons- Add coupons to cartcart_remove_coupons- Remove coupons from cartcart_get_charge_codes- Get charge codescart_get_max_loyalty_points_to_redeem_for_transaction_balance- Get max loyalty points for redemptioncart_get_declined_or_voided_card_receipts- Get declined/voided card receiptscart_reset_all_charges- Reset all chargescart_get_entity_by_key- Get cart entity by keycart_create_entity- Create cart entitycart_update_entity- Update cart entitycart_delete_entity- Delete cart entitycart_get_cart_by_id- Get cart by IDcart_merge_carts- Merge multiple cartscart_validate_cart- Validate cart before checkout
🏷️ Products Controller (4 tools)
products_search- Search for products by various criteriaproducts_get_by_id- Get detailed information about a specific productproducts_get_recommended_products- Get recommended products based on a specific productproducts_get_product_availability- Get product availability across different locations
🏪 Org Units Controller (3 tools)
orgunits_get_locations_by_area- Get store locations within a specific areaorgunits_get_available_inventory- Get available inventory for a store/warehouseorgunits_get_store_hours- Get operating hours for a specific store
💳 Loyalty Card Controller (3 tools)
loyaltycard_issue_loyalty_card- Issue a new loyalty card to a customerloyaltycard_get_loyalty_card- Get loyalty card information and statusloyaltycard_get_loyalty_card_transactions- Get transaction history for a loyalty card
👨💼 Shifts Controller (4 tools)
shifts_get_shift- Get information about a specific shiftshifts_open- Open a new shift for an employeeshifts_close- Close an existing shiftshifts_resume- Resume a previously suspended shift
🏠 Address Controller (1 tool)
address_get_address_purposes- Gets the address purposes with paging and sorting support
🏷️ Barcode Controller (1 tool)
barcode_get_barcode_by_id- Gets barcode by identifier
💰 Cash Declaration Controller (1 tool)
cash_declaration_get_cash_declarations- Gets cash declarations with paging support
🏙️ Cities Controller (1 tool)
cities_get_cities- Get all the cities filtered by Country/Region, State Province and County
🏞️ Counties Controller (1 tool)
counties_get_counties- Get all the counties filtered by country/region and state province
🌍 Country Region Controller (3 tools)
country_region_get_country_regions_for_shipping- Gets countries/regions with delivery modes configuredcountry_region_get_country_regions_by_language_id- Get countries/regions filtered by Language Idcountry_region_get_country_regions- Get all the countries/regions
📄 Credit Memo Controller (1 tool)
credit_memo_get_credit_memo_by_id- Get credit memo by identifier
🛒 Suspended Cart Controller (1 tool)
suspended_cart_get_all_suspended_carts- Gets all suspended carts
💳 Tender Types Controller (2 tools)
tender_types_get_tender_types- Gets tender typestender_types_round_amount_by_tender_type- Round amount by tender type
❓ Reason Codes Controller (3 tools)
reason_codes_get_reason_codes- Gets the reason codesreason_codes_get_return_order_reason_codes- Gets return order reason codesreason_codes_get_reason_codes_by_id- Gets reason codes by group or single identifier
💲 Pricing Controller (1 tool)
pricing_calculate_sales_document- Calculates prices and discounts for products at given quantities
🚚 Delivery Options Controller (1 tool)
delivery_options_get_delivery_options- Get the delivery options for the channel
👥 Customer Group Controller (1 tool)
customer_group_get_customer_groups- Gets collection of customer group
💱 Currency Controller (2 tools)
currency_get_currencies_amount- Gets the currencies amountcurrency_calculate_total_currency_amount- Calculates the total currency amount
⚖️ Customer Balance Controller (1 tool)
customer_balance_get_customer_balance- Gets the customer balance
📱 Device Configuration Controller (1 tool)
device_configuration_get_device_configuration- Gets a single device configuration
🌐 Language Controller (1 tool)
language_get_languages- Gets collection of supported languages
Installation
-
Clone the repository:
git clone <repository-url> cd mcp-commerce -
Install dependencies:
pip install -r requirements.txtOr using pip with pyproject.toml:
pip install -e .
Configuration
Claude Desktop
Add the server to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"dynamics365-commerce": {
"command": "python",
"args": ["/path/to/mcp-commerce/mcp_dynamics365_commerce_server/server.py"],
"env": {
"DYNAMICS365_BASE_URL": "https://your-commerce-site.com"
}
}
}
}
VS Code with MCP Extension
- Install the MCP extension for VS Code
- Add the server configuration:
{
"name": "dynamics365-commerce",
"command": "python",
"args": ["/path/to/mcp-commerce/mcp_dynamics365_commerce_server/server.py"],
"env": {
"DYNAMICS365_BASE_URL": "https://your-commerce-site.com"
}
}
Usage
Once configured, you can use the tools in your AI conversations:
Example Customer Operations
"Search for customers with email containing 'john@example.com'"
"Get order history for customer CUST001"
"Create a new customer with name 'Jane Smith' and email 'jane.smith@example.com'"
Example Product Operations
"Search for wireless headphones under $100"
"Get detailed information for product PROD001"
"Check availability of product PROD001 in Seattle area"
Example Cart Operations
"Add product PROD001 with quantity 2 to cart CART001"
"Checkout cart CART001 with credit card payment"
"Suspend cart CART001 with reason 'customer will return later'"
Example Store Operations
"Find stores in Seattle area with pickup service"
"Get inventory for store STORE001"
"What are the hours for store STORE001?"
Mock Data
This server provides comprehensive mock data for all API endpoints, including:
- Realistic Commerce Data: Products, customers, orders, transactions
- Complete Response Structures: Following Dynamics 365 Commerce API patterns
- Rich Metadata: Timestamps, IDs, status information, nested objects
- Error Handling: Appropriate error responses for invalid requests
All mock responses include:
- API endpoint information
- Realistic sample data
- Proper data relationships
- Timestamp information
- Status and metadata fields
Development
The server is structured with separate controllers for each API area:
mcp_dynamics365_commerce_server/
├── server.py # Main MCP server entry point
├── controllers/
│ ├── customer.py # Customer operations
│ ├── sales_order.py # Sales order operations
│ ├── cart.py # Cart operations
│ ├── products.py # Product operations
│ ├── org_units.py # Store/warehouse operations
│ ├── loyalty_card.py # Loyalty program operations
│ ├── shifts.py # Employee shift operations
│ ├── address.py # Address operations
│ ├── barcode.py # Barcode operations
│ ├── cash_declaration.py # Cash declaration operations
│ ├── cities.py # Cities operations
│ ├── counties.py # Counties operations
│ ├── country_region.py # Country/region operations
│ ├── credit_memo.py # Credit memo operations
│ ├── suspended_cart.py # Suspended cart operations
│ ├── tender_types.py # Tender types operations
│ ├── reason_codes.py # Reason codes operations
│ └── pricing.py # Pricing operations
Adding New Tools
- Choose the appropriate controller or create a new one
- Add the tool definition to the controller's
get_tools()method - Implement the handler logic in the controller's
handle_tool()method - Update the main server to import and register the new controller
Testing
Run the server directly to test:
python mcp_dynamics365_commerce_server/server.py
API Reference
Each tool accepts a baseUrl parameter to specify your Dynamics 365 Commerce site URL. If not provided, it defaults to https://your-commerce-site.com.
Authentication
This server provides mock implementations. In a production environment, you would need to:
- Implement proper authentication (OAuth 2.0, API keys)
- Add SSL/TLS certificate handling
- Implement proper error handling for API failures
- Add rate limiting and request throttling
Real API Integration
To integrate with actual Dynamics 365 Commerce APIs:
- Replace mock implementations with actual HTTP requests
- Add authentication headers and tokens
- Handle real API response formats
- Implement proper error handling for network issues
- Add data validation and sanitization
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
Support
For issues related to:
- MCP Server: Create an issue in this repository
- Dynamics 365 Commerce: Consult Microsoft's official documentation
- Claude Desktop: Check Anthropic's documentation
Note: This is a mock implementation for development and testing purposes. For production use with actual Dynamics 365 Commerce systems, additional authentication, security, and error handling implementations are required.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。