Skip to content

Commit b397125

Browse files
authored
Merge branch 'main' into main
2 parents f43a914 + 15fb99b commit b397125

Some content is hidden

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

46 files changed

+3689
-2545
lines changed

.gitignore

+6-2
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

+91-6
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,7 +44,7 @@ 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

@@ -59,6 +63,36 @@ The MCP Inspector supports the following configuration settings. To change them,
5963

6064
These settings can be adjusted in real-time through the UI and will persist across sessions.
6165

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+
```
71+
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+
```
95+
6296
### From this repository
6397

6498
If you're working on the inspector itself:
@@ -69,7 +103,7 @@ Development mode:
69103
npm run dev
70104
```
71105

72-
> **Note for Windows users:**
106+
> **Note for Windows users:**
73107
> On Windows, use the following command instead:
74108
>
75109
> ```bash
@@ -83,6 +117,57 @@ npm run build
83117
npm start
84118
```
85119
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+
86171
## License
87172

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

cli/package.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "@modelcontextprotocol/inspector-cli",
3+
"version": "0.10.0",
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)