Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4c4c8a0
Add CLI and config file support
nbarraud Mar 11, 2025
9f42629
Forgot package files
nbarraud Mar 11, 2025
f4e6f4d
Removed package-info.ts
nbarraud Mar 11, 2025
dae3890
Change --tool-args to --tool-arg for consistency
nbarraud Mar 11, 2025
a63de62
Update URL to use 127.0.0.1 instead of localhost
nbarraud Mar 30, 2025
5b22143
CLI and config file support
nbarraud Mar 30, 2025
65c589c
Fixes to the formatting
nbarraud Mar 30, 2025
1dfe10b
Merge branch 'main' into cli-and-config-file-support
nbarraud Mar 30, 2025
1832be2
Update package.json
nbarraud Mar 31, 2025
86a1ade
Update package.json
nbarraud Mar 31, 2025
cf86040
Update package-lock.json
nbarraud Mar 31, 2025
3fc6301
Moved some dependencies in repos where they are being used.
nbarraud Mar 31, 2025
6eb6b3f
Update package-lock.json
nbarraud Mar 31, 2025
952e13e
Update cli-tests.js
nbarraud Mar 31, 2025
73d4cec
prettier-fix
nbarraud Mar 31, 2025
8423776
Fixed conflicts
nbarraud Apr 12, 2025
bbff5c5
Merge branch 'main' into cli-and-config-file-support
nbarraud Apr 12, 2025
204a90b
Resolved new conflicts
nbarraud Apr 14, 2025
dcef9dd
Merge branch 'cli-and-config-file-support' of https://github.com/nbar…
nbarraud Apr 14, 2025
de233c9
Conflict resolution
nbarraud Apr 14, 2025
3784816
Merge branch 'main' into cli-and-config-file-support
nbarraud Apr 14, 2025
485e703
Merge branch 'main' into cli-and-config-file-support
nbarraud Apr 14, 2025
fe02efd
Merge branch 'main' into cli-and-config-file-support
nbarraud Apr 15, 2025
fd7dbba
Merge branch 'main' into cli-and-config-file-support
nbarraud Apr 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
.DS_Store
node_modules
node_modules/
*-workspace/
server/build
client/dist
client/tsconfig.app.tsbuildinfo
client/tsconfig.node.tsbuildinfo
.vscode
bin/build
cli/build
test-output
89 changes: 85 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ You can pass both arguments and environment variables to your MCP server. Argume
npx @modelcontextprotocol/inspector build/index.js arg1 arg2

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

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

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

The inspector runs both a client UI (default port 5173) and an MCP proxy server (default port 3000). Open the client UI in your browser to use the inspector. You can customize the ports if needed:
Expand All @@ -48,12 +48,42 @@ The MCP Inspector includes a proxy server that can run and communicate with loca

### Configuration

The MCP Inspector supports the following configuration settings. To change them click on the `Configuration` button in the MCP Inspector UI :
The MCP Inspector supports the following configuration settings. To change them click on the `Configuration` button in the MCP Inspector UI:

| Name | Purpose | Default Value |
| -------------------------- | ----------------------------------------------------------------------------------------- | ------------- |
| MCP_SERVER_REQUEST_TIMEOUT | Maximum time in milliseconds to wait for a response from the MCP server before timing out | 10000 |

The inspector also supports configuration files to store settings for different MCP servers. This is useful when working with multiple servers or complex configurations:

```bash
npx @modelcontextprotocol/inspector --config path/to/config.json --server everything
```

Example server configuration file:

```json
{
"mcpServers": {
"everything": {
"command": "npx",
"args": ["@modelcontextprotocol/server-everything"],
"env": {
"hello": "Hello MCP!"
}
},
"my-server": {
"command": "node",
"args": ["build/index.js", "arg1", "arg2"],
"env": {
"key": "value",
"key2": "value2"
}
}
}
}
```

### From this repository

If you're working on the inspector itself:
Expand All @@ -78,6 +108,57 @@ npm run build
npm start
```

### CLI Mode

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.

```bash
npx @modelcontextprotocol/inspector --cli node build/index.js
Comment thread
nbarraud marked this conversation as resolved.
```

The CLI mode supports most operations across tools, resources, and prompts. A few examples:

```bash
# Basic usage
npx @modelcontextprotocol/inspector --cli node build/index.js
Comment thread
nbarraud marked this conversation as resolved.

# With config file
npx @modelcontextprotocol/inspector --cli --config path/to/config.json --server myserver

# List available tools
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list
Comment thread
nbarraud marked this conversation as resolved.

# Call a specific tool
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/call --tool-name mytool --tool-arg key=value --tool-arg another=value2
Comment thread
nbarraud marked this conversation as resolved.

# List available resources
npx @modelcontextprotocol/inspector --cli node build/index.js --method resources/list

# List available prompts
npx @modelcontextprotocol/inspector --cli node build/index.js --method prompts/list

# Connect to a remote MCP server
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com

# Call a tool on a remote server
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method tools/call --tool-name remotetool --tool-arg param=value

# List resources from a remote server
npx @modelcontextprotocol/inspector --cli https://my-mcp-server.example.com --method resources/list
```

### UI Mode vs CLI Mode: When to Use Each

| Use Case | UI Mode | CLI Mode |
| ------------------------ | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **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 |
| **Resource Exploration** | Interactive browser with hierarchical navigation and JSON visualization | Programmatic listing and reading for automation and scripting |
| **Tool Testing** | Form-based parameter input with real-time response visualization | Command-line tool execution with JSON output for scripting |
| **Prompt Engineering** | Interactive sampling with streaming responses and visual comparison | Batch processing of prompts with machine-readable output |
| **Debugging** | Request history, visualized errors, and real-time notifications | Direct JSON output for log analysis and integration with other tools |
| **Automation** | N/A | Ideal for CI/CD pipelines, batch processing, and integration with coding assistants |
| **Learning MCP** | Rich visual interface helps new users understand server capabilities | Simplified commands for focused learning of specific endpoints |

## License

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