Skip to main content
Glama

seafile-mcp

Model Context Protocol server for Seafile file storage. Multi-user, with two token-based auth modes and full file/folder/library management.

Built with FastMCP (mcp<2). Inspired by setugk/seafile-mcp (tool coverage), virtUOS/seafile-mcp (multi-user + safety modes) and 5p00kyy/seafile-mcp (dual account/repo-token env config).

Auth: log in once, then pass only session_token

No tokens are fixed in .env. Each user authenticates once; the server keeps the Seafile credentials in a session store (SEAFILE_SESSION_PATH, default ~/.seafile-mcp/sessions.json, mode 0600) keyed by SHA-256 hash of an opaque bearer token. All later calls present only that token:

  1. auth_login(user_id="alice", password="...") — validates against Seafile and issues a full-scope session token (password used once, never stored; add otp="123456" with 2FA). Or auth_register_library( library_token="<token>", library_name="Docs") — validates the library token and issues a scoped session token.

  2. Use any tool with session_token="<token>" — no Seafile tokens per call.

  3. Maintain with auth_reauth (after a password change), auth_rotate, auth_revoke, auth_add_library, auth_remove_library; inspect with auth_status (nothing secret is revealed).

Resolution order per call: explicit account_token/repo_token params → session record for session_token → env defaults (SEAFILE_ACCOUNT_TOKEN / SEAFILE_REPO_TOKENS_JSON, single-user fallback only).

Session scope

Allowed

Full (account login)

All libraries, all tools

Scoped (library tokens)

Only those libraries; browse/read/upload/rename-folders. Library management, move/copy/delete and search return a clear error (Seafile exposes no such endpoints for repo tokens)

Security note: a session token is a bearer secret — whoever holds it may use the stored Seafile credentials, and it travels with every call, so always use TLS and protect multi-user HTTP deployments (reverse-proxy auth, VPN/Tailscale). The store file holds Seafile tokens plus only hashes of session tokens; rotate/revoke sessions any time without touching Seafile.

Getting an account token (one-time, never expires)

Normally you never do this by hand — auth_login exchanges your password for a Seafile token and stores it in the session. For reference, there is no Web UI page for account tokens; the manual equivalent is (add -H 'X-SEAFILE-OTP: <6-digit>' with 2FA):

curl -d "username=YOUR_EMAIL&password=YOUR_PASSWORD" \
  https://YOUR_SEAFILE_SERVER/api2/auth-token/
# {"token": "24fd3c026886e3121b2ca630805ed425c272cb96"}

The token is permanent — after a password change it is invalidated, so run auth_reauth to refresh the session. The get_auth_help tool repeats these instructions for agents.

Getting a library API token (scoped, r or rw, valid until deleted)

Seafile Web UI: library menu (⋯) → Advanced → API Token → create with read or read-write permission. Or via API with an account token:

curl -H "Authorization: Token <account-token>" -H 'Content-Type: application/json' \
  -d '{"app_name": "my-assistant", "permission": "rw"}' \
  https://YOUR_SEAFILE_SERVER/api/v2.1/repos/<repo-id>/repo-api-tokens/

Related MCP server: Kova Mind MCP Server

Install

python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env   # set SEAFILE_SERVER_URL; tokens are registered at runtime

Requires SEAFILE_SERVER_URL (no trailing slash). Auth header scheme defaults to auto (Token, falling back to Bearer on 401 — covers Seafile < 11 and ≥ 11).

Transfer guardrails (all optional): SEAFILE_TIMEOUT seconds (default 60), SEAFILE_MAX_READ_SIZE bytes (default 10485760 — read_file refuses bigger downloads with a clear 413 error), SEAFILE_MAX_WRITE_SIZE bytes (default 52428800 — uploads/updates over this are refused before sending).

Run

# Local single-user (Claude Desktop / Code / OpenCode)
seafile-mcp --transport stdio

# Multi-user HTTP
seafile-mcp --transport streamable-http --host 127.0.0.1 --port 8000

Put the HTTP endpoint behind a reverse proxy / VPN for remote use — it has no built-in endpoint auth; Seafile tokens travel per tool call.

Client config examples

stdio (claude_desktop_config.json / .mcp.json):

{ "mcpServers": { "seafile": {
  "command": "/abs/path/seafile-mcp/.venv/bin/seafile-mcp",
  "args": ["--transport", "stdio"],
  "env": { "SEAFILE_SERVER_URL": "https://seafile.example.com",
            "SEAFILE_ACCOUNT_TOKEN": "<token>" }
} } }

Streamable HTTP + Docker: cp .env.example .env, set values, docker compose up.

Safety modes (SEAFILE_MCP_MODE)

  • read_only — mutating tools are not registered at all.

  • safe_write (default) — create/rename/move/copy/upload allowed; deletes hidden.

  • full — also registers delete_library (permanent!) and delete_item (to trash).

Overwrites create new versions in Seafile file history; deletes go to library trash. The trash-purge endpoint is deliberately not exposed.

Tools (30)

Session auth (all modes): auth_login, auth_register_library, auth_reauth, auth_rotate, auth_revoke, auth_add_library, auth_remove_library, auth_status · Help: get_auth_help, resolve_library · Libraries (account only): list_libraries, get_library_info, create_library, rename_library, delete_library (full mode) · Files: list_directory, get_file_detail (account only), read_file, get_download_link, search_files (account only), create_directory (parents auto-created), upload_file, update_file, rename_item, move_item (account only), copy_item (account only), delete_item (full mode, account only) · Share links (account only): create_share_link, list_share_links, delete_share_link (full mode).

