Skip to content

Commit 052de86

Browse files
committed
respond to PR feedback
1 parent a976aef commit 052de86

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ You can pass both arguments and environment variables to your MCP server. Argume
2121
npx @modelcontextprotocol/inspector build/index.js arg1 arg2
2222

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

2626
# Pass both environment variables and arguments
27-
npx @modelcontextprotocol/inspector -e KEY=value -e KEY2=value2 build/index.js arg1 arg2
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
2831
```
2932

3033
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:

bin/cli.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ async function main() {
1616
const envVars = {};
1717
const mcpServerArgs = [];
1818
let command = null;
19+
let parsingFlags = true;
1920

2021
for (let i = 0; i < args.length; i++) {
21-
if (args[i] === "-e" && i + 1 < args.length) {
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) {
2230
const [key, value] = args[++i].split("=");
2331
if (key && value) {
2432
envVars[key] = value;
2533
}
2634
} else if (!command) {
27-
command = args[i];
35+
command = arg;
2836
} else {
29-
mcpServerArgs.push(args[i]);
37+
mcpServerArgs.push(arg);
3038
}
3139
}
3240

client/src/components/Sidebar.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const Sidebar = ({
5656
}: SidebarProps) => {
5757
const [theme, setTheme] = useTheme();
5858
const [showEnvVars, setShowEnvVars] = useState(false);
59-
const [shownEnvVars, setShownEnvVars] = useState<Record<string, boolean>>({});
59+
const [shownEnvVars, setShownEnvVars] = useState<Set<string>>(new Set());
6060

6161
return (
6262
<div className="w-80 bg-card border-r border-border flex flex-col h-full">
@@ -149,8 +149,12 @@ const Sidebar = ({
149149
newEnv[newKey] = value;
150150
setEnv(newEnv);
151151
setShownEnvVars((prev) => {
152-
const { [key]: shown, ...rest } = prev;
153-
return shown ? { ...rest, [newKey]: true } : rest;
152+
const next = new Set(prev);
153+
if (next.has(key)) {
154+
next.delete(key);
155+
next.add(newKey);
156+
}
157+
return next;
154158
});
155159
}}
156160
className="font-mono"
@@ -170,7 +174,7 @@ const Sidebar = ({
170174
</div>
171175
<div className="flex gap-2">
172176
<Input
173-
type={shownEnvVars[key] ? "text" : "password"}
177+
type={shownEnvVars.has(key) ? "text" : "password"}
174178
placeholder="Value"
175179
value={value}
176180
onChange={(e) => {
@@ -185,16 +189,24 @@ const Sidebar = ({
185189
size="icon"
186190
className="h-9 w-9 p-0 shrink-0"
187191
onClick={() => {
188-
setShownEnvVars((prev) => ({
189-
...prev,
190-
[key]: !prev[key],
191-
}));
192+
setShownEnvVars((prev) => {
193+
const next = new Set(prev);
194+
if (next.has(key)) {
195+
next.delete(key);
196+
} else {
197+
next.add(key);
198+
}
199+
return next;
200+
});
192201
}}
202+
aria-label={shownEnvVars.has(key) ? "Hide value" : "Show value"}
203+
aria-pressed={shownEnvVars.has(key)}
204+
title={shownEnvVars.has(key) ? "Hide value" : "Show value"}
193205
>
194-
{shownEnvVars[key] ? (
195-
<Eye className="h-4 w-4" />
206+
{shownEnvVars.has(key) ? (
207+
<Eye className="h-4 w-4" aria-hidden="true" />
196208
) : (
197-
<EyeOff className="h-4 w-4" />
209+
<EyeOff className="h-4 w-4" aria-hidden="true" />
198210
)}
199211
</Button>
200212
</div>
@@ -208,7 +220,6 @@ const Sidebar = ({
208220
const newEnv = { ...env };
209221
newEnv[key] = "";
210222
setEnv(newEnv);
211-
setShownEnvVars({});
212223
}}
213224
>
214225
Add Environment Variable

0 commit comments

Comments
 (0)