# Microsoft 365 Files

This MCP server connects OneDrive to AI coding hosts through Microsoft Graph for file search, reading, transfers, and sharing links.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 13
- Author: mindstone
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/mindstone/mcp-servers/tree/HEAD/connectors/microsoft-files
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/mcp/microsoft-365-files

## What it 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.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `MS_CLIENT_ID`, `MS_CONFIG_DIR`, `MS_ACCOUNT_EMAIL`, `MS_MCP_PACKAGE_ID`, `MICROSOFT_REQUEST_TIMEOUT_MS` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
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-files
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
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-files
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "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

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "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

### Gemini CLI

**Platform CLI**
```bash
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-files
```
Replace <…> with your own values

## When to use it
- 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
- Find the latest `Q3-plan.docx` in my OneDrive and create a read-only link for my team.
- Read the text from `project-notes.docx` in OneDrive and summarize it.
- Upload the prepared file to OneDrive and return its sharing link.

## Similar
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902
- [Coder](https://affpapa.org/en/nevibecode/mcp/coder.md) — MCP server · ★ 17191
- [firebase-mcp](https://affpapa.org/en/nevibecode/mcp/firebase-mcp.md) — MCP server · ★ 4482
- [Radar Kubernetes MCP Server](https://affpapa.org/en/nevibecode/mcp/radar-kubernetes-mcp-server.md) — MCP server · ★ 3918
- [Supabase](https://affpapa.org/en/nevibecode/mcp/supabase.md) — MCP server · ★ 2974
- [Microsoft Fabric MCP Server](https://affpapa.org/en/nevibecode/mcp/microsoft-fabric-mcp-server.md) — MCP server · ★ 3804

From the same set: [mindstone/mcp-servers](https://affpapa.org/en/nevibecode/by/mindstone/mcp-servers.md) — 24 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
