GRAPH_API_MCP

jacklatrobe/GRAPH_API_MCP

3.2

If you are the rightful owner of GRAPH_API_MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A FastMCP server providing access to Microsoft Graph API documentation via the Model Context Protocol (MCP).

Tools
4
Resources
0
Prompts
0

Graph API MCP Server

A FastMCP server that provides access to Microsoft Graph API documentation via the Model Context Protocol (MCP). The server runs in Docker and exposes Graph API documentation through a Streamable-HTTP MCP interface.

Features

  • FastMCP Server: Implements MCP protocol using FastMCP with Streamable-HTTP transport
  • Offline Documentation: Reads from local graph_docs.jsonl file for fast, offline access
  • Search Tools: Provides multiple tools for querying Graph API documentation
  • Docker Support: Containerized deployment for easy setup and portability
  • Documentation Importer: Script to parse and extract metadata from Microsoft Graph docs

MCP Tools

The server exposes the following tools via MCP:

1. searchDocs

Search documentation by keyword across titles, paths, and content.

Parameters:

  • query (string): Search query string
  • max_results (int, optional): Maximum number of results (default: 10)

Example:

{
  "query": "user",
  "max_results": 5
}

2. getDocByPath

Get complete documentation for a specific file path.

Parameters:

  • path (string): File path of the documentation

Example:

{
  "path": "api-reference/v1.0/api/user-get.md"
}

3. getApiSchema

Get JSON schema for a specific API endpoint.

Parameters:

  • endpoint (string): API endpoint path (e.g., "/users" or "users")

Example:

{
  "endpoint": "/users"
}

4. getExamples

Get code examples for a specific topic or API.

Parameters:

  • topic (string): Topic or API to get examples for
  • language (string, optional): Filter by programming language

Example:

{
  "topic": "users",
  "language": "javascript"
}

Setup

Prerequisites

  • Docker and Docker Compose
  • Python 3.11+ (for running locally without Docker)

Quick Start with Docker

  1. Clone the repository:

    git clone https://github.com/jacklatrobe/GRAPH_API_MCP.git
    cd GRAPH_API_MCP
    
  2. Build and run with Docker Compose:

    docker-compose up --build
    
  3. The server will be available at: http://localhost:8000

Local Development

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Run the server:

    python server.py
    

Importing Documentation

To import documentation from the Microsoft Graph docs repository:

  1. Clone the Microsoft Graph documentation:

    git clone https://github.com/microsoftgraph/microsoft-graph-docs-contrib.git
    
  2. Run the importer script:

    python import_graph_docs.py microsoft-graph-docs-contrib graph_docs.jsonl
    
  3. The script will:

    • Parse all markdown files in the repository
    • Extract metadata (title, version, HTTP methods, examples, permissions, schema)
    • Output a normalized JSONL file

Data Format

The graph_docs.jsonl file contains one JSON object per line with the following structure:

{
  "path": "api-reference/v1.0/api/user-get.md",
  "title": "Get user",
  "version": "v1.0",
  "http_methods": [
    {"method": "GET", "path": "/users/{id}"}
  ],
  "examples": [
    {"language": "http", "code": "GET https://graph.microsoft.com/v1.0/users/{id}"}
  ],
  "permissions": ["User.Read", "User.ReadBasic.All"],
  "schema": {"@odata.type": "microsoft.graph.user", "id": "string"},
  "content": "First 5000 characters of markdown content..."
}

Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│   MCP Client        │
│   (LLM Agent)       │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
           │ MCP Protocol
           │ (Streamable-HTTP)
           ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│   FastMCP Server    │
│   (server.py)       │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ - searchDocs        │
│ - getDocByPath      │
│ - getApiSchema      │
│ - getExamples       │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
           │ Read
           ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  graph_docs.jsonl   │
│  (Documentation DB) │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Development

Project Structure

GRAPH_API_MCP/
ā”œā”€ā”€ server.py                 # FastMCP server implementation
ā”œā”€ā”€ import_graph_docs.py      # Documentation importer script
ā”œā”€ā”€ graph_docs.jsonl          # Sample documentation data
ā”œā”€ā”€ requirements.txt          # Python dependencies
ā”œā”€ā”€ Dockerfile               # Docker image definition
ā”œā”€ā”€ docker-compose.yml       # Docker Compose configuration
└── README.md                # This file

Running Tests

The server includes sample data in graph_docs.jsonl. You can test the tools by:

  1. Starting the server
  2. Connecting with an MCP client
  3. Calling the available tools

License

MIT License - See file for details

Acknowledgments