OneDrive Read-Only MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OneDrive Read-Only MCP Serversearch my OneDrive for the Q3 budget spreadsheet"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OneDrive Read-Only MCP Server
A local Model Context Protocol (MCP) server that lets AI agents search, inspect, and download files from a personal Microsoft OneDrive account.
This project isread-only. It exposes five read-style tools and only performs HTTP GET requests against Microsoft Graph. It cannot upload, edit, rename, move, or delete OneDrive content.
Features
Search OneDrive by file name or indexed content.
Browse folders with secure, bounded pagination.
Inspect file and folder metadata.
Download files to a controlled local directory without overwriting existing files.
Refresh cached Microsoft credentials without interactive sign-in.
Connect directly to VS Code or Hermes over stdio, or to Open WebUI through an authenticated
mcpobridge.
This server targets personal Microsoft accounts and consumer OneDrive. OneDrive for Business and SharePoint are outside the project's default scope.
Related MCP server: SharePoint MCP Server
Requirements
Linux and Python 3.10 or newer.
A personal Microsoft account.
A Microsoft Entra app registration configured for device-code authentication; see the registration prerequisites.
Linux is the supported production platform. Windows is suitable for development only because POSIX file modes do not establish Windows ACLs.
Quick start
For complete Azure and authentication instructions, see Setup.
git clone https://github.com/joescars/onedrive-mcp.git
cd onedrive-mcp
python3 -m venv venv
./venv/bin/pip install --require-hashes -r requirements.lock
cp .env.example .envSet AZURE_CLIENT_ID in .env, restrict the file, and sign in:
chmod 600 .env
./venv/bin/python scripts/setup_auth.py
./venv/bin/python scripts/smoke_test.pyThe smoke test reads drive information and lists the root folder. It does not download or modify files.
Connect a client
Complete the quick start before configuring a client. The MCP host starts this server when needed; do not leave a separate standalone process running.
Client | Transport | Guide |
VS Code with GitHub Copilot | stdio | |
Hermes | stdio | |
Open WebUI | OpenAPI/HTTP via |
Example VS Code workspace configuration:
{
"servers": {
"onedrive": {
"type": "stdio",
"command": "${workspaceFolder}/venv/bin/python",
"args": ["${workspaceFolder}/server.py"]
}
}
}Use absolute paths for user-level or remote-user configuration. No tokens or
.env values belong in client configuration.
Tools
Tool | Description |
| Search the drive one page at a time |
| List a folder's children |
| Return metadata for one file or folder |
| Download a file into |
| Return drive, owner, and quota information |
Paths such as /Documents/report.pdf and raw Graph item IDs are accepted where
path_or_id is documented. Pagination continuations are opaque and must be
passed back to the same tool with the original arguments.
See the Tool reference for complete inputs, outputs, and pagination behavior.
Example prompts:
Use OneDrive to list /Documents without downloading anything.Search OneDrive for "invoice" and tell me if more pages are available.Get metadata for /Documents/report.pdf without downloading it.Download /Documents/report.pdf as report-copy.pdf.
Downloads remain on the machine running the server. The tool returns a local path and metadata, not the file's contents.
Security and privacy
Microsoft Graph operations use the GET-only helper in
graph_client.pyand read-only delegated scopes; this is not a guarantee against future code changes.The token cache and downloads are stored with owner-only POSIX permissions.
Signed Graph download URLs are never returned in tool results or errors.
Downloads have configurable per-file and directory-wide limits.
Existing files are never overwritten.
The optional HTTP bridge requires an API key and defaults to loopback.
Read-only access is still sensitive: names, paths, metadata, and quota details
returned by tools enter the MCP client's context. Use only accounts and files
you intend to make available, and never share token_cache.bin.
See Security for the trust model, safeguards, and operational limitations.
Documentation
Guide | Covers |
Azure registration, local installation, environment variables, and sign-in | |
VS Code, Hermes, and stdio operation | |
Tool inputs, response shapes, pagination, and downloads | |
Authenticated | |
Read-only enforcement, local storage, pagination, and privacy | |
Tests, dependency locks, smoke tests, and project structure | |
Common authentication, Graph, client, and dependency errors |
Development
Run the credential-free test suite:
./venv/bin/python -m pytest -vTests mock Microsoft Graph and MSAL traffic; they do not access a real OneDrive account. See Development for maintenance and contribution details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Permissioned access to Outlook, OneDrive and Teams via the user's own Microsoft account
Knowledge base MCP for AI agents on iknow.dev. Search, read, and maintain via OAuth.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Read-only MCP server: let AI agents read your ORANO saved-video library, tasks, and memory.
Related MCP Servers
- FlicenseDqualityDmaintenanceProvides access to organizational Sharepoint documents through the Microsoft Graph API, enabling search and retrieval of Sharepoint content for AI assistants.142 npm21-
- AlicenseNot gradedqualityDmaintenanceEnables browsing and interacting with Microsoft SharePoint sites and documents through Microsoft Graph API, supporting file search, site listing, document library browsing, and file content retrieval with OAuth2 authentication.89 npm10MIT
- FlicenseNot gradedqualityNot gradedmaintenanceProvides unified access to OneDrive and SharePoint through Microsoft Graph API, enabling file operations, SharePoint list management, Excel integration, and content search across personal and business Microsoft accounts.-
- FlicenseAqualityDmaintenanceConnects Claude with OneDrive via Microsoft Graph API to list, search, create, move, copy, and share files.10-