File size: 2,425 Bytes
1814d17
 
 
 
 
 
 
 
a2aa9d2
1814d17
 
 
293074b
1814d17
 
a2aa9d2
1814d17
 
 
a2aa9d2
1814d17
 
293074b
1814d17
 
a2aa9d2
1814d17
 
 
a2aa9d2
1814d17
a2aa9d2
 
1814d17
 
293074b
1814d17
a2aa9d2
dcd54e9
a2aa9d2
1814d17
 
a2aa9d2
 
293074b
 
 
 
 
1814d17
 
 
 
a2aa9d2
293074b
1814d17
 
dcd54e9
18d0508
 
a2aa9d2
18d0508
 
 
a2aa9d2
18d0508
a2aa9d2
 
 
53ba205
 
 
 
 
 
 
 
a2aa9d2
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: cli
sidebarTitle: cli
---

# `fastmcp.cli.cli`


FastMCP CLI tools using Cyclopts.

## Functions

### `version` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L103" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
version()
```


Display version information and platform details.


### `dev` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L141" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
dev(server_spec: str) -> None
```


Run an MCP server with the MCP Inspector for development.

**Args:**
- `server_spec`: Python file to run, optionally with \:object suffix


### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L286" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
run(server_spec: str, *server_args: str) -> None
```


Run an MCP server or connect to a remote one.

The server can be specified in four ways:
1. Module approach: "server.py" - runs the module directly, looking for an object named 'mcp', 'server', or 'app'
2. Import approach: "server.py:app" - imports and runs the specified server object
3. URL approach: "http://server-url" - connects to a remote server and creates a proxy
4. MCPConfig file: "mcp.json" - runs as a proxy server for the MCP Servers in the MCPConfig file

Server arguments can be passed after -- :
fastmcp run server.py -- --config config.json --debug

**Args:**
- `server_spec`: Python file, object specification (file\:obj), MCPConfig file, or URL


### `inspect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L439" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
inspect(server_spec: str) -> None
```


Inspect an MCP server and generate a JSON report.

This command analyzes an MCP server and generates a comprehensive JSON report
containing information about the server's name, instructions, version, tools,
prompts, resources, templates, and capabilities.

**Examples:**

fastmcp inspect server.py
fastmcp inspect server.py -o report.json
fastmcp inspect server.py:mcp -o analysis.json
fastmcp inspect path/to/server.py:app -o /tmp/server-info.json

**Args:**
- `server_spec`: Python file to inspect, optionally with \:object suffix