CLI reference

Complete reference for all mcp commands.

Output format

By default, mcp detects the output context:

  • Interactive terminal — human-readable tables with colors

  • Piped or redirected — JSON (for scripting with jq, etc.)

Use --json anywhere to force JSON output regardless of context:

mcp --list --json          # JSON even in terminal
mcp sentry --list --json   # JSON tool list

Global commands

mcp --help, mcp -h

Show usage information.

mcp --list

List all configured servers.

mcp --list

Interactive output:

JSON output (--json or piped):

Global flags

--json

Force JSON output. Can be placed anywhere in the command:

Server commands

mcp <server> --list

Connect to the server and list available tools.

Interactive output:

If the server name alone is provided (no flags, no tool), this is the default behavior:

mcp <server> --info

Like --list, but includes parameter details for each tool.

Interactive output:

JSON output includes full JSON Schema for each tool's input parameters.

mcp <server> <tool> [json]

Call a tool on the server. The optional json argument is a JSON object with the tool's parameters.

If json is omitted:

  • Interactive terminal — Uses {} (empty object)

  • Piped input — Reads JSON from stdin

Interactive output prints text content directly:

Errors are prefixed with error: on stderr.

JSON output wraps content in the MCP protocol format:

Content items have a type field:

  • "text" — Text content in the text field

  • "image" — Base64-encoded image in data field, with mimeType

  • "resource" — Embedded resource content

Registry commands

mcp search <query>

Search the MCP server registry.

Interactive output shows a table of matching servers. JSON output returns full server metadata including repository URL and install instructions.

mcp add <name>

Add a server from the registry. Looks up the server by name, generates a config entry, and writes it to servers.json.

Fails if:

  • Server not found in registry

  • Server already exists in config

  • Name is reserved (search, add, remove, list, help, version)

mcp add --url <url> <name>

Add an HTTP server manually.

mcp remove <name>

Remove a server from the config file.

Fails if the server is not in the config.

Last updated

Was this helpful?