Skip to content

Commit be1236a

Browse files
committed
feat: Use client-provided MCP servers in ACP agent session creation
- Replace local config MCP servers with client-provided servers - Add logging for MCP server count and registration details - Support stdio transport only, skip unsupported types with warning
1 parent 3cf99e6 commit be1236a

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

mpp-ui/src/jsMain/typescript/agents/acp/AcpAgentServer.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ class AutoDevAcpAgent implements acp.Agent {
5959

6060
async newSession(params: acp.NewSessionRequest): Promise<acp.NewSessionResponse> {
6161
const sessionId = `autodev-${Date.now()}`;
62-
const cwd = params.cwd || process.cwd();
62+
const cwd = params.cwd;
6363

6464
console.error(`[ACP Agent] New session: ${sessionId} (cwd=${cwd})`);
65+
console.error(`[ACP Agent] MCP servers from client: ${params.mcpServers.length}`);
6566

6667
// Load config
6768
const config = await ConfigManager.load();
@@ -83,16 +84,20 @@ class AutoDevAcpAgent implements acp.Agent {
8384
)
8485
);
8586

86-
// Load MCP servers if configured
87-
const mcpServers = config.getMcpServers();
87+
// Convert ACP MCP servers to our internal format
8888
const enabledMcpServers: Record<string, any> = {};
89-
for (const [name, serverConfig] of Object.entries(mcpServers)) {
90-
if ((serverConfig as any).enabled) {
89+
for (const mcpServer of params.mcpServers) {
90+
// Only support stdio transport for now
91+
if ('command' in mcpServer) {
92+
const name = (mcpServer as any).name || mcpServer.command;
9193
enabledMcpServers[name] = {
92-
command: (serverConfig as any).command,
93-
args: (serverConfig as any).args || [],
94-
env: (serverConfig as any).env || {},
94+
command: mcpServer.command,
95+
args: mcpServer.args || [],
96+
env: (mcpServer as any).env || {},
9597
};
98+
console.error(`[ACP Agent] Registered MCP server: ${name} (${mcpServer.command})`);
99+
} else {
100+
console.error(`[ACP Agent] Skipping non-stdio MCP server (not supported yet)`);
96101
}
97102
}
98103

0 commit comments

Comments
 (0)