Skip to content

Commit a70687e

Browse files
committed
feat(core): add environment variable support for MCP servers
- Add functionality to set environment variables for MCP servers - Iterate through the environment variable map and set them in the command line - This enhancement allows for more flexible and configurable server management
1 parent 04d35a4 commit a70687e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/main/kotlin/cc/unitmesh/devti/mcp/client/CustomMcpServerManager.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ class CustomMcpServerManager(val project: Project) {
5050
val cmd = GeneralCommandLine(resolvedCommand)
5151
cmd.addParameters(*entry.value.args.toTypedArray())
5252

53+
entry.value.env?.forEach { (key, value) ->
54+
cmd.environment[key] = value
55+
}
56+
5357
val process = cmd.createProcess()
5458
val input = process.inputStream.asSource().buffered()
5559
val output = process.outputStream.asSink().buffered()

0 commit comments

Comments
 (0)