mcp-graph-me-tool

mcp-graph-me-tool

Enables MCP clients to fetch the signed-in Microsoft Entra user's profile from Microsoft Graph via the GET /me endpoint using the provided bearer token.

Category
Visit Server

README

mcp-graph-me-tool

A minimal Streamable HTTP MCP server exposing one tool, graph_me, which calls Microsoft Graph's GET /me with the caller's bearer token and returns the signed-in user's profile.

It's the backend half of a Microsoft Entra ID On-Behalf-Of (OBO) token exchange demo: a gateway (e.g. agentgateway) sits in front of this server, validates the caller's Entra token, exchanges it for a Graph-scoped token via Entra's own token endpoint, and forwards the request here with the exchanged token substituted for Authorization. This server does not perform any exchange or validation itself - it only relays whatever bearer token it's handed to Graph.

What it does

sequenceDiagram
    participant Client as MCP Client
    participant AGW as Gateway (OBO exchange)
    participant Tool as mcp-graph-me-tool
    participant Graph as Microsoft Graph

    Client->>AGW: tools/call graph_me + user's Entra token
    AGW->>AGW: exchange for a Graph-scoped token
    AGW->>Tool: tools/call graph_me + exchanged token
    Tool->>Graph: GET /v1.0/me + exchanged token
    Graph-->>Tool: profile
    Tool-->>AGW: tool result
    AGW-->>Client: tool result
  • graph_me - no arguments. Reads the Authorization header off the incoming HTTP request and calls https://graph.microsoft.com/v1.0/me with it. Returns the profile JSON on success, or {"error": "Graph API returned <status>", "detail": "<Graph's own error body>"} on failure (including when no Authorization header is present at all).
  • GET /healthz - plain 200 ok liveness/readiness check.

Each HTTP request gets a fresh McpServer instance built from that request's own Authorization header (see buildServer() in server.js) - there is no session or connection state held between requests.

Running locally

npm install
npm start
# listening on :8080 (override with PORT)
curl localhost:8080/healthz
# ok

Development

npm test   # node --check server.js (syntax check)

Wiring into agentgateway

Deploy this image behind a plain EnterpriseAgentgatewayBackend/HTTPRoute pointing at port 8080, protocol: StreamableHTTP, path: /mcp, then apply an oauthTokenExchange policy (grantType: JwtBearer) on that route to perform the Entra OBO exchange before requests reach this server. See docs.solo.io's Entra OBO guide for the full walkthrough.

License

Apache License 2.0 - see LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured