mcp-sync 标志

mcp-sync

社区
ztripez

Sync MCP (Model Context Protocol) configurations across AI tools

发布者ztripez
代码仓库mcp-sync
语言Python
复刻数
6
星标数
45
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    mcp-sync 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 45 个 Star 和 6 个 Fork。

mcp-sync

Sync MCP (Model Context Protocol) configurations across AI tools.

Overview

mcp-sync is a command-line tool that helps you manage and synchronize MCP server configurations across different AI coding tools like Claude Desktop, Claude Code, Cline, VS Code extensions, and more.

Features

  • Auto-discovery: Automatically finds MCP configs on your system
  • Manual registration: Add custom config file locations for future-proofing
  • Global & project configs: Supports both user-wide and project-specific servers
  • Conflict resolution: Smart merging with project configs taking priority
  • Dry-run mode: Preview changes before applying them
  • Cross-platform: Works on macOS, Windows, and Linux

Installation

Quick Usage (Recommended)

bash
uvx mcp-sync status
uvx mcp-sync sync --dry-run

Persistent Installation

bash
uv tool install mcp-sync
mcp-sync status

Development Install

bash
git clone <repo-url>
cd mcp-sync
./scripts/setup.sh    # Installs dependencies and git hooks automatically

Quick Start

  1. Scan for existing configs:

    bash
    mcp-sync scan
  2. Check current status:

    bash
    mcp-sync status
  3. Add a server to global config:

    bash
    mcp-sync add-server filesystem
    # Follow prompts to configure
  4. Preview sync changes:

    bash
    mcp-sync diff
    mcp-sync sync --dry-run
  5. Sync configurations:

    bash
    mcp-sync sync

Commands

Discovery & Status

  • mcp-sync scan - Auto-discover known MCP configs
  • mcp-sync status - Show sync status
  • mcp-sync diff - Show config differences

Config Location Management

  • mcp-sync add-location <path> [--name <alias>] - Register custom config file
  • mcp-sync remove-location <path> - Unregister config location
  • mcp-sync list-locations - Show all registered config paths

Sync Operations

  • mcp-sync sync - Sync all registered configs
  • mcp-sync sync --dry-run - Preview changes without applying
  • mcp-sync sync --global-only - Sync only global configs
  • mcp-sync sync --project-only - Sync only project configs
  • mcp-sync sync --location <path> - Sync specific location only

Server Management

  • mcp-sync add-server <name> - Add MCP server to sync (interactive prompts)
  • mcp-sync add-server <name> --command <cmd> --args <args> --env <vars> --scope <global|project> - Add server with inline parameters
  • mcp-sync remove-server <name> - Remove server from sync (interactive prompts)
  • mcp-sync remove-server <name> --scope <global|project> - Remove server with inline scope
  • mcp-sync list-servers - Show all managed servers

Migration

  • mcp-sync vacuum - Import MCP servers from discovered configs
    • --auto-resolve <first|last> choose conflict resolution automatically
    • --skip-existing avoid overwriting servers already in global config

Adding Servers: When adding a server, you need to provide:

  • Command: The executable to run (e.g., python, npx, node)
  • Arguments: Command-line arguments (comma-separated, optional)
  • Environment: Environment variables as KEY=value pairs (comma-separated, optional)
  • Scope: Whether to add to global config (synced everywhere) or project config (this project only)

Interactive example:

bash
mcp-sync add-server filesystem
# Prompts for: scope, command, args, env vars

Automated example:

bash
mcp-sync add-server filesystem --command npx --args "-y,@modelcontextprotocol/server-filesystem,/home/user/docs" --scope global

Project Management

  • mcp-sync init - Create project .mcp.json
  • mcp-sync template - Show template config

Client Management

  • mcp-sync list-clients - Show all supported clients and their detection status
  • mcp-sync client-info [client-id] - Show detailed client information and paths
  • mcp-sync edit-client-definitions - Edit user client definitions to add custom clients

Configuration Hierarchy

mcp-sync uses a three-tier configuration system:

  1. Global Config (~/.mcp-sync/global.json)

    • Personal development servers
    • Synced across all tools
  2. Project Config (.mcp.json in project root)

    • Project-specific servers
    • Version controlled with your project
    • Takes priority over global config
  3. Tool Configs (Auto-discovered locations)

    • Claude Desktop, VS Code, Cline, etc.
    • Updated by sync operations

Supported Tools

mcp-sync uses a configuration-driven approach to support AI tools and editors. Client definitions are managed through JSON configuration files.

Built-in client support:

  • Claude Desktop - Official Claude Desktop application
  • Claude Code - Claude CLI for code editing
  • Cline - VS Code extension for AI assistance
  • Roo - Roo VS Code extension for AI assistance
  • VS Code User Settings - VS Code global user settings
  • Cursor - Cursor AI code editor
  • Continue - Continue VS Code extension

Run mcp-sync list-clients to see which clients are detected on your system, or mcp-sync client-info <client-id> for detailed information about specific clients.

Adding custom clients: Users can add their own client definitions by running mcp-sync edit-client-definitions. This creates ~/.mcp-sync/client_definitions.json where custom client configurations can be added. User definitions take precedence over built-in ones, allowing customization and adding support for new tools without modifying the codebase.

Example Workflow

bash
# 1. Initialize project config
mcp-sync init

# 2. Add project-specific server
mcp-sync add-server database
# Choose "2. Project config"
# Command: python
# Args: /path/to/db-server.py
# Env: DB_URL=postgresql://...

# 3. Add global development server
mcp-sync add-server filesystem
# Choose "1. Global config"
# Command: npx
# Args: -y, @modelcontextprotocol/server-filesystem, /home/user

# 4. Sync to all tools
mcp-sync sync

# 5. Check status
mcp-sync status

Configuration File Format

MCP Server Configuration

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/path/to/directory"
      ]
    },
    "custom-server": {
      "command": "python",
      "args": ["/path/to/server.py"],
      "env": {
        "API_KEY": "your-api-key"
      }
    }
  }
}

Development

Requirements

  • Python 3.12+
  • uv package manager

Setup

bash
git clone <repo-url>
cd mcp-sync
uv sync
uv pip install -e .

Code Quality

bash
uv run ruff check .     # Linting
uv run ruff format .    # Formatting
uv run pytest          # Tests (when available)

Running Tests

Tests require the package to be on PYTHONPATH. Either install it in editable mode:

bash
uv pip install -e .
uv run pytest

or set PYTHONPATH manually when invoking pytest:

bash
PYTHONPATH=$PWD uv run pytest

License

[License details here]

Contributing

[Contributing guidelines here]

将 mcp-sync MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 mcp-sync 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 mcp-sync 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 mcp-sync MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "mcp-sync": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 mcp-sync MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 mcp-sync MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 mcp-sync 帮我完成这项任务吗?
mcp-sync
当然。我已阅读。
以下是我使用 mcp-sync 得到的结果。

常见问题

mcp-sync MCP 服务器有什么用途?

mcp-sync 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 mcp-sync MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 mcp-sync,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 mcp-sync MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 mcp-sync 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 mcp-sync MCP 连接到 TypingMind?

mcp-sync 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

mcp-sync MCP 在 TypingMind 中提供哪些工具?

mcp-sync 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 mcp-sync MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 mcp-sync 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