ForIT Microsoft Graph

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.

Category
访问服务器

README

<p align="center"> <img src="logo.png" alt="ForIT Logo" width="350"> </p>

ForIT Microsoft Graph

License: MIT

A lean MCP (Model Context Protocol) server for raw Microsoft Graph API access with multi-tenant account management.

The Problem

AI assistants using Microsoft Graph face two challenges:

  1. Context bloat - Existing MCPs expose 30-40 specialized tools, consuming ~12KB of context per conversation
  2. Multi-tenant friction - Managing multiple Microsoft 365 accounts requires constant switching

The Solution

7 tools. ~1KB context. Direct tenant access.

Tool Description
login Authenticate with Microsoft (device code flow)
logout Log out from Microsoft account
verify-login Check authentication status
list-accounts List all cached Microsoft accounts
select-account Switch default account
remove-account Remove an account from cache
graph-request Execute any Graph API request

Why This Approach?

Instead of 30+ specialized tools like list-mail-messages, create-calendar-event, get-user, etc., we expose one flexible tool that can call any Graph API endpoint. The AI already knows the Graph API - it doesn't need hand-holding.

Before (Softeria, 37 tools):

list-mail-messages, get-mail-message, send-mail, create-draft-email,
list-calendar-events, create-calendar-event, get-calendar-event,
list-users, get-user, get-current-user, list-calendars...

After (ForIT, 1 tool):

{ "endpoint": "/me/messages", "queryParams": { "$top": "10" } }

Multi-Tenant Without Switching

The killer feature: reference any account directly without switching.

{
  "endpoint": "/me/calendar/events",
  "accountId": "work-tenant-id"
}
{
  "endpoint": "/me/calendar/events",
  "accountId": "personal-tenant-id"
}

Query both tenants in the same conversation. No select-account dance required.


Installation

npm install -g @foritllc/microsoft-graph

Quick Start

With Claude Desktop / MCP Client

{
  "mcpServers": {
    "graph": {
      "command": "npx",
      "args": ["-y", "@foritllc/microsoft-graph"]
    }
  }
}

Authentication (Device Code)

Device code authentication is used, which is the most reliable method for:

  • SSH sessions where browser auth isn't available
  • Headless servers
  • Remote development environments
  • AI agent automation

The device code is displayed prominently in a box format for visibility.

Login to Multiple Tenants

# First tenant (device code displayed clearly)
npx @foritllc/microsoft-graph --login

# Second tenant (adds to cache)
npx @foritllc/microsoft-graph --login

# See all accounts
npx @foritllc/microsoft-graph --list-accounts

Multi-Account Requirement

When multiple accounts exist, you must specify which account to use:

{
  "endpoint": "/me",
  "accountId": "abc123..."
}

Without accountId, requests will error showing available accounts. Use list-accounts tool to see account IDs.


The graph-request Tool

Parameters

Parameter Type Description
endpoint string Graph API path (e.g., /me, /users/{id}, /me/messages)
method enum GET, POST, PUT, PATCH, DELETE (default: GET)
body object Request body for POST/PUT/PATCH
queryParams object OData params ($select, $filter, $top, $orderby, etc.)
headers object Additional HTTP headers
apiVersion enum v1.0 (default) or beta
accountId string Target specific tenant without switching

Examples

Get current user:

{ "endpoint": "/me" }

List unread emails:

{
  "endpoint": "/me/messages",
  "queryParams": {
    "$filter": "isRead eq false",
    "$select": "subject,from,receivedDateTime",
    "$top": "10",
    "$orderby": "receivedDateTime desc"
  }
}

Create calendar event:

{
  "endpoint": "/me/calendar/events",
  "method": "POST",
  "body": {
    "subject": "Team Sync",
    "start": { "dateTime": "2025-01-15T10:00:00", "timeZone": "UTC" },
    "end": { "dateTime": "2025-01-15T11:00:00", "timeZone": "UTC" }
  }
}

Use beta API:

{
  "endpoint": "/me/insights/used",
  "apiVersion": "beta"
}

Cross-tenant query:

{
  "endpoint": "/me/drive/root/children",
  "accountId": "client-tenant-abc123"
}

Use With PnP CLI

This MCP complements PnP CLI for Microsoft 365:

Use Case Tool
Raw Graph API calls ForIT Microsoft Graph
SharePoint, Teams, Power Platform PnP CLI
Multi-tenant management ForIT Microsoft Graph
Specialized admin commands PnP CLI

Environment Variables

Variable Description
MS365_MCP_CLIENT_ID Azure AD app client ID (optional)
MS365_MCP_CLIENT_SECRET Client secret for confidential apps
MS365_MCP_TENANT_ID Azure AD tenant ID (default: common)

Credits

Fork of @softeria/ms-365-mcp-server, rebuilt with a different philosophy: less is more.

License

MIT - See LICENSE

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选