-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(McpHub): inject env vars on whole mcp config #3970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit to improve type assertion. This looks good to me.
|
Please explain how to use this. I can't figure out where to place the secret values so that it works. ,roo/mcp.json {
"mcpServers": {
"mcp-clickhouse-docker": {
"command": "docker",
"args": [
"run",
"--rm",
"--network",
"host",
"-i",
"-e",
"CLICKHOUSE_HOST",
"-e",
"CLICKHOUSE_PORT",
"-e",
"CLICKHOUSE_USER",
"-e",
"CLICKHOUSE_PASSWORD",
"-e",
"CLICKHOUSE_SECURE",
"-e",
"CLICKHOUSE_VERIFY",
"-e",
"CLICKHOUSE_CONNECT_TIMEOUT",
"-e",
"CLICKHOUSE_SEND_RECEIVE_TIMEOUT",
"-e",
"CLICKHOUSE_DATABASE",
"mcp-clickhouse"
],
"env": {
"CLICKHOUSE_HOST": "127.0.0.1",
"CLICKHOUSE_PORT": "8123",
"CLICKHOUSE_USER": "userro",
"CLICKHOUSE_PASSWORD": "${env:CLICKHOUSE_PASSWORD}",
"CLICKHOUSE_DATABASE": "default",
"CLICKHOUSE_SECURE": "false",
"CLICKHOUSE_VERIFY": "false",
"CLICKHOUSE_CONNECT_TIMEOUT": "30",
"CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
},
"disabled": false,
"alwaysAllow": [
"list_tables"
]
}
}
}
|
|
Hi @R-omk, that should be correct ( |
|
but i need to load variables from a file inside the project. the standard location is always the I don't want secrets to be globally accessible to any processes in the vscode |
|
Hey @R-omk, What if you have multiple Which |
|
in my example, roo/mcp.json is located in the root of the project, of course I expect that in each project there will be completely isolated instances even if the names are the same. Currently, for MCP, I use continue, and it includes functionality for reading from both local and global .env files. I just wanted to share envs along with the roo. |
|
Hi @R-omk , IIRC currently Roo Code does not support loading the env files in the current workspace/folder, please create an issue for it and someone will pick it up, ty! |
* Fixing OpenAI compatible to support cache token display * Removing redundant logging and write to file * Removing redundant logging and write to file * Splitting constants --------- Co-authored-by: Cline Evaluation <[email protected]>
Related GitHub Issue
Resolves #4014
Description
From
@axmoreporting via Discord, some MCPs require inputting secrets via the CLI args, instead ofenv, and/or for any other reason, user would like to havecommandorargsto have value inferred from the env, like usingbunxornpx, configuring mcp args via env without code committing,...The PR also fixes an unreported problem: env vars is not injected for
ssetransport, currently it's injected forstdioonly.Test Procedure
There is unit tests covering the usage and I also do some manual tests via VSCode debug to make sure all works good, just add breakpoint at the line.
Type of Change
srcor test files.Pre-Submission Checklist
npm run lint).console.log) has been removed.npm test).mainbranch.npm run changesetif this PR includes user-facing changes or dependency updates.Documentation Updates
Currently the docs does not note about the ability to reference env variables in the mcp config at all, would be great if anyone can help add it, normal user might not know about this feature and commit API keys.
Additional Notes
Get in Touch
@NamesMTImportant
Inject environment variables into MCP configurations for both
stdioandssetransports, fixing a bug inMcpHub.ts.stdioandssetransports inMcpHub.ts.injectEnvfunction inconfig.tsto support both string and object configurations.ssetransport inMcpHub.ts.This description was created by
for 8961614. You can customize this summary. It will automatically update as commits are pushed.