MCP (Model Context Protocol) Commands & Prompt Reference

30 commands & parameters · 5 categories · Source: Claude Code Docs - MCP

MCP (Model Context Protocol) is the wiring layer of the current agent ecosystem: an open standard that lets any client - Claude Code, Cursor, OpenClaw, LM Studio and dozens more - talk to any tool server over a common protocol. Its typed surface is exactly the kind of thing this site catalogs: a CLI for registering servers, a JSON configuration format, transport and scope choices, and a handful of environment variables that govern limits and timeouts. This page uses Claude Code, the most fully documented MCP client, as the reference implementation; the .mcp.json shape carries over to other clients with minor differences.

The pieces fit together in one sentence: claude mcp add registers a server (stdio locally, http or sse remotely), the definition lands in one of three scopes (local, project via .mcp.json, or user), and at run time /mcp shows status while @server:resource pulls server content into context. The scope choice matters more than it looks - project scope commits the server list to the repository for the whole team, which is why Claude asks for approval before using servers from a checked-out .mcp.json.

We run MCP on both sides of the wire: this site serves its own MCP endpoint (six tools across the shortcuts and prompts references), and the entries here were verified against the official documentation while operating that server. Two limits worth knowing before they surprise you: tool output warns at 10,000 tokens and truncates at 25,000 unless MAX_MCP_OUTPUT_TOKENS raises it, and long tool calls are moved to the background automatically past a threshold you can tune or disable.

All Commands

claude mcp CLI (8)

Command / SyntaxWhat it doesNotes
claude mcp add <name> ...Register an MCP server with Claude CodeLocal stdio by default; --transport http or sse for remote servers, with -- separating the launch command for stdio.
claude mcp add-json <name> '{...}'Register a server from a JSON definitionPaste the same JSON shape used in .mcp.json.
claude mcp listList all configured serversShows every server visible in the current scope hierarchy.
claude mcp get <name>Show details for one serverIncludes transport, scope, and status.
claude mcp remove <name>Remove a configured serverTakes the server name shown by claude mcp list.
claude mcp login <name> / logout <name>Authenticate or sign out of a remote server from the command lineOAuth flow runs in the browser unless --no-browser is set.
claude mcp reset-project-choicesReset approval choices for project-scoped .mcp.json serversClaude prompts again before using project-scoped servers.
claude mcp serveRun Claude Code itself as a stdio MCP serverPrints nothing on start; other applications connect to it as a server.

.mcp.json Configuration Fields (7)

Command / SyntaxWhat it doesNotes
mcpServersTop-level object in .mcp.json holding all server definitionsEach key is a server name mapping to its config object.
command / argsLaunch command and arguments for a local stdio serverExample: "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"].
envEnvironment variables passed to a stdio serverObject of KEY: value pairs; supports expansion like ${VAR} and ${VAR:-default}.
type / urlTransport type and endpoint for a remote server"type": "http" or "sse" with the server URL.
headersCustom HTTP headers sent to a remote serverUsed for API keys or bearer tokens on http/sse transports.
${VAR} / ${VAR:-default}Environment variable expansion inside .mcp.jsonExpands in command, args, env, url, and headers; the :- form supplies a default.
.mcp.jsonProject-scope server file committed at the repository rootClaude prompts for approval before using servers from it; reset with claude mcp reset-project-choices.

Scopes, Transports & Flags (7)

Command / SyntaxWhat it doesNotes
--scope local|project|userWhere a server definition is storedlocal is private to you in this project (default); project writes .mcp.json; user applies across all your projects.
--transport http|sseRemote transport selection on claude mcp addOmit for local stdio; WebSocket servers use a ws:// URL.
--env KEY=valueSet an environment variable for a stdio server at add timeRepeatable.
--header "Name: value"Attach a custom header to a remote server at add timeRepeatable; the usual carrier for API keys.
--callback-port / --client-id / --client-secretFixed OAuth callback port and pre-configured OAuth credentialsFor remote servers whose OAuth setup does not support dynamic registration.
--no-browserPrint the OAuth URL instead of opening a browserPair with claude mcp login on headless machines.
--mcp-config <file>Load MCP servers from a JSON file for this runUsed with claude -p runs and the Agent SDK.

Environment Variables (5)

Command / SyntaxWhat it doesNotes
MAX_MCP_OUTPUT_TOKENSRaise the MCP tool output limitClaude warns past 10,000 tokens and truncates at 25,000 by default.
CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUTIdle timeout for MCP tool callsDefaults to 30 minutes for stdio servers; before v2.1.203 stdio was exempt.
CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSThreshold before a long MCP tool call is moved to the backgroundAutomatic backgrounding of long tool calls.
MCP_CLIENT_SECRETPre-configured OAuth client secret for a remote serverPaired with --client-id when dynamic registration is unavailable.
CLAUDE_CODE_DISABLE_BACKGROUND_TASKSDisable automatic backgrounding entirelySet to 1 to keep every tool call in the foreground.

In-Session Usage (3)

Command / SyntaxWhat it doesNotes
/mcpIn-session MCP menu: server status, auth, tools, resourcesAlso where organization-managed connector controls surface.
@server:resourceReference an MCP resource in the promptPulls the resource content into context.
/mcp__server__promptRun an MCP prompt exposed by a server as a slash commandArguments follow the command like any other slash command.

Recipes

Our own notes on combining the commands above. Every token used here appears in the reference tables on this page.

Expose Claude Code itself as a server to another MCP client

claude mcp serve → register as a local stdio server in the other client

claude mcp serve runs Claude Code as a stdio MCP server and prints nothing on start. In the consuming client, add it the same way as any local stdio server - in Claude Code's own syntax that shape is claude mcp add with a launch command.

Share one server list with your whole team

claude mcp add --scope project → .mcp.json → claude mcp reset-project-choices

Project scope writes the definition into .mcp.json at the repository root, so the server ships with the checkout. Teammates are prompted for approval on first use; reset-project-choices makes Claude ask again after changes.

Connect a remote server that needs an API key

claude mcp add --transport http <url> --header "Authorization: Bearer ..."

--header is repeatable and is the documented carrier for credentials on http and sse transports. For OAuth servers use claude mcp login instead, with --no-browser on headless machines.

Frequently Asked Questions

How do I add a remote MCP server to Claude Code?

claude mcp add <name> --transport http <url> (or --transport sse). Attach credentials with repeatable --header flags, and use claude mcp login for OAuth servers.

What is the difference between local, project, and user scope?

local (default) is private to you in the current project. project writes the server into .mcp.json at the repository root so the whole team shares it. user applies across all your projects. More specific scopes win when names collide.

Why is my MCP tool output being cut off?

Claude Code warns when tool output exceeds 10,000 tokens and truncates at 25,000 by default. Raise the ceiling with the MAX_MCP_OUTPUT_TOKENS environment variable.

Every entry on this page is a literal, typeable token taken from the official documentation linked above. Command sets in AI tools change quickly - the in-product command menu is always authoritative for your installed version.

Related prompt references

Claude Code (111) · OpenClaw (66) · LM Studio (24) · All AI prompt references