Skip to main content

Remote MCP Servers

Basic Remote Server

Install a remote MCP server using the default HTTP transport.
npx add-mcp https://mcp.example.com/mcp

Remote Server with SSE Transport

Some servers use Server-Sent Events (SSE) instead of HTTP streaming.
npx add-mcp https://mcp.example.com/sse --transport sse

Remote Server with Authentication

Add custom HTTP headers for servers that require authentication.
npx add-mcp https://mcp.example.com/mcp --header "Authorization: Bearer $TOKEN"

Local Packages

npm Package

Install an MCP server from npm. The package will run via npx.
npx add-mcp @modelcontextprotocol/server-postgres

Full Command with Arguments

Pass additional arguments to the MCP server command.
npx add-mcp "npx -y @org/mcp-server --flag value"

Node.js Script

Run a custom Node.js script as an MCP server.
npx add-mcp "node /path/to/server.js --port 3000"

Installation Modes

Non-Interactive Project Installation

Install to all detected agents in the project directory without prompts.
npx add-mcp https://mcp.example.com/mcp -y

Global Installation

Install to the global configuration for Claude Code without prompts.
npx add-mcp https://mcp.example.com/mcp -g -a claude-code -y

Install to All Agents

Install to all supported agents, globally, without prompts.
npx add-mcp mcp-server-github --all

Multiple Agents

Install to Specific Agents

Target multiple agents in a single command.
npx add-mcp https://mcp.example.com/mcp -a cursor -a claude-code

Install with Custom Name

Provide a custom server name instead of using the auto-inferred name.
npx add-mcp @modelcontextprotocol/server-postgres --name postgres

Advanced Usage

Add to .gitignore

Automatically add generated config files to .gitignore (project-scoped only).
npx add-mcp https://mcp.example.com/mcp -a cursor -y --gitignore

Context7 Example

A complete example installing the Context7 MCP server.
npx add-mcp https://mcp.context7.com/mcp

Common Workflows

Development Team Setup

Install an MCP server for your team’s project with automatic .gitignore management.
npx add-mcp https://mcp.example.com/mcp --gitignore -y
The generated config files (e.g., .cursor/mcp.json, .vscode/mcp.json) will be committed with your project, and the CLI will add them to .gitignore automatically.

Personal Global Setup

Install an MCP server globally to use across all your projects.
npx add-mcp https://mcp.example.com/mcp -g -y

Quick Test

Quickly test an MCP server with Cursor in the current project.
npx add-mcp https://mcp.example.com/mcp -a cursor -y

Build docs developers (and LLMs) love