The Microsoft Dynamics 365 MCP Server enables interaction with Dynamics 365 using the Model Context Protocol (MCP) by Anthropic. It allows operations like retrieving user information, managing accounts and opportunities directly from Claude Desktop through a set of specialized tools.
Before getting started, ensure you have:
git clone https://github.com/your-repo/dynamics365-mcp-server.git
cd dynamics365-mcp-server
npm install
Create a .env
file in the project root with the following credentials:
CLIENT_ID=your-client-id
CLIENT_SECRET=your-client-secret
TENANT_ID=your-tenant-id
D365_URL=https://your-org.crm.dynamics.com
Compile and start the server:
npm run build
node build/index.js
You should see: Dynamics365 MCP server running on stdio...
claude_desktop_config.json
:{
"mcpServers": {
"Dynamics365": {
"command": "node",
"args": [
"<Path to your MCP server build file ex: rootfolder/build/index.js>"
],
"env": {
"CLIENT_ID": "<D365 Client Id>",
"CLIENT_SECRET": "<D365 Client Secret>",
"TENANT_ID": "<D365 Tenant ID>",
"D365_URL": "Dynamics 365 url"
}
}
}
}
Fetches information about the currently authenticated user.
Retrieves all accounts from Dynamics 365.
Retrieves opportunities associated with a specific account.
accountId
(string, required)Creates a new account in Dynamics 365.
accountData
(object, required) containing account detailsUpdates an existing account in Dynamics 365.
accountId
(string, required), accountData
(object, required)You can test the tools using the MCP Inspector:
npx @modelcontextprotocol/inspector node build/index.js
Then visit http://localhost:5173 in your browser to access the inspector interface.
If you encounter issues:
.env
file is correctly configuredconsole.error("Debugging: Loaded environment variables:", process.env);
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.