Back to MCP directory
publicPublicdnsLocal runtime

server-sharepoint

SharePoint Online MCP服务器是一个强大的工具,通过SharePoint REST API实现与SharePoint Online的无缝交互,支持多种操作如用户管理、站点管理、列表操作等,并提供两种认证方式。

article

README

🚀 SharePoint Online MCP Server

最强大的 SharePoint MCP 服务器,可通过 SharePoint REST API 与 SharePoint Online 进行无缝交互。该 MCP 服务器专为与 Claude Desktop 应用程序配合使用而设计,但也可由其他 MCP 客户端(如 Cline)使用。

SharePoint MCP Server

Node.js Version SharePoint REST API npx License SharePoint Online Windows Linux macOS

🚀 快速开始

本项目是一个强大的 SharePoint MCP 服务器,能借助 SharePoint REST API 与 SharePoint Online 实现无缝交互。以下将详细介绍如何使用该服务器。

✨ 主要特性

  • 支持通过 SharePoint REST API 与 SharePoint Online 进行无缝交互。
  • 可与 Claude Desktop 应用配合使用,也支持其他 MCP 客户端。
  • 提供两种认证方式:客户端密钥认证和证书认证。

📦 安装指南

安装 Node.js

安装 Node.js 版本:22.14.0 或更高版本

安装并配置 Claude Desktop

  • 下载 Claude Desktop 并进行安装。
  • 在 Claude Desktop 中,依次点击 File > Settings > DeveloperFile > Settings
  • 点击 Edit ConfigConfig
  • 在编辑器中打开 claude_desktop_config.json 配置文件,也可使用之前 PowerShell 脚本生成的 claude_desktop_config.json 文件。
  • 将以下内容粘贴到配置中,并使用你自己的值更新 mcpServers 部分:

证书认证配置

{
  "mcpServers": {
    "server-sharepoint": {
      "command": "npx",
      "args": [
        "-y",
        "server-sharepoint"
      ],
      "env": {
        "AZURE_APPLICATION_ID": "<your-app-id>",
        "AZURE_APPLICATION_CERTIFICATE_THUMBPRINT": "<your-certificate-thumbprint>",
        "AZURE_APPLICATION_CERTIFICATE_PASSWORD": "<your-certificate-password>",
        "M365_TENANT_ID": "<your-tenant-id>"
      }
    }
  }
} 

客户端密钥认证配置(不推荐)

{
  "mcpServers": {
    "server-sharepoint": {
      "command": "npx",
      "args": [
        "-y",
        "server-sharepoint"
      ],
      "env": {
        "SHAREPOINT_CLIENT_ID": "<your-client-id>",
        "SHAREPOINT_CLIENT_SECRET": "<your-client-secret>",
        "M365_TENANT_ID": "<your-tenant-id>"
      }
    }
  }
} 

💡了解如何从 Entra ID 获取租户 ID

  • 保存配置文件并重启 Claude Desktop。确保通过任务栏图标完全退出应用程序: Quick Claude App

📚 详细文档

SharePoint 操作可用性

用户操作

| 操作 | 是否可用 | 备注 | |------|------|------| | 列出网站用户 | ✅ | | | 列出网站组 | ✅ | | | 获取组成员 | ✅ | | | 添加组成员 | ✅ | | | 删除组成员 | ✅ | | | 获取用户配置文件 | ❌ | /_api/SP.UserProfiles.PeopleManager | | 更新用户配置文件 | ❌ | |

网站操作

| 操作 | 是否可用 | |------|------| | 获取网站详细信息 | ✅ | | 更新网站属性 | ✅ | | 获取全局导航链接 | ✅ | | 获取快速导航链接 | ✅ | | 添加导航链接 | ✅ | | 更新导航链接 | ✅ | | 删除导航链接 | ✅ | | 获取子网站 | ✅ | | 创建子网站 | ❌ | | 删除子网站 | ✅ |

区域设置操作

| 操作 | 是否可用 | |------|------| | 获取区域设置 | ✅ | | 更新区域设置 | ❌ |

功能操作

| 操作 | 是否可用 | |------|------| | 获取网站集功能 | ✅ | | 获取所有网站功能 | ✅ | | 获取网站功能 | ✅ | | 获取所有网站功能 | ✅ | | 激活功能 | ❌ | | 停用功能 | ❌ |

