Microsoft 365 Files — Claude Code MCP server
This MCP server connects OneDrive to AI coding hosts through Microsoft Graph for file search, reading, transfers, and sharing links.
claude mcp add --env MS_CLIENT_ID=<MS_CLIENT_ID> --env MS_CONFIG_DIR=<MS_CONFIG_DIR> --env MS_ACCOUNT_EMAIL=<MS_ACCOUNT_EMAIL> --env MS_MCP_PACKAGE_ID=<MS_MCP_PACKAGE_ID> --env MICROSOFT_REQUEST_TIMEOUT_MS=<MICROSOFT_REQUEST_TIMEOUT_MS> --transport stdio microsoft-files -- npx -y @mindstone/mcp-server-microsoft-filesWhat Microsoft 365 Files does
Microsoft 365 Files exposes Microsoft 365 OneDrive files through Microsoft Graph. An agent can list and search items, fetch file data, read text and Office documents, upload or download files, and delete, move, or copy them. It also covers share links, permissions, version history, and file activity. The server provides 20 tools.
Run it with npx on Node.js 20+ and npm. You must provide MS_CLIENT_ID and MS_CONFIG_DIR. The host handles Microsoft OAuth and writes the account token files, since this server does not start the OAuth flow itself. MS_ACCOUNT_EMAIL selects an account in a multi-account setup, while the same credentials can be shared with the Microsoft mail connector.
What it helps with
- search OneDrive by filename
- read text from an Office document
- upload a file to OneDrive
- create a read-only sharing link
- inspect file versions and activity
Example prompts for the agent
- Find the latest
Q3-plan.docxin my OneDrive and create a read-only link for my team. - Read the text from
project-notes.docxin OneDrive and summarize it. - Upload the prepared file to OneDrive and return its sharing link.
How to install Microsoft 365 Files
Platform CLI
claude mcp add --env MS_CLIENT_ID=<MS_CLIENT_ID> --env MS_CONFIG_DIR=<MS_CONFIG_DIR> --env MS_ACCOUNT_EMAIL=<MS_ACCOUNT_EMAIL> --env MS_MCP_PACKAGE_ID=<MS_MCP_PACKAGE_ID> --env MICROSOFT_REQUEST_TIMEOUT_MS=<MICROSOFT_REQUEST_TIMEOUT_MS> --transport stdio microsoft-files -- npx -y @mindstone/mcp-server-microsoft-filesReplace <…> with your own values
Platform CLI
codex mcp add microsoft-files --env MS_CLIENT_ID=<MS_CLIENT_ID> --env MS_CONFIG_DIR=<MS_CONFIG_DIR> --env MS_ACCOUNT_EMAIL=<MS_ACCOUNT_EMAIL> --env MS_MCP_PACKAGE_ID=<MS_MCP_PACKAGE_ID> --env MICROSOFT_REQUEST_TIMEOUT_MS=<MICROSOFT_REQUEST_TIMEOUT_MS> -- npx -y @mindstone/mcp-server-microsoft-filesReplace <…> with your own values
Config file
{
"mcpServers": {
"microsoft-files": {
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-microsoft-files"
],
"env": {
"MS_CLIENT_ID": "<MS_CLIENT_ID>",
"MS_CONFIG_DIR": "<MS_CONFIG_DIR>",
"MS_ACCOUNT_EMAIL": "<MS_ACCOUNT_EMAIL>",
"MS_MCP_PACKAGE_ID": "<MS_MCP_PACKAGE_ID>",
"MICROSOFT_REQUEST_TIMEOUT_MS": "<MICROSOFT_REQUEST_TIMEOUT_MS>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"microsoft-files": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-microsoft-files"
],
"env": {
"MS_CLIENT_ID": "<MS_CLIENT_ID>",
"MS_CONFIG_DIR": "<MS_CONFIG_DIR>",
"MS_ACCOUNT_EMAIL": "<MS_ACCOUNT_EMAIL>",
"MS_MCP_PACKAGE_ID": "<MS_MCP_PACKAGE_ID>",
"MICROSOFT_REQUEST_TIMEOUT_MS": "<MICROSOFT_REQUEST_TIMEOUT_MS>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e MS_CLIENT_ID=<MS_CLIENT_ID> -e MS_CONFIG_DIR=<MS_CONFIG_DIR> -e MS_ACCOUNT_EMAIL=<MS_ACCOUNT_EMAIL> -e MS_MCP_PACKAGE_ID=<MS_MCP_PACKAGE_ID> -e MICROSOFT_REQUEST_TIMEOUT_MS=<MICROSOFT_REQUEST_TIMEOUT_MS> microsoft-files npx -y @mindstone/mcp-server-microsoft-filesReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Microsoft 365 Files
How do I install Microsoft 365 Files in Claude Code?
Run `claude mcp add mcp-server-microsoft-files -e MS_CLIENT_ID=<MS_CLIENT_ID> -e MS_CONFIG_DIR=<MS_CONFIG_DIR> -- npx -y @mindstone/mcp-server-microsoft-files`. Fill in the Microsoft OAuth client ID and configuration directory values.
What does Microsoft 365 Files do?
It gives an agent Microsoft Graph access to OneDrive files. The server supports search, reading, upload, download, file moves and copies, plus sharing, permissions, versions, and activity.
Does the server perform Microsoft OAuth itself?
No. The host completes the OAuth flow and writes token files under MS_CONFIG_DIR; Microsoft 365 Files reads them. The credentials can be shared with mcp-server-microsoft-mail.