Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/neon-solutions/add-mcp/llms.txt

Use this file to discover all available pages before exploring further.

The add command is the default action of add-mcp — you run it simply by passing a target directly to npx add-mcp. It installs an MCP server (remote URL, npm package, or shell command) into the configuration files of your chosen AI coding agents, either at the project level or globally.

Usage

npx add-mcp <target> [options]
The <target> can be a remote URL (HTTP or SSE), an npm package name, or a shell command (for stdio-based servers). When no target is supplied, the CLI displays the help banner and exits.

Options

-g, --global
flag
Install to the user-level (global) config directory instead of the current project directory. Use this when you want the server available across all your projects.
-a, --agent <agent>
string (repeatable)
Specify one or more agents to install to (e.g. -a cursor -a claude-code). Run npx add-mcp list-agents for all valid values. Can be repeated. When omitted, the CLI auto-detects agents from your project or prompts for selection.
-n, --name <name>
string
Override the server name written to the config file. When not provided, the name is auto-inferred from the target (e.g. context7 from https://mcp.context7.com/mcp).
-t, --transport <type>
string
Transport type for remote servers. Accepts http (default, streamable HTTP) or sse. Use --transport sse for servers that use the legacy Server-Sent Events protocol. Has no effect on local (stdio) targets.
--type <type>
string
Alias for --transport. Both flags are interchangeable.
-h, --header <header>
string (repeatable)
Add an HTTP header for remote servers, in Key: Value format. Repeatable for multiple headers. Supports ${VAR} placeholders — interactive installs will prompt for each variable; use single quotes to prevent your shell from expanding them early (e.g. --header 'Authorization: Bearer ${TOKEN}'). Only applies to remote targets.
--env <env>
string (repeatable)
Set an environment variable for stdio servers, in KEY=VALUE format. Repeatable. Supports ${VAR} placeholders. Use single quotes to prevent shell expansion. Only applies to local (npm package or command) targets.
--args <arg>
string (repeatable)
Pass an additional argument to a stdio server. Repeatable. Supports ${VAR} placeholders. Only applies to local targets.
-y, --yes
flag
Skip all interactive confirmation prompts. The CLI installs to auto-detected agents (or all project-capable agents if none are detected) without asking. Template variable placeholders are inserted as-is (e.g. <your-value-here>).
--all
flag
Install to all 15 supported agents at once. Agents that do not support the chosen transport are skipped with a warning rather than causing an error.
--gitignore
flag
Automatically append the generated project-level config file paths (e.g. .cursor/mcp.json) to your .gitignore. Ignored when --global is also set.

Transport types

add-mcp supports all three MCP transport types. The transport is chosen automatically for local targets and can be controlled with --transport for remote targets.
TransportFlagDescription
HTTP--transport http (default)Streamable HTTP — the current MCP standard for remote servers
SSE--transport sseServer-Sent Events — deprecated by the MCP spec but still supported by many servers
stdio(automatic)Used for all npm packages and shell commands — no flag needed
Most modern agents (Cursor, OpenCode, Claude Code, etc.) do not require the type field to be written to their config. add-mcp handles the per-agent format differences automatically.

Smart agent detection

When you don’t pass -a or --all, the CLI detects agents automatically:
  • Project mode (default) — scans the current directory for config files (.cursor/mcp.json, .mcp.json, .vscode/mcp.json, etc.) and pre-selects any it finds.
  • Global mode (-g) — checks for globally installed agents (Claude Desktop, Codex, Zed, etc.) and pre-selects them.
  • No agents detected — in interactive mode, you are prompted to choose from all supported agents; with -y, all project-capable agents are targeted automatically.

Examples

npx add-mcp https://mcp.context7.com/mcp
Always use single quotes around --header and --env values that contain ${VAR} placeholders. Double quotes allow your shell to expand the variable before add-mcp sees it, which may result in an empty value being written to the config.
--header is silently ignored for local (stdio) targets, and --env / --args are silently ignored for remote targets. The CLI will log a warning if it detects the mismatch.

Build docs developers (and LLMs) love