列表操作

| 操作 | 是否可用 | 备注 | |------|------|------| | 获取所有列表 | ✅ | | | 创建列表 | ✅ | | | 向列表添加网站内容类型 | ✅ | | | 从列表中删除内容类型 | ✅ | | | 向列表内容类型添加字段 | ❌ | | | 从列表内容类型中删除字段 | ❌ | | | 更新列表 | ✅ | | | 获取列表字段 | ✅ | | | 创建列表字段 | ✅ | 仅基本场景 | | 更新列表字段 | ✅ | | | 删除列表字段 | ✅ | | | 设置列表字段格式 | ❌ | | | 设置列表视图格式 | ❌ | | | 删除列表 | ✅ | |

列表视图操作

| 操作 | 是否可用 | |------|------| | 获取列表视图 | ✅ | | 删除列表视图 | ✅ | | 创建列表视图 | ✅ | | 更新列表视图 | ✅ | | 获取视图字段 | ✅ | | 添加视图字段 | ✅ | | 删除视图字段 | ✅ | | 删除所有视图字段 | ✅ | | 移动视图字段 | ✅ |

列表内容类型操作

| 操作 | 是否可用 | 备注 | |------|------|------| | 获取所有列表内容类型 | ✅ | | | 获取列表内容类型 | ✅ | | | 创建列表内容类型 | ❌ | | | 更新列表内容类型 | ✅ | 仅更改内容类型标题和组 | | 删除列表内容类型 | ✅ | |

列表项操作

| 操作 | 是否可用 | |------|------| | 获取所有列表项 | ✅ | | 创建列表项 | ✅ | | 更新列表项 | ✅ | | 删除列表项 | ✅ |

网站内容类型操作

| 操作 | 是否可用 | 备注 | |------|------|------| | 获取所有网站内容类型 | ✅ | | | 获取网站内容类型 | ✅ | | | 创建网站内容类型 | ❌ | | | 更新网站内容类型 | ✅ | 仅更改内容类型标题和组 | | 删除网站内容类型 | ✅ | |

页面操作

| 操作 | 是否可用 | |------|------| | 创建现代页面 | ✅ | | 删除现代页面 | ✅ | | 列出现代页面 | ✅ | | 添加页面 Web 部件 | ❌ | | 删除页面 Web 部件 | ❌ | | 移动页面 Web 部件 | ❌ | | 更新页面 Web 部件 | ❌ |

文档操作

| 操作 | 是否可用 | |------|------| | 创建文档 | ❌ | | 上传文档 | ❌ | | 移动文档 | ❌ | | 复制文档 | ❌ |

分类操作

| 操作 | 是否可用 | |------|------| | 获取分类组 | ❌ | | 创建分类标签 | ❌ | | 更新分类标签 | ❌ | | 删除分类标签 | ❌ |

搜索操作

| 操作 | 是否可用 | |------|------| | 在 SharePoint 网站内搜索 | ✅ |

认证选项

服务器支持两种认证方式:

  1. 客户端密钥认证 - 传统的客户端 ID 和密钥。这是仅应用程序认证方式,已弃用,2026 年 4 月后将无法使用。
  2. 证书认证 - 更现代的方法,使用带有证书的 Azure AD 应用注册。

选项 1:客户端密钥认证(2026 年 4 月后将无法使用)

此选项需要 SharePoint 管理员角色。

配置步骤

⚠️ 重要提示

你需要是 SharePoint 租户管理员或全局管理员才能创建 SharePoint 应用程序。

允许仅 SharePoint 应用程序
  • 此处 下载并安装 SharePoint Online 管理外壳。
  • 打开 PowerShell 并运行以下命令,确保仅 SharePoint 应用程序已启用:
Connect-SPOService -Url https://<your-tenant>-admin.sharepoint.com/
Set-SPOTenant -DisableCustomAppAuthentication $false
使用客户端密钥创建仅 SharePoint 应用程序
  • 打开 https://<your-tenant>.sharepoint.com/_layouts/15/appregnew.aspx
  • 点击 Generate 以创建新的客户端 ID 和密钥。
  • 填写以下字段:
    • 应用程序域:www.example.com(或你拥有的任何域名)
    • 重定向 URL:http://example.com App registration
  • 点击 Create 以创建应用程序。
  • Client IDClient Secret 值复制到安全的地方,后续会用到。
