Synology MCP Server

Synology MCP Server

Enables AI assistants to manage Synology NAS devices with file operations (create, delete, move, search) and Download Station control through secure authentication and session management.

Category
访问服务器

README

💾 Synology MCP Server

Synology MCP Server

A Model Context Protocol (MCP) server for Synology NAS devices. Enables AI assistants to manage files and downloads through secure authentication and session management.

🌟 NEW: Unified server supports both Claude/Cursor (stdio) and Xiaozhi (WebSocket) simultaneously!

🚀 Quick Start with Docker

1️⃣ Setup Environment

# Clone repository
git clone https://github.com/atom2ueki/mcp-server-synology.git
cd mcp-server-synology

# Create environment file
cp env.example .env

2️⃣ Configure .env File

Basic Configuration (Claude/Cursor only):

# Required: Synology NAS connection
SYNOLOGY_URL=http://192.168.1.100:5000
SYNOLOGY_USERNAME=your_username
SYNOLOGY_PASSWORD=your_password

# Optional: Auto-login on startup
AUTO_LOGIN=true
VERIFY_SSL=false

Extended Configuration (Both Claude/Cursor + Xiaozhi):

# Required: Synology NAS connection
SYNOLOGY_URL=http://192.168.1.100:5000
SYNOLOGY_USERNAME=your_username
SYNOLOGY_PASSWORD=your_password

# Optional: Auto-login on startup
AUTO_LOGIN=true
VERIFY_SSL=false

# Enable Xiaozhi support
ENABLE_XIAOZHI=true
XIAOZHI_TOKEN=your_xiaozhi_token_here
XIAOZHI_MCP_ENDPOINT=wss://api.xiaozhi.me/mcp/

3️⃣ Run with Docker

One simple command supports both modes:

# Claude/Cursor only mode (default if ENABLE_XIAOZHI not set)
docker-compose up -d

# Both Claude/Cursor + Xiaozhi mode (if ENABLE_XIAOZHI=true in .env)
docker-compose up -d

# Build and run
docker-compose up -d --build

4️⃣ Alternative: Local Python

# Install dependencies
pip install -r requirements.txt

# Run with environment control
python main.py

🔌 Client Setup

🤖 Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "synology": {
      "command": "docker-compose",
      "args": [
        "-f", "/path/to/your/mcp-server-synology/docker-compose.yml",
        "run", "--rm", "synology-mcp"
      ],
      "cwd": "/path/to/your/mcp-server-synology"
    }
  }
}

↗️ Cursor

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "synology": {
      "command": "docker-compose",
      "args": [
        "-f", "/path/to/your/mcp-server-synology/docker-compose.yml",
        "run", "--rm", "synology-mcp"
      ],
      "cwd": "/path/to/your/mcp-server-synology"
    }
  }
}

🔄 Continue (VS Code Extension)

Add to your Continue configuration (.continue/config.json):

{
  "mcpServers": {
    "synology": {
      "command": "docker-compose",
      "args": [
        "-f", "/path/to/your/mcp-server-synology/docker-compose.yml",
        "run", "--rm", "synology-mcp"
      ],
      "cwd": "/path/to/your/mcp-server-synology"
    }
  }
}

💻 Codeium

For Codeium's MCP support:

{
  "mcpServers": {
    "synology": {
      "command": "docker-compose",
      "args": [
        "-f", "/path/to/your/mcp-server-synology/docker-compose.yml",
        "run", "--rm", "synology-mcp"
      ],
      "cwd": "/path/to/your/mcp-server-synology"
    }
  }
}

🐍 Alternative: Direct Python Execution

If you prefer not to use Docker:

{
  "mcpServers": {
    "synology": {
      "command": "python",
      "args": ["main.py"],
      "cwd": "/path/to/your/mcp-server-synology",
      "env": {
        "SYNOLOGY_URL": "http://192.168.1.100:5000",
        "SYNOLOGY_USERNAME": "your_username",
        "SYNOLOGY_PASSWORD": "your_password",
        "AUTO_LOGIN": "true",
        "ENABLE_XIAOZHI": "false"
      }
    }
  }
}

🌟 Xiaozhi Integration

New unified architecture supports both clients simultaneously!

How It Works

  • ENABLE_XIAOZHI=false (default): Standard MCP server for Claude/Cursor via stdio
  • ENABLE_XIAOZHI=true: Multi-client bridge supporting both:
    • 📡 Xiaozhi: WebSocket connection
    • 💻 Claude/Cursor: stdio connection

Setup Steps

  1. Add to your .env file:
ENABLE_XIAOZHI=true
XIAOZHI_TOKEN=your_xiaozhi_token_here
  1. Run normally:
# Same command, different behavior based on environment
python main.py
# OR
docker-compose up

Key Features

  • Zero Configuration Conflicts: One server, multiple clients
  • Parallel Operation: Both clients can work simultaneously
  • All Tools Available: Xiaozhi gets access to all Synology MCP tools
  • Backward Compatible: Existing setups work unchanged
  • Auto-Reconnection: Handles WebSocket connection drops
  • Environment Controlled: Simple boolean flag to enable/disable

Startup Messages

Claude/Cursor only mode:

🚀 Synology MCP Server
==============================
📌 Claude/Cursor only mode (ENABLE_XIAOZHI=false)

Both clients mode:

