Pass all environment variables to MCP server instead of just PATH (#8602)

This commit is contained in:
Nate Sesti 2025-11-05 08:41:23 -08:00 • committed by GitHub
parent 1c1fce33eb
commit e761b68bc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -509,8 +509,12 @@ export class MCPService
serverConfig: StdioMcpServer,
): StdioClientTransport {
const env: Record<string, string> = serverConfig.env || {};
if (process.env.PATH !== undefined) {
env.PATH = process.env.PATH;
if (process.env) {
for (const [key, value] of Object.entries(process.env)) {
if (!(key in env) && !!value) {
env[key] = value;
}
}
}
return new StdioClientTransport({