| MCP(1) | User Manual | MCP(1) |
NAME¶
mcp - Model Context Protocol development tools
SYNOPSIS¶
mcp [OPTIONS] COMMAND [ARGS]...
DESCRIPTION¶
mcp is a command-line interface for working with the Model Context Protocol (MCP). MCP allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction.
The mcp command provides tools for developing, running, and installing MCP servers.
COMMANDS¶
version¶
mcp version [OPTIONS]
Show the MCP version.
- -h, –help
- Show this message and exit.
dev¶
mcp dev [OPTIONS] FILE_SPEC
Run an MCP server with the MCP Inspector.
- FILE_SPEC (required)
- Python file to run, optionally with :object suffix
- -e, –with-editable DIRECTORY
- Directory containing pyproject.toml to install in editable mode
- –with TEXT
- Additional packages to install
- -h, –help
- Show this message and exit.
The dev command launches the server with the official MCP Inspector (@modelcontextprotocol/inspector), which provides a web-based interface for testing and interacting with your MCP server during development. Requires Node.js and npm to be installed on your system.
run¶
mcp run [OPTIONS] FILE_SPEC
Run an MCP server.
- FILE_SPEC (required)
- Python file to run, optionally with :object suffix
- -t, –transport TEXT
- Transport protocol to use (stdio or sse)
- -h, –help
- Show this message and exit.
The server can be specified in two ways:
- 1.
- Module approach: server.py - runs the module directly, expecting a server.run() call.
- 2.
- Import approach: server.py:app - imports and runs the specified server object.
Note: This command runs the server directly. You are responsible for ensuring all dependencies are available. For dependency management, use mcp install or mcp dev instead.
install¶
mcp install [OPTIONS] FILE_SPEC
Install an MCP server in the Claude desktop app.
- FILE_SPEC (required)
- Python file to run, optionally with :object suffix
- -n, –name TEXT
- Custom name for the server (defaults to server’s name attribute or file name)
- -e, –with-editable DIRECTORY
- Directory containing pyproject.toml to install in editable mode
- –with TEXT
- Additional packages to install
- -v, –env-var TEXT
- Environment variables in KEY=VALUE format
- -f, –env-file FILE
- Load environment variables from a .env file
- -h, –help
- Show this message and exit.
Environment variables are preserved once added and only updated if new values are explicitly provided. Requires the Claude desktop application to be installed on your system.
FILE SPECIFICATION¶
Both dev and run commands accept a file specification that can optionally include a server object name:
- FILE
- Runs the file directly. The file must be a valid Python file.
- FILE:OBJECT
- Runs the specified server object from the file.
If no object is specified, the command will automatically try common server object names: mcp, server, or app.
EXAMPLES¶
- mcp version
- Display the installed MCP version.
- mcp run server.py
- Run an MCP server from server.py, auto-detecting the server object.
- mcp run server.py:mcp
- Run the `mcp' server object from server.py.
- mcp run server.py –transport stdio
- Run a server using stdio transport.
- mcp dev server.py
- Run a server with the MCP Inspector for development.
- mcp dev server.py –with-editable . –with requests
- Run a server in the current directory as editable with additional dependencies.
- mcp install server.py –name “my-server” -v “API_KEY=secret” -f .env
- Install a server in Claude with custom name, environment variables, and variables from a .env file.
AUTHORS¶
Written by Anthropic, PBC.
BUGS¶
Submit bug reports online at: https://github.com/modelcontextprotocol/python-sdk/issues
| June 27, 2026 | mcp 1.28.0 |