WG

william-garden/sync-mcp

Developer tools
53 stars 0 forks Quality 55 Trend 55

One-Click MCP Configuration Sync Tool. 中文

Overview

One-Click MCP Configuration Sync Tool. 中文

README

sync-mcp

One-Click MCP Configuration Sync Tool. 中文

1. Overview

sync-mcp is a Node.js-based command-line tool designed to solve the pain point of manually syncing universal MCP configurations across multiple IDEs, code editors, and CLI tools. Users can use simple commands to safely synchronize the configuration file of one tool (source) to another tool (target), thereby achieving unified and automated configuration management.

2. Technical Specifications

  • Environment: Node.js 18+ (requires ESM support and modern APIs).
  • Distribution: Distributed via npm, supports direct execution with npx sync-mcp or global installation with npm i -g sync-mcp.
  • Runtime Dependencies: Only depends on cross-platform file system and CLI interaction libraries; no native compilation environment required.
  • Supported Platforms: Runs stably on Linux, Windows, and macOS.

3. Usage

3.1. Direct Sync

Execute synchronization directly by providing keywords for the source and target tools.

npx -y sync-mcp  

3.2. Interactive Sync

When the command is executed without any arguments, it enters interactive mode.

npx -y sync-mcp

Operation Flow:

  1. Select Source:
    ? Select the configuration source file: (Use arrow keys)  
    > 1. VS Code (~/.vscode/mcp.json)  
        2. Cursor (~/.cursor/mcp.json)  
        3. GitHub Copilot CLI (~/.copilot/mcp-config.json)  
        4. Customize
    
  2. Select Target:
    ? Select the configuration target file: (Use arrow keys)  
    > 1. VS Code (~/.vscode/mcp.json)  
        2. Cursor (~/.cursor/mcp.json)  
        3. GitHub Copilot CLI (~/.copilot/mcp-config.json)  
        4. Customize (Select a target tool or create a new configuration)
    

4. Tool Matching Keywords

Tool Name Supported Keywords
Codex codex, openai, codex cli
Claude Code claude, claude-code, claude code, anthropic
Cursor cursor, cursor ide
Gemini CLI gemini, gemini cli, google, gcloud
GitHub Copilot CLI copilot, copilot cli, github, gh
Visual Studio Code vscode, vs code, vs-code, code
OpenCode opencode, open code, anomaly

5. Supported Tools and Configuration Paths

Tool Name Linux Path macOS Path Windows Path Documentation URL
Codex ~/.codex/config.toml ~/.codex/config.toml %USERPROFILE%\.codex\config.toml Codex MCP guide
Claude Code ~/.claude.json ~/.claude.json %USERPROFILE%\.claude.json Claude Code MCP guide
Cursor ~/.cursor/mcp.json ~/.cursor/mcp.json %USERPROFILE%\.cursor\mcp.json Cursor MCP guide
Gemini CLI ~/.gemini/settings.json ~/.gemini/settings.json %USERPROFILE%\.gemini\settings.json Gemini CLI MCP server
GitHub Copilot CLI ~/.copilot/mcp-config.json ~/.copilot/mcp-config.json %USERPROFILE%\.copilot\mcp-config.json Copilot CLI MCP guide
Visual Studio Code ~/.config/Code/User/mcp.json ~/Library/Application Support/Code/User/mcp.json %APPDATA%\Code\User\mcp.json VS Code MCP servers
OpenCode ~/.config/opencode/opencode.json ~/.config/opencode/opencode.json %LOCALAPPDATA%\opencode\opencode.json OpenCode MCP guide

5.1. Codex

Default configuration file: ~/.codex/config.toml

[mcp_servers.context7]
command = "npx"
args = [
    "-y",
    "@upstash/context7-mcp",
    "--api-key",
    "YOUR_API_KEY"
]
env = {}
startup_timeout_sec = 60

Alternative - Remote HTTP Server:

[mcp_servers.context7]
url = "https://mcp.context7.com/mcp"
bearer_token_env_var = "CONTEXT7_API_KEY"
startup_timeout_sec = 60

5.2. Claude Code

Default configuration file: ~/.claude.json

