ForIT Microsoft Graph
Provides direct access to Microsoft Graph API with multi-tenant account management, allowing users to interact with Microsoft 365 services across multiple tenants through a single flexible graph-request tool.
README
Microsoft Master (MM)
Unified Microsoft 365 MCP server for AI assistants. One server, two tools, all of M365.
History
This repo originally contained four separate MCP servers:
| Server | Purpose | Status |
|---|---|---|
| graph | Microsoft Graph REST API (TypeScript) | Archived |
| pnp | CLI for Microsoft 365 / SharePoint (TypeScript) | Archived |
| pwsh-manager | PowerShell session management (Python/Docker) | Archived |
| registry | Connection registry management (Python) | Archived |
In February 2026, these were consolidated into a single mm server with two tools:
mm__run— PowerShell commands via a Docker session poolmm__graph_request— Direct Microsoft Graph REST API calls via MSAL
The old servers are preserved in _archived/ for reference.
Architecture
┌─────────────────────────────────────────────────────────┐
│ AI Assistant │
└─────────────────────┬───────────────────────────────────┘
│ MCP Protocol (stdio)
▼
┌─────────────┐
│ mm/server │ Python MCP server
│ │ - graph_request (MSAL → Graph API)
│ │ - run (HTTP → session pool)
└──────┬──────┘
│ HTTP :5200
▼
┌───────────────────────┐
│ session-pool/ │ Docker container(s)
│ session_pool.py │ - PowerShell processes per module
│ │ - Native device code auth
│ Modules: │ - Session persistence
│ exo, pnp, azure, │ - Command guardrails
│ teams │ - Comprehensive logging
└───────────────────────┘
│
┌───────────┴───────────┐
│ ~/.m365-connections │ Connection registry (READ-ONLY)
│ ~/.mm-graph-tokens/ │ Graph MSAL token cache
│ ~/.m365-logs/ │ Persistent logs
│ ~/.m365-state/ │ Session state persistence
└───────────────────────┘
Quick Start
1. Start the session pool
# Unified mode — single container, all connections (recommended for dev/small servers)
cd session-pool
docker compose -p m365-session-pool -f docker-compose.unified.yml up -d
# Isolated mode — one container per connection (recommended for production/32GB+ RAM)
docker compose -p m365-session-pool -f docker-compose.isolated.yml up -d
2. Register with MCPJungle
mcpjungle register --conf mm/mcpjungle-config.json
3. Use it
# List connections
mcpjungle invoke mm run '{}'
# PowerShell (Exchange)
mcpjungle invoke mm run '{"connection":"ForIT-GA","module":"exo","command":"Get-Mailbox -ResultSize 1"}'
# Graph API
mcpjungle invoke mm graph_request '{"connection":"ForIT-GA","endpoint":"/me"}'
# Power Automate (Flow API)
mcpjungle invoke mm graph_request '{"connection":"ForIT-GA","endpoint":"/providers/Microsoft.ProcessSimple/environments","resource":"flow"}'
Auth is automatic — if a connection isn't authenticated, the tool returns a device code. No pre-auth step needed.
Connection Registry
All connections live in ~/.m365-connections.json (read-only to MCPs):
{
"connections": {
"ForIT-GA": {
"appId": "your-app-id",
"tenant": "forit.io",
"tenantId": "guid-here",
"expectedEmail": "user@domain.com",
"description": "ForIT Global Admin"
}
}
}
Every command requires a connection parameter. There are no defaults.
Tools
mm__run — PowerShell via Session Pool
Execute PowerShell commands through persistent Docker-hosted sessions.
| Parameter | Description |
|---|---|
connection |
Connection name (e.g., ForIT-GA) |
module |
exo (Exchange), pnp (SharePoint), azure, teams |
command |
PowerShell command to execute |
Omit all parameters to list available connections.
mm__graph_request — Microsoft Graph REST API
Direct HTTP requests to Microsoft Graph (or Flow API) via MSAL tokens.
| Parameter | Description |
|---|---|
connection |
Connection name |
endpoint |
API path (e.g., /me/messages) |
method |
GET, POST, PATCH, PUT, DELETE (default: GET) |
body |
Request body for POST/PATCH/PUT |
resource |
graph (default) or flow for Power Automate |
Session Pool
The session pool manages PowerShell processes with native device code authentication.
Deployment Modes
| Mode | File | Use Case | RAM |
|---|---|---|---|
| Unified | docker-compose.unified.yml |
Dev, small servers | ~1-2GB total |
| Isolated | docker-compose.isolated.yml |
Production, multi-user | ~512MB per connection |
Features
- Session persistence — Authenticated sessions survive container restarts. Session metadata saved to
~/.m365-state/, PowerShell token caches persisted via Docker volumes. Azure sessions restore from cached tokens; EXO/Teams require re-auth (in-process only). - Command guardrails — Blocks dangerous operations:
Install-Module(container integrity),New-AzRoleAssignment(access escalation), raw OAuth requests, app registration modifications. Warned but allowed:Remove-Az*, mail forwarding rules. - Azure context isolation — In unified mode,
Disable-AzContextAutosave+Select-AzContextby expectedEmail prevents cross-tenant context contamination when multiple Azure sessions share~/.Azure. - Comprehensive logging — Dual output: stdout (docker logs) + persistent files (
~/.m365-logs/). Every command's output content logged. AADSTS and auth error patterns flagged at WARNING level. - Keepalive — Background thread pings authenticated sessions every 5 minutes to prevent token expiry. Stale sessions (auth_pending > 15 min) automatically reaped.
- Metrics —
/metricsendpoint with request counts, error rates, response times, session states.
Session Pool API
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/status |
GET | All session states |
/connections |
GET | List registry connections |
/run |
POST | Execute a command |
/reset |
POST | Reset a connection's sessions |
/metrics |
GET | Performance metrics |
Host Directories
| Path | Purpose |
|---|---|
~/.m365-connections.json |
Connection registry (read-only) |
~/.m365-logs/ |
Persistent log files |
~/.m365-state/ |
Session state for restart persistence |
~/.mm-graph-tokens/ |
MSAL token cache for Graph API |
Monitoring
# Container health
docker ps --format "{{.Names}}\t{{.Status}}" | grep m365
# Live logs
docker logs -f m365-pool
# Persistent logs (survive container restarts)
tail -f ~/.m365-logs/session-pool-unified.log
# Session status
curl http://localhost:5200/status | jq
# Metrics
curl http://localhost:5200/metrics | jq
App Registration
The PnP multi-tenant app was retired September 9, 2024. You must create your own Azure AD app registration. See docs/M365-CLI-SETUP.md for instructions.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。