0
# CLI Tools
1
2
Command-line interface for MCP development, testing, and debugging. The MCP CLI provides tools for server inspection, client testing, and protocol validation to streamline MCP development workflows.
3
4
## Capabilities
5
6
### CLI Application
7
8
Main command-line interface built with Typer for MCP operations.
9
10
```python { .api }
11
app: typer.Typer
12
```
13
14
### Available Commands
15
16
Core CLI commands for MCP development and server management.
17
18
```bash { .api }
19
# Display help information
20
mcp --help
21
22
# Show MCP version
23
mcp version
24
25
# Development mode - run server with MCP Inspector
26
mcp dev <file-spec> [--with-editable DIR] [--with PACKAGES]
27
28
# Run MCP server directly
29
mcp run <file-spec> [--transport stdio|sse]
30
31
# Install MCP server in Claude desktop app
32
mcp install <file-spec> [--name NAME] [--with-editable DIR] [--with PACKAGES] [--env-var KEY=VALUE] [--env-file FILE]
33
```
34
35
## Usage Examples
36
37
### Version Information
38
39
Display MCP version and help information.
40
41
```bash
42
# Show MCP version
43
mcp version
44
45
# Show help for all commands
46
mcp --help
47
```
48
49
### Development Mode
50
51
Run MCP servers with the MCP Inspector for development and testing.
52
53
```bash
54
# Run server in development mode with Inspector
55
mcp dev server.py
56
57
# Run server with additional dependencies
58
mcp dev server.py --with requests --with pandas
59
60
# Run server with editable project installation
61
mcp dev server.py:app --with-editable /path/to/project
62
```
63
64
### Direct Server Execution
65
66
Run MCP servers directly without additional tooling.
67
68
```bash
69
# Run server using stdio transport (default)
70
mcp run server.py
71
72
# Run server with specific transport
73
mcp run server.py --transport sse
74
75
# Run specific server object from module
76
mcp run server.py:app --transport stdio
77
```
78
79
### Claude Desktop Integration
80
81
Install MCP servers for use with Claude Desktop application.
82
83
```bash
84
# Install basic server
85
mcp install server.py
86
87
# Install server with custom name
88
mcp install server.py --name "My MCP Server"
89
90
# Install with environment variables
91
mcp install server.py --env-var "API_KEY=your-key" --env-var "DEBUG=true"
92
93
# Install with .env file
94
mcp install server.py --env-file .env
95
96
# Install with additional packages and editable mode
97
mcp install server.py --with requests --with-editable /path/to/project
98
```
99
100
## Command Reference
101
102
Each CLI command accepts a file specification in the format `file.py` or `file.py:object` where:
103
- `file.py` - Runs the module directly (expects `server.run()` call)
104
- `file.py:object` - Imports and runs the specified server object
105
106
Common options:
107
- `--with PACKAGE` - Install additional Python packages
108
- `--with-editable DIR` - Install directory in editable mode
109
- `--env-var KEY=VALUE` - Set environment variables
110
- `--env-file FILE` - Load environment variables from file