Repository navigation
binding-mcp-schema-registry: composite mcp_schema_registry · client binding - #2068
Merged
Merged
Conversation
#1672 Adds specs/binding-mcp-schema-registry.spec/ (schema patch, 20 mcp/http .rpt scenario pairs for the 10 bundled tools, config fixtures, self consistency ITs — all green) and runtime/binding-mcp-schema-registry/ module scaffold, wired into runtime/specs/docker-image poms. No Java implementation yet by design: the runtime IT currently fails with an unrecognized binding type, the expected checkpoint before implementation begins per the repo's test-first discipline. Design: kind: proxy emitting the real OpenapiBeginEx wire extension to an operator-declared `type: openapi, kind: client` exit, mirroring the binding-openapi-asyncapi precedent, using an internally-bundled spec to resolve tool -> operationId with zero operator catalog boilerplate. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HL4h3tkf4oYSdjEgK4zffn
…y binding Adds the BindingFactorySpi, config adapters, and stream handler (McpSchemaRegistryProxyFactory) that map the 10 bundled MCP tools onto Schema Registry OpenAPI operations, forwarding through an operator-declared openapi client exit per the mcp-natural design in #1672. Also fixes escaping bugs in the .rpt fixtures: k3po strips a single backslash-quote in single-quoted write/read literals, so scripts embedding a JSON-quoted string value (the "schema" field) need \\" to produce a literal \" on the wire. This was silently truncating declared contentLength and corrupting response bodies for get_schema/register_schema/ check_compatibility. Also fixes the request-body flush to respect initial-window flow-control credit instead of writing the full body unconditionally on the first WINDOW frame. Fixes #1672
The module was already wired into runtime/pom.xml, specs/pom.xml, and cloud/docker-image/pom.xml, but missing from the zpm packaging manifest, so it would not have been installed into the published Docker image.
…per around mcp_openapi Replace the hand-rolled MCP proxy implementation with a kind:client composite generator that inlines a bundled schema-registry OpenAPI spec into a generated catalog and drives it through an mcp_openapi kind:client binding, mirroring how binding-openapi's own kind:client generates its downstream bindings. The 10 tools are fixed and author-controlled, so routes and tool naming are synthesized internally rather than exposed as operator-facing config; the only remaining option is options.server. McpSchemaRegistryClientFactory is now a pure pass-through relay (no protocol awareness), matching McpOpenapiClientFactory. Spec fixtures were rewritten to the zilla://streams/http0 k3po transport (required for the external-exit test double to intercept nested composite-generated streams) and structuredContent shapes corrected to match mcp_openapi's verbatim JSON passthrough behavior.
…a-registry-mcp-62egyz
… key mcp_openapi/mcp_http on current develop always wraps tool-call structuredContent under a top-level "result" key, regardless of the underlying HTTP response shape (object, array, or scalar) - a behavior change picked up by merging develop (most likely from the common-json parsson removal). Update all 10 scenarios' mcp-side fixtures to match.
…a-registry-mcp-62egyz
Allow operators to scope and guard individual tools via routes[], on top of #2103/#2105's new mcp_openapi routes[].guarded support: - routes[].when[].tool accepts a tool name or glob pattern (mirrors mcp_openapi's own when.tool schema - a singular string, not an array, since when[] is already the "match any of several" mechanism) - routes[].guarded threads through to the generated mcp_openapi0 route, resolved to an absolute namespace-qualified guard qname since the guard is declared in the operator's outer namespace but the generated route lives in the nested composite namespace - with omitting routes entirely still exposes all 10 tools ungated (unchanged default); declaring routes narrows exposure to only the tools matched by a when.tool entry routes[].with stays disallowed - the operation mapping is still synthesized internally from the tool name, never operator-declared.
…SchemaRegistryClientFactory
…mmaries
Add explicit response schemas to register_schema, get_schema,
check_compatibility, get_compatibility, and set_compatibility in the bundled
OpenAPI spec, and interpolate their tool summaries with the confirmable
result value (e.g. "Registered schema with id ${result.id}").
Declaring the response schema is required, not cosmetic: without it,
McpOpenapiCompositeGenerator treats the tool output as schema-less and wraps
structuredContent as {"result": <value>}, shifting every capture path down
one level and making ${result.*} resolve empty.
…shape
McpHttpResultWrap previously wrapped structuredContent as {"result": <value>}
whenever no declared object response schema existed, regardless of what the
upstream API actually returned. Any undeclared-schema operation whose real
response happened to already be an object got a spurious wrapper.
Make the decision from the real body's own first event instead: skip
wrapping when it's already an object, wrap otherwise (arrays, scalars, or
anything a declared array/scalar schema guarantees non-object). Rename
McpHttpToolConfig.outputWrapped to outputMaybeWrapped to reflect that the
field now only gates whether the transform is installed, not what it does.
Backs out the karapace-schema-registry.openapi.json response-schema
additions from the previous commit -- declaring schemas was a workaround for
this bug, not the real fix. ${result.*} interpolation in the 5 tool
summaries now works via the runtime fix alone, with no schema required.
…a-registry-mcp-62egyz
…a-registry-mcp-62egyz
…a-registry-mcp-62egyz
…a-registry-mcp-62egyz
…a-registry-mcp-62egyz
Our spec and runtime modules were created before develop's bulk copyright-year-update (#2183) landed, so their license headers still said 2021-2024 while the rest of the repo now says 2021-2026. license:format brings both modules in line.
…a-registry-mcp-62egyz
…y, not in vanilla/Karapace Schema Registry)
GET /contexts ("Schema Contexts") is a Confluent Platform/Confluent Cloud
extension, absent from the Aiven-Open/karapace source and 404s against a
live Karapace instance. binding-mcp-schema-registry targets vanilla/Karapace
Schema Registry, so drop list_contexts from the bundled OpenAPI spec, the
composite generator's tool list, and all associated tests/fixtures.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HL4h3tkf4oYSdjEgK4zffn
… Karapace Extends the multi-toolkit MCP gateway example with an mcp_schema_registry kind:client binding wired against a real Karapace Schema Registry (not a mock) sharing the example's existing Kafka broker. Adds the south_mcp_schema_registry_client binding/routes, the karapace-registry compose service, README documentation (architecture diagram, authorization layering, walkthrough), and .github/test.sh assertions covering tools/list scope filtering plus a full register -> list -> describe -> get_schema -> set_compatibility -> get_compatibility -> check_compatibility call sequence against the live Karapace instance. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HL4h3tkf4oYSdjEgK4zffn
Every existing scenario only exercised tools/call by name; tools/list was never tested for this binding. Add shouldListTools, driving a bare mcp:beginEx().toolsList() request directly against the binding's own accept side and asserting the full nine-tool set with correct input schemas comes back. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HL4h3tkf4oYSdjEgK4zffn
…ix tools/list hydration Renames the schema-registry toolkit's routing key from "schemaregistry" to "kafka_sr" throughout north_mcp_proxy's routes, the eager tools.match list, JWT scope examples, README, and .github/test.sh. While validating this end-to-end, tools/list never surfaced any of the toolkit's tools (not even as a cold/searchable tool), though tools/call by name worked fine. Root cause: north_mcp_proxy.options.cache.authorization's hardcoded hydration JWT never had its scope updated to include kafka_sr:tools when this toolkit was added -- its guard silently rejected the hydration stream while every other toolkit's required scope happened to already be present in that credential. tools/call was unaffected because real calls use the caller's own JWT, not this shared one. Minted a new hydration credential including kafka_sr:tools and added a comment warning that every new guarded toolkit must be added here too. Full .github/test.sh run against the real stack (including live Karapace) now passes 25/25 with zero failures. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HL4h3tkf4oYSdjEgK4zffn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
mcp_schema_registry· client binding: a thin composite generator that exposes the Karapace/vanilla Schema Registry REST API as a fixed, LLM-optimised MCP tool set (list_subjects,describe_subject,get_schema,register_schema,delete_subject,delete_schema_version,check_compatibility,get_compatibility,set_compatibility).Rather than reimplementing MCP tool-call handling,
mcp_schema_registry(kind: client) generates a composite namespace containing:inlinecatalog with the bundled Schema Registry OpenAPI spec (9 operations,operationIdvalues pre-set to the exact tool names)mcp_openapi(kind: client) binding, driven by that inlined spec, with the 9 tool → operation routes synthesized internallyThe engine attaches the generated
mcp_openapibinding through its own already-registeredBindingFactorySpi, which does its own real OpenAPI parsing/tool-naming/composite generation —mcp_schema_registryitself never touches OpenAPI parsing, request/response body shaping, or path-param extraction;McpSchemaRegistryClientFactoryis a pure pass-through relay (BEGIN/DATA/END/ABORT/RESET/WINDOW), mirroringMcpOpenapiClientFactory.The only required operator-facing config is
options.server(the Schema Registry base URL) — nocatalog:.routes:is optional and, when present, lets an operator scope and guard individual tools:Omitting
routes:entirely exposes all 9 tools ungated (the original default).routes[].withstays disallowed — the operation mapping is always synthesized internally from the tool name, never operator-declared.Building on #2103/#2105, which added
guarded:support tomcp_openapi's own routes, independent of the underlying OpenAPI spec's security schemes — needed here since the bundled schema-registry spec declares no security schemes at all.specs/binding-mcp-schema-registry.spec/— JSON schema patch (kind: [client],catalog/vault/entry/exitdisallowed,routes[].when[].tool+routes[].guardedallowed,routes[].withdisallowed,options.serverrequired), 18.rptscenario pairs (9 tools × mcp-side + http-side, using thezilla://streams/http0k3po transport required to intercept nested composite-generated streams), invalid-config fixtures, and self-consistency IT classes.runtime/binding-mcp-schema-registry/—BindingFactorySpi,McpSchemaRegistryOptionsConfig/Adapter,McpSchemaRegistryConditionConfig/Adapter(thewhen.toolcondition),McpSchemaRegistryCompositeGenerator(the composite namespace builder, including tool-name/glob matching and guard qname resolution), andMcpSchemaRegistryClientFactory(the pass-through stream relay).${result.*}summary interpolation5 of the bundled spec's tool summaries now interpolate a confirmable value from the response, e.g.
register_schema's summary is"Registered schema with id ${result.id}"(alsoget_schema,check_compatibility,get_compatibility,set_compatibility) — mirrors the existingmcp_openapi/mcp_httpinterpolation mechanism (see"Created pull request #${result.number}"precedent).binding-mcp-httpfix: result-wrapping decided from the real response shape, not schema presenceImplementing the interpolation above surfaced a real bug in
McpHttpResultWrap(shared by everymcp_openapi/mcp_http-based binding, not just this one): when a tool's OpenAPI operation has no declared response schema, the transform unconditionally wrappedstructuredContentas{"result": }regardless of whether the real response was already an object — a schema-presence decision, not a runtime-shape one. This meant any undeclared-schema operation whose response happens to already be a JSON object got a spurious wrapper, and (the symptom that surfaced it)${result.*}interpolation paths were matched one depth level too shallow whenever that spurious wrap occurred.Fixed by making
McpHttpResultWrappeek the real body's own first event and decide from that: skip wrapping when it's already an object, wrap otherwise (arrays, scalars, or anything a declared array/scalar schema guarantees non-object).McpOpenapiCompositeGenerator's existing schema-presence check is unchanged in purpose — it still decides whether to install the transform at all (skipped entirely when a declared object schema statically proves it's never needed) — only the transform's own decision of whether to actually wrap is now runtime-shape-based.McpHttpToolConfig.outputWrappedis renamed tooutputMaybeWrappedto reflect that the field now only gates installation, not behavior.Touches
runtime/binding-mcp-http/(McpHttpResultWrap,McpHttpToolConfig,McpHttpProxyFactory, andMcpHttpResultWrapTest) andruntime/binding-mcp-openapi/(the composite generator's call site and its test) in addition to the new binding itself.list_contextsremoved — Confluent-specific, not part of vanilla Schema RegistryThe bundled spec originally also included a
list_contextstool (GET /contexts). Verified against the realAiven-Open/karapaceimplementation (zero references to/contextsin its source) and a live Karapace 3.15.2 instance (404) that this endpoint is a Confluent Platform/Confluent Cloud "Schema Contexts" feature, not part of the open API surface Karapace implements. Sincebinding-mcp-schema-registrytargets vanilla/Karapace-compatible Schema Registry deployments,list_contextshas been removed from the bundled OpenAPI spec, the composite generator's tool list, and all associated tests/fixtures. A future Confluent-specificmcp-confluent-schema-registrybinding in zilla-plus, mirroring the existingconfluent-schema-registrycatalog split, is the intended home for this and other Confluent-only behavior.Fixes #1672
Test plan
./mvnw clean install -pl specs/binding-mcp-schema-registry.spec— 22/22 tests pass (4 schema validation + 9 mcp-side + 9 http-side self-consistency)./mvnw clean verify -pl runtime/binding-mcp-schema-registry— 9/9 integration test scenarios pass end-to-end against a real engine through the full nested composite (mcp_schema_registry → mcp_openapi → mcp_http), including request/response bodies for the 3 body-bearing tools and interpolated summaries for the 5 tools above; plus composite-generator (default all-unguarded, reduced scope, guarded route with qname resolution, no-match), options-adapter, and configuration unit tests; checkstyle, license headers, NOTICE, and JaCoCo all pass./mvnw clean verify -pl runtime/binding-mcp-httpand./mvnw clean verify -pl runtime/binding-mcp-openapi— full suites green after the result-wrapping fix, confirming no regression for existing array/scalar-response and declared-schema toolsKnown gaps acknowledged as out of scope for this PR: no
tools/listsupport yet, and spec coverage is happy-path + config-validation only. Akind: proxyvariant (operator-declared exit instead ofoptions.server) is tracked separately as #2104.Generated by Claude Code