README.md
Enables AI assistants to interact with Seafile cloud storage
Seafile MCP Server
MCP (Model Context Protocol) server for Seafile cloud storage. Access your self-hosted files from AI assistants like Claude, OpenCode, and other MCP clients.
Features
- List, read, and write files in your Seafile libraries
- Create and manage directories
- Move, copy, and rename files
- Search across libraries
- Supports both account-based and library-specific authentication
Installation
Using pip
pip install seafile-mcp
From source
git clone https://github.com/5p00kyy/seafile-mcp.git
cd seafile-mcp
pip install -e .
Configuration
Create a .env file or set environment variables:
Required
SEAFILE_SERVER_URL: Your Seafile server URL
Authentication (choose one)
Option 1: Account Authentication (access all libraries)
SEAFILE_USERNAME: Your emailSEAFILE_PASSWORD: Your password
Option 2: Library Token (single library, more secure)
SEAFILE_REPO_TOKEN: API token from library settingsSEAFILE_REPO_ID: Library UUID
Optional
SEAFILE_MAX_READ_SIZE: Max file size to read (default: 1MB)SEAFILE_MAX_WRITE_SIZE: Max upload size (default: 10MB)SEAFILE_TIMEOUT: Request timeout in seconds (default: 30)
Usage with OpenCode
Add to your OpenCode MCP configuration:
{
"mcpServers": {
"seafile": {
"command": "python",
"args": ["-m", "seafile_mcp"],
"env": {
"SEAFILE_SERVER_URL": "https://your-seafile.com",
"SEAFILE_USERNAME": "user@example.com",
"SEAFILE_PASSWORD": "your-password"
}
}
}
}
Or with library token:
{
"mcpServers": {
"seafile": {
"command": "seafile-mcp",
"env": {
"SEAFILE_SERVER_URL": "https://your-seafile.com",
"SEAFILE_REPO_TOKEN": "your-api-token",
"SEAFILE_REPO_ID": "library-uuid"
}
}
}
}
Available Tools
| Tool | Description |
|---|---|
seafile_list_libraries |
List all accessible libraries |
seafile_get_library_info |
Get library details |
seafile_list_directory |
List directory contents |
seafile_read_file |
Read file content |
seafile_write_file |
Write text to a file |
seafile_upload_file |
Upload binary file (base64) |
seafile_create_directory |
Create a folder |
seafile_delete |
Delete file or folder |
seafile_move |
Move file or folder |
seafile_copy |
Copy file or folder |
seafile_rename |
Rename file or folder |
seafile_get_file_info |
Get file metadata |
seafile_get_download_link |
Get download URL |
seafile_search |
Search files by name |
File Handling
- Text files: Content returned directly (up to MAX_READ_SIZE)
- Binary files: Returns metadata and download URL
- Large files: Returns download URL instead of content
Security Notes
- Use library tokens for production (limits access to single library)
- Never commit
.envfiles with credentials - API tokens can be revoked from Seafile web interface
License
MIT
Tools (14)
seafile_list_librariesList all accessible librariesseafile_get_library_infoGet library detailsseafile_list_directoryList directory contentsseafile_read_fileRead file contentseafile_write_fileWrite text to a fileseafile_upload_fileUpload binary file (base64)seafile_create_directoryCreate a folderseafile_deleteDelete file or folderseafile_moveMove file or folderseafile_copyCopy file or folderseafile_renameRename file or folderseafile_get_file_infoGet file metadataseafile_get_download_linkGet download URLseafile_searchSearch files by nameEnvironment Variables
SEAFILE_SERVER_URLrequiredYour Seafile server URLSEAFILE_USERNAMEYour email for account authenticationSEAFILE_PASSWORDYour password for account authenticationSEAFILE_REPO_TOKENAPI token from library settingsSEAFILE_REPO_IDLibrary UUIDSEAFILE_MAX_READ_SIZEMax file size to read (default: 1MB)SEAFILE_MAX_WRITE_SIZEMax upload size (default: 10MB)SEAFILE_TIMEOUTRequest timeout in seconds (default: 30)Configuration
claude_desktop_config.json
{"mcpServers": {"seafile": {"command": "python", "args": ["-m", "seafile_mcp"], "env": {"SEAFILE_SERVER_URL": "https://your-seafile.com", "SEAFILE_USERNAME": "user@example.com", "SEAFILE_PASSWORD": "your-password"}}}}Try it
→List all the libraries in my Seafile account.
→Search for a file named 'budget.xlsx' across my Seafile libraries.
→Read the contents of 'notes.txt' in my Documents folder.
→Create a new directory called 'Project-Alpha' in my main library.
→Upload a new text file to Seafile with the summary of our meeting.