MCP ExplorerExplorer

Mcp Msgraph

@kevinbellingeron 9 months ago
1 MIT
FreeCommunity
AI Systems
A prototype MCP server which reads a user profile from Microsoft Graph.

Overview

What is Mcp Msgraph

mcp-msgraph is a prototype MCP server that connects to Microsoft Graph to read user profiles, demonstrating the integration of MCP with data stored in Microsoft Graph as a proof of concept.

Use cases

Use cases for mcp-msgraph include retrieving user information for personalized services, integrating user data into business applications, and developing proof of concept projects that demonstrate the capabilities of Microsoft Graph.

How to use

To use mcp-msgraph, create an Azure AD application, set up a virtual environment, install the required packages, configure your application credentials in ‘main.py’, and start the server using ‘uvicorn’. You can then send POST requests to the server to retrieve user profiles.

Key features

Key features of mcp-msgraph include the ability to read user profiles from Microsoft Graph, integration with Azure AD for authentication, and a simple RESTful API for interaction.

Where to use

mcp-msgraph can be used in applications that require user profile data from Microsoft Graph, such as enterprise applications, user management systems, and data analytics platforms.

Content

MCP-MSGraph

A prototype MCP (Model Context Protocol) server that reads a user profile from Microsoft Graph.
This project demonstrates how to connect MCP to data stored in Microsoft Graph as a proof of concept.


Create an Azure AD Application

  1. Log into Azure Portal.
  2. Navigate to Azure Active Directory > App registrations > New registration.
  3. Create a new application.
  4. Note the generated Application (client) ID and Client Secret.
  5. Under API permissions, add User.Read.All (as delegated or application permission as appropriate) and grant admin consent.

Instructions to run the server:

  1. Clone the repository or setup your own folder and files structure.

  2. Create a virtual environment:

python3 -m venv venv
source venv/bin/activate
  1. Install the required packages:
pip install fastapi uvicorn requests requests-oauthlib pydantic
  1. Open ‘main.py’ and replace the placeholder values with your App ID, Tenant ID, and Client Secret.

  2. Start the server

uvicorn main:app --reload

Your server will be available at http://127.0.0.1:8000.


Example Request

Use curl (or any REST client) to send a request to retrieve a user’s profile:

curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
        "action":"readUserProfile",
        "contextId":"abc123",
        "data": {"userId":"[email protected]"}
      }'

Result should look something like:

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers