Skip to content

binding-mcp-openapi: add kind: proxy variant with operator-declared exit - #2242

Merged
jfallows merged 3 commits into
developfrom
claude/github-issue-2237-95q79x
Jul 31, 2026
Merged

jfallows merged 3 commits into
developfrom
claude/github-issue-2237-95q79x

Conversation

@jfallows

@jfallows jfallows commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

mcp_openapi previously supported only kind: client, with the generated mcp_http0 route's exit always sourced from the JVM-wide zilla.binding.mcp.openapi.http.client.exit Configuration property. This adds a kind: proxy variant that lets the operator declare exit directly on the binding (top-level or per-route), so the generated composite can terminate at an operator-provided binding instead of the configured default — the same split binding-mcp-schema-registry got in #2068/#2231.

Rebased onto latest develop (post #2241, #2243, #2244), which landed binding-mcp-http's own kind: client (#2243, #2238). That unlocked a cleaner design than originally planned: mcp_openapi no longer needs its own zilla.binding.mcp.openapi.http.client.exit default for the generated mcp_http0 — it now propagates its own kind directly onto mcp_http0 (client → client, proxy → proxy with the resolved exit stamped per route), relying entirely on mcp_http's own zilla.binding.mcp.http.client.exit default (sys:http_client) for the client case. The mcp-openapi-level property is removed as redundant.

client (no exit anywhere) and proxy (exit required) now have a precisely-specified meaning enforced by the schema, so McpOpenapiCompositeGenerator trusts binding.kind directly (.kind(binding.kind)) rather than deriving the generated kind from exit presence — every caller of McpOpenapiBindingConfig lives in this codebase, so a caller that ever set kind/exit inconsistently would simply fail to route correctly and get caught by tests, rather than needing to be defended against here.

Changes

  • specs/binding-mcp-openapi.spec: schema patch widens kind to ["client", "proxy"]. client keeps disallowing exit (top-level and per-route); proxy requires exit either top-level or per-route — the per-route branch mirrors binding-mcp-http's own if: {required: [with]} then: {required: [exit]} shape (and the corrected, non-vacuous form of binding-tcp's pattern from fix(binding-tcp): enforce per-route exit requirement for kind: server #2241) rather than binding-tcp's original array-level "required", which is a no-op since required only constrains object instances. New fixtures (kind.proxy.yaml, kind.proxy.invalid.yaml, kind.proxy.route.exit.yaml, exit.invalid.yaml) plus SchemaTest coverage for the valid/invalid combinations.
  • runtime/binding-mcp-openapi:
    • McpOpenapiBindingConfig resolves a binding-level exit from the first route with a non-null exit, using that route's already-resolved route.id (set generically by EngineManager for every route before any binding-specific code runs) rather than re-resolving the raw route.exit string a second time.
    • McpOpenapiCompositeGenerator generates mcp_http0 with the same kind as the outer mcp_openapi binding, stamping the resolved exit on every route when one exists.
    • McpOpenapiBinding/McpOpenapiBindingContext widen their kind == CLIENT gates to also accept PROXY — without this, kind: proxy bindings never reach attach() at all and every stream aborts immediately, mirroring McpSchemaRegistryBinding/McpSchemaRegistryBindingContext's existing client+proxy dual-kind pattern from binding-mcp-schema-registry: add kind: proxy variant with operator-declared exit #2231.
  • McpOpenapiClientIT/McpSchemaRegistryClientIT: switch their exit override from the removed zilla.binding.mcp.openapi.http.client.exit to zilla.binding.mcp.http.client.exit (now owned by binding-mcp-http), since there's no longer an mcp-openapi-level exit for kind: client to override.
  • New McpOpenapiProxyIT reuses the existing mcp/http .rpt scripts already exercised by McpOpenapiClientIT, driven by a kind: proxy + exit: fixture — analogous to McpSchemaRegistryProxyIT.

options.specs.*.server is untouched — it stays available for both kinds, since it shapes per-spec HTTP headers independently of which binding receives the stream.

Follow-up for binding-mcp-schema-registry (once #2104/#2231 lands and picks this up): its own composite generator currently hardcodes .kind(CLIENT) on the intermediate mcp_openapi0 it generates, regardless of its own kind. It should instead propagate its own kind the same way this PR does — .kind(schemaRegistryBinding.kind) with .exit(schemaRegistryBinding.exit) stamped on the generated route(s) — rather than hardcoding CLIENT while separately threading exit through, which is exactly the kind/exit inconsistency this PR moved away from tolerating.

Verified locally: ./mvnw verify is green for specs/binding-mcp-openapi.spec, runtime/binding-mcp-openapi, and runtime/binding-mcp-schema-registry, including checkstyle, license checks, JaCoCo coverage, and all ITs.

Fixes #2237

claude added 2 commits July 31, 2026 16:12
…ared exit

Widens mcp_openapi's kind enum to [client, proxy]. kind: proxy requires
exit (top-level or per-route, mirroring binding-tcp's kind: server
pattern, written to actually enforce per-route via "contains" rather
than tcp's vacuous array-typed "required"); kind: client keeps
disallowing exit.

McpOpenapiBindingConfig now resolves a binding-level exit from the
engine's own pre-resolved route.id (set generically by EngineManager
for every route before binding-specific code runs) rather than
re-resolving the raw route.exit string, and McpOpenapiCompositeGenerator
prefers it over the configured httpClientExit default when stamping
mcp_http0's routes. McpOpenapiBinding/McpOpenapiBindingContext widen
their kind == CLIENT gates to also accept PROXY, mirroring the
client+proxy dual-kind pattern binding-mcp-schema-registry uses for its
own kind: proxy variant.

Adds McpOpenapiProxyIT (reusing the existing mcp/http .rpt scripts
against a kind: proxy + exit fixture) and SchemaTest coverage for the
valid/invalid kind/exit combinations.

Fixes #2237

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SgdvrgkrnhEy7uUpoan62L
…t/proxy kind

Now that binding-mcp-http supports kind: client (implicit sys:http_client
exit via zilla.binding.mcp.http.client.exit, #2243), the generated
mcp_http0 no longer needs to always be kind: proxy defaulting to a
JVM-wide httpClientExit Configuration property owned by mcp_openapi
itself. McpOpenapiCompositeGenerator now mirrors kind: proxy when a
resolved exit exists (whether authored directly or passed through by a
generator like binding-mcp-schema-registry), kind: client otherwise,
relying entirely on mcp-http's own default. Removes the now-redundant
zilla.binding.mcp.openapi.http.client.exit Configuration property.

McpOpenapiClientIT and McpSchemaRegistryClientIT switch their exit
override to zilla.binding.mcp.http.client.exit (owned by mcp-http)
since there is no longer an mcp-openapi-level exit for kind: client.

Also updates the mcp_openapi schema patch's kind: proxy per-route exit
requirement to match binding-mcp-http's actual if/with-then/exit shape
(and binding-tcp's now-fixed #2241 items-based enforcement) rather than
the vacuous array-level "required" this mirrored initially.

Rebased onto latest develop (#2241, #2243, #2244).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SgdvrgkrnhEy7uUpoan62L
@jfallows
jfallows force-pushed the claude/github-issue-2237-95q79x branch from 7c6a702 to 0949181 Compare July 31, 2026 16:21
…http0 directly

Replace the derived binding.exit != null ? PROXY : CLIENT check with a
direct .kind(binding.kind) propagation. client (no exit anywhere) and
proxy (exit required) now have a precisely-specified meaning enforced
by the schema, and every caller of McpOpenapiBindingConfig lives in
this codebase — so trust the kind a caller sets rather than deriving it
defensively from exit presence. A caller that sets kind and exit
inconsistently (e.g. kind: client with an exit stamped on a route) will
now simply not route correctly, which is the right failure mode: it
gets caught by tests and fixed at the source, rather than silently
papered over here.

Updates the one unit test exercising this path to author its binding
as kind: proxy (the real, schema-valid way to declare an exit) instead
of kind: client + exit (a caller-side inconsistency this no longer
special-cases).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SgdvrgkrnhEy7uUpoan62L
@jfallows
jfallows merged commit cb0baed into develop Jul 31, 2026
41 checks passed
jfallows pushed a commit that referenced this pull request Jul 31, 2026
Bring in binding-mcp-openapi kind: proxy support (#2242) and update
binding-mcp-schema-registry to generate its inner mcp_openapi0 binding
with the operator's own kind/exit instead of hardcoding kind: client,
per the handoff on #2104.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

binding-mcp-openapi: add kind: proxy variant with operator-declared exit

2 participants