# onedrive-cli [Health: Active]

**Category:** 📂 File Systems  
**Repository:** https://github.com/lionello/onedrive-cli  
**GitHub Stars:** 179  
**npm Downloads (last month):** 196  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/onedrive-cli

## Description
Command line interface and MCP for OneDrive

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "onedrive-cli": {
    "command": "npx",
    "args": ["-y","@lionello/onedrive-cli"]
  }
}
```

## Documentation

## What onedrive-cli does

onedrive-cli connects command-line workflows and MCP clients to Microsoft OneDrive Personal. The CLI treats the remote drive in a filesystem-like way, with commands for listing folders, reading files, searching by name or content, copying and moving files, creating folders, deleting items, managing sharing permissions, and checking storage usage.

It also supports OneDrive photo albums. Albums are separate collections that reference files rather than containing them, so removing a photo from an album does not remove the underlying file. The CLI can list, create, and edit albums, including adding and removing photos.

The MCP interface is intentionally read-only. It exposes OneDrive data to an MCP client without providing operations that modify the drive.

## How it works

Install the package with npm, Nix, or from a source checkout. The installed command is `onedrive`; `onedrive-cli` is available as an alias. Run `onedrive login` to open Microsoft's login page. After authentication, the command receives an OAuth access token through a local callback flow and stores it in `~/.onedrive-cli-token`, or under `$XDG_STATE_HOME` when that variable is set.

Start the MCP endpoint with `onedrive mcp`. It communicates over standard input and output, allowing an MCP client to launch it as a local process. The MCP process reuses the token saved by `login`, so authentication must happen before connecting the client. Tokens expire after one hour; running `login` again refreshes access. The `-r` option requests a read-only token and is appropriate for MCP use.

A Claude Desktop configuration can launch the server with the `onedrive` command and the `mcp` argument.

## Setup and configuration

Install globally with:

```sh
npm install -g @lionello/onedrive-cli
```

Then authenticate and verify access:

```sh
onedrive login
onedrive df
onedrive ls
```

For a source installation, clone the repository, run `npm install`, and use `bin/onedrive login`. A Nix installation and development environment are also available. Set `XDG_STATE_HOME` if the token should be stored in an XDG state directory instead of the default location.

Register the stdio process in an MCP client using a command entry equivalent to:

```json
{
  "mcpServers": {
    "onedrive": {
      "command": "onedrive",
      "args": ["mcp"]
    }
  }
}
```

## Tools and capabilities

The MCP server provides these operations:

- `list_onedrive_folder` lists the direct contents of a folder.
- `search_onedrive_content` performs full-text search across the drive.
- `find_onedrive_files` recursively finds items by name glob.
- `list_onedrive_albums` lists albums or the items in a selected album.
- `read_onedrive_file` returns a file's contents as text.
- `stat_onedrive_item` returns complete item metadata.
- `onedrive_storage` reports storage quota for available drives.

The command-line interface adds write and transfer operations, including local-to-remote and remote-to-local copies, moves, folder creation, deletion, sharing-link creation, invitation emails, permission changes, and server-side URL downloads. It also includes `cat`, `grep`, `find`, `ls`, `stat`, and storage reporting commands.

## Limitations and notes

The MCP endpoint only issues GET requests and cannot change files, folders, permissions, or albums. OneDrive Personal is the supported service; OneDrive for Business is not included in the supported scope.

Authentication tokens last one hour, so an expired-token error requires another `login`. The CLI's copy command does not copy folders directly, and a copy fails when the destination already contains an item with the same name. Local and remote paths can be disambiguated with `./` and `:/` prefixes.

Album deletion is not supported through the API and must be performed in the OneDrive web interface. The `chmod` command supports specific sharing-mode forms rather than unrestricted octal permission semantics.

_Full upstream README: https://allmcps.com/mcp/onedrive-cli/readme_

