Token导航 LogoToken导航TokenDH.com
Mcpsync CLI logo
开发工具stdio官方级别未说明来源级核验

Mcpsync CLI

MCP Server

mcpsync-cli

mcpsync-cli是一个用于统一管理并同步MCP服务器配置到多个AI编程工具的命令行工具,支持Claude Code、Gemini CLI、OpenAI Codex等多种代理。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
开发工具TypeScriptClaude命令行工具Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

1shanra1

提供方

1shanra1

最后核验

2026/5/17 20:22

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx mcpsync-cli init

详细介绍

mcpsync客户端

](https://www.npmjs.com/package/mcpsync-cli) ![CI](https://github.com/1shanra1/mcpsync/actions/workflows/ci.yml)

所有编码代理的统一MCP服务器配置。

停止在Claude Code、Gemini CLI、OpenAI Codex和其他AI编码工具之间复制MCP服务器配置。定义服务器一次,到处同步。

# Add a server once
mcp-sync add github --command npx --args "-y @modelcontextprotocol/server-github"

# Push to all your coding agents
mcp-sync push

# ✓ claude-code  (3 servers)
# ✓ codex        (3 servers)
# ✓ gemini-cli   (3 servers)
# ✓ roo-code     (3 servers)

安装

npm install -g mcpsync-cli

或者在不安装的情况下使用:

npx mcpsync-cli init

快速开始

# 1. Initialize config
mcp-sync init

# 2. Add your MCP servers
mcp-sync add github
# Interactive prompts guide you through setup

# 3. Sync to all detected agents
mcp-sync push

# 4. Check everything is working
mcp-sync doctor

支持的代理

代理状态配置格式注释
克劳德代码JSON完全支持
OpenAI Codex✅TOML全面支持,包括工具过滤
Gemini CLIJSON全面支持,包括cwd、工具过滤、信任
Roo代码JSON完全支持alwaysAllow、env-var转换
放大器代码JSON完全支持includeTools、HTTP的httpUrl
OpenCodeJSON完全支持disabledTools、autoApprove、env-var转换
基米代码🚧JSON即将推出

命令

mcp-sync init

初始化新的配置文件。

mcp-sync init           # Create ~/.config/mcp-sync/config.yaml
mcp-sync init --force   # Overwrite existing config

mcp-sync add

添加新的MCP服务器。

# Interactive mode
mcp-sync add github

# Non-interactive
mcp-sync add github \
  --type stdio \
  --command npx \
  --args "-y" "@modelcontextprotocol/server-github" \
  --env "GITHUB_TOKEN=\${GITHUB_TOKEN}"

# HTTP server
mcp-sync add context7 \
  --type http \
  --url "https://mcp.context7.com/mcp" \
  --env "CONTEXT7_API_KEY=\${CONTEXT7_API_KEY}"

mcp-sync remove

卸下MCP服务器。

mcp-sync remove github

mcp-sync list

列出所有已配置的服务器。

mcp-sync list         # Table format
mcp-sync list --json  # JSON format

mcp-sync push [agent]

将配置同步到代理。

mcp-sync push              # All installed agents
mcp-sync push claude-code  # Specific agent
mcp-sync push --dry-run    # Preview changes

mcp-sync agents

列出检测到的代理及其状态。

mcp-sync agents         # Table format
mcp-sync agents --json  # JSON format

mcp-sync doctor

对您的配置进行健康检查。

mcp-sync doctor

配置

配置存在于 ~/.config/mcp-sync/config.yaml:

version: "1"

defaults:
  timeout: 60
  autoApprove: false

servers:
  # Stdio server (local command)
  github:
    type: stdio
    command: npx
    args:
      - "-y"
      - "@modelcontextprotocol/server-github"
    env:
      GITHUB_PERSONAL_ACCESS_TOKEN: ${GITHUB_TOKEN}
    description: "GitHub API access"
    
    # Agent-specific overrides
    agents:
      codex:
        enabledTools:
          - list_repos
          - get_file_contents
        disabledTools:
          - delete_repo

  # HTTP server (remote)
  context7:
    type: http
    url: https://mcp.context7.com/mcp
    headers:
      CONTEXT7_API_KEY: ${CONTEXT7_API_KEY}
    description: "Documentation lookup"

# Optional: control which agents to sync to
agents:
  claude-code:
    enabled: true
    scope: user
  codex:
    enabled: true

# Optional: exclude servers from specific agents
exclusions:
  - server: github
    agent: roo-code
    reason: "Using different auth method"

环境变量

使用 ${VAR_NAME} 引用环境变量的语法:

env:
  API_KEY: ${MY_API_KEY}           # Required
  API_KEY: ${MY_API_KEY:-default}  # With default value

代理特定设置

某些功能仅由某些代理支持。使用 agents 自定义键:

servers:
  myserver:
    type: stdio
    command: myserver
    agents:
      codex:
        # Codex supports tool filtering
        enabledTools: [tool1, tool2]
        disabledTools: [dangerous_tool]
      claude-code:
        # Different timeout for Claude
        timeout: 120

编程式用法

import { ConfigManager, adapterRegistry } from 'mcpsync-cli';

// Load config
const manager = new ConfigManager();
const config = manager.get();

// Sync to specific adapter
const claudeAdapter = adapterRegistry.get('claude-code');
if (claudeAdapter) {
  await claudeAdapter.write(config);
}

// Detect installed agents
const installed = await adapterRegistry.getInstalled();
for (const adapter of installed) {
  console.log(`Found: ${adapter.displayName}`);
}

发展

# Install dependencies
npm install

# Run unit tests
npm run test:unit

# Run E2E tests in Docker
npm run test:e2e:docker

# Lint code
npm run lint

# Format code
npm run format

# Check formatting
npm run format:check

# Build
npm run build

贡献

欢迎投稿!我们需要帮助的领域:

  • 新适配器:基米代码
  • 测试:适配器的测试覆盖率
  • 文档:特定工作流程指南

添加新适配器

  1. 创建 src/adapters/your-agent.ts 实施 BaseAdapter
  2. 注册于 src/adapters/index.ts
  3. 在中添加测试 tests/adapters/your-agent.test.ts

src/adapters/claude-code.ts 以供参考。

许可证

麻省理工学院

目录标签

目录标签

开发工具TypeScriptClaude命令行工具配置同步本地部署AI编程工具服务器管理开发效率

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

mcpsync-cli

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP