npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

add-mcp

v1.2.1

Published

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

Readme

add-mcp

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

Supports Claude Code, Codex, Cursor, OpenCode, VSCode and 5 more.

Install an MCP Server

npx add-mcp url | package name [options]

Example installing the Context7 MCP server:

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

Usage Examples

# 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"

# 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"

# 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 | | --header <header> | HTTP header for remote servers (repeatable, Key: Value) | | -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 |

Additional Commands

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

| Command | Description | | ------------- | ------------------------------------------------------------ | | list-agents | List all supported coding agents with scope (project/global) |

# List all supported agents
npx add-mcp list-agents

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
  • Installs to project-level config files

With -g (global mode):

  • Detects all globally-installed agents (including Claude Desktop, Codex, Zed)
  • All agents use global config

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)

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 some agents like Cursor and opencode do not require the type information to be set.

HTTP Headers

Use --header to pass custom headers for remote servers. The flag can be repeated. If you explicitly select agents that don't support headers, the install will error. Auto-detected installs skip unsupported agents with a warning.

Agents that support headers: Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, OpenCode, VS Code, Zed. Agents that do not support headers: Goose.

Supported Agents

MCP servers can be installed to any of these agents:

| Agent | --agent | Project Path | Global Path | | ------------------ | -------------------- | ----------------------- | ----------------------------------------------------------------- | | 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 | | 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 | .vscode/mcp.json | ~/.copilot/mcp-config.json | | OpenCode | opencode | opencode.json | ~/.config/opencode/opencode.json | | VS Code | vscode | .vscode/mcp.json | ~/Library/Application Support/Code/User/mcp.json | | Zed | zed | .zed/settings.json | ~/Library/Application Support/Zed/settings.json |

Aliases: geminigemini-cli, github-copilotvscode

The CLI uses smart detection to find agents in your project directory and globally installed agents. See Smart Detection for details.

What are MCP Servers?

Model Context Protocol (MCP) servers extend your coding agent's capabilities by providing tools, resources, and context. MCP servers can:

  • Integrate with external services (Notion, Linear, GitHub, etc.)
  • Connect to databases (PostgreSQL, MySQL, etc.)
  • Provide file system access
  • Offer specialized tools for your workflow

Troubleshooting

Server not loading

  • Verify the server URL is correct and accessible
  • Check the agent's MCP configuration file for syntax errors
  • Ensure the server name doesn't conflict with existing servers

Permission errors

Ensure you have write access to the target configuration directory.

License

Apache 2.0