code-mode-mcp: don't return resolved secrets from register_manual

LO
1d ago
+26-2

Fixes #49

Problem

UtcpClient.registerManual returns the call template after variable substitution, both in manualCallTemplate and in every tool's tool_call_template. The bridge's register_manual tool sent that result verbatim, so any header, arg or env value resolved through load_variables_from (bearer tokens, API keys) ended up in the MCP client: the model context, chat transcripts and logs.

Fix

register_manual now returns only what the caller needs:

{"success":true,"manual_name":"demo","tool_count":1,"tools":[{"name":"demo.echo","description":"Echo back"}],"errors":[]}

Tool names use the same TypeScript-callable form as search_tools / list_tools, so the agent can call them straight away. Tool calls are unaffected: the stored template still carries the resolved values.

Verification

End-to-end with a real MCP client over stdio, a local HTTP manual whose header is Authorization: Bearer ${TOKEN}, and a dotenv loader holding a fake token:

register_manual contains the tokencall_tool_chain sends the right header
@utcp/code-mode-mcp 1.2.1 (npm)yesyes
this branchnoyes

npm run build passes.

Not in this PR

The double substitution noted in #49 (a secret containing $ breaks at call time because the already-resolved template is substituted again) lives in @utcp/sdk (UtcpClient.registerManual storing the resolved template), so it belongs in typescript-utcp.


Summary by cubic

Fixes #49: register_manual now stops leaking resolved secrets such as bearer tokens and API keys to the MCP client.

  • UtcpClient.registerManual returns the call template after variable substitution, and the bridge previously sent that verbatim, exposing secrets in the model context, transcripts, and logs.
  • The response now contains only success, the manual name, the TypeScript-callable tool names with descriptions, and errors. Stored tool templates still carry the resolved values, so tool calls are unaffected.