Skip to main content
When you run add-mcp without specifying an agent, it doesn’t ask you to pick from a blank list — it scans your environment first. This smart detection step finds which AI coding agents are active in your current directory (or on your machine globally) and pre-selects them in the interactive prompt, so the right agents are already checked before you press Enter.

How detection works

Detection logic differs based on whether you are installing in project scope (the default) or global scope (-g).
add-mcp scans the current directory for agent config markers. Each agent has a set of paths it looks for — for example, Cursor is detected when .cursor/ exists, Claude Code when .mcp.json or .claude/ is present, and VS Code / GitHub Copilot CLI when .vscode/ exists.Detected agents appear at the top of the multi-select list with a project hint and are pre-checked. You can deselect them or add others before confirming.Detected project markers by agent:Agents that are global-only (Antigravity, Cline, Cline CLI, Claude Desktop, Goose, Windsurf) are never detected in project mode but still appear in the list so you can select them manually.

Last-selection memory

add-mcp remembers the agents you chose the last time you ran an install. This selection is persisted to ~/.config/add-mcp/config.json (respecting $XDG_CONFIG_HOME) and used as the default pre-selection the next time no agents are detected. In the multi-select prompt, previously chosen agents that were not detected in the current environment appear below detected agents with a · selected last time hint, making it easy to spot them.
The last-selection memory is used as a fallback only when no agents are detected. Detected agents always take priority and are pre-selected regardless of the saved state.

Bypassing detection explicitly

If you already know which agents you want, pass -a one or more times. This skips detection and the interactive prompt entirely:

The --all flag

--all installs to every supported agent at once, completely bypassing both detection and the interactive prompt:
Use --all --gitignore when you want a broad install across all project-capable agents without committing any of the generated config files to version control.

Detection in the programmatic API

You can run the same detection logic from your own tooling using the exported functions:
Both functions return an array of AgentType strings (e.g. ["cursor", "claude-code"]) that you can pass directly to upsertServer or use for any other purpose in your own CLI integrations.