Skip to content

Commit 07f292f

Browse files
committed
app: Allo mcp server to accept env vars
1 parent e6fdc9e commit 07f292f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/electron/mcp-client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ interface MCPServer {
2525
command: string;
2626
args: string[];
2727
enabled: boolean;
28+
env?: Record<string, string>;
2829
}
2930

3031
interface MCPConfig {
@@ -155,10 +156,14 @@ class ElectronMCPClient {
155156
const expandedArgs = this.expandArgs(server.args || []);
156157
console.log(`Expanded args for ${server.name}:`, expandedArgs);
157158

159+
// Prepare environment variables
160+
const serverEnv = server.env ? { ...process.env, ...server.env } : process.env;
161+
158162
mcpServers[server.name] = {
159163
transport: 'stdio',
160164
command: server.command,
161165
args: expandedArgs,
166+
env: serverEnv,
162167
restart: {
163168
enabled: true,
164169
maxAttempts: 3,
@@ -228,6 +233,7 @@ class ElectronMCPClient {
228233

229234
// Handle MCP tool execution
230235
ipcMain.handle('mcp-execute-tool', async (event, { toolName, args, toolCallId }) => {
236+
console.log('args in mcp-execute-tool:', args);
231237
try {
232238
await this.initializeClient();
233239

0 commit comments

Comments
 (0)