sharepoint-mcp

The MCP Server that gives your AI agent a brain for Microsoft SharePoint

๐Ÿ—‚๏ธ sharepoint-mcp

The MCP Server that gives your AI agent a brain for Microsoft SharePoint

CI PyPI version Python License: MIT Docker MCP

A production-grade Model Context Protocol (MCP) server for Microsoft SharePoint.
Connect Claude Desktop, VS Code Copilot, Cursor, Continue, or any MCP-compatible AI agent
to your SharePoint โ€” read files, manage folders, and reason over your organisation's knowledge.

๐Ÿ“š Docs ยท ๐Ÿ—บ๏ธ Roadmap ยท ๐Ÿ› Bugs ยท ๐Ÿ’ก Features


๐Ÿ“‘ Table of Contents


๐Ÿง  Why sharepoint-mcp?

Most AI agents only know what's in their training data.
sharepoint-mcp gives your agent live access to your organisation's real knowledge.

Without sharepoint-mcpWith sharepoint-mcp
๐Ÿคท Agent guesses or hallucinatesAgent reads the actual document
๐Ÿ“‹ You copy-paste content manuallyAgent fetches files automatically
๐Ÿ”’ Knowledge locked in SharePointKnowledge flows into your AI workflow
๐ŸŒ Static, one-shot answersAgent reasons, rewrites, and saves back

๐Ÿš€ What Your Agent Can Do

๐Ÿ“– Understand Any Document

You: "Summarise the Q3 report in the Finance folder"
Agent: โ†’ Get_Document_Content("Finance", "Q3_Report.pdf")
       โ†’ Reads full extracted text
       โ†’ Returns a sharp, accurate summary

โœ๏ธ Read โ†’ Reason โ†’ Write

You: "Translate the proposal to French and save it"
Agent: โ†’ Get_Document_Content โ†’ translate โ†’ Upload_Document

๐Ÿ—‚๏ธ Navigate Your Library

You: "What files are in the Legal/Contracts folder?"
Agent: โ†’ List_SharePoint_Documents("Legal/Contracts")

๐Ÿ“Š Supported File Formats

๐Ÿ“„ Format๐Ÿค– What the Agent Gets
PDFFull text from every page
Word .docx .docComplete document content
Excel .xlsx .xlsAll sheets as structured text
Text, JSON, Markdown, HTML, YAML, PythonRaw content as-is
Images, ZIP, binariesFile type + Base64

โœจ Features

FeatureDescription
๐Ÿ”€Dual API SupportChoose Office365 REST or Microsoft Graph API
๐Ÿ“Folder ManagementList, create, delete, get full recursive tree
๐Ÿ“„Document ManagementUpload, download, update, delete, search, read content
๐Ÿท๏ธMetadata ManagementRead and update SharePoint list-item fields
๐Ÿ”Smart ParsingAuto-detects PDF / Word / Excel / text
๐Ÿ”ŽKQL SearchNative SharePoint KQL search for semantic file finding
๐Ÿ“‚Flexible Library ScopeScope to a subfolder or access the entire library root
๐Ÿ”Auto-RetryExponential backoff on SharePoint 429/503 throttling
๐Ÿš€Dual Transportstdio for desktop ยท http for Docker/remote
๐ŸชตStructured LoggingJSON in production ยท coloured console in dev
๐ŸณDocker-ReadySingle command: docker compose up -d
๐Ÿ›ก๏ธNon-Root ContainerRuns as unprivileged user inside Docker
๐ŸฉบHealth CheckLive /health endpoint with real SharePoint check
๐Ÿค–CI/CDTested on Python 3.10 ยท 3.11 ยท 3.12 ยท 3.13

โšก Quickstart

1๏ธโƒฃ Install

pip install sharepoint-mcp

Or from source:

git clone https://github.com/ravikant1918/sharepoint-mcp.git
cd sharepoint-mcp && pip install -e .

2๏ธโƒฃ Configure

