mcpField
M
MCP-MSGraph

MCP-MSGraph

本地服务
github.com/kevinbellinger开发工具184 周前更新

关于 MCP-MSGraph

MCP-MSGraph 是一个原型 MCP 服务,可读取 Microsoft Graph 中的用户个人资料。它用于演示 MCP 如何连接 Microsoft Graph 数据,是概念验证项目。

主要功能

  1. 01读取 Microsoft Graph 用户资料
  2. 02通过 HTTP 端点接收资料请求
  3. 03使用 Azure AD 应用凭据进行身份验证

适用场景

  1. 01按用户 ID 获取个人资料
  2. 02构建连接 Microsoft Graph 的 MCP 原型

MCP 相关

它作为 MCP 服务,通过请求端点向 MCP 客户端提供读取 Microsoft Graph 用户资料的能力。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

MCP-MSGraph

一个从 Microsoft Graph 读取用户个人资料的原型 MCP(Model Context Protocol) 服务。
本项目演示了如何将 MCP 连接到存储在 Microsoft Graph 中的数据,作为概念验证。


创建 Azure AD 应用程序

  1. 登录 Azure Portal。
  2. 前往 Azure Active Directory > App registrations > New registration。
  3. 创建新的应用程序。
  4. 记下生成的 Application (client) ID 和 Client Secret。
  5. 在 API permissions 下,添加 User.Read.All(根据需要选择委托权限或应用程序权限),并授予管理员同意。

运行服务的说明:

  1. 克隆此存储库,或自行设置文件夹和文件结构。

  2. 创建虚拟环境:

python3 -m venv venv
source venv/bin/activate
  1. 安装所需的软件包:
pip install fastapi uvicorn requests requests-oauthlib pydantic
  1. 打开 'main.py',将占位值替换为你的 App ID、Tenant ID 和 Client Secret。

  2. 启动服务

uvicorn main:app --reload

你的服务将在 http://127.0.0.1:8000 上可用。


请求示例

使用 curl(或任意 REST 客户端)发送请求,以获取用户个人资料:

curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
        "action":"readUserProfile",
        "contextId":"abc123",
        "data": {"userId":"[email protected]"}
      }'

结果应类似于:

{"status":"success","action":"readUserProfile","contextId":"abc123","data":{"@odata.context":"https://graph.microsoft.com/beta/$metadata#users('adelev%40M365x17584779.onmicrosoft.com')/profile/$entity","id":"profileId","[email protected]":"https://graph.microsoft.com/beta/$metadata#users('adelev%40M365x17584779.onmicrosoft.com')/profile/account","account":[{"ageGroup":"","countryCode":"","userPrincipalName":"[email protected]","allowedAudiences":"organization","createdDateTime":"2025-01-30T11:06:01.7661211Z","lastModifiedDateTime":"2025-01-30T11:06:01.9431431Z","id":"c74cb3af-2f62-43fa-9709-5d2cfc4b4042","isSearchable":false,"inference":null,"preferredLanguageTag":{"locale":null,"displayName":null},"createdBy":{"user":null,"device":null,"application":{"displayName":"AAD","id":null}},"lastModifiedBy":{"user":null,"device":null,"application":{"displayName":"MsGraph","id":null}},"source":{"type":["AAD","MsGraph"]},"sources":[{"sourceId":"4ce763dd-9214-4eff-af7c-da491cc3782d","isDefaultSource":true},{"sourceId":"0024a795-114d-4031-95c7-5fb543e00e80","properties":["isSipEnabled"]}]},{"ageGroup":"","countryCode":"","userPrincipalName":"","allowedAudiences":"federatedOrganizations","createdDateTime":"2025-01-30T11:06:01.7661213Z","lastModifiedDateTime":"2025-01-30T11:06:01.9431431Z","id":"750f8cc2-2f72-4b38-88c6-531dfc5ed47f","isSearchable":false,"inference":null,"preferredLanguageTag":{"locale":null,"displayName":null},"createdBy":{"user":null,"device":null,"application":{"displayName":"AAD","id":null}},"lastModifiedBy":{"user":null,"device":null,"application":{"displayName":"MsGraph","id":null}},"source":{"type":["AAD","MsGraph"]},"sources":[{"sourceId":"4ce763dd-9214-4eff-af7c-da491cc3782d","isDefaultSource":true},{"sourceId":"0024a795-114d-4031-95c7-5fb543e00e80","properties":["isSipEnabled"]}]}]}}%  

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。