Skip to content
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

Support for MCP env config #3583

Open
2 tasks done
leaft opened this issue Jan 2, 2025 · 1 comment
Open
2 tasks done

Support for MCP env config #3583

leaft opened this issue Jan 2, 2025 · 1 comment
Assignees
Labels
area:configuration Relates to configuration options kind:enhancement Indicates a new feature request, imrovement, or extension "needs-triage"

Comments

@leaft
Copy link

leaft commented Jan 2, 2025

Validations

  • I believe this is a way to improve. I'll try to join the Continue Discord for questions
  • I'm not able to find an open issue that requests the same enhancement

Problem

I have checked the code on main branch, found cannot set env in transport config now,

case "stdio":
return new StdioClientTransport({
command: options.transport.command,
args: options.transport.args,
});

Solution

Support env block in config.json, add PATH environment and env in config when construct the StdioClientTransport.
Example config.json and code below.

{
// ... other config
  "experimental": {
    "useTools": true,
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "npx",
          "args": [
            "-y",
            "@modelcontextprotocol/server-brave-search"
          ],
          "env": {
            "BRAVE_API_KEY": "xxx...xxx"
          }
        }
      }
    ]
  }
}
new StdioClientTransport({ 
    command: options.transport.command, 
    args: options.transport.args, 
    env: {
	...options.transport.env,
	...(process.env.PATH ? { PATH: process.env.PATH } : {}),
      },
   }); 
@sestinj sestinj self-assigned this Jan 2, 2025
@dosubot dosubot bot added area:configuration Relates to configuration options kind:enhancement Indicates a new feature request, imrovement, or extension labels Jan 2, 2025
@sestinj
Copy link
Contributor

sestinj commented Jan 3, 2025

@leaft thanks for calling this out! I just made the fix here: #3600

and am about to push a new pre-release version for VS Code in the next hour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:configuration Relates to configuration options kind:enhancement Indicates a new feature request, imrovement, or extension "needs-triage"
Projects
None yet
Development

No branches or pull requests

2 participants