@modelcontextprotocol/inspector 0.9.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -6
- package/{bin/cli.js → client/bin/start.js} +3 -3
- package/package.json +21 -15
- package/client/dist/assets/OAuthCallback-C3r8TjnW.js +0 -40
- package/client/dist/assets/index-CgrYmEaq.js +0 -29522
- package/client/dist/assets/index-D5WIP3OH.css +0 -2204
- package/client/dist/index.html +0 -14
- package/client/dist/mcp.svg +0 -12
- package/server/build/index.js +0 -168
- package/server/build/mcpProxy.js +0 -32
- /package/client/bin/{cli.js → client.js} +0 -0
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@ The MCP inspector is a developer tool for testing and debugging MCP servers.
|
|
|
6
6
|
|
|
7
7
|
## Running the Inspector
|
|
8
8
|
|
|
9
|
+
### Requirements
|
|
10
|
+
|
|
11
|
+
- Node.js: ^22.7.5
|
|
12
|
+
|
|
9
13
|
### From an MCP server repository
|
|
10
14
|
|
|
11
15
|
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
|
|
|
18
22
|
|
|
19
23
|
```bash
|
|
20
24
|
# Pass arguments only
|
|
21
|
-
npx @modelcontextprotocol/inspector build/index.js arg1 arg2
|
|
25
|
+
npx @modelcontextprotocol/inspector node build/index.js arg1 arg2
|
|
22
26
|
|
|
23
27
|
# Pass environment variables only
|
|
24
|
-
npx @modelcontextprotocol/inspector -e
|
|
28
|
+
npx @modelcontextprotocol/inspector -e key=value -e key2=$VALUE2 node build/index.js
|
|
25
29
|
|
|
26
30
|
# Pass both environment variables and arguments
|
|
27
|
-
npx @modelcontextprotocol/inspector -e
|
|
31
|
+
npx @modelcontextprotocol/inspector -e key=value -e key2=$VALUE2 node build/index.js arg1 arg2
|
|
28
32
|
|
|
29
33
|
# Use -- to separate inspector flags from server arguments
|
|
30
|
-
npx @modelcontextprotocol/inspector -e
|
|
34
|
+
npx @modelcontextprotocol/inspector -e key=$VALUE -- node build/index.js -e server-flag
|
|
31
35
|
```
|
|
32
36
|
|
|
33
37
|
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
|
|
|
40
44
|
|
|
41
45
|
### Authentication
|
|
42
46
|
|
|
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.
|
|
44
48
|
|
|
45
49
|
### Security Considerations
|
|
46
50
|
|
|
@@ -59,6 +63,36 @@ The MCP Inspector supports the following configuration settings. To change them,
|
|
|
59
63
|
|
|
60
64
|
These settings can be adjusted in real-time through the UI and will persist across sessions.
|
|
61
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
|
+
```
|
|
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
|
+
|
|
62
96
|
### From this repository
|
|
63
97
|
|
|
64
98
|
If you're working on the inspector itself:
|
|
@@ -69,7 +103,7 @@ Development mode:
|
|
|
69
103
|
npm run dev
|
|
70
104
|
```
|
|
71
105
|
|
|
72
|
-
> **Note for Windows users:**
|
|
106
|
+
> **Note for Windows users:**
|
|
73
107
|
> On Windows, use the following command instead:
|
|
74
108
|
>
|
|
75
109
|
> ```bash
|
|
@@ -83,6 +117,57 @@ npm run build
|
|
|
83
117
|
npm start
|
|
84
118
|
```
|
|
85
119
|
|
|
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
|
+
|
|
86
171
|
## License
|
|
87
172
|
|
|
88
173
|
This project is licensed under the MIT License—see the [LICENSE](LICENSE) file for details.
|
|
@@ -46,7 +46,7 @@ async function main() {
|
|
|
46
46
|
|
|
47
47
|
const inspectorServerPath = resolve(
|
|
48
48
|
__dirname,
|
|
49
|
-
"
|
|
49
|
+
"../..",
|
|
50
50
|
"server",
|
|
51
51
|
"build",
|
|
52
52
|
"index.js",
|
|
@@ -55,10 +55,10 @@ async function main() {
|
|
|
55
55
|
// Path to the client entry point
|
|
56
56
|
const inspectorClientPath = resolve(
|
|
57
57
|
__dirname,
|
|
58
|
-
"
|
|
58
|
+
"../..",
|
|
59
59
|
"client",
|
|
60
60
|
"bin",
|
|
61
|
-
"
|
|
61
|
+
"client.js",
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
const CLIENT_PORT = process.env.CLIENT_PORT ?? "6274";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modelcontextprotocol/inspector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Model Context Protocol inspector",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
|
@@ -8,45 +8,51 @@
|
|
|
8
8
|
"bugs": "https://github.com/modelcontextprotocol/inspector/issues",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"bin": {
|
|
11
|
-
"mcp-inspector": "
|
|
11
|
+
"mcp-inspector": "cli/build/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"bin",
|
|
15
14
|
"client/bin",
|
|
16
15
|
"client/dist",
|
|
17
|
-
"server/build"
|
|
16
|
+
"server/build",
|
|
17
|
+
"cli/build"
|
|
18
18
|
],
|
|
19
19
|
"workspaces": [
|
|
20
20
|
"client",
|
|
21
|
-
"server"
|
|
21
|
+
"server",
|
|
22
|
+
"cli"
|
|
22
23
|
],
|
|
23
24
|
"scripts": {
|
|
24
|
-
"
|
|
25
|
-
"dev:windows": "concurrently \"cd client && npm run dev\" \"cd server && npm run dev:windows",
|
|
26
|
-
"test": "npm run prettier-check && cd client && npm test",
|
|
25
|
+
"build": "npm run build-server && npm run build-client && npm run build-cli",
|
|
27
26
|
"build-server": "cd server && npm run build",
|
|
28
27
|
"build-client": "cd client && npm run build",
|
|
29
|
-
"build": "
|
|
28
|
+
"build-cli": "cd cli && npm run build",
|
|
29
|
+
"dev": "concurrently \"cd client && npm run dev\" \"cd server && npm run dev\"",
|
|
30
|
+
"dev:windows": "concurrently \"cd client && npm run dev\" \"cd server && npm run dev:windows\"",
|
|
31
|
+
"start": "node client/bin/start.js",
|
|
30
32
|
"start-server": "cd server && npm run start",
|
|
31
33
|
"start-client": "cd client && npm run preview",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
+
"test": "npm run prettier-check && cd client && npm test",
|
|
35
|
+
"test-cli": "cd cli && npm run test",
|
|
34
36
|
"prettier-fix": "prettier --write .",
|
|
35
37
|
"prettier-check": "prettier --check .",
|
|
36
38
|
"publish-all": "npm publish --workspaces --access public && npm publish --access public"
|
|
37
39
|
},
|
|
38
40
|
"dependencies": {
|
|
39
|
-
"@modelcontextprotocol/inspector-
|
|
40
|
-
"@modelcontextprotocol/inspector-
|
|
41
|
+
"@modelcontextprotocol/inspector-cli": "^0.10.1",
|
|
42
|
+
"@modelcontextprotocol/inspector-client": "^0.10.1",
|
|
43
|
+
"@modelcontextprotocol/inspector-server": "^0.10.1",
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.10.0",
|
|
41
45
|
"concurrently": "^9.0.1",
|
|
42
46
|
"shell-quote": "^1.8.2",
|
|
43
47
|
"spawn-rx": "^5.1.2",
|
|
44
|
-
"ts-node": "^10.9.2"
|
|
48
|
+
"ts-node": "^10.9.2",
|
|
49
|
+
"zod": "^3.23.8"
|
|
45
50
|
},
|
|
46
51
|
"devDependencies": {
|
|
47
52
|
"@types/jest": "^29.5.14",
|
|
48
53
|
"@types/node": "^22.7.5",
|
|
49
54
|
"@types/shell-quote": "^1.7.5",
|
|
50
|
-
"prettier": "3.3.3"
|
|
55
|
+
"prettier": "3.3.3",
|
|
56
|
+
"typescript": "^5.4.2"
|
|
51
57
|
}
|
|
52
58
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { r as reactExports, j as jsxRuntimeExports, S as SESSION_KEYS, a as auth, b as authProvider } from "./index-CgrYmEaq.js";
|
|
2
|
-
const OAuthCallback = () => {
|
|
3
|
-
const hasProcessedRef = reactExports.useRef(false);
|
|
4
|
-
reactExports.useEffect(() => {
|
|
5
|
-
const handleCallback = async () => {
|
|
6
|
-
if (hasProcessedRef.current) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
hasProcessedRef.current = true;
|
|
10
|
-
const params = new URLSearchParams(window.location.search);
|
|
11
|
-
const code = params.get("code");
|
|
12
|
-
const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL);
|
|
13
|
-
if (!code || !serverUrl) {
|
|
14
|
-
console.error("Missing code or server URL");
|
|
15
|
-
window.location.href = "/";
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const result = await auth(authProvider, {
|
|
20
|
-
serverUrl,
|
|
21
|
-
authorizationCode: code
|
|
22
|
-
});
|
|
23
|
-
if (result !== "AUTHORIZED") {
|
|
24
|
-
throw new Error(
|
|
25
|
-
`Expected to be authorized after providing auth code, got: ${result}`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
window.location.href = `/?serverUrl=${encodeURIComponent(serverUrl)}`;
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error("OAuth callback error:", error);
|
|
31
|
-
window.location.href = "/";
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
void handleCallback();
|
|
35
|
-
}, []);
|
|
36
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-gray-500", children: "Processing OAuth callback..." }) });
|
|
37
|
-
};
|
|
38
|
-
export {
|
|
39
|
-
OAuthCallback as default
|
|
40
|
-
};
|