Python MCP tool for D365 Commerce Scale Unit REST APIs
Project description
d365-csu
Python MCP tool for D365 Commerce Scale Unit (CSU) REST APIs.
Provides CRUD operations against CSU endpoints and a built-in catalog of available endpoints with sample JSON payloads.
Installation
pip install -e .
Configuration
Set the following environment variables:
| Variable | Description |
|---|---|
CSU_BASE_URL |
CSU base URL (e.g. https://myhost.commerce.dynamics.com/Commerce) |
CSU_OUN |
Operating Unit Number |
AZURE_TENANT_ID |
Azure AD tenant ID |
AZURE_CLIENT_ID |
App registration client ID |
AZURE_CLIENT_SECRET |
App registration client secret |
AZURE_RESOURCE_ID |
CSU resource ID for token scope |
Usage
As an MCP Tool
Add to your MCP client config (e.g. Claude Desktop):
{
"mcpServers": {
"d365-csu": {
"command": "d365-csu",
"env": {
"CSU_BASE_URL": "https://myhost.commerce.dynamics.com/Commerce",
"CSU_OUN": "128",
"AZURE_TENANT_ID": "your-tenant-id",
"AZURE_CLIENT_ID": "your-client-id",
"AZURE_CLIENT_SECRET": "your-client-secret",
"AZURE_RESOURCE_ID": "your-resource-id"
}
}
}
}
Browse Endpoints (no credentials needed)
from d365_csu.endpoints import list_endpoints, get_sample_payload, list_entities
# List all supported entities
print(list_entities())
# ['Carts', 'Categories', 'Customers', 'OrgUnits', 'Products', 'SalesOrders']
# List all endpoints for an entity
for ep in list_endpoints("Customers"):
print(f"{ep['method']} {ep['path']} — {ep['description']}")
# Get a sample request body
payload = get_sample_payload("Customers", "Search")
print(payload)
Direct Python Usage
from d365_csu.auth import AzureADAuth
from d365_csu.client import CSUClient
from d365_csu.entities import customers, products
auth = AzureADAuth(
tenant_id="...",
client_id="...",
client_secret="...",
resource_id="...",
)
client = CSUClient("https://myhost.commerce.dynamics.com/Commerce", "128", auth)
# Search customers
results = customers.search_customers(client, "contoso")
# Search products
results = products.search_products(client, "laptop")
Available MCP Tools
| Tool | Description |
|---|---|
csu_list_endpoints |
List available CSU endpoints with sample payloads |
csu_list_entities |
List supported entity names |
csu_get_sample_payload |
Get sample JSON body for an endpoint |
csu_search_customers |
Search customers by keyword |
csu_create_customer |
Create a new customer |
csu_search_products |
Search product catalog |
csu_get_product |
Get a product by ID |
csu_manage_cart |
Cart operations (create, add lines, checkout) |
csu_search_orders |
Search sales orders |
csu_get_stores |
Get org units / stores |
csu_get_categories |
Get category hierarchy |
csu_raw_request |
Make a raw CSU API call |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file d365_csu-0.1.0.tar.gz.
File metadata
- Download URL: d365_csu-0.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5351b64bdb0e1e7272891957be592ccab7249504b70e14641f0e64ecba38baef
|
|
| MD5 |
0b912f256508c648f31d06aa6ca8fec9
|
|
| BLAKE2b-256 |
91f4b18923cd3985d78d8a2b0f097cf10fece98fce4c48a38a8612402cdedcfc
|
File details
Details for the file d365_csu-0.1.0-py3-none-any.whl.
File metadata
- Download URL: d365_csu-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1d327f732cc8e3e78c554ae09c4786f19be651560976113f96a60e0fad33c4c
|
|
| MD5 |
99bfdb68a8aa20e00ca547bd6d194e98
|
|
| BLAKE2b-256 |
d2162c0359baa6ab7390303f166ac538fee6fe71ced6e01cdfd0372a566dd52f
|