cp .env.example .env
# Open .env and fill in your Azure AD credentials
SHP_ID_APP=your-azure-app-client-id
SHP_ID_APP_SECRET=your-azure-app-secret
SHP_TENANT_ID=your-tenant-id
SHP_SITE_URL=https://your-tenant.sharepoint.com/sites/your-site
SHP_API_TYPE=office365   # or "graph" / "graphql" for Microsoft Graph API

๐Ÿ”‘ New to Azure AD? Follow the step-by-step guide โ†’
๐Ÿ”€ Choose Your API: SharePoint MCP supports both Office365 REST API (default) and Microsoft Graph API. See API Configuration Guide โ†’

Optional: Scope to a subfolder

By default, the server accesses your entire document library root. To restrict operations to a specific subfolder:

# Only operate within this subfolder (omit for full library access)
SHP_DOC_LIBRARY=mcp_server

# Library name (only needed if your org renamed "Shared Documents")
# Graph API auto-detects the default drive โ€” this is only for Office365 REST API
# SHP_LIBRARY_NAME=Shared Documents

3๏ธโƒฃ Run

# ๐Ÿ” Interactive testing with MCP Inspector
npx @modelcontextprotocol/inspector -- sharepoint-mcp

# โ–ถ๏ธ Run directly
sharepoint-mcp

๐Ÿณ Docker

The fastest way to deploy for remote or cloud use.

๐Ÿ“‹ Usage Scenarios

Scenario A: Pull Latest Version from DockerHub (Recommended)

Use this for production deployments with the latest stable release:

# Step 1: Clone repository
git clone https://github.com/ravikant1918/sharepoint-mcp.git
cd sharepoint-mcp

# Step 2: Create .env file with your SharePoint credentials
cp .env.example .env
# Edit .env and fill in:
# SHP_ID_APP=your-app-id
# SHP_ID_APP_SECRET=your-secret
# SHP_TENANT_ID=your-tenant-id
# SHP_SITE_URL=https://yourcompany.sharepoint.com/sites/yoursite

# Step 3: Start container (pulls from DockerHub automatically)
docker compose up -d

# Step 4: Verify it's running
docker compose ps
curl http://localhost:8000/health

# View logs
docker compose logs -f

# Stop container
docker compose down

What happens: Pulls ravikant1918/sharepoint-mcp:latest from DockerHub with automatic architecture detection (Intel/ARM).


Scenario B: Use Specific Version

Lock to a specific version for stability or testing:

# Step 1: Set version via environment variable
SHAREPOINT_MCP_VERSION=v1.0.1 docker compose up -d

# Or add to .env file
echo "SHAREPOINT_MCP_VERSION=v1.0.1" >> .env
docker compose up -d

What happens: Pulls ravikant1918/sharepoint-mcp:v1.0.1 instead of latest.


Scenario C: Build Locally from Source

Use this for development or when you've made local code changes:

# Step 1: Clone and setup
git clone https://github.com/ravikant1918/sharepoint-mcp.git
cd sharepoint-mcp
cp .env.example .env
# Edit .env with your credentials

# Step 2: Build from local Dockerfile and start
docker compose up -d --build

# Step 3: Rebuild after code changes
docker compose down
docker compose up -d --build

What happens: Builds image from local Dockerfile, tags as ravikant1918/sharepoint-mcp:latest, and starts container.


Scenario D: Use Custom Image/Fork

If you've forked the repo and published to your own DockerHub:

# Use your custom image
SHAREPOINT_MCP_IMAGE=myusername/sharepoint-mcp \
SHAREPOINT_MCP_VERSION=dev \
docker compose up -d

# Or add to .env
echo "SHAREPOINT_MCP_IMAGE=myusername/sharepoint-mcp" >> .env
echo "SHAREPOINT_MCP_VERSION=dev" >> .env
docker compose up -d

What happens: Pulls from your custom registry/repository.


๐Ÿ”ง Common Commands

# Start in detached mode
docker compose up -d

# Start with live logs
docker compose up

# View logs
docker compose logs -f

# Stop container
docker compose down

# Restart container
docker compose restart

# Pull latest image
docker compose pull

