msgraph-kb-mcp
A. 模型上下文协议(MCP) 提供以下功能的服务器 Microsoft Graph API知识 --搜索27000多个端点,查找权限,并获取代码示例,所有这些都可以从您的AI助手中完成。
快速开始
无需本地安装。使用 npx 按需运行服务器:
npx github:UniverseCitiz3n/msgraph-kb-mcp先决条件: Node.js≥18 git 在PATH环境变量中可用。______________________________________________________________________
在MCP客户端中安装
VS代码(GitHub副本)
一键安装:
| 平台 | VS代码 | VS代码内部人员 |
|---|
或手动添加到 .vscode/mcp.json 在您的工作区中(如果文件不存在,请创建该文件):
{
"servers": {
"msgraph-kb": {
"type": "stdio",
"command": "npx",
"args": ["-y", "github:UniverseCitiz3n/msgraph-kb-mcp"]
}
}
}克劳德桌面版
编辑您的Claude Desktop配置文件:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 窗户:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"msgraph-kb": {
"command": "npx",
"args": ["-y", "github:UniverseCitiz3n/msgraph-kb-mcp"]
}
}
}克劳德代码
添加到您的项目 mcp.json 文件:
{
"mcpServers": {
"msgraph-kb": {
"command": "npx",
"args": ["-y", "github:UniverseCitiz3n/msgraph-kb-mcp"]
}
}
}GitHub Copilot编码代理(存储库设置)
在您的存储库中 设置→ 副驾驶→ MCP服务器,添加:
{
"mcpServers": {
"msgraph-kb": {
"type": "local",
"command": "npx",
"args": ["-y", "github:UniverseCitiz3n/msgraph-kb-mcp"],
"tools": ["*"]
}
}
}______________________________________________________________________
可用工具
| 工具 | 输入 | 描述 |
|---|---|---|
search_graph_apis | query (string) | 按关键字搜索端点--返回路径、方法、描述、权限 |
get_api_details | endpoint (string) | 特定端点的完整详细信息 |
get_api_sample | endpoint (string) | 端点的代码示例 |
list_permissions | endpoint (string) | 委托和应用程序权限 |
get_server_info | _(无)_ | 数据版本、克隆时间戳、索引统计信息 |
______________________________________________________________________
端点建议
服务器可以连接 advisories 当已知的真实世界行为与索引元数据不同时,将结果转换为端点。
当前咨询:
- Intune DeviceConfigV2警告
PATCH /deviceManagement/configurationPolicies/{deviceManagementConfigurationPolicy-id}/settings/{deviceManagementConfigurationSetting-id}. - 如果此路由在您的租户中返回路由不匹配错误,请首选:
- PUT /deviceManagement/configurationPolicies('{deviceManagementConfigurationPolicy-id}') - 包含完整的策略有效负载,并嵌入 settings.
这些建议是附加指南,不能取代官方的Graph文档。
______________________________________________________________________
本地开发
克隆仓库,安装依赖项,然后构建:
git clone https://github.com/UniverseCitiz3n/msgraph-kb-mcp.git
cd msgraph-kb-mcp
npm install
npm run build
node dist/index.js将任何MCP客户端指向构建的二进制文件:
{
"mcpServers": {
"msgraph-kb": {
"command": "node",
"args": ["/absolute/path/to/msgraph-kb-mcp/dist/index.js"]
}
}
}______________________________________________________________________
运作原理
启动时,服务器获取最新版本的 merill/msgraph 并从以下文件构建可搜索的内存索引 skills/msgraph/references/:
graph-api-index.json--端点路径、HTTP方法、摘要api-docs-index.json--权限、注释、查询参数samples-index.json--示例查询
克隆存储在临时目录中,并在进程退出时删除。如果克隆失败,服务器仍将启动——工具将返回一个描述性错误,直到数据可用。
搜索相关性
- 查询被规范化以删除停用词、对术语进行去复数化并修复常见的拼写错误(例如,
bussines→business). - Windows Update for Business驱动程序配置文件路由(包括驱动程序清单)获得了额外的相关性提升,因此自然语言提示在不粘贴原始URL的情况下显示正确的端点。
许可证
麻省理工学院
