Skip to main content
Glama
Cloudreve MCP Server

Cloudreve MCP Server

by SanderCokart

Cloudreve v4 MCP

Standalone Model Context Protocol server for Cloudreve v4. It authenticates with a registered OAuth application (authorization code + PKCE), then exposes file and local-cache tools over stdio for Cursor and other MCP clients.

Not published on npm — run it with npx from GitHub (github:SanderCokart/cloudreve-mcp).

Features

  • OAuth authorize / status / logout with secure local token storage

  • File tools: list, resolve id, properties, download URL, download, upload, create directory, rename, move, copy, delete, source URL, share URL

  • Local cache helpers: list, write text, presign, download-to-cache, upload-from-cache

  • Cloudreve v4 File URIs (cloudreve://my/...) with friendly /path inputs

Related MCP server: nutstore-mcp

Prerequisites

  1. Node.js 20+

  2. A Cloudreve v4 site (this MCP uses /api/v4/...)

  3. An OAuth app created in Cloudreve admin

Register an OAuth app

In Cloudreve admin → OAuth applications, create an app with:

Field

Value

App name

e.g. Cursor Cloudreve MCP

Client secret

Generate and store securely

Redirect URI

http://127.0.0.1:53682/callback (must match CLOUDREVE_REDIRECT_URI)

Scopes

At least openid, profile, offline_access, plus file scopes such as Files.Read, Files.Write, Shares.Read, Shares.Write (exact names depend on your Cloudreve build)

Copy the Client ID and Client Secret. Do not commit them to git or share them publicly.

offline_access is required to receive a refresh token.

Cursor MCP setup

Add to ~/.cursor/mcp.json (Windows: %USERPROFILE%\.cursor\mcp.json):

{
  "mcpServers": {
    "cloudreve": {
      "command": "npx",
      "args": [
        "-y",
        "github:SanderCokart/cloudreve-mcp"
      ],
      "env": {
        "CLOUDREVE_BASE_URL": "https://cloud.example.com",
        "CLOUDREVE_CLIENT_ID": "YOUR_CLIENT_ID",
        "CLOUDREVE_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
        "CLOUDREVE_REDIRECT_URI": "http://127.0.0.1:53682/callback",
        "CLOUDREVE_SCOPES": "openid profile offline_access Files.Read Files.Write Shares.Read Shares.Write"
      }
    }
  }
}

Replace https://cloud.example.com and the OAuth placeholders with your own values. Endpoint overrides are optional; they are derived from CLOUDREVE_BASE_URL when omitted.

Reload MCP servers / restart Cursor, then call the authorize tool once. A browser window opens; after you approve, tokens are saved locally and other tools work.

Run from the terminal

npx -y github:SanderCokart/cloudreve-mcp

Set the same environment variables as in the Cursor env block before running.

Prefer github:SanderCokart/cloudreve-mcp over the GitHub .tar.gz archive URL. The archive install skips the package build on some platforms (notably Windows), so the cloudreve-mcp binary is missing.

Environment

Variable

Required

Description

CLOUDREVE_BASE_URL

Yes

Your Cloudreve site, e.g. https://cloud.example.com

CLOUDREVE_CLIENT_ID

Yes

OAuth Client ID

CLOUDREVE_CLIENT_SECRET

Yes

OAuth Client Secret

CLOUDREVE_AUTH_ENDPOINT

No

Authorization endpoint (default: {BASE}/session/authorize)

CLOUDREVE_TOKEN_ENDPOINT

No

Token endpoint (default: {BASE}/api/v4/session/oauth/token)

CLOUDREVE_REFRESH_ENDPOINT

No

Refresh endpoint (default: {BASE}/api/v4/session/token/refresh)

CLOUDREVE_USERINFO_ENDPOINT

No

User-info endpoint (default: {BASE}/api/v4/session/oauth/userinfo)

CLOUDREVE_REDIRECT_URI

No

Default http://127.0.0.1:53682/callback

CLOUDREVE_SCOPES

No

Space-separated scopes (see defaults above)

CLOUDREVE_DOWNLOAD_ROOT

No

Local download root

CLOUDREVE_CACHE_ROOT

No

Local cache root

CLOUDREVE_TOKEN_STORE

No

Path to tokens JSON (mode 0600)

Tokens are stored under the platform config dir by default:

  • Windows: %APPDATA%/cloudreve-mcp/tokens.json

  • macOS: ~/Library/Application Support/cloudreve-mcp/tokens.json

  • Linux: ~/.config/cloudreve-mcp/tokens.json

First-run flow

sequenceDiagram
  participant Cursor
  participant MCP as CloudreveMCP
  participant Browser
  participant Cloudreve

  Cursor->>MCP: authorize
  MCP->>Browser: open /session/authorize (PKCE)
  Browser->>Cloudreve: user login + consent
  Cloudreve->>MCP: redirect code to localhost callback
  MCP->>Cloudreve: POST /api/v4/session/oauth/token
  Cloudreve->>MCP: access_token + refresh_token
  MCP->>MCP: persist tokens (0600)
  Cursor->>MCP: list_files / download_file / ...
  MCP->>Cloudreve: Bearer access_token on /api/v4/*

Install from source (contributors)

git clone https://github.com/SanderCokart/cloudreve-mcp.git
cd cloudreve-mcp
npm install
npm run build

For local Cursor config, point command at node and args at the built dist/index.js, and set the same env block as above.

Copy .env.example for a local checklist of variables (do not commit a filled .env).

Tool notes

  • Paths may be /docs/a.md or full cloudreve://my/docs/a.md

  • upload_file.remote_path must include the filename

  • download_file.local_path is relative to CLOUDREVE_DOWNLOAD_ROOT and cannot escape it

  • Upload supports local / relay policies fully; OneDrive and generic pre-signed chunk uploads are best-effort

  • Cache tools operate only under CLOUDREVE_CACHE_ROOT

Development

npm run typecheck
npm test
npm run dev

License

Apache-2.0

Available Tools

22 tools
authorizeA

Start Cloudreve v4 OAuth (authorization code + PKCE). Opens a browser and waits for the local callback. Requires CLOUDREVE_CLIENT_ID and CLOUDREVE_CLIENT_SECRET.

Inputs: timeout_ms, open_browser.

auth_statusA

Show whether this MCP has a valid Cloudreve OAuth token stored locally.

Inputs: no named parameters.

cache_listA

List files in the local MCP cache directory.

Inputs: dir.

cache_presign_urlB

Create a short-lived signed local_uri for a cache file (HMAC). Useful for verifying cache access.

Inputs: path (required), expire_seconds.

cache_write_textC

Write a text file into the local MCP cache.

Inputs: path (required), text (required).

cloudreve_download_to_cacheB

Download a Cloudreve file into the local MCP cache.

Inputs: path (required), presign, cache_path.

cloudreve_upload_from_cacheA

Upload a file from the local MCP cache to Cloudreve.

Inputs: cache_path (required), remote_path (required).

copy_fileC

Copy a remote file/folder into a destination directory.

Inputs: source_path (required), destination_path (required).

create_directoryC

Create a remote directory.

Inputs: path (required).

delete_fileA

Delete remote files/folders (soft-delete to trash by default).

Inputs: path (required), unlink, skip_soft_delete.

download_fileA

Download a remote file into the configured download root (default local app data). local_path is relative to that root.

Inputs: path (required), local_path.

get_download_urlB

Get a temporary download URL for a remote file.

Inputs: path (required).

get_file_idB

Resolve a remote path to its Cloudreve file/folder id.

Inputs: path (required).

get_file_propertiesC

Get file/folder properties by path, File URI, or id.

Inputs: path, file_id, extended.

get_share_urlC

Create a share link for a file or folder.

Inputs: path (required), expire, is_dir, preview, +2 more.

get_source_urlB

Create/get a permanent-ish direct (source) link for a file.

Inputs: path (required).

list_filesA

List files and folders under a Cloudreve path or File URI (default /).

Inputs: page, path, page_size.

logoutA

Clear locally stored Cloudreve OAuth tokens.

Inputs: no named parameters.

move_fileB

Move a remote file/folder into a destination directory.

Inputs: source_path (required), destination_path (required).

rename_fileB

Rename a remote file or directory.

Inputs: path (required), new_name (required).

to_file_uriC

Convert a path to a Cloudreve File URI (cloudreve://my/...).

Inputs: path (required).

upload_fileA

Upload a local file to Cloudreve. remote_path must include the filename (e.g. /docs/report.pdf).

Inputs: local_path (required), remote_path (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 22 tools

    Disambiguation5/5

    Each tool targets a distinct operation: caching, OAuth, file operations, and URL handling have clear boundaries. Even similar actions like download_file and get_download_url differ in output (file vs URL).

    Naming Consistency3/5

    While many tools follow verb_noun pattern, there is inconsistency with prefixes (cache_, cloudreve_) and a few outliers like 'authorize' (single verb) and 'to_file_uri' (preposition). Mix of snake_case and camelCase is not an issue, but naming styles vary.

    Tool Count4/5

    22 tools is slightly above the typical ideal range (3-15) but still reasonable for a file storage server with caching and OAuth. The number is not excessive and each tool serves a clear purpose.

    Completeness4/5

    The tool set covers core file lifecycle: create (upload, mkdir), read (list, properties, download), update (rename, move, copy), delete (trash). Missing direct update of properties and batch operations, but these are minor gaps for the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server for cloud storage operations enabling browsing, file transfer, offline download, and multi-platform resource search for Quark and 115 drives.
      55 npm
      1
      GPL 3.0
    • A
      license
      B
      quality
      D
      maintenance
      MCP server for Nutstore cloud storage, enabling AI assistants to manage files via WebDAV with support for listing, searching, uploading, downloading, and more.
      19
      29 PyPI
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables AI assistants to search, read, and manage files across multiple cloud drives (Baidu, Aliyun, 115, OneDrive, Quark) through a unified interface.
      17 npm
      MIT