Skip to content

bug(mcp): tools whose input schema carries $schema cannot be published as Client Capabilities #3559

Description

@jsiu93

What happened

maka runtime-host capability-provider serve fails before publishing a single tool when an MCP server advertises input schemas with a root $schema annotation. The descriptor is copied into the Client Capability frame unchanged, and the protocol's strict keyword allowlist rejects it:

Runtime Host capability provider stopped: Unsupported Client Capability tool schema keyword
CapabilityProviderPublicationError: Unsupported Client Capability tool schema keyword
[exit=1]

This hits most servers built with the TypeScript SDK. @modelcontextprotocol/sdk converts Zod input schemas in server/zod-json-schema-compat.js with zod-to-json-schema (Zod v3) or z.toJSONSchema (Zod v4), and both emit a root $schema by default. A direct tools/list from XcodeBuildMCP 2.7.0 had $schema on 44 of 44 tools, and it was the only keyword outside the allowlist in any of them; an earlier probe through mcp_router saw the same on 31 of 31 tools. Python FastMCP servers generally do not emit it.

$schema and $comment are annotations with no validation meaning. Expected: the provider publishes these tools; the allowlist can stay strict for everything else.

How to reproduce

  1. Start a fresh Runtime Host with a loopback WebSocket listener and issue a capability-provider credential (supply it through MAKA_RUNTIME_HOST_ACCESS_CREDENTIAL).
  2. Point an MCP config at any TypeScript SDK server, for example:
{
  "version": 2,
  "mcpServers": {
    "xcodebuildmcp": {
      "command": "bunx",
      "args": ["xcodebuildmcp", "mcp"]
    }
  }
}
  1. Run:
maka runtime-host capability-provider serve \
  --url ws://127.0.0.1:47633/runtime-host \
  --mcp-config ./mcp.json \
  --expected-root "$ROOT_ID" \
  --client-identity ./capability-provider-identity.json
  1. The provider exits 1 with the error above and publishes nothing.

Unit reproduction: an MCP manager test against a stdio fixture whose tool schema carries a root $schema, a nested $schema under properties, a $comment, and an $id. On origin/main the descriptor still contains all three annotations.

Environment

  • Maka version or commit: 0.1.11 dev build; confirmed on origin/main at 6ada6b546
  • OS and version: macOS 26.6.1 (25G76), arm64
  • Surface: CLI capability provider and Runtime Host
  • Node.js v22.22.2, npm 10.9.7
  • MCP server: XcodeBuildMCP 2.7.0 (TypeScript SDK)

Logs, screenshots, or additional context

Census of the captured XcodeBuildMCP tools/list, recursing through the allowlisted child positions:

tools=44
root_$schema=44
unsupported_keywords={"$schema":44}

I have a fix that strips $schema and $comment at MCP discovery and leaves the validator untouched; PR to follow.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions