Skip to content

Commit d9e63d9

Browse files
committed
Merge branch 'main' into dockerfile
2 parents 6d561a0 + 6ab7ac3 commit d9e63d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4878
-3104
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ jobs:
5454
# - run: npm ci
5555
- run: npm install --no-package-lock
5656

57+
- run: npm run build
58+
5759
# TODO: Add --provenance once the repo is public
5860
- run: npm run publish-all
5961
env:

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
.DS_Store
2-
node_modules
2+
.vscode
3+
.idea
4+
node_modules/
5+
*-workspace/
36
server/build
47
client/dist
58
client/tsconfig.app.tsbuildinfo
69
client/tsconfig.node.tsbuildinfo
7-
.vscode
10+
cli/build
11+
test-output

README.md

Lines changed: 100 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The MCP inspector is a developer tool for testing and debugging MCP servers.
66

77
## Running the Inspector
88

9+
### Requirements
10+
11+
- Node.js: ^22.7.5
12+
913
### From an MCP server repository
1014

1115
To inspect an MCP server implementation, there's no need to clone this repo. Instead, use `npx`. For example, if your server is built at `build/index.js`:
@@ -18,16 +22,16 @@ You can pass both arguments and environment variables to your MCP server. Argume
1822

1923
```bash
2024
# Pass arguments only
21-
npx @modelcontextprotocol/inspector build/index.js arg1 arg2
25+
npx @modelcontextprotocol/inspector node build/index.js arg1 arg2
2226

2327
# Pass environment variables only
24-
npx @modelcontextprotocol/inspector -e KEY=value -e KEY2=$VALUE2 node build/index.js
28+
npx @modelcontextprotocol/inspector -e key=value -e key2=$VALUE2 node build/index.js
2529

2630
# Pass both environment variables and arguments
27-
npx @modelcontextprotocol/inspector -e KEY=value -e KEY2=$VALUE2 node build/index.js arg1 arg2
31+
npx @modelcontextprotocol/inspector -e key=value -e key2=$VALUE2 node build/index.js arg1 arg2
2832

2933
# Use -- to separate inspector flags from server arguments
30-
npx @modelcontextprotocol/inspector -e KEY=$VALUE -- node build/index.js -e server-flag
34+
npx @modelcontextprotocol/inspector -e key=$VALUE -- node build/index.js -e server-flag
3135
```
3236

3337
The inspector runs both an MCP Inspector (MCPI) client UI (default port 6274) and an MCP Proxy (MCPP) server (default port 6277). Open the MCPI client UI in your browser to use the inspector. (These ports are derived from the T9 dialpad mapping of MCPI and MCPP respectively, as a mnemonic). You can customize the ports if needed:
@@ -40,20 +44,54 @@ For more details on ways to use the inspector, see the [Inspector section of the
4044

4145
### Authentication
4246

43-
The inspector supports bearer token authentication for SSE connections. Enter your token in the UI when connecting to an MCP server, and it will be sent in the Authorization header.
47+
The inspector supports bearer token authentication for SSE connections. Enter your token in the UI when connecting to an MCP server, and it will be sent in the Authorization header. You can override the header name using the input field in the sidebar.
4448

4549
### Security Considerations
4650

4751
The MCP Inspector includes a proxy server that can run and communicate with local MCP processes. The proxy server should not be exposed to untrusted networks as it has permissions to spawn local processes and can connect to any specified MCP server.
4852

4953
### Configuration
5054

51-
The MCP Inspector supports the following configuration settings. To change them click on the `Configuration` button in the MCP Inspector UI :
55+
The MCP Inspector supports the following configuration settings. To change them, click on the `Configuration` button in the MCP Inspector UI:
56+
57+
| Setting | Description | Default |
58+
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------- |
59+
| `MCP_SERVER_REQUEST_TIMEOUT` | Timeout for requests to the MCP server (ms) | 10000 |
60+
| `MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS` | Reset timeout on progress notifications | true |
61+
| `MCP_REQUEST_MAX_TOTAL_TIMEOUT` | Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications) | 60000 |
62+
| `MCP_PROXY_FULL_ADDRESS` | Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577 | "" |
63+
64+
These settings can be adjusted in real-time through the UI and will persist across sessions.
65+
66+
The inspector also supports configuration files to store settings for different MCP servers. This is useful when working with multiple servers or complex configurations:
67+
68+
```bash
69+
npx @modelcontextprotocol/inspector --config path/to/config.json --server everything
70+
```
5271

53-
| Name | Purpose | Default Value |
54-
| -------------------------- | ----------------------------------------------------------------------------------------- | ------------- |
55-
| MCP_SERVER_REQUEST_TIMEOUT | Maximum time in milliseconds to wait for a response from the MCP server before timing out | 10000 |
56-
| MCP_PROXY_FULL_ADDRESS | The full URL of the MCP Inspector proxy server (e.g. `http://10.2.1.14:2277`) | `null` |
72+
Example server configuration file:
73+
74+
```json
75+
{
76+
"mcpServers": {
77+
"everything": {
78+
"command": "npx",
79+
"args": ["@modelcontextprotocol/server-everything"],
80+
"env": {
81+
"hello": "Hello MCP!"
82+
}
83+
},
84+
"my-server": {
85+
"command": "node",
86+
"args": ["build/index.js", "arg1", "arg2"],
87+
"env": {
88+
"key": "value",
89+
"key2": "value2"
90+
}
91+
}
92+
}
93+
}
94+
```
5795

5896
### From this repository
5997

@@ -65,7 +103,7 @@ Development mode:
65103
npm run dev
66104
```
67105

68-
> **Note for Windows users:**
106+
> **Note for Windows users:**
69107
> On Windows, use the following command instead:
70108
>
71109
> ```bash
@@ -79,6 +117,57 @@ npm run build
79117
npm start
80118
```
81119
120+
### CLI Mode
121+
122+
CLI mode enables programmatic interaction with MCP servers from the command line, ideal for scripting, automation, and integration with coding assistants. This creates an efficient feedback loop for MCP server development.
123+
124+
```bash
125+
npx @modelcontextprotocol/inspector --cli node build/index.js
126+
```
127+
128+
The CLI mode supports most operations across tools, resources, and prompts. A few examples:
129+
130+
```bash
131+
# Basic usage
132+
npx @modelcontextprotocol/inspector --cli node build/index.js
133+
134+
# With config file
135+
npx @modelcontextprotocol/inspector --cli --config path/to/config.json --server myserver
136+
137+
# List available tools
138+
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list
139+
140+
# Call a specific tool
141+
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/call --tool-name mytool --tool-arg key=value --tool-arg another=value2
142+
143+
# List available resources
144+
npx @modelcontextprotocol/inspector --cli node build/index.js --method resources/list
145+
146+
# List available prompts
147+
npx @modelcontextprotocol/inspector --cli node build/index.js --method prompts/list
148+
149+
# Connect to a remote MCP server
150+
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com
151+
152+
# Call a tool on a remote server
153+
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method tools/call --tool-name remotetool --tool-arg param=value
154+
155+
# List resources from a remote server
156+
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method resources/list
157+
```
158+
159+
### UI Mode vs CLI Mode: When to Use Each
160+
161+
| Use Case | UI Mode | CLI Mode |
162+
| ------------------------ | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
163+
| **Server Development** | Visual interface for interactive testing and debugging during development | Scriptable commands for quick testing and continuous integration; creates feedback loops with AI coding assistants like Cursor for rapid development |
164+
| **Resource Exploration** | Interactive browser with hierarchical navigation and JSON visualization | Programmatic listing and reading for automation and scripting |
165+
| **Tool Testing** | Form-based parameter input with real-time response visualization | Command-line tool execution with JSON output for scripting |
166+
| **Prompt Engineering** | Interactive sampling with streaming responses and visual comparison | Batch processing of prompts with machine-readable output |
167+
| **Debugging** | Request history, visualized errors, and real-time notifications | Direct JSON output for log analysis and integration with other tools |
168+
| **Automation** | N/A | Ideal for CI/CD pipelines, batch processing, and integration with coding assistants |
169+
| **Learning MCP** | Rich visual interface helps new users understand server capabilities | Simplified commands for focused learning of specific endpoints |
170+
82171
## License
83172

84173
This project is licensed under the MIT License—see the [LICENSE](LICENSE) file for details.

cli/package.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "@modelcontextprotocol/inspector-cli",
3+
"version": "0.10.2",
4+
"description": "CLI for the Model Context Protocol inspector",
5+
"license": "MIT",
6+
"author": "Anthropic, PBC (https://anthropic.com)",
7+
"homepage": "https://modelcontextprotocol.io",
8+
"bugs": "https://github.com/modelcontextprotocol/inspector/issues",
9+
"main": "build/cli.js",
10+
"type": "module",
11+
"bin": {
12+
"mcp-inspector-cli": "build/cli.js"
13+
},
14+
"files": [
15+
"build"
16+
],
17+
"scripts": {
18+
"build": "tsc",
19+
"postbuild": "node scripts/make-executable.js",
20+
"test": "node scripts/cli-tests.js"
21+
},
22+
"devDependencies": {},
23+
"dependencies": {
24+
"@modelcontextprotocol/sdk": "^1.10.0",
25+
"commander": "^13.1.0",
26+
"spawn-rx": "^5.1.2"
27+
}
28+
}

0 commit comments

Comments
 (0)