# add-mcp

> Add MCP servers to your favorite coding agents with a single command.

Latest version **2.6.0** (published 2026-10-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install add-mcp
pnpm add add-mcp
yarn add add-mcp
bun add add-mcp
```

Provides the command `add-mcp`.

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.6.0 |
| Published | 2026-10-23 |
| First published | 2025-06-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 6 |
| Unpacked size | 223 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 315 |
| Author | Andre Landgraf |
| Maintainers | andrelandgraf |
| Keywords | cli, mcp, model-context-protocol, ai-agents, antigravity, cline, claude-code, claude-desktop, codex, cursor, fx, github-copilot-cli, gemini-cli, factory-droid, goose, grok, grok-build, hermes, junie, kilo-code, kimi-code, kiro, kiro-cli, mastracode, mcporter, opencode, pi, vscode, windsurf, zed |

## Links

- npm: https://www.npmjs.com/package/add-mcp
- Repository: https://github.com/neon-solutions/add-mcp
- Homepage: https://github.com/neon-solutions/add-mcp#readme
- Issues: https://github.com/neon-solutions/add-mcp/issues
- npm.io page: https://npm.io/package/add-mcp

## Dependencies (6)

- [yaml](https://npm.io/package/yaml.md) ^2.9.1
- [chalk](https://npm.io/package/chalk.md) ^5.4.1
- [commander](https://npm.io/package/commander.md) ^13.1.0
- [@iarna/toml](https://npm.io/package/@iarna/toml.md) ^2.2.5
- [jsonc-parser](https://npm.io/package/jsonc-parser.md) ^3.3.1
- [@clack/prompts](https://npm.io/package/@clack/prompts.md) ^0.9.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.6.0 (latest) — 2026-10-23
- 2.4.1 — 2026-09-29
- 2.4.0 — 2026-09-08
- 2.3.0 — 2026-08-24
- 2.2.0 — 2026-08-23
- 2.1.0 — 2026-08-22
- 2.0.0 — 2026-07-23
- 1.14.0 — 2026-07-07
- 1.13.3 — 2026-07-06
- 1.13.2 — 2026-07-06
- 1.13.1 — 2026-07-06
- 1.13.0 — 2026-06-29
- 1.12.0 — 2026-06-29
- 1.11.0 — 2026-06-22
- 1.10.4 — 2026-05-23
- … 34 more at https://npm.io/package/add-mcp/versions

## README

# add-mcp

Add MCP servers to your favorite coding agents with a single command.

Supports **Claude Code**, **Codex**, **Cursor**, **OpenCode**, **VS Code**, **Grok Build** and [19 more](#supported-agents).

Docs and registry: [add-mcp.com](https://add-mcp.com)

## Install an MCP Server

Install an MCP server by remote URL or package name:

```bash
npx add-mcp url | package name [options]
```

Example installing the Context7 remote MCP server:

```bash
npx add-mcp https://mcp.context7.com/mcp
```

Example installing the Context7 remote MCP server via the programmatic API — great for integrating add-mcp in your own CLI tool:

```ts
import { upsertServer } from "add-mcp";

const result = upsertServer(
  "cursor",
  "context7",
  { type: "http", url: "https://mcp.context7.com/mcp" },
  { local: true },
);
console.log(result);
```

You can add env variables and arguments (stdio) and headers (remote) to the server config using the `--env`, `--args` and `--header` options. With `${VAR}` placeholders, interactive installs prompt for each variable (omit skipped optional keys so empty strings are not written to config).

## Find MCP Servers

Find and install MCP servers from the [add-mcp registry](https://add-mcp.com/registry):

```bash
npx add-mcp find vercel
```

The first `find`/`search` run automatically saves the add-mcp registry to `~/.config/add-mcp/config.json` (or `$XDG_CONFIG_HOME/add-mcp/config.json`). You can edit that file to replace the default registry, add the official Anthropic registry, or point at any registry-compatible server.

## Supported Agents

MCP servers can be installed to any of these agents:

| Agent                  | `--agent`            | Project Path                                                                  | Global Path                                                                                                     |
| ---------------------- | -------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| Antigravity            | `antigravity`        | -                                                                             | `~/.gemini/config/mcp_config.json` (shared by Antigravity, Antigravity IDE, and Antigravity CLI)                |
| Cline VSCode Extension | `cline`              | -                                                                             | `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` |
| Cline CLI              | `cline-cli`          | -                                                                             | `~/.cline/data/settings/cline_mcp_settings.json`                                                                |
| Claude Code            | `claude-code`        | `.mcp.json`                                                                   | `~/.claude.json`                                                                                                |
| Claude Desktop         | `claude-desktop`     | -                                                                             | `~/Library/Application Support/Claude/claude_desktop_config.json`                                               |
| Codex                  | `codex`              | `.codex/config.toml`                                                          | `~/.codex/config.toml`                                                                                          |
| Cursor                 | `cursor`             | `.cursor/mcp.json`                                                            | `~/.cursor/mcp.json`                                                                                            |
| Factory Droid          | `factory-droid`      | `.factory/mcp.json`                                                           | `~/.factory/mcp.json`                                                                                           |
| fx                     | `fx`                 | -                                                                             | `~/.fx/mcp.json`                                                                                                |
| Gemini CLI             | `gemini-cli`         | `.gemini/settings.json`                                                       | `~/.gemini/settings.json`                                                                                       |
| Goose                  | `goose`              | `.goose/config.yaml`                                                          | `~/.config/goose/config.yaml`                                                                                   |
| GitHub Copilot CLI     | `github-copilot-cli` | `.mcp.json` (or existing `.github/mcp.json`)                                  | `$COPILOT_HOME/mcp-config.json` (defaults to `~/.copilot/mcp-config.json`)                                      |
| Grok Build             | `grok-build`         | `.grok/config.toml`                                                           | `$GROK_HOME/config.toml` (defaults to `~/.grok/config.toml`)                                                    |
| Hermes Agent           | `hermes`             | -                                                                             | `$HERMES_HOME/config.yaml` (defaults to `~/.hermes/config.yaml`, or the active profile)                         |
| Junie                  | `junie`              | `.junie/mcp/mcp.json`                                                         | `$JUNIE_HOME/mcp/mcp.json` (defaults to `~/.junie/mcp/mcp.json`, which the Junie JetBrains IDE plugin reads)    |
| Kilo Code              | `kilo-code`          | `kilo.json` (or existing `.kilo/`, `.kilocode/`, or root `kilo.jsonc` config) | `~/.config/kilo/kilo.json` (or existing `~/.config/kilo/kilo.jsonc`)                                            |
| Kimi Code              | `kimi-code`          | `.kimi-code/mcp.json`                                                         | `$KIMI_CODE_HOME/mcp.json` (defaults to `~/.kimi-code/mcp.json`)                                                |
| Kiro CLI               | `kiro-cli`           | `.kiro/settings/mcp.json`                                                     | `~/.kiro/settings/mcp.json` (shared with the Kiro IDE)                                                          |
| Mastra Code            | `mastracode`         | `.mastracode/mcp.json`                                                        | `~/.mastracode/mcp.json`                                                                                        |
| MCPorter               | `mcporter`           | `config/mcporter.json`                                                        | `~/.mcporter/mcporter.json` (or existing `~/.mcporter/mcporter.jsonc`)                                          |
| OpenCode               | `opencode`           | `opencode.jsonc` (or existing `opencode.json` / `.opencode/` config)          | `~/.config/opencode/opencode.jsonc` (or existing `opencode.json`)                                               |
| Pi                     | `pi`                 | `.pi/mcp.json`                                                                | `$PI_CODING_AGENT_DIR/mcp.json` (defaults to `~/.pi/agent/mcp.json`)                                            |
| VS Code                | `vscode`             | `.vscode/mcp.json`                                                            | `~/Library/Application Support/Code/User/mcp.json`                                                              |
| Windsurf               | `windsurf`           | -                                                                             | `~/.codeium/windsurf/mcp_config.json`                                                                           |
| Zed                    | `zed`                | `.zed/settings.json`                                                          | `~/Library/Application Support/Zed/settings.json`                                                               |

**Aliases:** `codeium`, `cascade` → `windsurf`, `cline-vscode` → `cline`, `gemini` → `gemini-cli`, `github-copilot` → `vscode`, `grok` → `grok-build`, `kilo`, `kilocode` → `kilo-code`, `kimi` → `kimi-code`, `kiro` → `kiro-cli`, `mastra` → `mastracode`, `pi-agent` → `pi`

Mastra Code also reads project `.mcp.json` for Claude Code compatibility. add-mcp writes `.mastracode/mcp.json` so a mixed Claude + Mastra install does not share that file.

Pi has no built-in MCP. add-mcp writes the Pi-owned files [`pi-mcp-adapter`](https://github.com/nicobailon/pi-mcp-adapter) reads (`pi install npm:pi-mcp-adapter`). A running Pi session picks the change up after `/reload`.

Kimi Code only loads a project-level `.kimi-code/mcp.json` after you trust the folder in the CLI, so a project install may not take effect until then.

Junie CLI and the Junie JetBrains IDE plugin read the same `mcp.json`. The IDE plugin always reads `~/.junie/mcp/mcp.json`, so it only sees a global install when `JUNIE_HOME` is unset. Junie requires server names to match `^[a-zA-Z0-9_-]+$`, so keep `--name` within that pattern. Junie CLI sends an `Authorization` header from the config; the IDE plugin does not support tokens in MCP configs.

Hermes Agent keeps MCP servers under `mcp_servers` in the same `config.yaml` as its other settings; add-mcp edits only that entry and keeps the file's comments. Without `HERMES_HOME`, add-mcp writes to the profile selected with `hermes profile use`. A running session picks the change up after `/reload-mcp`.

fx reads MCP servers only from `~/.fx/mcp.json`. A project file cannot add a server. A running session applies the change with `/mcp reload`.

OpenCode keeps the shape already in the file: `mcp.<name>` on a V1 or empty config, `mcp.servers.<name>` when that native map is already there. In a mixed file, a native entry wins over a legacy entry with the same name. Adding a new name to a mixed file still writes V1; renaming a server keeps it in the map it already uses.

GitHub Copilot CLI project installs write `.mcp.json`. If `.mcp.json` is absent, an existing `.github/mcp.json` is reused. Copilot CLI does not read `.vscode/mcp.json` (that path is the VS Code agent). Entries left in `.vscode/mcp.json` from older Copilot CLI installs stay there for VS Code; rerun with `--agent github-copilot-cli` to write the CLI path. `.mcp.json` is shared with Claude Code: removing a server from either agent removes it for both. add-mcp will not create `.mcp.json` when `.github/mcp.json` already exists, because Copilot CLI would then ignore the GitHub file. Merge those servers into `.mcp.json` under `mcpServers` first. Copilot writes replace the file with strict JSON, so comments in that file are dropped (including global `~/.copilot/mcp-config.json`). Copilot CLI loads a project file only after the folder is trusted; confirm with `copilot mcp list --json`.

## Installation Scope

| Scope       | Flag      | Location                | Use Case                                      |
| ----------- | --------- | ----------------------- | --------------------------------------------- |
| **Project** | (default) | `.cursor/mcp.json` etc. | Committed with your project, shared with team |
| **Global**  | `-g`      | `~/.cursor/mcp.json`    | Available across all projects                 |

## Smart Detection

The CLI automatically detects agents based on your environment:

**Default (project mode):**

- Detects project-level config files (`.cursor/`, `.vscode/`, `.mcp.json`, etc.)
- Selects detected agents (have project config in the current directory) by default
- Shows detected agents plus all other supported agents for selection

**With `-g` (global mode):**

- Detects all globally-installed agents (including Claude Desktop, Codex, Zed)
- Selects detected agents by default
- Shows detected agents plus all other supported agents for selection

**No agents detected:**

- Interactive mode: Defaults to the last selection and shows all agents for selection
- With `--yes`: Installs to all project-capable agents (project mode) or all global-capable agents (global mode)

## Commands

Besides the implicit add command, `add-mcp` also supports the following commands:

| Command       | Description                                                  |
| ------------- | ------------------------------------------------------------ |
| `find`        | Search MCP registry servers and install a selected match     |
| `search`      | Alias for `find`                                             |
| `list`        | List installed MCP servers across detected agents            |
| `remove`      | Remove an MCP server from agent configurations               |
| `sync`        | Synchronize server names and installations across agents     |
| `unify`       | Alias for `sync`                                             |
| `list-agents` | List all supported coding agents with scope (project/global) |

## Add Command

### Usage Examples

```bash
# Remote MCP server (streamable HTTP)
npx add-mcp https://mcp.example.com/mcp

# Remote MCP server (SSE transport)
npx add-mcp https://mcp.example.com/sse --transport sse

# Remote MCP server with auth header
npx add-mcp https://mcp.example.com/mcp --header "Authorization: Bearer $TOKEN"

# Remote server; fx reads the bearer token from this env var
npx add-mcp https://mcp.example.com/mcp --bearer-token-env NEON_API_KEY

# Remote server with a request timeout and OAuth scopes
# (each agent only keeps the fields it supports; others are dropped with a warning)
npx add-mcp https://mcp.example.com/mcp --timeout 30000 --scopes "read,write"

# Auto-approve all tools for agents that support it (Codex, Claude Code)
npx add-mcp "executor mcp" --name executor -a codex -a claude-code --auto-approve

# Auto-approve only selected tools
npx add-mcp "executor mcp" --name executor -a codex --auto-approve --approve-tool execute

# npm package (runs via npx)
npx add-mcp @modelcontextprotocol/server-postgres

# Non-interactive installation to all detected agents in the project directory
npx add-mcp https://mcp.example.com/mcp -y

# Non-interactive installation to the global Claude Code config
npx add-mcp https://mcp.example.com/mcp -g -a claude-code -y

# Full command with arguments
npx add-mcp "npx -y @org/mcp-server --flag value"

# Node.js script
npx add-mcp "node /path/to/server.js --port 3000"

# Local stdio server with environment variables (repeatable)
npx add-mcp @modelcontextprotocol/server-filesystem --env "API_KEY=secret" --env "DATABASE_URL=postgres://localhost/app"

# Install for Cursor and Claude Code
npx add-mcp https://mcp.example.com/mcp -a cursor -a claude-code

# Install with custom server name
npx add-mcp @modelcontextprotocol/server-postgres --name postgres

# Install to all supported agents
npx add-mcp mcp-server-github --all

# Install to all agents, globally, without prompts
npx add-mcp mcp-server-github --all -g -y

# Add generated config files to .gitignore
npx add-mcp https://mcp.example.com/mcp -a cursor -y --gitignore
```

### Options

| Option                      | Description                                                                  |
| --------------------------- | ---------------------------------------------------------------------------- |
| `-g, --global`              | Install to user directory instead of project                                 |
| `-a, --agent <agent>`       | Target specific agents (e.g., `cursor`, `claude-code`). Can be repeated.     |
| `-t, --transport <type>`    | Transport type for remote servers: `http` (default), `sse`                   |
| `--type <type>`             | Alias for `--transport`                                                      |
| `-h, --header <header>`     | HTTP header for remote servers (repeatable, `Key: Value`)                    |
| `--bearer-token-env <name>` | Env var whose value fx sends as a bearer token (capability-gated, see below) |
| `--env <env>`               | Env var for local stdio servers (repeatable, `KEY=VALUE`)                    |
| `--timeout <ms>`            | Request timeout (ms) for remote servers (capability-gated, see below)        |
| `--scopes <scopes>`         | OAuth scopes for remote servers, comma-separated (capability-gated)          |
| `--oauth-scopes <scopes>`   | Alias for `--scopes`                                                         |
| `--auto-approve`            | Auto-approve MCP tool calls for supported agents (Codex, Claude Code)        |
| `--approve-tool <tool>`     | Tool to auto-approve with `--auto-approve` (repeatable; defaults to all)     |
| `-n, --name <name>`         | Server name (auto-inferred if not provided)                                  |
| `-y, --yes`                 | Skip all confirmation prompts                                                |
| `--all`                     | Install to all agents                                                        |
| `--gitignore`               | Add generated config files to `.gitignore`                                   |

#### Capability-gated fields (`--timeout`, `--scopes`, `--bearer-token-env`)

Not every MCP client understands every field. `add-mcp` keeps one canonical
server config and each agent declares which optional fields it supports, mapping
them into that client's native shape:

| Field              | Flag                                | Supported by                                                                                         | Mapped to                                                                                                                                             |
| ------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Timeout            | `--timeout`                         | Claude Code, Factory Droid, Gemini CLI, Grok Build, Hermes Agent, Kilo Code, Kimi Code, Kiro CLI, Pi | `timeout` (milliseconds); Grok Build `tool_timeout_sec` (seconds), Hermes Agent `timeout` (seconds), Kimi Code `toolTimeoutMs`, Pi `requestTimeoutMs` |
| OAuth scopes       | `--scopes`                          | Cursor, Gemini CLI, Mastra Code                                                                      | Cursor `auth.scopes`, Gemini and Mastra Code `oauth.scopes`                                                                                           |
| Bearer token env   | `--bearer-token-env`                | fx                                                                                                   | `bearer_token_env`                                                                                                                                    |
| Tool auto-approval | `--auto-approve` / `--approve-tool` | Codex, Claude Code                                                                                   | Codex approval modes; Claude Code permission allow rules                                                                                              |

When you target an agent that does not support a field, `add-mcp` drops it from
that agent's config and prints a warning (e.g. _"request timeout is not
supported by VS Code; dropped from that config."_). Other agents still receive
it. `--timeout`, `--scopes`, and `--bearer-token-env` apply to remote servers
only; `--auto-approve` applies to both remote and local servers.

When `--bearer-token-env` and `--header Authorization` are both set, fx omits
the Authorization header and writes `bearer_token_env`. Other agents keep the
header.

#### Auto-approving tool calls (`--auto-approve`)

`--auto-approve` preconfigures agent-level approval so the agent doesn't prompt
before each MCP tool call — useful for servers that already gate actions
internally. Use `--approve-tool <name>` (repeatable) to approve only specific
tools; without it, all tools are approved.

- **Codex** — writes approval modes into `config.toml`: per-tool
  `tools.<name>.approval_mode = "approve"`, or `default_tools_approval_mode = "approve"` for all tools.
- **Claude Code** — writes permission allow rules to a separate settings file
  (`.claude/settings.local.json` for project installs, `~/.claude/settings.json`
  for global), e.g. `mcp__<server>__<tool>`, or `mcp__<server>` for all tools.
  The MCP server entry itself stays clean.

> Note: Claude Code's all-tools rule (`mcp__<server>`) follows the documented
> format, but a known Claude Code bug ([#34739](https://github.com/anthropics/claude-code/issues/34739))
> can still prompt for non-fully-qualified MCP rules. Listing tools explicitly
> with `--approve-tool` is the most reliable path there.

### Transport Types

`add-mcp` supports all three transport types: HTTP, SSE, and stdio. Some agents require `type` option to be set to specify the transport type. You can use the `--type` or `--transport` option to specify the transport type:

| Transport | Flag               | Description                                           |
| --------- | ------------------ | ----------------------------------------------------- |
| **HTTP**  | `--transport http` | Streamable HTTP (default)                             |
| **SSE**   | `--transport sse`  | Server-Sent Events (deprecated by MCP but still used) |

Local servers (npm packages, commands) always use **stdio** transport.

Note that most agents like Cursor and opencode do not require the `type` information to be set.

## Find Command

### Usage Examples

```bash
# Search for servers by keyword and choose one interactively
npx add-mcp find vercel

# Browse servers without a keyword
npx add-mcp find

# Use search alias (same as find)
npx add-mcp search notion

# Install a found server globally to a specific agent without prompts
npx add-mcp find neon -a claude-code -g -y

# Install to all agents and add generated project configs to .gitignore
npx add-mcp find github --all --gitignore
```

### Options

| Option                  | Description                                                              |
| ----------------------- | ------------------------------------------------------------------------ |
| `-g, --global`          | Install to user directory instead of project                             |
| `-a, --agent <agent>`   | Target specific agents (e.g., `cursor`, `claude-code`). Can be repeated. |
| `-n, --name <name>`     | Server name override (defaults to the selected catalog entry name)       |
| `-y, --yes`             | Skip confirmation prompts                                                |
| `--auto-approve`        | Auto-approve MCP tool calls for supported agents (Codex, Claude Code)    |
| `--approve-tool <tool>` | Tool to auto-approve with `--auto-approve` (repeatable; defaults to all) |
| `--all`                 | Install to all agents                                                    |
| `--gitignore`           | Add generated config files to `.gitignore`                               |

Transport for `find`/`search` is inferred from registry metadata. The CLI prefers HTTP remotes when available and only falls back to SSE when HTTP is not available for the selected install context.

When a server offers both remote and stdio package options, interactive mode lets you choose one (remote is the default). With `-y`, it auto-selects remote.

If a selected remote server defines URL variables or header inputs:

- required values must be provided
- optional values can be skipped with Enter
- with `-y`, placeholders are inserted (for example `<your-header-value-here>`)

### Configuring Registries for Find / Search

The first time you run `find` or `search`, the CLI automatically saves the add-mcp registry to `~/.config/add-mcp/config.json` (respects `XDG_CONFIG_HOME`) and reuses that registry on every subsequent search.

### Built-in Registries

| Registry                        | Base URL                                                | Description                                                                                                                                                      |
| ------------------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **add-mcp registry**            | `https://add-mcp.com/registry/api/v1/servers`           | MCP servers discovered by integrations.sh and exposed through an MCP registry-compatible API, using add-mcp's checked-in `registry.json` as the source of truth. |
| **Official Anthropic registry** | `https://registry.modelcontextprotocol.io/v0.1/servers` | The community-driven MCP server registry maintained by Anthropic. Contains the broadest catalog of MCP servers.                                                  |

> The add-mcp registry previously lived at `https://mcp.agent-tooling.dev/api/v1/servers`. That URL keeps working, and saved configs referencing it are migrated to the add-mcp.com address automatically on the next `find`/`search` run.

### Missing A Server in integrations.sh?

The default add-mcp registry is generated from [integrations.sh](https://integrations.sh). To be listed in add-mcp, add your MCP server to integrations.sh. Package-only servers, and remotes integrations.sh dropped that we still want in `find`, go in `registry.overlay.json`.

Maintainers can refresh the checked-in registry snapshot with:

```bash
bun run registry:sync
bun run registry:verify
```

### Editing or Removing Registries

Registry selections are stored in `~/.config/add-mcp/config.json` under the `findRegistries` key. You can edit this file directly to replace, add, remove, or reorder registries.

Default add-mcp registry:

```json
{
  "version": 1,
  "findRegistries": [
    {
      "url": "https://add-mcp.com/registry/api/v1/servers",
      "label": "add-mcp registry"
    }
  ]
}
```

Replace the default with the official Anthropic registry:

```json
{
  "version": 1,
  "findRegistries": [
    {
      "url": "https://registry.modelcontextprotocol.io/v0.1/servers",
      "label": "Official Anthropic registry"
    }
  ]
}
```

Search both the add-mcp registry and the official Anthropic registry:

```json
{
  "version": 1,
  "findRegistries": [
    {
      "url": "https://add-mcp.com/registry/api/v1/servers",
      "label": "add-mcp registry"
    },
    {
      "url": "https://registry.modelcontextprotocol.io/v0.1/servers",
      "label": "Official Anthropic registry"
    }
  ]
}
```

To reset to the default add-mcp registry, remove the `findRegistries` key or delete the config file.

### Adding a Custom Registry

Any server that implements the registry API can be added as a custom entry. The CLI sends a `GET` request to the configured `url` with the following query parameters:

| Parameter | Value                                  |
| --------- | -------------------------------------- |
| `search`  | The user's search keyword (lowercased) |
| `version` | `latest`                               |
| `limit`   | `100`                                  |

The endpoint must return JSON in this shape:

```json
{
  "servers": [
    {
      "server": {
        "name": "example-server",
        "description": "An example MCP server",
        "version": "1.0.0",
        "remotes": [
          {
            "type": "streamable-http",
            "url": "https://mcp.example.com/mcp"
          }
        ]
      }
    }
  ]
}
```

To add your own registry, append an entry to `findRegistries` in `~/.config/add-mcp/config.json`:

```json
{
  "url": "https://my-registry.example.com/api/v1/servers",
  "label": "My custom registry"
}
```

## List Command

List installed MCP servers across detected agents:

```bash
# List servers for all detected agents in the project
npx add-mcp list

# List global server configs
npx add-mcp list -g

# List servers for a specific agent (shown even if not detected)
npx add-mcp list -a cursor
```

| Option                | Description                            |
| --------------------- | -------------------------------------- |
| `-g, --global`        | List global configs instead of project |
| `-a, --agent <agent>` | Filter to specific agent(s)            |

## Remove Command

Remove an MCP server from agent configurations by server name, URL, or package name:

```bash
# Remove by server name (interactive selection by default)
npx add-mcp remove neon

# Remove all matches without prompting
npx add-mcp remove neon -y

# Remove by URL
npx add-mcp remove https://mcp.neon.tech/mcp -y

# Remove from global configs for a specific agent
npx add-mcp remove neon -g -a cursor -y
```

| Option                | Description                          |
| --------------------- | ------------------------------------ |
| `-g, --global`        | Remove from global configs           |
| `-a, --agent <agent>` | Filter to specific agent(s)          |
| `-y, --yes`           | Remove all matches without prompting |

## Sync Command

Synchronize server names and installations across all detected agents. Servers are grouped by URL or package name, and each group is unified to the shortest server name. Servers with conflicting headers, env, or args across agents are skipped with a warning.

```bash
# Sync project-level configs (interactive confirmation)
npx add-mcp sync

# Sync without prompting
npx add-mcp sync -y

# Sync global configs
npx add-mcp sync -g -y
```

| Option         | Description                            |
| -------------- | -------------------------------------- |
| `-g, --global` | Sync global configs instead of project |
| `-y, --yes`    | Skip confirmation prompts              |

`unify` is an alias for `sync`.

## Programmatic API

```ts
import {
  detectProjectAgents,
  detectGlobalAgents,
  upsertServer,
  removeServer,
  listInstalledServers,
} from "add-mcp";

const project = detectProjectAgents("/path/to/project");
const global = await detectGlobalAgents();

// Remote server
upsertServer(
  "claude-code",
  "example",
  { type: "http", url: "https://mcp.example.com/api" },
  { local: true, cwd: "/path/to/project" },
);

// Stdio (npm package)
upsertServer("claude-code", "postgres", {
  command: "npx",
  args: ["-y", "@modelcontextprotocol/server-postgres"],
});

const projectServers = await listInstalledServers({
  cwd: "/path/to/project",
});
const globalServers = await listInstalledServers({ global: true });

removeServer("claude-code", "example", {
  local: true,
  cwd: "/path/to/project",
});
```

`upsertServer` and `removeServer` return `{ success, path, error? }` rather than throwing.

## Troubleshooting

### Server not loading

Some agents & editors like Claude Code require a restart to load the new MCP server. Otherwise, like Cursor, require you to navigate to the MCP settings page and toggle the new server as enabled.

fx reads MCP servers only from `~/.fx/mcp.json`. A project file cannot add a server. A running session applies the change with `/mcp reload`.

---
_Source: https://npm.io/package/add-mcp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
