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.
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, Hermes, or pi 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.
Requirements
- Linux is the supported production platform. Windows is suitable for development only because POSIX file modes do not establish Windows ACLs.
- Source installs require Python 3.11 or newer. The optional npm launcher
requires Node.js 18+ and Astral
uv(which can provision Python). - A personal Microsoft account and a Microsoft Entra app registration configured for device-code authentication; see the registration prerequisites.
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
export ONEDRIVE_MCP_CONFIG_DIR="${ONEDRIVE_MCP_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/onedrive-mcp}"
CONFIG_DIR="$ONEDRIVE_MCP_CONFIG_DIR"
install -d -m 700 "$CONFIG_DIR"
cp .env.example "$CONFIG_DIR/.env"
Set AZURE_CLIENT_ID in "$CONFIG_DIR/.env", restrict the file, and sign in:
chmod 600 "$CONFIG_DIR/.env"
./venv/bin/python scripts/setup_auth.py
./venv/bin/python scripts/smoke_test.py
The token cache and downloads default to the stable per-user data directory
($XDG_DATA_HOME/onedrive-mcp or ~/.local/share/onedrive-mcp), not the
checkout or package install directory. The 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 | VS Code setup |
| Hermes | stdio | Hermes setup |
| pi (pi.dev) | stdio | pi setup |
| npx launcher | stdio | npm installation |
| Open WebUI | OpenAPI/HTTP via mcpo |
Bridge deployment |
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_onedrive(query, top=20, next_link=None) |
Search the drive one page at a time |
list_folder(path='/', top=50, next_link=None) |
List a folder's children |
get_item_metadata(path_or_id) |
Return metadata for one file or folder |
download_file(path_or_id, dest_filename=None) |
Download a file into DOWNLOAD_DIR |
get_drive_info() |
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 |
|---|---|
| Setup | Azure registration, local installation, environment variables, and sign-in |
| Client configuration | VS Code, Hermes, pi, and stdio operation |
| npm installation | Version-pinned npm launcher and separate device-code setup |
| Tool reference | Tool inputs, response shapes, pagination, and downloads |
| Open WebUI deployment | Authenticated mcpo bridge and systemd |
| Security | Read-only enforcement, local storage, pagination, and privacy |
| Development | Tests, dependency locks, smoke tests, and project structure |
| Troubleshooting | Common authentication, Graph, client, and dependency errors |
Development
Run the credential-free test suite:
./venv/bin/python -m pytest -v
Tests mock Microsoft Graph and MSAL traffic; they do not access a real OneDrive account. See Development for maintenance and contribution details.
License
This project is licensed under the MIT License. It is an independent community project and is not affiliated with or endorsed by Microsoft.
Metadata
Release files for joescars-onedrive-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| joescars_onedrive_mcp-0.1.0.tar.gz | 32.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| joescars_onedrive_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.9 kB
Release files / joescars_onedrive_mcp-0.1.0.tar.gz
| Download URL | joescars_onedrive_mcp-0.1.0.tar.gz |
|---|---|
| Size | 32.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b211cbef3d6ae8f72a1b86eaa15dbdf8ab8c110e52fc1902ba4bfb374455aac
|
|
BLAKE2b-256 checksum How to use checksums |
8b895488eed56ca48a255684a5973b9e5c29c617413e06d714b14146e0bc6f98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / joescars_onedrive_mcp-0.1.0-py3-none-any.whl
| Download URL | joescars_onedrive_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e06d51deab5355f9192030cfb269c3a39c2d73b4f9cc458777384acedf1dd71
|
|
BLAKE2b-256 checksum How to use checksums |
c668b8a4c467c27fb7a0b63f78262e2ffdb3930799e8db677ce4e84fc3f321d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logSecurity for joescars-onedrive-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for joescars_onedrive_mcp-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.