Skip to content

Commit afe14bc

Browse files
committed
Merge branch 'feature/audio-rendering' of https://github.com/evalstate/inspector into feature/audio-rendering
2 parents 068d213 + 04faff4 commit afe14bc

19 files changed

+729
-359
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17+
- name: Check formatting
18+
run: npx prettier --check .
19+
1720
- uses: actions/setup-node@v4
1821
with:
1922
node-version: 18

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
packages
22
server/build
3+
CODE_OF_CONDUCT.md
4+
SECURITY.md

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@ To inspect an MCP server implementation, there's no need to clone this repo. Ins
1414
npx @modelcontextprotocol/inspector build/index.js
1515
```
1616

17-
You can also pass arguments along which will get passed as arguments to your MCP server:
17+
You can pass both arguments and environment variables to your MCP server. Arguments are passed directly to your server, while environment variables can be set using the `-e` flag:
1818

19-
```
20-
npx @modelcontextprotocol/inspector build/index.js arg1 arg2 ...
19+
```bash
20+
# Pass arguments only
21+
npx @modelcontextprotocol/inspector build/index.js arg1 arg2
22+
23+
# Pass environment variables only
24+
npx @modelcontextprotocol/inspector -e KEY=value -e KEY2=$VALUE2 build/index.js
25+
26+
# Pass both environment variables and arguments
27+
npx @modelcontextprotocol/inspector -e KEY=value -e KEY2=$VALUE2 build/index.js arg1 arg2
28+
29+
# Use -- to separate inspector flags from server arguments
30+
npx @modelcontextprotocol/inspector -e KEY=$VALUE -- build/index.js -e server-flag
2131
```
2232

2333
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:
@@ -26,6 +36,8 @@ The inspector runs both a client UI (default port 5173) and an MCP proxy server
2636
CLIENT_PORT=8080 SERVER_PORT=9000 npx @modelcontextprotocol/inspector build/index.js
2737
```
2838

39+
For more details on ways to use the inspector, see the [Inspector section of the MCP docs site](https://modelcontextprotocol.io/docs/tools/inspector). For help with debugging, see the [Debugging guide](https://modelcontextprotocol.io/docs/tools/debugging).
40+
2941
### From this repository
3042

3143
If you're working on the inspector itself:

bin/cli.js

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,32 @@ function delay(ms) {
1111
}
1212

1313
async function main() {
14-
// Get command line arguments
15-
const [, , command, ...mcpServerArgs] = process.argv;
14+
// Parse command line arguments
15+
const args = process.argv.slice(2);
16+
const envVars = {};
17+
const mcpServerArgs = [];
18+
let command = null;
19+
let parsingFlags = true;
20+
21+
for (let i = 0; i < args.length; i++) {
22+
const arg = args[i];
23+
24+
if (parsingFlags && arg === "--") {
25+
parsingFlags = false;
26+
continue;
27+
}
28+
29+
if (parsingFlags && arg === "-e" && i + 1 < args.length) {
30+
const [key, value] = args[++i].split("=");
31+
if (key && value) {
32+
envVars[key] = value;
33+
}
34+
} else if (!command) {
35+
command = arg;
36+
} else {
37+
mcpServerArgs.push(arg);
38+
}
39+
}
1640

1741
const inspectorServerPath = resolve(
1842
__dirname,
@@ -52,7 +76,11 @@ async function main() {
5276
...(mcpServerArgs ? [`--args=${mcpServerArgs.join(" ")}`] : []),
5377
],
5478
{
55-
env: { ...process.env, PORT: SERVER_PORT },
79+
env: {
80+
...process.env,
81+
PORT: SERVER_PORT,
82+
MCP_ENV_VARS: JSON.stringify(envVars),
83+
},
5684
signal: abort.signal,
5785
echoOutput: true,
5886
},

client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-client",
3-
"version": "0.2.7",
3+
"version": "0.3.0",
44
"description": "Client-side application for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",
@@ -21,7 +21,7 @@
2121
"preview": "vite preview"
2222
},
2323
"dependencies": {
24-
"@modelcontextprotocol/sdk": "^1.0.1",
24+
"@modelcontextprotocol/sdk": "^1.0.3",
2525
"@radix-ui/react-icons": "^1.3.0",
2626
"@radix-ui/react-label": "^2.1.0",
2727
"@radix-ui/react-select": "^2.1.2",

0 commit comments

Comments
 (0)