MCP Server for the Microsoft Graph Api
About
Model-context-protocol (MCP) server for the Microsoft Graph API in C#
Details
- Author
- MartinM85
- GitHub stars
- 10
- Downloads
- 498
- Categories
- Developer Tools
Jump to
- Connects AI assistants to the Microsoft Graph API
- Supports multiple national clouds (Global, US Gov, China, Germany)
- Uses app‑only authentication via Entra ID client secret
- Exposes Graph API tools through the Model Context Protocol
- Compatible with Claude Desktop and any MCP client
- Optionally works with Azure OpenAI Service or Anthropic Claude API
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
MCP Server for the Microsoft Graph ApiCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Register an Entra ID application with at least User.Read.All permission, then configure the server in claude_desktop_config.json with your tenant ID, client ID, client secret, and optional national cloud endpoint. Build the solution, and the MCP server will be automatically discovered by the Claude Desktop app.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"mcp server for the microsoft graph api": {
"graphApi": {
"command": "dotnet",
"args": [
"run",
"--project",
"path/to/folder/with/console_project",
"--no-build"
],
"env": {
"TENANT_ID": "<tenant_id>",
"CLIENT_ID": "<client_id>",
"CLIENT_SECRET": "<client_secret>",
"NATIONAL_CLOUD": "Global"
}
}
}
}
}
McpServers
{
"graphApi": {
"command": "dotnet",
"args": [
"run",
"--project",
"path/to/folder/with/console_project",
"--no-build"
],
"env": {
"TENANT_ID": "<tenant_id>",
"CLIENT_ID": "<client_id>",
"CLIENT_SECRET": "<client_secret>",
"NATIONAL_CLOUD": "Global"
}
}
}
MCP Server for the Microsoft Graph Api
Model-context-protocol (MCP) server for the Microsoft Graph API in C#.Prerequisites
Entra ID application
Register a new Entra ID application, add and grant at least the User.Read.All application permission and create a new client secret.
You can grant also another permissions, it depends on what you want to ask AI about your tenant through the Microsoft Graph API.
Claude Desktop app
I'm using the Claude Desktop app, but I think you can use any other MCP clients, including GitHub Copilot if they allow to add local MCP server.
MCP server
Open and build the solution.
MCP server configuration
Open the claude_desktop_config.json file. On Windows, the file should be located in \%APPDATA%\Claude\\ folder.
Add the MCP Server. Under the args section, specify the path to project folder. Don't forget to set the details about the Entra ID application like tenant id, client id and client secret under the env section.
By default, Microsoft Graph global service is used. You can change it by modifying the NATIONAL_CLOUD environment variable.
Possible values for the NATIONAL_CLOUD are:
- Global: https://graph.microsoft.com - Microsoft Graph global service
- US_GOV: https://graph.microsoft.us - Microsoft Graph for US Government L4
- US_GOV_DOD: https://dod-graph.microsoft.us - Microsoft Graph for US Government L5 (DOD)
- China: https://microsoftgraph.chinacloudapi.cn - Microsoft Graph China operated by 21Vianet
- Germany: https://graph.microsoft.de - Microsoft Graph for Germany
{
"mcpServers": {
"graphApi": {
"command": "dotnet",
"args": [
"run",
"--project",
"path/to/folder/with/console_project",
"--no-build"
],
"env": {
"TENANT_ID": "<tenant_id>",
"CLIENT_ID": "<client_id>",
"CLIENT_SECRET": "<client_secret>",
"NATIONAL_CLOUD": "Global"
}
}
}
}
Run MCP server
When you open Claude Desktop app, the MCP server should be automatically discovered and run. You can start new chat.
If Claude Desktop app was already open, you need to close (quit it in system tray) and reopen it.
In case of any issues, you can check logs in \%APPDATA%\Claude\\logs.
MCP Client
The MCP client allows you to connect the MCP server.
Tools exposed by the MCP server can be invoked either by Claude AI (via Anthropic Claude API) or by any model deployed to Azure OpenAI Service.
You need to set the Anthropic API key in the AnthropicService.GetAnthropicApiKey() method.
private static string GetAnthropicApiKey()
{
return "<anthropic-api-key>";
}
For Azure OpenAI Service, you need to
- API key: set either the AZURE_OPENAI_API_KEY environment variable or specify the key in the AzureOpenAIServiceGetOpenAIApiKey() method
- Azure OpenAI endpoint: set either the AZURE_OPENAI_ENDPOINT environment variable or specify the endpoint in the AzureOpenAIService.GetOpenAIEndpoint() method
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