# Rebuild and restart
docker compose up -d --build

# Remove everything (including volumes)
docker compose down -v

Using Podman? Just replace docker with podman โ€” fully compatible.

Docker Environment Variables

VariableDefaultDescription
TRANSPORThttpstdio or http
HTTP_HOST0.0.0.0Bind address
HTTP_PORT8000Port
LOG_FORMATjsonjson or console

๐Ÿ”Œ Transport Modes

ModeBest ForSet With
stdioClaude Desktop, Cursor, MCP InspectorTRANSPORT=stdio (default)
httpDocker, remote agents, VS Code Copilot, REST clientsTRANSPORT=http

๐Ÿ”— Integrations

๐Ÿค– Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "sharepoint": {
      "command": "sharepoint-mcp",
      "env": {
        "SHP_ID_APP": "your-app-id",
        "SHP_ID_APP_SECRET": "your-app-secret",
        "SHP_SITE_URL": "https://your-tenant.sharepoint.com/sites/your-site",
        "SHP_TENANT_ID": "your-tenant-id",
        "SHP_DOC_LIBRARY": "my-subfolder"
      }
    }
  }
}

๐Ÿ’ก Omit SHP_DOC_LIBRARY to access the full library root. If your org uses Office365 REST API and renamed the default library, also set SHP_LIBRARY_NAME.

๐Ÿ’ป VS Code Copilot (Agent Mode)

  1. Start the server via Docker or TRANSPORT=http sharepoint-mcp
  2. Create .vscode/mcp.json in your workspace:
{
  "servers": {
    "sharepoint": {
      "url": "http://localhost:8000/mcp/",
      "type": "http"
    }
  }
}
  1. Open Copilot Chat โ†’ switch to Agent mode โ†’ your 14 SharePoint tools are available.

โš ๏ธ Trailing slash matters โ€” the URL must end with /mcp/ (not /mcp).

โŒจ๏ธ Cursor / Continue

Add to your MCP config (uses stdio transport):

{
  "mcpServers": {
    "sharepoint": {
      "command": "sharepoint-mcp",
      "env": {
        "SHP_ID_APP": "your-app-id",
        "SHP_ID_APP_SECRET": "your-app-secret",
        "SHP_SITE_URL": "https://your-tenant.sharepoint.com/sites/your-site",
        "SHP_TENANT_ID": "your-tenant-id"
      }
    }
  }
}

๐Ÿ› ๏ธ All 14 Tools

๐Ÿ“ Folder Management

ToolWhat It Does
List_SharePoint_Folders๐Ÿ“‹ List all sub-folders in a directory
Get_SharePoint_Tree๐ŸŒณ Get full recursive folder + file tree
Create_Folderโž• Create a new folder
Delete_Folder๐Ÿ—‘๏ธ Delete an empty folder

๐Ÿ“„ Document Management

ToolWhat It Does
List_SharePoint_Documents๐Ÿ“‹ List all files with metadata
Search_SharePoint๐Ÿ”Ž Search documents using KQL queries
Get_Document_Content๐Ÿ“– Read & parse file content (PDF/Word/Excel/text)
Upload_Documentโฌ†๏ธ Upload file as string or Base64
Upload_Document_From_Path๐Ÿ“‚ Upload a local file directly
Update_Documentโœ๏ธ Overwrite existing file content
Delete_Document๐Ÿ—‘๏ธ Permanently delete a file
Download_Documentโฌ‡๏ธ Download file to local filesystem

๐Ÿท๏ธ Metadata Management

ToolWhat It Does
Get_File_Metadata๐Ÿ” Get all SharePoint list-item fields
Update_File_Metadataโœ๏ธ Update metadata fields

โš™๏ธ Full Configuration Reference

