kl-sharepoint-mcp
Microsoft 365 (SharePoint & OneDrive) MCP Server
A modern Model Context Protocol (MCP) server that lets ChatGPT (and other MCP compatible clients) interact with SharePoint Online and OneDrive content using Microsoft Graph. The server is designed for environments where multiple Microsoft 365 accounts may exist on the same workstation: each session can authenticate with the signed-in Windows/Microsoft account that the user chooses at runtime.
Why this fork? The original SharePoint-only implementation relied on application credentials tied to a specific tenant. This version embraces user-centric authentication (device code flow + MSAL cache) so the connector works with whichever account is selected on the machineβideal for teams that share GPT licenses but want to access their own SharePoint/OneDrive resources.
Feature Highlights
π Device-code authentication β Pick the Microsoft account that is signed into the local machine instead of the ChatGPT account.
π₯ Multi-account aware β List cached accounts, switch between them, and inspect the active context at any time.
ποΈ Drive discovery β Enumerate OneDrive personal drives and SharePoint document libraries.
π Full file lifecycle β Create folders, upload/update files (text or binary), download contents, and delete resources.
π Deep research β Perform scoped searches inside a drive or global Microsoft Graph Search across SharePoint + OneDrive.
π Site exploration β Search for SharePoint sites and list their document libraries before activating one.
Related MCP server: SharePoint MCP Server
MCP Tools Overview
Tool | Purpose |
| Initiate and complete the device-code flow for the desired Microsoft account. |
| Inspect cached accounts and pick which one is active. |
| Debug helpers showing the current authentication + drive context. |
| Discover drives and sites available to the active account. |
| Choose the OneDrive or SharePoint library used for subsequent operations. |
| Explore the selected drive and read file contents. |
| Create, modify, and remove items. |
| Search inside the currently-selected drive. |
| Perform a Microsoft Graph Search across SharePoint and OneDrive resources for deep research scenarios. |
All tools automatically reuse the selected Microsoft account and drive context.
Prerequisites
Azure AD App Registration β Register a public client application (no secret) in Azure AD / Entra ID.
Redirect URI can be
https://login.microsoftonline.com/common/oauth2/nativeclient.Required delegated permissions:
Files.ReadWrite.All,Sites.ReadWrite.All,User.Read, and optionally others you need.
Client ID β Note the Application (client) ID of the registration.
Python 3.10+ β A recent Python interpreter for running the MCP server.
Configuration
The server is configured with environment variables (you can store them in a .env file during development):
Variable | Description |
| Required. Client ID of the Azure AD public application (fallback: |
| Optional. Tenant ID to restrict sign-ins. Defaults to |
| Optional comma-separated scopes. Defaults to |
| Optional custom path for the MSAL token cache. Default: |
| Optional drive ID to auto-select on startup. |
| Optional logging settings. |
Quickstart
Installation
pip install -e .Running the server
python -m mcp_sharepointIntegrate the binary into your MCP-aware client (ChatGPT desktop, Claude Desktop, MCP Inspector, etc.) by referencing the script mcp-sharepoint (created via the console script entry point) or by executing python -m mcp_sharepoint directly.
First-time authentication workflow
Call
Start_Device_Loginfrom your MCP client.Follow the
verification_urianduser_codeprovided to authenticate with the Microsoft account currently logged into the workstation.Call
Complete_Device_Loginwith the returnedflow_idto finish the sign-in.(Optional) Use
List_Available_AccountsandSet_Active_Accountto switch between cached profiles.Discover drives with
List_My_DrivesorList_Site_Drives, then select one usingSet_Active_Drive.You are ready to browse, search, and modify files using the rest of the tools.
Development
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .Use the MCP Inspector to debug traffic:
npx @modelcontextprotocol/inspector -- python -m mcp_sharepointLicense
This project is released under the MIT License.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/PoOpOpO/kl-sharepoint-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server