{  
  "mcpServers": {  
    "context7": {  
        "type": "stdio",  
        "command": "npx",  
        "args": [  
            "-y",  
            "@upstash/context7-mcp",  
            "--api-key",  
            "YOUR_API_KEY"  
        ],  
        "env": {}  
    }  
  }  
}

5.3. Cursor

Default configuration file: ~/.cursor/mcp.json

{  
    "mcpServers": {  
        "context7": {  
            "command": "npx",  
            "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]  
        }  
    }  
}

5.4. Gemini CLI (gcloud)

Default configuration file: ~/.gemini/settings.json

{  
    "mcpServers": {  
        "context7": {  
            "command": "npx",  
            "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]  
        }  
    }  
}

5.5. GitHub Copilot CLI

Default configuration file: ~/.copilot/mcp-config.json

{
  "mcpServers": {
    "context7": {
      "type": "local",
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
      "env": {}
    }
  }
}

5.6. Visual Studio Code

Default configuration file:

  • macOS: ~/Library/Application Support/Code/User/mcp.json
  • Linux: ~/.config/Code/User/mcp.json
  • Windows: %APPDATA%\Code\User\mcp.json
{
    "servers": {
        "context7": {
            "type": "stdio",
            "command": "npx",
            "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
        }
    }
}

5.7. OpenCode

Default configuration file:

  • macOS / Linux: ~/.config/opencode/opencode.json
  • Windows: %LOCALAPPDATA%\opencode\opencode.json

Local MCP Server:

{
    "mcp": {
        "context7": {
            "type": "local",
            "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],
            "environment": {}
        }
    }
}

Remote MCP Server:

{
    "mcp": {
        "context7": {
            "type": "remote",
            "url": "https://mcp.context7.com/mcp",
            "timeout": 5000
        }
    }
}

6. Core Features

  • Dual-Mode Operation: Supports both fast, direct single-line command sync and a guided interactive mode.
  • Fuzzy Parameter Matching: Users don’t need to remember the exact tool names; the tool automatically matches common keywords.
  • Cross-Platform Compatibility: Perfect support for Linux, Windows, and macOS environments, automatically handling different OS path formats.
  • Automatic Path Detection: Built-in default configuration paths for mainstream development tools, automatically discovering locally existing configuration files.
  • Safe Backup Mechanism: Automatically backs up the target configuration file before performing any overwrite operation, ensuring the operation is reversible and preventing accidental data loss.
  • Customization and Extension: Supports manually specifying configuration file paths and can automatically create target files if they do not exist.

7. File Backup Mechanism

Safety is one of the core principles of this tool. Before any synchronization operation (i.e., overwriting the target file) occurs, the following backup process must be executed:

  1. Safety Principle: Before any operation writes to the target file, a backup must be completed to ensure the operation is reversible.
  2. Default Location: Creates a ~/.sync-mcp/backup/ directory in the user’s home directory. If it doesn’t exist, it is created automatically.
  3. Backup Content: A complete copy of the current target file.
  4. Backup Path:
    • Root directory: ~/.sync-mcp/backup/
    • Subdirectory structure: ///
    • ``: Unix timestamp (in milliseconds) when the sync operation was executed, e.g., 1677619200000
  5. Example:
    • Operation: npx sync-mcp vscode cursor
    • Time: 2025-10-24 18:00:00 (assuming timestamp 1761319200000)
    • Target file: ~/.cursor/mcp.json on Linux
    • Action: The program copies ~/.cursor/mcp.json to ~/.sync-mcp/backup/1761319200000/.cursor/mcp.json
    • This prevents backup files from being overwritten and preserves the original file’s path structure, making it easy to find and restore.

8. Platform Compatibility

  • Operating Systems: Must run stably on mainstream Linux distributions (Ubuntu, CentOS, etc.), as well as Windows 10/11 and macOS.
  • Path Handling: Internal logic must use Node.js path module functions like path.join() and path.resolve() to handle file paths. Hardcoding / or \ is prohibited.
View this README on GitHub

Install

npx -y @upstash/context7-mcp --api-key YOUR_API_KEY

Configuration

{ "mcpServers": { "context7": { "type": "stdio", "command": "npx", "args": [ "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY" ], "env": {} } } }