SharePoint MCP Server

SharePoint MCP Server

Provides Claude with access to Microsoft SharePoint via the Microsoft Graph API, enabling folder management, document operations (upload, download, read, update, delete), and metadata management with secure OAuth 2.0 authentication.

Category
访问服务器

README

SharePoint MCP Server

A Model Context Protocol (MCP) server that provides Claude with access to Microsoft SharePoint via the Microsoft Graph API.

Features

  • Folder Management: List, create, delete folders and view folder tree structure
  • Document Operations: Upload, download, read, update, and delete documents
  • Metadata Support: Get and update file metadata fields
  • OAuth 2.0 Authentication: Secure user-based authentication via browser flow
  • Consistent Architecture: Same modular pattern as Outlook MCP for easy maintenance

Quick Start

1. Install Dependencies

cd sharepoint-mcp
npm install

2. Azure AD Setup

  1. Go to Azure Portal > App registrations > New registration
  2. Name: sharepoint-mcp (or your preferred name)
  3. Supported account types: "Accounts in this organizational directory only"
  4. Redirect URI: Web > http://localhost:3334/auth/callback
  5. Click Register

After registration:

  1. Copy the Application (client) ID
  2. Copy the Directory (tenant) ID
  3. Go to Certificates & secrets > New client secret
    • Copy the Value (not the Secret ID!)
  4. Go to API permissions > Add a permission > Microsoft Graph > Delegated permissions
    • Add: Sites.ReadWrite.All, Files.ReadWrite.All
  5. Click Grant admin consent (requires admin)

3. Configure Environment

Create a .env file:

SHAREPOINT_CLIENT_ID=your-client-id
SHAREPOINT_CLIENT_SECRET=your-client-secret-value
SHAREPOINT_TENANT_ID=your-tenant-id
SHAREPOINT_SITE_URL=https://your-tenant.sharepoint.com/sites/your-site
SHAREPOINT_DOC_LIBRARY=Shared Documents

4. Authenticate

# Start the auth server
npm run auth-server

# Open http://localhost:3334 in your browser and complete authentication

5. Run the Server

npm start

Claude Desktop Integration

Add to your Claude Desktop config:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "sharepoint-assistant": {
      "command": "node",
      "args": ["/path/to/sharepoint-mcp/index.js"],
      "env": {
        "SHAREPOINT_CLIENT_ID": "your-client-id",
        "SHAREPOINT_CLIENT_SECRET": "your-client-secret",
        "SHAREPOINT_TENANT_ID": "your-tenant-id",
        "SHAREPOINT_SITE_URL": "https://your-tenant.sharepoint.com/sites/your-site",
        "SHAREPOINT_DOC_LIBRARY": "Shared Documents"
      }
    }
  }
}

Available Tools

Authentication

Tool Description
authenticate Start the OAuth authentication flow
check_auth_status Check current authentication status
logout Clear stored tokens

Folder Operations

Tool Description
list_folders List folders in a directory
create_folder Create a new folder
delete_folder Delete an empty folder
get_folder_tree Get recursive folder structure

Document Operations

Tool Description
list_documents List documents in a folder
get_document_content Read document content
upload_document Upload content as a new document
upload_document_from_path Upload a local file
update_document Update an existing document
delete_document Delete a document
download_document Download to local filesystem
get_file_metadata Get file metadata fields
update_file_metadata Update metadata fields

Development

# Run with MCP Inspector for testing
npm run inspect

# Run in test mode (mock data)
npm run test-mode

# Run tests
npm test

Architecture

sharepoint-mcp/
├── index.js              # Main MCP server entry point
├── config.js             # Configuration settings
├── sharepoint-auth-server.js  # OAuth callback server
├── auth/                 # Authentication module
│   ├── index.js
│   ├── token-manager.js  # Token storage & refresh
│   └── tools.js          # Auth tools
├── folder/               # Folder operations
│   ├── index.js
│   └── tools.js
├── document/             # Document operations
│   ├── index.js
│   └── tools.js
└── utils/                # Shared utilities
    ├── index.js
    └── graph-api.js      # Graph API client

Troubleshooting

"Authentication required" error

  • Ensure you've run the auth server and completed browser authentication
  • Check that tokens are stored in ~/.sharepoint-mcp-tokens.json

"AADSTS7000215" error

  • You're using the Secret ID instead of the Secret Value
  • Go back to Azure and copy the actual secret value

"Access denied" error

  • Ensure admin consent was granted for the API permissions
  • Verify the site URL is correct

Port 3334 in use

npx kill-port 3334

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选