# πŸ”Œ MCPX > **One config to rule them all.** Configure your MCP servers once, deploy to every AI CLI automatically. [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20-339933?logo=node.js&logoColor=white)](https://nodejs.org/) [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) --- ## 😩 The Problem Each AI CLI tool uses a **different file format** for configuring MCP (Model Context Protocol) servers: | AI CLI | Config File | Format | |--------|------------|--------| | Claude Code | `.mcp.json` | JSON | | Gemini CLI | `.gemini/settings.json` | JSON | | Kimi CLI | `~/.kimi/mcp.json` | JSON | | OpenAI Codex | `.codex/config.toml` | **TOML** | | OpenCode | `opencode.json` | JSON | | GitHub Copilot CLI | `.copilot/mcp-config.json` | JSON | | VS Code | `.vscode/mcp.json` | JSON | | IntelliJ IDEA | `.idea/mcp.json` | JSON | If you use multiple AI tools (and you probably do), you need to **manually maintain 8 different config files** with different structures, field names, and quirks. For **every single project**. --- ## ✨ The Solution **MCPX** maintains a single canonical config file (`.mcpx.json`) per project and **automatically generates** the correct config file for each AI CLI provider you use. ``` .mcpx.json ──────► .mcp.json (Claude Code) β”‚ ──────► .gemini/settings.json (Gemini CLI) β”‚ ──────► ~/.kimi/mcp.json (Kimi CLI) β”‚ ──────► .codex/config.toml (OpenAI Codex) β”‚ ──────► opencode.json (OpenCode) β”‚ ──────► .copilot/mcp-config.json (Copilot CLI) β”‚ ──────► .vscode/mcp.json (VS Code) └───── ──────► .idea/mcp.json (IntelliJ IDEA) ``` --- ## πŸš€ Quick Start ### πŸ“¦ Installation ```bash npm install -g mcpx-cli ``` ### ⚑ First Setup Navigate to your project directory and run: ```bash mcpx ``` The interactive wizard will guide you through: 1. πŸ” **Detection** β€” Automatically detects existing MCP configs in your project 2. πŸ“₯ **Import** β€” Offers to import servers from detected configs 3. βž• **Add servers** β€” Interactive wizard to configure new MCP servers 4. 🎯 **Select providers** β€” Choose which AI CLIs you want to generate configs for 5. βš™οΈ **Generate** β€” Creates `.mcpx.json` and all provider config files --- ## πŸ“‹ Commands | Command | Description | |---------|-------------| | `mcpx` or `mcpx init` | πŸ§™ Interactive setup wizard | | `mcpx add [name]` | βž• Add a new MCP server | | `mcpx remove [name]` | βž– Remove an MCP server | | `mcpx list` | πŸ“„ List configured MCP servers | | `mcpx sync` | πŸ”„ Regenerate all provider config files | | `mcpx import [provider]` | πŸ“₯ Import config from an existing provider | | `mcpx status` | πŸ“Š Show sync status of all providers | ### 🏳️ Global Flags | Flag | Description | |------|-------------| | `--dir, -d ` | πŸ“ Project directory (defaults to current) | | `--verbose` | πŸ”Š Show detailed logs | | `--version, -V` | 🏷️ Show version | | `--help, -h` | ❓ Show help | --- ## πŸ“ Canonical Format MCPX uses a single `.mcpx.json` file as the source of truth: ```json { "version": 1, "providers": ["claude-code", "gemini-cli", "openai-codex", "copilot-cli"], "servers": { "jira": { "description": "Jira Atlassian", "transport": "stdio", "command": "uvx", "args": ["mcp-atlassian"], "env": { "JIRA_URL": "https://myorg.atlassian.net", "JIRA_USERNAME": "user@example.com", "JIRA_API_TOKEN": "your-token" } }, "github": { "description": "GitHub MCP Server", "transport": "stdio", "command": "npx", "args": ["-y", "@anthropic-ai/mcp-github-server"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxx" } } } } ``` ### πŸ“ Server Fields | Field | Type | Required | Description | |-------|------|----------|-------------| | `transport` | `"stdio"` \| `"http"` | βœ… Yes | Transport protocol | | `command` | `string` | stdio | Executable command | | `args` | `string[]` | β€” | Command arguments | | `env` | `Record` | β€” | Environment variables | | `cwd` | `string` | β€” | Working directory | | `url` | `string` | http | Server URL | | `headers` | `Record` | β€” | HTTP headers | | `description` | `string` | β€” | Human-readable description | | `enabled` | `boolean` | β€” | Enable/disable (default: `true`) | --- ## πŸ€– Supported Providers ### πŸ“ Project-Scoped Providers These providers generate config files **inside your project directory**. Each project has its own independent config. #### 🟣 Claude Code | Aspect | Detail | |--------|--------| | **File** | `.mcp.json` | | **Format** | JSON | | **Root key** | `mcpServers` | | **Requires `type`** | Yes `"stdio"` | #### πŸ”΅ Gemini CLI | Aspect | Detail | |--------|--------| | **File** | `.gemini/settings.json` | | **Format** | JSON | | **Root key** | `mcpServers` | | **Requires `type`** | No | #### 🟒 OpenAI Codex | Aspect | Detail | |--------|--------| | **File** | `.codex/config.toml` | | **Format** | **TOML** | | **Root key** | `mcp_servers` | | **Smart merge** | Yes β€” Preserves existing Codex settings (`model`, `approval_mode`, etc.) | #### 🟠 OpenCode | Aspect | Detail | |--------|--------| | **File** | `opencode.json` | | **Format** | JSON | | **Root key** | `mcp` | | **Quirks** | `command` is an array (command + args merged), uses `environment` instead of `env`, `type: "local"` | #### ⚫ GitHub Copilot CLI | Aspect | Detail | |--------|--------| | **File** | `.copilot/mcp-config.json` | | **Format** | JSON | | **Root key** | `mcpServers` | | **Quirks** | Requires `tools: ["*"]` field, needs shell alias for project-level config | > **πŸ“Œ Note:** Copilot CLI does not natively auto-discover project-level MCP configs. MCPX automatically configures a shell alias (`copilot='copilot --additional-mcp-config @.copilot/mcp-config.json'`) in your `.zshrc`, `.bashrc`, or `config.fish` so the project config is loaded automatically when you run `copilot`. #### πŸ”· VS Code | Aspect | Detail | |--------|--------| | **File** | `.vscode/mcp.json` | | **Format** | JSON | | **Root key** | `servers` | | **Quirks** | `type` field required (`"stdio"` or `"sse"`), HTTP mapped as `"sse"` | #### 🟧 IntelliJ IDEA | Aspect | Detail | |--------|--------| | **File** | `.idea/mcp.json` | | **Format** | JSON | | **Root key** | `mcpServers` | | **Quirks** | No `type` field, infers from `command` vs `url` | ### 🌍 Global Providers These providers use a **single global config file** shared across all projects. Running `mcpx sync` overwrites the global file with the current project's servers. #### πŸ”΄ Kimi CLI | Aspect | Detail | |--------|--------| | **File** | `~/.kimi/mcp.json` | | **Format** | JSON | | **Root key** | `mcpServers` | | **Scope** | Global β€” affects all projects | --- ## πŸ”„ Sync & Provider Management ### πŸ” Syncing After modifying `.mcpx.json` (manually or via commands), regenerate all provider configs: ```bash mcpx sync ``` ### πŸ”€ Changing Providers Use the interactive wizard to add or remove providers: ```bash mcpx init # Select "Alterar providers" ``` When a provider is **removed**, MCPX **deletes** the corresponding config file. For global providers, legacy project-level files are also cleaned up. ### πŸ“₯ Importing from Existing Configs Already have MCP servers configured in one of your AI tools? Import them: ```bash mcpx import ``` MCPX detects existing project-level configs (`.mcp.json`, `.gemini/settings.json`, etc.) and lets you select which servers to import into `.mcpx.json`. --- ## πŸ—οΈ Architecture ``` src/ β”œβ”€β”€ cli.ts # Commander setup & routing β”œβ”€β”€ types/ β”‚ β”œβ”€β”€ canonical.ts # McpConfigFile, McpServerConfig (Zod schemas) β”‚ β”œβ”€β”€ providers.ts # Provider interface β”‚ └── common.ts # CommandContext, SyncResult β”œβ”€β”€ commands/ β”‚ β”œβ”€β”€ init.ts # Interactive wizard β”‚ β”œβ”€β”€ add.ts / remove.ts # Server management β”‚ β”œβ”€β”€ list.ts / status.ts # Display info β”‚ β”œβ”€β”€ sync.ts # Regenerate configs β”‚ └── import.ts # Import from providers β”œβ”€β”€ providers/ β”‚ β”œβ”€β”€ base.ts # Provider interface β”‚ β”œβ”€β”€ registry.ts # Provider registry (factory) β”‚ β”œβ”€β”€ claude-code.ts # .mcp.json β”‚ β”œβ”€β”€ gemini-cli.ts # .gemini/settings.json β”‚ β”œβ”€β”€ kimi-cli.ts # ~/.kimi/mcp.json β”‚ β”œβ”€β”€ openai-codex.ts # .codex/config.toml β”‚ β”œβ”€β”€ opencode.ts # opencode.json β”‚ β”œβ”€β”€ copilot-cli.ts # .copilot/mcp-config.json β”‚ β”œβ”€β”€ vscode.ts # .vscode/mcp.json β”‚ └── intellij.ts # .idea/mcp.json β”œβ”€β”€ core/ β”‚ β”œβ”€β”€ config-store.ts # .mcpx.json read/write β”‚ β”œβ”€β”€ detector.ts # Detect existing configs β”‚ └── merger.ts # Smart sync with merge support β”œβ”€β”€ wizard/ β”‚ β”œβ”€β”€ main-wizard.ts # Main interactive flow β”‚ β”œβ”€β”€ server-wizard.ts # Server creation wizard β”‚ β”œβ”€β”€ provider-wizard.ts # Provider selection β”‚ └── step-runner.ts # Step navigation (back support) └── utils/ β”œβ”€β”€ fs.ts # File system helpers β”œβ”€β”€ logger.ts # Logger with colors └── validation.ts # Zod validation ``` --- ## πŸ§ͺ Testing ```bash # Run all tests npm test # Run once (CI) npm run test:run # Type checking npm run typecheck ``` --- ## πŸ› οΈ Tech Stack | Category | Library | |----------|---------| | πŸ’» Language | TypeScript 5.x (ESM) | | πŸ“¦ Build | tsup (esbuild) | | ⌨️ CLI Framework | commander | | πŸ’¬ Interactive Prompts | @clack/prompts | | 🎨 Colors | picocolors | | πŸ“„ TOML | smol-toml | | βœ… Validation | zod | | πŸ§ͺ Tests | vitest | | 🟒 Min Node | >= 20 | --- ## πŸ“„ License MIT ---

πŸ‡§πŸ‡· Leia em PortuguΓͺs (pt-BR)