SharePoint MCP Server
SharePoint MCP Server
A TypeScript MCP (Model Context Protocol) server for SharePoint file and folder management via Microsoft Graph API.
Features
11 MCP tools for complete SharePoint file/folder management
Two auth flows: Client Credentials (app-level) and On-Behalf-Of (user-level)
Two transports: stdio (for Claude Desktop/CLI) and Streamable HTTP
Resumable uploads for large files (>4MB)
Content extraction from PDF, Word (.docx), Excel (.xlsx), and text files
Markdown-to-DOCX conversion via Pandoc with optional style templates from SharePoint
Related MCP server: M365 Graph MCP Server
Quick Start
1. Install dependencies
npm install
npm run build2. Configure environment
cp .env.example .env
# Edit .env with your Azure AD and SharePoint detailsRequired environment variables:
AZURE_TENANT_ID- Azure AD tenant IDAZURE_CLIENT_ID- App registration client IDAZURE_CLIENT_SECRET- App registration client secretSHAREPOINT_HOSTNAME- e.g.yourcompany.sharepoint.comSHAREPOINT_SITE_NAME- e.g.YourSiteNameAUTH_FLOW-client_credentials(default) oron_behalf_of
3. Run
stdio transport (for Claude Desktop):
npm startHTTP transport:
npm run start:http
# Server starts on http://localhost:3000/mcpClaude Desktop Configuration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"sharepoint": {
"command": "node",
"args": ["/path/to/sharepoint-mcp-nodejs/dist/index.js"],
"env": {
"AZURE_TENANT_ID": "your-tenant-id",
"AZURE_CLIENT_ID": "your-client-id",
"AZURE_CLIENT_SECRET": "your-client-secret",
"SHAREPOINT_HOSTNAME": "yourcompany.sharepoint.com",
"SHAREPOINT_SITE_NAME": "YourSiteName"
}
}
}
}Available Tools
Tool | Description |
| List folders in a directory |
| Create a new folder |
| Delete a folder |
| Recursive tree view (configurable depth) |
| List documents with metadata |
| Download + extract text (PDF/Word/Excel/text) |
| Convert markdown/text to .docx with optional style template |
| Upload from base64 or text content |
| Upload a local file (resumable for >4MB) |
| Update existing document content |
| Delete a document |
Markdown to DOCX Conversion
The Create_Document_From_Markdown tool converts markdown or plain text to a .docx file using Pandoc and uploads it to SharePoint.
Parameters:
content(required) — Markdown or plain text to convertfolder_path(required) — Destination folder in SharePointfile_name(required) — Output filename (e.g.report.docx)template_path(optional) — Path to a .docx template on SharePoint for styling
Style templates: Create a .docx file in Word with your desired styles (fonts, headings, margins, colors), upload it to SharePoint, then reference it as template_path. Pandoc applies styles from the template to the generated document via --reference-doc.
Testing the Markdown-to-DOCX Tool
Prerequisites: Pandoc must be installed. In Docker this is handled automatically. For local development:
# macOS
brew install pandoc
# Ubuntu/Debian
sudo apt-get install pandoc
# Verify
pandoc --versionTest 1 — Basic conversion (no template):
Using MCP Inspector:
npx @modelcontextprotocol/inspector node dist/index.jsCall Create_Document_From_Markdown with:
{
"content": "# My Report\n\n## Introduction\n\nThis is a **test** document with:\n\n- Bullet point 1\n- Bullet point 2\n\n## Data\n\n| Name | Value |\n|------|-------|\n| A | 100 |\n| B | 200 |",
"folder_path": "Shared Documents",
"file_name": "test-report.docx"
}Then verify with Get_Document_Content:
{
"file_path": "Shared Documents/test-report.docx"
}Test 2 — With style template:
Create a styled .docx template in Word (set fonts, heading styles, margins, colors)
Upload it to SharePoint (e.g. via
Upload_Document_From_Pathor manually)Call
Create_Document_From_Markdownwith the template:
{
"content": "# Styled Report\n\nThis document uses corporate styling.",
"folder_path": "Shared Documents",
"file_name": "styled-report.docx",
"template_path": "Templates/corporate-style.docx"
}Test 3 — Via curl (HTTP transport):
# Initialize session
curl -s -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"}}}'
# Call the tool (use the mcp-session-id from the response headers above)
curl -s -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "mcp-session-id: <SESSION_ID>" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"Create_Document_From_Markdown","arguments":{"content":"# Hello World\n\nTest document.","folder_path":"Shared Documents","file_name":"curl-test.docx"}}}'Upload Strategy
Files <= 4MB: Simple PUT to
/contentendpointFiles > 4MB: Resumable upload session with 3.2MB chunks
Auth Flows
Client Credentials (default)
App-level access using client ID + secret. Best for server-to-server scenarios.
On-Behalf-Of (OBO)
User-level access by exchanging a user token. Use with HTTP transport where the client sends a Authorization: Bearer <token> header.
See docs/azure-setup.md for detailed Azure Portal setup instructions.
Docker
After editing .env with your credentials, build and run with:
docker compose up --build -dThe server will be available at http://localhost:3000/mcp.
After making changes to the source, rebuild and restart (the Docker build compiles TypeScript internally):
docker compose up --build -dTo view logs:
docker compose logs -fDevelopment
npm run dev # Watch mode for TypeScript compilationTesting with MCP Inspector
npx @modelcontextprotocol/inspector node dist/index.jsThis server cannot be deployed
Maintenance
Related MCP Connectors
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Model Context Protocol server for Studex tools, notifications, and profile integrations
A Model Context Protocol (MCP) server for Selise Blocks Cloud integration
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceA lightweight MCP server that enables integration with Microsoft SharePoint, allowing clients to interact with documents and folders through the Model Context Protocol.965MIT
- AlicenseNot gradedqualityCmaintenanceModel Context Protocol server wrapping Microsoft Graph API for OneDrive, SharePoint, and Calendar with read and write operations, plus Teams meeting transcript support.9 npmMIT
- AlicenseAqualityFmaintenanceA production-grade Model Context Protocol (MCP) server for Microsoft SharePoint that connects AI agents to read files, manage folders, and reason over organizational knowledge.1468 PyPI12MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that connects AI assistants to SharePoint via Microsoft Graph API, enabling natural language queries for documents, lists, and site management.85-