A Model Context Protocol (MCP) server for automating Microsoft Graph Explorer operations using Playwright.
- 🌐 Connect to existing Edge browser instance
- 📸 Screenshot functionality with FastMCP
- � Streamable HTTP transport for better scalability
- 🎯 Microsoft Graph Explorer automation
- 🔧 Stateless operation for multi-node deployments
- Python 3.12+
- uv (recommended) or pip
- Clone the repository and navigate to the project directory
- Install dependencies:
# Using uv (recommended)
uv sync
# Or using pip
pip install -r requirements.txt- Install Playwright browsers:
playwright install msedge# Using uv
uv run python main.py
# Or using pip
python main.pyThe server will start with streamable HTTP transport on the default MCP port.
This server uses the official MCP Python SDK with FastMCP for streamable HTTP transport. It can be integrated with:
- Claude Desktop
- MCP clients
- Other MCP-compatible applications
The server provides the following MCP tool:
Take a screenshot of the Microsoft Graph Explorer page.
Parameters:
full_page(boolean, optional): Whether to capture the full page (default: False)element_selector(string, optional): CSS selector to capture a specific element
Returns:
Image: Screenshot image data in PNG format
# Test the server with MCP development tools
uv run mcp dev main.py
# Install in Claude Desktop
uv run mcp install main.pyauto_azure_export/
├── main.py # Main MCP server implementation
├── requirements.txt # Python dependencies
├── pyproject.toml # Project configuration
├── .env # Environment variables
└── README.md # This file
Configure the server behavior using .env file:
# Edge browser debug port
EDGE_DEBUG_PORT=9222
# Graph Explorer URL
GRAPH_EXPLORER_URL=https://developer.microsoft.com/en-us/graph/graph-explorer
# Log level
LOG_LEVEL=INFO
# Timeout settings (milliseconds)
DEFAULT_TIMEOUT=10000
REQUEST_TIMEOUT=30000The server automatically:
- Tries to connect to an existing Edge browser with debugging enabled on port 9222
- If no existing browser is found, launches a new Edge instance
- Navigates to Microsoft Graph Explorer
- Maintains the browser session for subsequent requests
The server is configured with:
- Stateless HTTP: Enabled for better scalability
- JSON Response: Enabled for better compatibility
- Streamable HTTP Transport: For production deployments
The server launches Edge with the following arguments:
--remote-debugging-port=9222: Enable remote debugging--no-first-run: Skip first run setup--no-default-browser-check: Skip default browser check--disable-blink-features=AutomationControlled: Hide automation detection--disable-web-security: Disable web security (for automation)
Default viewport: 1920x1080
- Browser connection fails: Ensure no other applications are using port 9222
- Screenshot timeout: Check if Graph Explorer is loading properly
- Element not found: Verify CSS selectors are valid
- MCP connection issues: Ensure MCP client is properly configured
The server logs important events including:
- Browser connection status
- Navigation success/failure
- Screenshot operations
- MCP tool calls
- Errors and exceptions
This server implements the Model Context Protocol specification and supports:
- Tool discovery and execution
- Image data transfer
- Structured output
- Error handling
- Stateless operation
For more information about MCP, visit the Model Context Protocol documentation.