home / mcp / sharepoint mcp server
Provides access to SharePoint sites, drives, and files via MCP tools with OAuth2 authentication.
Configuration
View docs{
"mcpServers": {
"sekops-ch-sharepoint-mcp-server": {
"command": "node",
"args": [
"/path/to/sharepoint-mcp-server/build/index.js"
],
"env": {
"CLIENT_ID": "your-azure-app-client-id",
"TENANT_ID": "your-azure-tenant-id",
"CLIENT_SECRET": "your-azure-app-client-secret",
"SHAREPOINT_URL": "https://yourtenant.sharepoint.com"
}
}
}
}You can run a SharePoint MCP Server to browse SharePoint sites, search files, and retrieve document content via a structured MCP interface. It uses Microsoft Graph under the hood and handles authentication automatically, so you can focus on building experiences around SharePoint data and documents.
To use this MCP server with an MCP client, first ensure the server is running and reachable. The server exposes actions to search files across SharePoint, list sites and drives, browse library contents, and fetch file content. You authenticate once via your configured Azure AD app, and then you can perform these operations through the MCP client’s standard tool calls against the SharePoint endpoints. You can discover available resources and tools, then issue commands to list sites, search for documents, inspect a site’s drives, traverse folders, and read text file content.
# Prerequisites
- Node.js (12.x or newer) and npm
- Access to an Azure AD tenant to register an app
# Install dependencies for development
npm install
# Build the server for production or local testing
npm run build
# Development with auto-rebuild (optional)
npm run watch
# Run tests or inspect the MCP inspector (optional)
npm run inspector
# Global installation (alternative)
npm install -g .
# Then start the server directly
sharepoint-mcp-serverPrerequisites and environment are required to run the server. Register an Azure AD app and grant Graph permissions to enable SharePoint access, then provide the necessary credentials to the server via environment variables.
The server can be run as a local process with explicit environment variables. The following example shows a local, stdio-style configuration where the server is started via a Node process that loads a built index file and reads environment variables for authentication and targeting SharePoint.
The server uses OAuth2 client credentials flow for authentication and automatically refreshes tokens. All communications are over HTTPS, and client secrets should be stored securely and not committed to version control. Admin consent is required for the application permissions in Azure AD.
Common issues include authentication errors due to incorrect Azure app registration or permissions, insufficient SharePoint access for the app, and network problems preventing Microsoft Graph API calls. Enable verbose logging during debugging by setting the DEBUG environment variable to the server name, for example: DEBUG=sharepoint-mcp-server.
You can test all available tools and resources via the MCP Inspector interface. This web UI lets you exercise search_files, list_sites, get_site_info, list_site_drives, list_drive_items, and get_file_content to verify behavior before integrating into client applications.
The server follows a service-oriented architecture with dedicated layers for authentication, Graph API requests, tool handling, resource management, and error handling. This modular approach keeps concerns separated and makes it straightforward to extend with additional MCP tools for SharePoint.
Search across SharePoint using Microsoft Graph Search API with a required query and optional limit.
List all SharePoint sites accessible to the application with an optional name filter.
Retrieve detailed information about a specific SharePoint site by its URL.
List document libraries (drives) within a given SharePoint site.
List files and folders inside a specific document library path within a site.
Get the content of a specific file from a SharePoint document library (text files only).