Uh oh!
There was an error while loading. Please reload this page.
allow passing env vars to server from command line - #124
Conversation
936345b to
8a7da27Compare
jspahrsummers
left a comment
There was a problem hiding this comment.
Overall looks good! IMO supporting -- should be a blocker, but the other comments are not essential
| for (let i = 0; i < args.length; i++) { | ||
| if (args[i] === "-e" && i + 1 < args.length) { | ||
| const [key, value] = args[++i].split("="); | ||
| if (key && value) { | ||
| envVars[key] = value; | ||
| } | ||
| } else if (!command) { | ||
| command = args[i]; | ||
| } else { | ||
| mcpServerArgs.push(args[i]); | ||
| } | ||
| } |
There was a problem hiding this comment.
There must be an npm package that can make this easier, but nbd
| let command = null; | ||
| for (let i = 0; i < args.length; i++) { | ||
| if (args[i] === "-e" && i + 1 < args.length) { |
There was a problem hiding this comment.
We should support -- to end arg parsing, in cases where you might have a server that accepts its own -e option
| }: SidebarProps) => { | ||
| const [theme, setTheme] = useTheme(); | ||
| const [showEnvVars, setShowEnvVars] = useState(false); | ||
| const [shownEnvVars, setShownEnvVars] = useState<Record<string, boolean>>({}); |
There was a problem hiding this comment.
I'd probably just use a Set, but up to you
jerome3o-anthropic
left a comment
There was a problem hiding this comment.
one question - and I also agree that -- would be great to have here, but im happy to take that on as a follow up if you don't have time
| newEnv[""] = ""; | ||
| newEnv[key] = ""; | ||
| setEnv(newEnv); | ||
| setShownEnvVars({}); |
There was a problem hiding this comment.
will this hide all previously shown env vars? intential?
00f9228 to
052de86Compareallow passing env vars to server from command line

./bin/cli.js -e FOO=BAR /path/to/serverand have it pass the env var to the MCP server.Motivation and Context
Addresses #94.
How Has This Been Tested?
Verified with command above.
Breaking Changes
No
Types of changes
Checklist
Additional context