Metadata-Version: 2.5
Name: d365-dmf-mcp
Version: 0.1.0
Summary: Local, single-user MCP server to import/export data via Dynamics 365 F&O Data Management (DMF), authenticated as you via Entra ID
Project-URL: Repository, https://github.com/ahaugerud/d365-dmf-mcp
Author-email: Alexander Haugerud <ahaugerud@inspirit365.com>
License-Expression: MIT
License-File: LICENSE
Keywords: d365,data-management,dmf,dynamics-365,mcp,model-context-protocol
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: azure-identity>=1.25.3
Requires-Dist: mcp<2,>=1.0
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: requests>=2.31
Description-Content-Type: text/markdown

# d365-dmf-mcp

MCP server that imports CSV files into Dynamics 365 F&O via Data Management (DMF). It runs locally and authenticates as the user signed in to the Azure CLI.

## Setup on Windows

1. Install [uv](https://docs.astral.sh/uv/) and the [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli-windows).

   ```powershell
   winget install astral-sh.uv Microsoft.AzureCLI
   ```

2. Sign in with the account that has access to D365 (if there is no `az` session, the server falls back to an interactive browser login):

   ```powershell
   az login --tenant <entra-tenant-id>
   ```

3. Register the server with Claude Code (runs the published package via `uvx`; see `.mcp.json.example`):

   ```powershell
   claude mcp add d365-dmf `
     -e DMF_AZURE_TENANT_ID=<entra-tenant-id> `
     -e DMF_BASE_URL=https://<env>.sandbox.operations.eu.dynamics.com `
     -- uvx d365-dmf-mcp
   ```

   Other MCP clients: copy the block from `.mcp.json.example` into the client's MCP config. To run from a local checkout instead, use `uvx --from C:\path\to\d365-dmf-mcp d365-dmf-mcp`.

## Tools

Only the tenant and environment URL are config. Everything else is passed per call.

- `import_data(definition_group, company, files, format="CSV")`: import one or more files into a data project and wait for the result. `files` is a list of `{entity, file_path}`; `entity` is the DMF entity name as shown in D365 (e.g. `Customer groups`) and the file (`.csv` or `.xlsx`) has the entity's field names (e.g. `CUSTOMERGROUPID`) in its first row. The server generates the package manifest, looks up each entity's target and the dependency order from D365, and creates the data project if it doesn't exist. `format` is free text (`CSV`, `EXCEL`, or any CSV/Excel-based D365 source format on the environment, e.g. `CSV-Unicode`).
- `export_data(output_dir, definition_group, company)`: run an existing export data project and save its files.
- `create_data_project(name, description="")`: create an empty import data project (optional; `import_data` does this itself).
- `get_execution_status(execution_id)`: check the status of an execution, with errors if it failed.

## Notes

- Composite and XML-based entities are not supported.
- Optional env vars: `DMF_POLL_INTERVAL_SECONDS` (default 5), `DMF_POLL_TIMEOUT_SECONDS` (default 300).
