Microsoft Graph API

v1.0.0APIsstable

Model-context-protocol (MCP) server for the Microsoft Graph API in C#

claude-3-7-sonnetclaude-aigraph-apimcpmcp-server
Share:
9
Stars
0
Downloads
0
Weekly
0/5

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

Query Microsoft Graph API resources from Claude.
Integrate Office 365 data with AI assistants.
MartinM85

Maintainer

LicenseMIT
Languagec#
Versionv1.0.0
UpdatedMar 24, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx graph-api

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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 permissions
2

Clone 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 build
3

Test 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-build
4

Configure 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"
      }
    }
  }
}
5

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.

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.

Quick Config Preview

{ "mcpServers": { "graph-api": { "command": "npx", "args": ["-y", "graph-api"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides