Skip to content

Commit ddd13ee

Browse files
committed
Merge branch 'main' into auto_open
2 parents 5bcc1fd + cd28370 commit ddd13ee

37 files changed

+3375
-2428
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

+86-5
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ You can pass both arguments and environment variables to your MCP server. Argume
1818

1919
```bash
2020
# Pass arguments only
21-
npx @modelcontextprotocol/inspector build/index.js arg1 arg2
21+
npx @modelcontextprotocol/inspector node build/index.js arg1 arg2
2222

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

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

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

3333
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 +40,7 @@ For more details on ways to use the inspector, see the [Inspector section of the
4040

4141
### Authentication
4242

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.
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. You can override the header name using the input field in the sidebar.
4444

4545
### Security Considerations
4646

@@ -58,6 +58,36 @@ The MCP Inspector supports the following configuration settings. To change them,
5858
| `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 | "" |
5959
| `MCP_AUTO_OPEN_DISABLED` | Disable automatic browser opening when inspector starts | false |
6060

61+
The inspector also supports configuration files to store settings for different MCP servers. This is useful when working with multiple servers or complex configurations:
62+
63+
```bash
64+
npx @modelcontextprotocol/inspector --config path/to/config.json --server everything
65+
```
66+
67+
Example server configuration file:
68+
69+
```json
70+
{
71+
"mcpServers": {
72+
"everything": {
73+
"command": "npx",
74+
"args": ["@modelcontextprotocol/server-everything"],
75+
"env": {
76+
"hello": "Hello MCP!"
77+
}
78+
},
79+
"my-server": {
80+
"command": "node",
81+
"args": ["build/index.js", "arg1", "arg2"],
82+
"env": {
83+
"key": "value",
84+
"key2": "value2"
85+
}
86+
}
87+
}
88+
}
89+
```
90+
6191
### From this repository
6292

6393
If you're working on the inspector itself:
@@ -82,6 +112,57 @@ npm run build
82112
npm start
83113
```
84114
115+
### CLI Mode
116+
117+
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.
118+
119+
```bash
120+
npx @modelcontextprotocol/inspector --cli node build/index.js
121+
```
122+
123+
The CLI mode supports most operations across tools, resources, and prompts. A few examples:
124+
125+
```bash
126+
# Basic usage
127+
npx @modelcontextprotocol/inspector --cli node build/index.js
128+
129+
# With config file
130+
npx @modelcontextprotocol/inspector --cli --config path/to/config.json --server myserver
131+
132+
# List available tools
133+
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list
134+
135+
# Call a specific tool
136+
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/call --tool-name mytool --tool-arg key=value --tool-arg another=value2
137+
138+
# List available resources
139+
npx @modelcontextprotocol/inspector --cli node build/index.js --method resources/list
140+
141+
# List available prompts
142+
npx @modelcontextprotocol/inspector --cli node build/index.js --method prompts/list
143+
144+
# Connect to a remote MCP server
145+
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com
146+
147+
# Call a tool on a remote server
148+
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method tools/call --tool-name remotetool --tool-arg param=value
149+
150+
# List resources from a remote server
151+
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method resources/list
152+
```
153+
154+
### UI Mode vs CLI Mode: When to Use Each
155+
156+
| Use Case | UI Mode | CLI Mode |
157+
| ------------------------ | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
158+
| **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 |
159+
| **Resource Exploration** | Interactive browser with hierarchical navigation and JSON visualization | Programmatic listing and reading for automation and scripting |
160+
| **Tool Testing** | Form-based parameter input with real-time response visualization | Command-line tool execution with JSON output for scripting |
161+
| **Prompt Engineering** | Interactive sampling with streaming responses and visual comparison | Batch processing of prompts with machine-readable output |
162+
| **Debugging** | Request history, visualized errors, and real-time notifications | Direct JSON output for log analysis and integration with other tools |
163+
| **Automation** | N/A | Ideal for CI/CD pipelines, batch processing, and integration with coding assistants |
164+
| **Learning MCP** | Rich visual interface helps new users understand server capabilities | Simplified commands for focused learning of specific endpoints |
165+
85166
## License
86167

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

cli/package.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "@modelcontextprotocol/inspector-cli",
3+
"version": "0.9.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+
"commander": "^13.1.0",
25+
"spawn-rx": "^5.1.2"
26+
}
27+
}

0 commit comments

Comments
 (0)