🚀 Synology MCP Server with Xiaozhi Bridge
==================================================
🌟 Supports BOTH Xiaozhi and Claude/Cursor simultaneously!

🛠️ Available MCP Tools

🔐 Authentication

  • synology_status - Check authentication status and active sessions
  • synology_login - Authenticate with Synology NAS (conditional)
  • synology_logout - Logout from session (conditional)

📁 File System Operations

  • list_shares - List all available NAS shares
  • list_directory - List directory contents with metadata
    • path (required): Directory path starting with /
  • get_file_info - Get detailed file/directory information
    • path (required): File path starting with /
  • search_files - Search files matching pattern
    • path (required): Search directory
    • pattern (required): Search pattern (e.g., *.pdf)
  • create_file - Create new files with content
    • path (required): Full file path starting with /
    • content (optional): File content (default: empty string)
    • overwrite (optional): Overwrite existing files (default: false)
  • create_directory - Create new directories
    • folder_path (required): Parent directory path starting with /
    • name (required): New directory name
    • force_parent (optional): Create parent directories if needed (default: false)
  • delete - Delete files or directories (auto-detects type)
    • path (required): File/directory path starting with /
  • rename_file - Rename files or directories
    • path (required): Current file path
    • new_name (required): New filename
  • move_file - Move files to new location
    • source_path (required): Source file path
    • destination_path (required): Destination path
    • overwrite (optional): Overwrite existing files

📥 Download Station Management

  • ds_get_info - Get Download Station information
  • ds_list_tasks - List all download tasks with status
    • offset (optional): Pagination offset
    • limit (optional): Max tasks to return
  • ds_create_task - Create new download task
    • uri (required): Download URL or magnet link
    • destination (optional): Download folder path
  • ds_pause_tasks - Pause download tasks
    • task_ids (required): Array of task IDs
  • ds_resume_tasks - Resume paused tasks
    • task_ids (required): Array of task IDs
  • ds_delete_tasks - Delete download tasks
    • task_ids (required): Array of task IDs
    • force_complete (optional): Force delete completed
  • ds_get_statistics - Get download/upload statistics

⚙️ Configuration Options

Variable Required Default Description
SYNOLOGY_URL Yes* - NAS base URL (e.g., http://192.168.1.100:5000)
SYNOLOGY_USERNAME Yes* - Username for authentication
SYNOLOGY_PASSWORD Yes* - Password for authentication
AUTO_LOGIN No true Auto-login on server start
VERIFY_SSL No true Verify SSL certificates
DEBUG No false Enable debug logging
ENABLE_XIAOZHI No false Enable Xiaozhi WebSocket bridge
XIAOZHI_TOKEN Xiaozhi only - Authentication token for Xiaozhi
XIAOZHI_MCP_ENDPOINT No wss://api.xiaozhi.me/mcp/ Xiaozhi WebSocket endpoint

*Required for auto-login and default operations

📖 Usage Examples

📁 File Operations

✅ Creating Files and Directories

File Creation

// List directory
{
  "path": "/volume1/homes"
}

// Search for PDFs
{
  "path": "/volume1/documents", 
  "pattern": "*.pdf"
}

// Create new file
{
  "path": "/volume1/documents/notes.txt",
  "content": "My important notes\nLine 2 of notes",
  "overwrite": false
}

🗑️ Deleting Files and Directories

File Deletion

// Delete file or directory (auto-detects type)
{
  "path": "/volume1/temp/old-file.txt"
}

// Move file
{
  "source_path": "/volume1/temp/file.txt",
  "destination_path": "/volume1/archive/file.txt"
}

⬇️ Download Management

🛠️ Creating a Download Task

Download Sample

// Create download task
{
  "uri": "https://example.com/file.zip",
  "destination": "/volume1/downloads"
}

// Pause tasks
{
  "task_ids": ["dbid_123", "dbid_456"]
}

🦦 Download Results

Download Result

✨ Features

  • Unified Entry Point - Single main.py supports both stdio and WebSocket clients
  • Environment Controlled - Switch modes via ENABLE_XIAOZHI environment variable
  • Multi-Client Support - Simultaneous Claude/Cursor + Xiaozhi access
  • Secure Authentication - RSA encrypted password transmission
  • Session Management - Persistent sessions across multiple NAS devices
  • Complete File Operations - Create, delete, list, search, rename, move files with detailed metadata
  • Directory Management - Recursive directory operations with safety checks
  • Download Station - Complete torrent and download management
  • Docker Support - Easy containerized deployment
  • Backward Compatible - Existing configurations work unchanged
  • Error Handling - Comprehensive error reporting and recovery

🏗️ Architecture

File Structure

mcp-server-synology/
├── main.py                    # 🎯 Unified entry point
├── src/
│   ├── mcp_server.py         # Standard MCP server
│   ├── multiclient_bridge.py # Multi-client bridge
│   ├── auth/                 # Authentication modules
│   ├── filestation/          # File operations
│   └── downloadstation/      # Download management
├── docker-compose.yml        # Single service, environment-controlled
├── Dockerfile
├── requirements.txt
└── .env                      # Configuration

Mode Selection

  • ENABLE_XIAOZHI=falsemain.pymcp_server.py (stdio only)
  • ENABLE_XIAOZHI=truemain.pymulticlient_bridge.pymcp_server.py (both clients)

Perfect for any workflow - from simple Claude/Cursor usage to advanced multi-client setups! 🚀

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选