mcp共享点
A. 模型上下文协议(MCP)服务器 暴露核心 Microsoft SharePoint/Microsoft Graph API LLM代理(例如Claude Desktop)可用的工具功能。
此服务器设计有 代理优先法:
- 无法直接访问本地文件系统
- 确定性输入和输出
______________________________________________________________________
✨ 特性
服务器允许代理执行以下操作:
📁 文件夹管理
路径可以/必须作为参数传递
- 列出文件夹
- 创建新文件夹
- 删除文件夹(仅当为空时)
- 检索文件夹树结构
📄 文档管理
路径可以/必须作为参数传递
- 列出文件
- 阅读文档内容(PDF、Word、Excel、PowerPoint)
- 上传新文档(文本或二进制)
- 更新现有文档(替换全部内容)
- 删除文档
______________________________________________________________________
🔐 先决条件
- Node.js
- Microsoft 365租户
- 在中注册的应用程序 微软Entra ID 具有图形权限
推荐的图形权限
Sites.Read.All
Sites.ReadWrite.All
Files.Read.All
Files.ReadWrite.All⚠️ 使用 应用程序权限
______________________________________________________________________
- 通过身份验证 Microsoft Entra ID应用程序注册
- 所有操作均通过以下方式执行 微软图形
______________________________________________________________________
🧭 注册应用程序的分步指南
如果你已经注册了一个应用程序,你可以跳过这部分
- 转到您的Microsoft Entra网站
https://entra.microsoft.com/... - 点击左侧菜单上的“应用程序注册”
- 点击“新注册”
- 插入您喜欢的名称,然后单击“注册”
🧭 授权分步指南
如果您已经设置了授权,则可以跳过此部分
- 转到您的Microsoft Entra网站
https://entra.microsoft.com/... - 在左侧菜单上单击“应用程序注册”
- 在表格中点击您注册的应用程序
- 在左侧第二个菜单上单击“API授权”
- 点击“添加授权”
- 点击“Microsoft Graph”
- 点击“申请授权”
- 如果这是您第一次,或者您不熟悉授权,请在搜索栏中键入“网站”
- 选择“Sites.FullControl.All”,然后选择“添加授权”
⚠️此授权赋予应用程序完全控制权,建议使用所需的最小权限授权
- 点击“同意管理员访问 _名字_“,然后单击“是”
🧭 获取sharepoint参数的分步指南
如果您已经知道client_id、client_secret、tenant_id、site_id、drive_id、list_id,则可以跳过此部分
- 在微软Entra网站上
https://entra.microsoft.com/,在左侧菜单上单击“应用程序注册” - 在表格中点击您注册的应用程序
- 在顶部信息中,您可以看到 客户端ID 和 租户ID 作为ID应用程序(客户端)和ID目录(租户)
- 点击“客户端凭据:0个证书,0个机密”
- 点击“新客户机密”
- 插入所需的描述和过期时间,然后单击“添加”
- 在表中将有新的客户端机密,复制“值”字段。
⚠️您只能复制一次,之后将无法再次看到“值”
- 复制的“值”是 客户端密钥
- 发出此请求以获取连续请求所需的access_token:
curl --request POST \
--url "https://login.microsoftonline.com//oauth2/v2.0/token" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "client_id=" \
--data-urlencode "client_secret=" \
--data-urlencode "scope=https://graph.microsoft.com/.default" \
--data-urlencode "grant_type=client_credentials"响应是一个json,你只需要属性“access_token”\ 10.提出此请求以获取 站点ID,域名和网站名称可以在Sharepoint网站的URL上看到: https://.sharepoint.com/sites//...
curl -X GET "https://graph.microsoft.com/v1.0/sites/.sharepoint.com:/sites/?select=id" \
-H "Authorization: Bearer " \
-H "Accept: application/json"响应是json,你只需要属性“id”\ 11.提出此请求以获取 驱动器id
curl -X GET "https://graph.microsoft.com/v1.0/sites//drives?select=id,name" \
-H "Authorization: Bearer " \
-H "Accept: application/json"响应是一个json,属性“value”是json的数组,每个json是一个不同的驱动器,你只需要属性“id”\ 12.提出此请求以获取 列表id
curl -s -X GET "https://graph.microsoft.com/v1.0/sites//lists?select=id,displayName" \
-H "Authorization: Bearer " \
-H "Accept: application/json"响应是一个json,属性“value”是json的数组,每个json都是一个不同的列表,你只需要属性“id”
🧭 向Sharepoint添加自定义属性/列的分步指南
这是可选的,tou可以在默认属性/列中搜索
- 转到您的Sharepoint网站
https://.sharepoint.com/sites//... - 在左侧菜单上,单击“文档”
- 在右侧的列之后,单击“+添加列”
- 为新列选择所需的类型,安全的选择是“多行文本”
- 输入新列的名称,其他字段是可选的,不是必需的
- 点击“保存”
⚙️ 配置
授权是通过以下方式获得的 应用程序变量. 这些变量必须在每次调用中提供。
必需的应用程序变量
| 变量 | 描述 |
|---|---|
tenantId | Microsoft Entra目录租户ID |
clientId | Microsoft Entra应用程序客户端ID |
clientSecret | Microsoft Entra客户端机密 |
需要其他常见变量。 这取决于您使用的Sharepoint。
| 变量 | 描述 |
|---|---|
siteId | Sharepoint完整站点ID |
driveId | Sharepoint驱动器ID |
listId | Sharepoint列表ID |
______________________________________________________________________
🧰 可用的MCP工具
📁 文件夹
getFolders
列出给定路径中的文件夹。
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "path",
"type": "string",
"required": "true",
"descrciption": "The path in SharePoint to retrieve folders from",
"example": "cartella_1/cartella_2"
}______________________________________________________________________
createFolder
创建一个新文件夹。
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "path",
"type": "string",
"required": "true",
"descrciption": "The parent path where the folder will be created",
"example": "cartella_1/cartella_2"
},
{
"name": "folderName",
"type": "string",
"required": "true",
"descrciption": "The name of the new folder to create",
"example": "cartella_3"
}______________________________________________________________________
deleteFolder
删除文件夹 只有当它是空的.
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "path",
"type": "string",
"required": "true",
"descrciption": "The path to the folder to delete",
"example": "cartella_1/cartella_2/cartella_3"
}______________________________________________________________________
getFolderTree
检索文件夹树结构。
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "path",
"type": "string",
"required": "false",
"descrciption": "The starting path (default: 'root')",
"example": "cartella_1/cartella_2"
},
{
"name": "maxDepth",
"type": "number",
"required": "false",
"descrciption": "Maximum depth to traverse (default: 10)",
"example": 5
}______________________________________________________________________
📄 文件
getDocuments
列出文件夹中的文档。
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "path",
"type": "string",
"required": "true",
"descrciption": "The path in SharePoint to retrieve documents from",
"example": "cartella_1/cartella_2"
}______________________________________________________________________
getDocumentContent
检索和提取文档的文本内容。
支持的格式:
- 原生PDF
- Word/Excel/PowerPoint(通过图形转换为PDF)
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "filePath",
"type": "string",
"required": "true",
"descrciption": "The path to the file",
"example": "cartella_1/cartella_2/file.txt"
}______________________________________________________________________
uploadDocument
上传新文档。
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "filePath",
"type": "string",
"required": "true",
"descrciption": "The path where the file will be uploaded",
"example": "cartella_1/cartella_2"
},
{
"name": "content",
"type": "string",
"required": "true",
"descrciption": "The string or base64-encoded content of the file to upload",
"example": "Questo è il testo del doc .txt"
},
{
"name": "contentType",
"type": "string",
"required": "false",
"descrciption": "The MIME type of the content (default: 'application/octet-stream')",
"example": "application/octet-stream"
},
{
"name": "overwrite",
"type": "boolean",
"required": "false",
"descrciption": "Whether to overwrite existing files (default: false)",
"example": true
}______________________________________________________________________
updateDocumentContent
完全更新现有文档。
⚠️ 该操作将替换文件的全部内容。\ ⚠️ 如果文件不存在,则操作失败。
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "filePath",
"type": "string",
"required": "true",
"descrciption": "The path to the existing file to update",
"example": "cartella_1/cartella_2"
},
{
"name": "content",
"type": "string",
"required": "true",
"descrciption": "The new string or base64-encoded content of the file",
"example": "Questo è il nuovo testo del doc .txt"
},
{
"name": "contentType",
"type": "string",
"required": "false",
"descrciption": "The MIME type of the content (default: 'application/octet-stream')",
"example": "application/pdf"
}______________________________________________________________________
deleteDocument
删除文档(移动到SharePoint回收站)。
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "driveId",
"type": "string",
"required": "true",
"descrciption":" The ID of the drive within the SharePoint site",
"example": "f!aB12Cd34E5f6aB12cd34E5f6abd37cD37aB12Cd34E5f6aB12cd34E5f6abd3712"
},
{
"name": "filePath",
"type": "string",
"required": "true",
"descrciption": "The path to the file to delete",
"example": "cartella_1/cartella_2/file.docx"
},______________________________________________________________________
searchDocumentsByKeywords
搜索包含给定属性中至少一个关键字的文档。
输入:
{
"name": "clientId",
"type": "string",
"required": "true",
"descrciption": "The application (client) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "clientSecret",
"type": "string",
"required": "true",
"descrciption": "The client secret",
"example": "1~A1B~aB12Cd34E5f6aB12cd34E5f6ab~d37cD37"
},
{
"name": "tenantId",
"type": "string",
"required": "true",
"descrciption": "The directory (tenant) ID",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "siteId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint site",
"example": "namexyz.sharepoint.com,ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6,fb12cd34-e5f6-g7h8-i9j9-ab12cd34e5f9"
},
{
"name": "listId",
"type": "string",
"required": "true",
"descrciption": "The ID of the SharePoint list to search in",
"example": "ab12cd34-e5f6-g7h8-i9j9-ab12cd34e5f6"
},
{
"name": "keywords",
"type": "Array",
"required": "true",
"descrciption": "Array of keywords to search for",
"example": "["word_1", "word_2", "word_3"]"
},
{
"name": "attributeName",
"type": "string",
"required": "true",
"descrciption": The document attribute/column to search in",
"example": "name"
},______________________________________________________________________
🚀 试试Aisuru!
此MCP服务器很容易集成到 艾苏鲁,我们的AI代理平台,您可以在其中创建、测试和部署智能代理,并访问像mcp sharepoint服务器这样的强大工具。
访问 Aisuru.com 今天就开始与您的代理商合作!
______________________________________________________________________
⚠️ 已知限制
- 不支持部分文档更新
- 大文件(>4MB)需要上传会话(尚未实现)
- 从复杂的PDF/Excel文件中提取文本可能会失去结构
______________________________________________________________________
🔒 安全
- 永远不要暴露
client secret公开地 - 定期轮换机密
- 授予所需的最低图形权限
