Skip to content

Commit efb452e

Browse files
committed
fix: don't expose MCP command strings in system prompt
Commands may contain credentials or sensitive env values. Only expose server names to the model, not the full command strings.
1 parent ed1de83 commit efb452e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/node/services/systemMessage.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ You are in a git worktree at ${workspacePath}
8282
/**
8383
* Build MCP servers context XML block.
8484
* Only included when at least one MCP server is configured.
85+
* Note: We only expose server names, not commands, to avoid leaking secrets.
8586
*/
8687
function buildMCPContext(mcpServers: MCPServerMap): string {
87-
const entries = Object.entries(mcpServers);
88-
if (entries.length === 0) return "";
88+
const names = Object.keys(mcpServers);
89+
if (names.length === 0) return "";
8990

90-
const serverList = entries.map(([name, command]) => `- ${name}: \`${command}\``).join("\n");
91+
const serverList = names.map((name) => `- ${name}`).join("\n");
9192

9293
return `
9394
<mcp>

0 commit comments

Comments
 (0)