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 / Syntax | What it does | Notes |
|---|---|---|
| claude mcp add <name> ... | Register an MCP server with Claude Code | Local 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 definition | Paste the same JSON shape used in .mcp.json. |
| claude mcp list | List all configured servers | Shows every server visible in the current scope hierarchy. |
| claude mcp get <name> | Show details for one server | Includes transport, scope, and status. |
| claude mcp remove <name> | Remove a configured server | Takes 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 line | OAuth flow runs in the browser unless --no-browser is set. |
| claude mcp reset-project-choices | Reset approval choices for project-scoped .mcp.json servers | Claude prompts again before using project-scoped servers. |
| claude mcp serve | Run Claude Code itself as a stdio MCP server | Prints nothing on start; other applications connect to it as a server. |
.mcp.json Configuration Fields (7)
| Command / Syntax | What it does | Notes |
|---|---|---|
| mcpServers | Top-level object in .mcp.json holding all server definitions | Each key is a server name mapping to its config object. |
| command / args | Launch command and arguments for a local stdio server | Example: "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"]. |
| env | Environment variables passed to a stdio server | Object of KEY: value pairs; supports expansion like ${VAR} and ${VAR:-default}. |
| type / url | Transport type and endpoint for a remote server | "type": "http" or "sse" with the server URL. |
| headers | Custom HTTP headers sent to a remote server | Used for API keys or bearer tokens on http/sse transports. |
| ${VAR} / ${VAR:-default} | Environment variable expansion inside .mcp.json | Expands in command, args, env, url, and headers; the :- form supplies a default. |
| .mcp.json | Project-scope server file committed at the repository root | Claude prompts for approval before using servers from it; reset with claude mcp reset-project-choices. |
Scopes, Transports & Flags (7)
| Command / Syntax | What it does | Notes |
|---|---|---|
| --scope local|project|user | Where a server definition is stored | local is private to you in this project (default); project writes .mcp.json; user applies across all your projects. |
| --transport http|sse | Remote transport selection on claude mcp add | Omit for local stdio; WebSocket servers use a ws:// URL. |
| --env KEY=value | Set an environment variable for a stdio server at add time | Repeatable. |
| --header "Name: value" | Attach a custom header to a remote server at add time | Repeatable; the usual carrier for API keys. |
| --callback-port / --client-id / --client-secret | Fixed OAuth callback port and pre-configured OAuth credentials | For remote servers whose OAuth setup does not support dynamic registration. |
| --no-browser | Print the OAuth URL instead of opening a browser | Pair with claude mcp login on headless machines. |
| --mcp-config <file> | Load MCP servers from a JSON file for this run | Used with claude -p runs and the Agent SDK. |
Environment Variables (5)
| Command / Syntax | What it does | Notes |
|---|---|---|
| MAX_MCP_OUTPUT_TOKENS | Raise the MCP tool output limit | Claude warns past 10,000 tokens and truncates at 25,000 by default. |
| CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT | Idle timeout for MCP tool calls | Defaults to 30 minutes for stdio servers; before v2.1.203 stdio was exempt. |
| CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS | Threshold before a long MCP tool call is moved to the background | Automatic backgrounding of long tool calls. |
| MCP_CLIENT_SECRET | Pre-configured OAuth client secret for a remote server | Paired with --client-id when dynamic registration is unavailable. |
| CLAUDE_CODE_DISABLE_BACKGROUND_TASKS | Disable automatic backgrounding entirely | Set to 1 to keep every tool call in the foreground. |
In-Session Usage (3)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /mcp | In-session MCP menu: server status, auth, tools, resources | Also where organization-managed connector controls surface. |
| @server:resource | Reference an MCP resource in the prompt | Pulls the resource content into context. |
| /mcp__server__prompt | Run an MCP prompt exposed by a server as a slash command | Arguments 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.