授予应用程序权限
  • 打开 https://<your-tenant>.sharepoint.com/_layouts/15/appinv.aspx
  • Client ID 值粘贴到 App ID 字段中,然后点击 LookupLookup
  • 将以下 XML 粘贴到 App Permission Request XML 字段中:
<AppPermissionRequests AllowAppOnlyPolicy="true">
   <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
</AppPermissionRequests>
  • 点击 Create,然后点击 Trust It 以授予应用程序权限。 Trust it

选项 2:证书认证

基于证书的认证比客户端密钥提供更好的安全性。它使用证书来证明应用程序的身份,而不是共享密钥。

⚠️ 重要提示

此选项需要全局管理员角色才能为应用程序提供必要的权限。

克隆仓库
git clone https://github.com/Zerg00s/server-sharepoint.git
使用证书创建 Azure AD 应用程序

导航到克隆的仓库,并使用提供的 PowerShell 脚本创建带有证书的 Azure AD 应用程序:

.\Create-SPAppCertificate.ps1 -AppName "SharePoint-Server-MCP" -CertName "SharePoint-Server-MCP-Cert" -CertPassword "YourSecureP@ssw0rd!"

此脚本将:

  1. 在你的证书存储中创建自签名证书。
  2. 注册 Azure AD 应用程序。
  3. 将证书添加到应用程序。
  4. 配置所需的 SharePoint 权限。
  5. 生成包含必要设置的配置文件。
  6. 输出与 Claude Desktop 兼容的 claude_desktop_config.json
授予管理员同意

运行脚本后,你将获得一个管理员同意 URL。在浏览器中打开该 URL,并以全局管理员身份登录以授予权限同意。

如何与 MCP 服务器“对话”

  • 打开 Claude Desktop 并提出问题,例如 Get me the list of lists from https://<your-tenant>.sharepoint.com/sites/Dashboard-Communication. Present the results in a table form. don't use code

Sample result

🔧 技术细节

为贡献者提供的信息

构建新的 npm 包

npm run build
npm publish
npx clear-npx-cache
npm cache clean --force

本地运行 MCP 检查器

npx @modelcontextprotocol/inspector node build/src/index.js

MCP 服务器上下文 7 文档(适用于大语言模型)

MCP 服务器上下文 7 文档(适用于大语言模型)

SharePoint REST API 文档

本地开发

  • 克隆仓库
  • nvm use 22.14.0
  • npm install
  • 更新 claude_desktop_config.json 文件中的 MCP 配置。示例如下:
客户端密钥认证(2026 年 4 月后将无法使用)
{
"mcpServers": {
  "sharepoint": {
      "command": "node",
      "args": [
        "C:\\trash\\server-sharepoint\\build\\index.js"
      ],
      "env": {
        "SHAREPOINT_CLIENT_ID": "aaa2ce0f-7c97-4e51-acd9-4ac99e6831d0",
        "SHAREPOINT_CLIENT_SECRET": "bbb0OFF+aWkua2NJRERUMGduMmhsWDhGUTVPUHJZLXd5dldSemNPUw==",
        "M365_TENANT_ID": "22bcd981-eaa6-475f-aac3-3afca0c35261"
      }
    }
  }
}
证书认证(推荐)
{
"mcpServers": {
  "sharepoint": {
      "command": "node",
      "args": [
        "C:\\trash\\server-sharepoint\\build\\index.js"
      ],
      "env": {
        "AZURE_APPLICATION_ID": "5bc793c7-3eb0-4b86-88bf-b464b2459c4c",
        "AZURE_APPLICATION_CERTIFICATE_THUMBPRINT": "3D38D1D8AC3228CAD35E527D1105101B0B90CE86",
        "AZURE_APPLICATION_CERTIFICATE_PASSWORD": "TemporaryP@ssw0rd",
        "M365_TENANT_ID": "11bcd981-eaa6-475f-aac3-3afca0c35261"
      }
    }
  }
}
  • 对代码进行更改
  • 构建代码 npm run build
  • 使用 MCP 检查器进行测试:npx @modelcontextprotocol/inspector node build/src/index.js -y

📄 许可证

本项目采用 MIT 许可证

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client