MCP SharePoint
raw JSON → 0.1.7 verified Fri May 01 auth: no python
MCP server for integrating with Microsoft SharePoint. Allows model context protocol (MCP) clients to interact with SharePoint sites, lists, libraries, and items. Current version: 0.1.7. Actively developed with monthly releases.
pip install mcp-sharepoint Common errors
error ModuleNotFoundError: No module named 'mcp_sharepoint' ↓
cause Missing package installation or wrong Python environment.
fix
Run 'pip install mcp-sharepoint' in the correct environment.
error ValueError: Invalid site URL. Must be a valid SharePoint site URL. ↓
cause Site URL does not match expected pattern (e.g., missing 'sites' path or typo).
fix
Check the site URL format: 'https://{tenant}.sharepoint.com/sites/{site-name}/'
error KeyError: 'access_token' ↓
cause Authentication failed; Azure AD app may lack proper permissions or secrets expired.
fix
Verify SHAREPOINT_TENANT_ID, SHAREPOINT_CLIENT_ID, SHAREPOINT_CLIENT_SECRET are correct and app has 'Sites.Read.All' or equivalent delegated permissions.
Warnings
breaking In 0.1.5, the SharePointClient constructor changed from positional arguments to keyword-only arguments. Code using positional args will break. ↓
fix Use keyword arguments: SharePointClient(tenant_id=..., client_id=..., ...)
gotcha The SharePoint site URL must include the site path exactly (e.g., 'https://contoso.sharepoint.com/sites/MySite'). Trailing slash is required. ↓
fix Ensure site_url ends with '/' or no path error occurs.
deprecated The 'get_list_items' method was renamed to 'list_items' in 0.1.6. Old name still works but will be removed in 0.2.0. ↓
fix Use client.list_items() instead of client.get_list_items().
Imports
- Server wrong
from mcp_sharepoint.server import Servercorrectfrom mcp_sharepoint import Server - SharePointClient wrong
from mcp_sharepoint.client import SharePointClientcorrectfrom mcp_sharepoint import SharePointClient
Quickstart
import os
from mcp_sharepoint import Server, SharePointClient
# Environment variables: SHAREPOINT_TENANT_ID, SHAREPOINT_CLIENT_ID, SHAREPOINT_CLIENT_SECRET, SHAREPOINT_SITE_URL
client = SharePointClient(
tenant_id=os.environ.get('SHAREPOINT_TENANT_ID', ''),
client_id=os.environ.get('SHAREPOINT_CLIENT_ID', ''),
client_secret=os.environ.get('SHAREPOINT_CLIENT_SECRET', ''),
site_url=os.environ.get('SHAREPOINT_SITE_URL', '')
)
server = Server(client)
server.run()