Dynamics 365 MCP server

Integrates with Microsoft Dynamics 365 CRM to retrieve and manage business data including user information, accounts, opportunities, and record creation through Azure AD authentication.
Back to servers
Provider
Srikanth Paladugula
Release date
Mar 28, 2025
Language
TypeScript
Stats
5 stars

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.

Prerequisites

Before getting started, ensure you have:

  • Node.js (v16 or higher)
  • NPM (Node Package Manager)
  • A Dynamics 365 instance with API access
  • Azure Active Directory application configured for Dynamics 365 API access

Installation

Install the MCP Server

git clone https://github.com/your-repo/dynamics365-mcp-server.git
cd dynamics365-mcp-server
npm install

Configure Environment Variables

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

Build and Run

Compile and start the server:

npm run build
node build/index.js

You should see: Dynamics365 MCP server running on stdio...

Integrating with Claude Desktop

Register Your MCP Server

  1. Install Claude Desktop
  2. Navigate to Settings > Developer > Edit Config
  3. Edit 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"
            }
        }
    }
}
  1. Restart Claude Desktop
  2. The server tools should now appear in the prompt window

Available Tools

get-user-info

Fetches information about the currently authenticated user.

  • Input: None
  • Output: User details including name, user ID, and business unit ID

fetch-accounts

Retrieves all accounts from Dynamics 365.

  • Input: None
  • Output: List of accounts in JSON format

get-associated-opportunities

Retrieves opportunities associated with a specific account.

  • Input: accountId (string, required)
  • Output: List of opportunities in JSON format

create-account

Creates a new account in Dynamics 365.

  • Input: accountData (object, required) containing account details
  • Output: Details of the created account in JSON format

update-account

Updates an existing account in Dynamics 365.

  • Input: accountId (string, required), accountData (object, required)
  • Output: Details of the updated account in JSON format

Testing with MCP Interceptor

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.

Troubleshooting

If you encounter issues:

  • Verify your .env file is correctly configured
  • Ensure your Azure AD application has the necessary Dynamics 365 API permissions
  • Check that your Dynamics 365 instance is accessible from your environment
  • Add debug logs to trace issues:
console.error("Debugging: Loaded environment variables:", process.env);

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later