Skip to content

Commit a524f17

Browse files
committed
Implement auto-open feature for browser launch on server start
1 parent 3032a67 commit a524f17

File tree

4 files changed

+140
-0
lines changed

4 files changed

+140
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The MCP Inspector supports the following configuration settings. To change them
5454
| -------------------------- | ----------------------------------------------------------------------------------------- | ------------- |
5555
| MCP_SERVER_REQUEST_TIMEOUT | Maximum time in milliseconds to wait for a response from the MCP server before timing out | 10000 |
5656
| MCP_PROXY_FULL_ADDRESS | The full URL of the MCP Inspector proxy server (e.g. `http://10.2.1.14:2277`) | `null` |
57+
| MCP_AUTO_OPEN_DISABLED | Disable automatic browser opening when inspector starts | `false` |
5758

5859
### From this repository
5960

bin/cli.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env node
22

3+
import open from "open";
34
import { resolve, dirname } from "path";
45
import { spawnPromise } from "spawn-rx";
56
import { fileURLToPath } from "url";
@@ -99,6 +100,9 @@ async function main() {
99100

100101
if (serverOk) {
101102
try {
103+
if (!process.env.MCP_AUTO_OPEN_DISABLED) {
104+
open(`http://localhost:${CLIENT_PORT}`);
105+
}
102106
await spawnPromise("node", [inspectorClientPath], {
103107
env: { ...process.env, PORT: CLIENT_PORT },
104108
signal: abort.signal,

package-lock.json

+134
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@modelcontextprotocol/inspector-client": "^0.8.1",
4040
"@modelcontextprotocol/inspector-server": "^0.8.1",
4141
"concurrently": "^9.0.1",
42+
"open": "^10.1.0",
4243
"shell-quote": "^1.8.2",
4344
"spawn-rx": "^5.1.2",
4445
"ts-node": "^10.9.2"

0 commit comments

Comments
 (0)