FM

ftaricano/mcp-onedrive-sharepoint

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

8 stars 9 forks 质量 81 趋势 36MIT

MCP server and CLI for OneDrive and SharePoint document libraries via Microsoft Graph, with app-only auth and a small default tool set

概览

Give AI agents (over MCP) and shell scripts (through the ods CLI) access to OneDrive and SharePoint document libraries via Microsoft Graph, with app-only authentication and a small default tool set. Real CLI output against a mocked Microsoft Graph with fictional data (the Acme site on contoso.sharepoint.com). - the MCP server and the CLI share the same tools, auth and handlers. - the core profile has 10 everyday tools; delete, share, permission, list-item and raw Graph tools are opt-in. - request URLs are checked against https://graph.microsoft.com before the token is attached, and local file access is confined to one root directory. - tool results are JSON, so jq and friends just work. You need Node.js 20+ and a Microsoft Entra ID app registration with the Files.ReadWrite.All and Sites.ReadWrite.All Application permissions and admin consent (see Requirements). Prefer injecting the secret from your secret manager over typing it into the shell.

README

以下为原文 README 节选,完整内容请查看原文。

MCP OneDrive/SharePoint Server

Give AI agents (over MCP) and shell scripts (through the ods CLI) access to OneDrive and SharePoint document libraries via Microsoft Graph, with app-only authentication and a small default tool set.

Real CLI output against a mocked Microsoft Graph with fictional data (the Acme site on contoso.sharepoint.com).

  • One core, two front ends: the MCP server and the CLI share the same tools, auth and handlers.
  • Small default surface: the core profile has 10 everyday tools; delete, share, permission, list-item and raw Graph tools are opt-in.
  • Guarded requests: request URLs are checked against https://graph.microsoft.com before the token is attached, and local file access is confined to one root directory.
  • Script friendly: tool results are JSON, so jq and friends just work.

Quickstart

You need Node.js 20+ and a Microsoft Entra ID app registration with the Files.ReadWrite.All and Sites.ReadWrite.All Application permissions and admin consent (see Requirements).

git clone https://github.com/ftaricano/mcp-onedrive-sharepoint.git
cd mcp-onedrive-sharepoint
npm ci && npm run build
export MICROSOFT_GRAPH_TENANT_ID=
export MICROSOFT_GRAPH_CLIENT_ID=
export MICROSOFT_GRAPH_CLIENT_SECRET=
node build/cli.js list
node build/cli.js list_files --siteUrl=https://contoso.sharepoint.com/sites/Docs --path=/

Prefer injecting the secret from your secret manager over typing it into the shell. To use the MCP server, point your MCP client at node /absolute/path/to/mcp-onedrive-sharepoint/build/index.js with the same three variables in its environment (see MCP stdio snippet).

Example

List a folder of a SharePoint site and keep only the fields you need:

node build/cli.js list_files --siteUrl=https://contoso.sharepoint.com/sites/Acme --path=/Reports \
  | jq -c '.items[] | {name, type, size}'
{"name":"2026-Q2","type":"folder","size":0}
{"name":"Quarterly report Q1.pdf","type":"file","size":482133}
{"name":"Sales pipeline.xlsx","type":"file","size":91520}
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "sharepoint": { "command": "node", "args": ["/absolute/path/to/mcp-onedrive-sharepoint/build/index.js"], "env": { "MICROSOFT_GRAPH_TENANT_ID": "<tenant-uuid>", "MICROSOFT_GRAPH_CLIENT_ID": "<application-client-id>", "MICROSOFT_GRAPH_CLIENT_SECRET": "<client-secret>" } } } }