VariableRequiredDefaultDescription
SHP_ID_APPโœ…Azure AD app client ID
SHP_ID_APP_SECRETโœ…Azure AD client secret
SHP_TENANT_IDโœ…Microsoft tenant ID
SHP_SITE_URLโœ…SharePoint site URL
SHP_API_TYPEoffice365office365, graph, or graphql
SHP_LIBRARY_NAMEShared DocumentsLibrary name (Office365 REST only; Graph auto-detects)
SHP_DOC_LIBRARY(empty = full library)Subfolder scope (e.g. mcp_server). Empty = entire library
SHP_MAX_DEPTH15Max tree depth
SHP_MAX_FOLDERS_PER_LEVEL100Folders per batch
SHP_LEVEL_DELAY0.5Delay (s) between tree levels
TRANSPORTstdiostdio or http
HTTP_HOST0.0.0.0HTTP bind host
HTTP_PORT8000HTTP port
LOG_LEVELINFODEBUG INFO WARNING ERROR
LOG_FORMATconsoleconsole or json

โš ๏ธ Limitations

LimitationDetails
Single siteConnects to one SharePoint site per server instance (multi-site planned for v2.0)
Sync clientUses synchronous SharePoint REST API calls (async client planned for v1.3)
No sharingCannot create sharing links yet (planned for v1.1)
Large filesVery large files may hit memory limits during content extraction
Rate limitsSharePoint throttling (429/503) is handled with auto-retry, but sustained bulk operations may be slow

๐Ÿ”ง Troubleshooting

Authentication Errors

Problem: Missing or invalid SharePoint credentials
Solution: Verify all 4 required environment variables are set:

echo $SHP_ID_APP $SHP_ID_APP_SECRET $SHP_TENANT_ID $SHP_SITE_URL

Connection Issues (HTTP Transport)

Problem: Agent can't connect to the MCP server
Solution:

  1. Ensure the server is running: curl http://localhost:8000/mcp/
  2. Check the URL ends with /mcp/ (trailing slash required)
  3. Verify the port is not blocked by a firewall

Docker Container Unhealthy

Problem: podman ps / docker ps shows (unhealthy)
Solution: Check container logs for errors:

docker logs sharepoint-mcp

Debug Logging

Enable verbose output by setting LOG_LEVEL=DEBUG:

LOG_LEVEL=DEBUG sharepoint-mcp

For Docker, add to your .env file or docker-compose.yml:

LOG_LEVEL=DEBUG
LOG_FORMAT=console

Permission Errors

Problem: Access denied from SharePoint
Solution:

  1. Verify the Azure AD app has the required API permissions
  2. Ensure admin consent has been granted (if required by your org)
  3. Confirm SHP_SITE_URL points to a site your app has access to

๐Ÿงช Development

git clone https://github.com/ravikant1918/sharepoint-mcp.git
cd sharepoint-mcp
pip install -e ".[dev]"

make test      # run all tests
make inspect   # ๐Ÿ” launch MCP Inspector
make check     # quick import sanity check
make clean     # ๐Ÿงน remove caches

๐Ÿ“š Documentation

๐Ÿ“„ Doc๐Ÿ“ Description
โšก Getting StartedFull setup guide
โš™๏ธ ConfigurationAll environment variables
๐Ÿ› ๏ธ Tools ReferenceDetailed tool parameters
๐Ÿ›๏ธ ArchitectureDesign and layer diagram
๐Ÿ”‘ Azure SetupAzure AD app registration guide
๐Ÿ—บ๏ธ RoadmapPlanned features
๐Ÿ“… ChangelogVersion history

๐Ÿค Contributing

Contributions are welcome! Please read docs/contributing.md and our Code of Conduct.

  1. ๐Ÿด Fork the repo
  2. ๐ŸŒฟ Create a branch: git checkout -b feat/my-tool
  3. โœ… Add tests: make test
  4. ๐Ÿ“ฌ Open a Pull Request

๐Ÿ”’ Security

Found a vulnerability? Please do not open a public issue.
Report privately via GitHub Security Advisories or see SECURITY.md.


MIT License ยฉ 2026 Ravi Kant

โญ If this project helps you, please star it on GitHub!

Related Servers

NotebookLM Web Importer

Import web pages and YouTube videos to NotebookLM with one click. Trusted by 200,000+ users.

Install Chrome Extension