Every file/library tool accepts session_token, repo_id or library_name, plus optional account_token / repo_token overrides (explicit params win over the session). read_file returns text (truncated with notice) or, for binaries, metadata + download link. upload_file / update_file take text or base64 (is_base64: true).

Tests

.venv/bin/python -m pytest -q   # 72 tests, mocked HTTP (no live server needed)

Roadmap

  • PDF/Office text extraction (currently binaries return metadata + link)

  • Optional endpoint bearer-auth for the HTTP transport

  • Background search index for repo-token libraries (cf. dm7500/seafile-vault-mcp)

License

MIT

Available Tools

27 tools
auth_add_libraryC

Attach another library token to a session.

Inputs: library_token (required), session_token (required), repo_id, library_name.

auth_loginA

Validate user_id+password against Seafile and issue a full-scope session token. Password is used once, never stored.

Inputs: user_id (required), password (required), otp.

auth_reauthB

Refresh a session after a password change.

Inputs: password (required), session_token (required), otp.

auth_register_libraryB

Validate a library API token; bootstrap a scoped session or attach the library to an existing one. Returns the session token.

Inputs: library_token (required), repo_id, user_id, library_name, +1 more.

auth_remove_libraryC

Detach a library token from a session.

Inputs: library_name (required), session_token (required).

auth_revokeC

Delete a session.

Inputs: session_token (required).

auth_rotateC

Replace a session token, keeping its credentials.

Inputs: session_token (required).

auth_statusB

Show a session's scope and libraries (nothing secret).

Inputs: session_token (required).

copy_itemC

Copy a file or folder (account token only).

Inputs: path (required), dst_dir (required), is_dir, repo_id, +4 more.

create_directoryC

Create a folder.

Inputs: path (required), repo_id, repo_token, library_name, +2 more.

create_libraryD

Create a library (password -> encrypted).

Inputs: name (required), password, account_token, session_token.

get_auth_helpA

Explain how to obtain Seafile account and library API tokens.

Inputs: no named parameters. Returns: result

get_file_detailC

Get file metadata (account token only).

Inputs: path (required), repo_id, repo_token, library_name, +2 more.

get_library_infoC

Get details of one library, by repo_id or name.

Inputs: repo_id, repo_token, library_name, account_token, +1 more.

list_directoryC

List a directory. entry_type: 'f' files, 'd' folders.

Inputs: path, repo_id, recursive, entry_type, +4 more.

list_librariesB

List libraries visible to the account token. lib_type: mine, shared, group, mine-group, public (default: all).

Inputs: lib_type, account_token, session_token.

move_itemC

Move a file or folder (account token only).

Inputs: path (required), dst_dir (required), is_dir, repo_id, +4 more.

read_fileC

Read a text file. Binary files return metadata + download link.

Inputs: path (required), repo_id, max_chars, repo_token, +3 more.

rename_itemC

Rename a file or folder (repo token: folders only).

Inputs: path (required), new_name (required), is_dir, repo_id, +4 more.

rename_libraryD

Rename a library.

Inputs: name (required), repo_id, library_name, account_token, +1 more.

resolve_libraryC

Resolve a library name to its repo_id (account token only).

Inputs: library_name (required), account_token, session_token.

search_filesB

Search files (account token only; needs search on server).

Inputs: query (required), repo_id, repo_token, library_name, +2 more.

update_fileC

Overwrite a file (new version in history).

Inputs: path (required), content (required), repo_id, is_base64, +4 more.

upload_fileC

Upload/create a file (text or base64).

Inputs: path (required), content (required), replace, repo_id, +5 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.8/5.0

    Scored across 27 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: auth operations, library management, file operations, and share links are all cleanly separated. Even similar tools like upload_file vs update_file or rename_library vs rename_item have unambiguous boundaries. No two tools could be confused.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (e.g., list_libraries, create_directory, auth_rotate). The auth_ prefix groups session tools, while resource-specific verbs (list, get, create, update, rename, move, copy) are applied uniformly. No mixed conventions or vague verbs.

    Tool Count4/5

    27 tools is slightly above the typical heavy threshold, but each tool addresses a distinct operation needed for a full file server integration (auth, libraries, files, shares). While the count feels a bit large, the scope justifies it, and the tools are all useful without redundancy.

    Completeness2/5

    The tool surface lacks delete operations for files, folders, libraries, and share links, which are essential for a complete file management lifecycle. Users can create, read, update, move, and copy but cannot remove anything, leaving obvious dead ends in workflows. This is a significant gap that will cause agent failures when cleanup is needed.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with Seafile cloud storage for managing self-hosted files and directories. It supports operations such as reading, writing, moving, and searching across libraries using either account-based or library-specific authentication.
      14
      8
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI memory persistence and secure credential management via vault tools for MCP-compatible clients like Claude Desktop, Cursor, and VS Code.
      12
      13 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to manage multiple Outlook/Microsoft 365 mailboxes simultaneously through MCP tools, with local OAuth token storage.
      1
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP-compatible AI assistants to interact with a user's Google Drive, including listing, searching, reading, creating, updating, and deleting files, with authentication via Google OAuth.
      1
      -