feat: add MCP client plugin (dsh-mcp-client)

Connects to an external MCP server and registers its tools on
ctx.tools. Supports stdio (child process) and Streamable HTTP
transports. Credential-shaped env vars are scrubbed before forwarding
to child processes.

- Plugin lifecycle: connect, sync tools, re-sync on ToolListChanged,
  dispose unregisters and closes
- Full JSDoc on all exports (@param/@returns on functions)
- 100% per-file coverage (apply lifecycle, args coercion, env scrubbing)
- Config catalog regenerated
This commit is contained in:
lintianle
2026-07-07 23:21:54 +08:00
parent f8a6525b5c
commit 1fbe7c39d4
18 changed files with 2087 additions and 6 deletions

View File

@@ -537,6 +537,15 @@ function walkSchemaExpr(
}
return
}
// A union of objects (discriminated union config): collect keys from all
// variants. Each variant is visited the same way as an intersect element.
if (method === 'union' && call.arguments[0] && ts.isArrayLiteralExpression(call.arguments[0])) {
for (const el of call.arguments[0].elements) {
const part = unwrapExpr(el)
if (ts.isCallExpression(part)) { visit(part); continue }
}
return
}
// A chained refinement (`z.object({…}).default(…)` etc.): the keys live on
// the call the chain hangs off — keep unwrapping toward it.
const base = unwrapExpr(call.expression.expression)