Microsoft Graph API
Model-context-protocol (MCP) server for the Microsoft Graph API in C#
What is Microsoft Graph API?
Microsoft Graph API is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model-context-protocol (mcp) server for the microsoft graph api in c#
Model-context-protocol (MCP) server for the Microsoft Graph API in C#
This server falls under the APIs and Cloud Services categories on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Model-context-protocol (MCP) server for the Microsoft Graph
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx graph-apiConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Microsoft Graph API
This MCP server exposes the Microsoft Graph API to Claude and Azure OpenAI through a C# console application using the .NET SDK. It authenticates via an Entra ID (Azure AD) application using client credentials, enabling AI agents to query Microsoft 365 resources such as users, groups, calendar events, emails, and OneDrive files — with support for global, US Government, China, and Germany national cloud endpoints.
Prerequisites
- .NET 8 SDK installed (dotnet --version should show 8.x)
- An Azure Entra ID (Azure AD) tenant with permissions to register an application
- An Entra ID app registration with at least User.Read.All permission and a client secret
- Claude Desktop installed on Windows (config at %APPDATA%\Claude\claude_desktop_config.json) or macOS
- git installed to clone the repository
Register an Entra ID application
In the Azure portal, register a new app, create a client secret, and assign Microsoft Graph API permissions. Admin consent is required for application permissions like User.Read.All.
# Via Azure CLI
az ad app create --display-name "MCP Graph API Server"
az ad app credential reset --id <app-id> --display-name "MCP Secret"
# Or use the Azure portal: portal.azure.com > Entra ID > App registrations > New registration
# After creation: Certificates & secrets > New client secret
# Then: API permissions > Add permission > Microsoft Graph > Application permissionsClone the repository and build
Clone the MCP server repository and build the .NET project. The --no-build flag in the run command requires a prior build.
git clone https://github.com/MartinM85/mcp-server-graph-api.git
cd mcp-server-graph-api
dotnet buildTest the server manually
Run the server with environment variables set to verify it starts and connects to the Graph API before configuring Claude Desktop.
TENANT_ID=your-tenant-id \
CLIENT_ID=your-client-id \
CLIENT_SECRET=your-client-secret \
NATIONAL_CLOUD=Global \
dotnet run --project path/to/console_project --no-buildConfigure Claude Desktop
Add the Graph API MCP server to claude_desktop_config.json. On Windows the config is at %APPDATA%\Claude\claude_desktop_config.json. On macOS it is at ~/Library/Application Support/Claude/claude_desktop_config.json.
{
"mcpServers": {
"graphApi": {
"command": "dotnet",
"args": [
"run",
"--project",
"C:\\Users\\user\\mcp-server-graph-api\\console_project",
"--no-build"
],
"env": {
"TENANT_ID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"CLIENT_ID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"CLIENT_SECRET": "your-client-secret-value",
"NATIONAL_CLOUD": "Global"
}
}
}
}Restart Claude Desktop and verify
Restart Claude Desktop to load the MCP server. If it does not appear, check the logs at %APPDATA%\Claude\logs on Windows.
Microsoft Graph API Examples
Client configuration
Full claude_desktop_config.json entry for the Microsoft Graph API MCP server using a pre-built .NET project.
{
"mcpServers": {
"graphApi": {
"command": "dotnet",
"args": [
"run",
"--project",
"/home/user/mcp-server-graph-api/console_project",
"--no-build"
],
"env": {
"TENANT_ID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"CLIENT_ID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"CLIENT_SECRET": "your_client_secret",
"NATIONAL_CLOUD": "Global"
}
}
}
}Prompts to try
Sample prompts that query Microsoft 365 data through the Graph API MCP server.
- "List all users in my organization with their display names and email addresses"
- "Show me the 10 most recently modified files in my OneDrive"
- "Get my calendar events for the next 7 days"
- "List all security groups in the tenant and their member counts"
- "Find all guest users in the directory and show when they last signed in"Troubleshooting Microsoft Graph API
AADSTS700016: Application not found in tenant
Verify that CLIENT_ID matches the Application (client) ID shown in the Entra ID app registration overview, and that TENANT_ID matches your directory's tenant ID. Both are GUIDs visible in the Azure portal under App registrations.
403 Forbidden when querying Graph API resources
The Entra ID application needs admin-consented application permissions (not delegated). In the Azure portal, go to the app's API permissions, add the required Microsoft Graph application permission (e.g. User.Read.All), and click 'Grant admin consent for <tenant>'.
dotnet run fails with 'project not found' or build errors
Run dotnet build in the repository root first to compile the project. The --no-build flag requires a successful prior build. Also ensure the path in the args array points to the directory containing the .csproj file, not the .csproj file itself.
Frequently Asked Questions about Microsoft Graph API
What is Microsoft Graph API?
Microsoft Graph API is a Model Context Protocol (MCP) server that model-context-protocol (mcp) server for the microsoft graph api in c# It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Microsoft Graph API?
Follow the installation instructions on the Microsoft Graph API GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Microsoft Graph API?
Microsoft Graph API works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Microsoft Graph API free to use?
Yes, Microsoft Graph API is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Microsoft Graph API Alternatives — Similar APIs Servers
Looking for alternatives to Microsoft Graph API? Here are other popular apis servers you can use with Claude, Cursor, and VS Code.
Kong
★ 43.4k🦍 The API and AI Gateway
API Mega List
★ 5.4kThis GitHub repo is a powerhouse collection of APIs you can start using immediately to build everything from simple automations to full-scale applications. One of the most valuable API lists on GitHub—period. 💪
Fetch
★ 5.4kFetch web content and convert to markdown for AI consumption
Fusio
★ 2.1kSelf-Hosted API Management for Builders
Korean Law
★ 1.8k국가법령정보MCP v4.0 | 법제처 41개 API → 17개 MCP 도구. 법령·판례·조례 검색 + LLM 환각 방지 인용검증 + 조문 영향 그래프(impact_map) + 시점 비교 자동 diff(time_travel) + 시민 5단계 실행 가이드(action_plan) | 41 Korean legal APIs → 17 MCP tools
RuleGo
★ 1.5k⛓️RuleGo is a lightweight, high-performance, embedded, next-generation component orchestration rule engine framework for Go.
Browse More APIs MCP Servers
Explore all apis servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Microsoft Graph API in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Microsoft Graph API?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.