Repository navigation
Description
Summary
mcp_openapi's own routes[] schema currently disallows guarded: (additionalProperties: false on the route item alongside when/with). The only way a tool/resource route ends up guarded today is by resolving the bundled OpenAPI spec's own security/securitySchemes declarations against options.specs[label].security (see McpOpenapiCompositeGenerator.resolveAlternative/injectGuarded).
That's a real limitation: many OpenAPI specs declare no security schemes at all, so there's currently no way to guard or scope individual mcp_openapi tools/resources when the underlying spec doesn't already carry that information — even though the operator may still want to require a guard (JWT, API key, etc.) on specific tools.
Proposal
Allow guarded: directly on mcp_openapi's own routes[], using the same shape every other binding's routes already support (guarded: [{name, roles}], referencing a guard declared in the enclosing zilla.yaml). When present, thread it into the corresponding generated mcp_http0 route's guarded: — in addition to (or independent of) whatever the bundled spec's own security requirements resolve to.
bindings:
app0:
type: mcp_openapi
kind: client
options:
specs:
github:
catalog: ...
routes:
- when:
- tool: create_pr
with:
spec: github
operation: create_pr
guarded:
- name: jwt0
roles: [write]Motivating use case
mcp_schema_registry (composite kind: client wrapping mcp_openapi, see #2068) exposes a fixed set of tools with no OpenAPI security schemes in its bundled spec at all. To let operators guard/scope individual tools (e.g. require a guard on register_schema/delete_subject but leave read-only tools open), its own composite generator needs to pass an operator-declared route's guarded: straight through to the mcp_openapi0 binding it generates — which requires mcp_openapi to accept guarded: on its own routes independent of spec-derived security. Once this lands, mcp_schema_registry can add its own routes[].when.tool (name or glob) + guarded: on top of it, resolving guard references to absolute namespace:name qnames since the generated composite lives in a different namespace than where the operator declares the guard.
Notes
- No schema change needed beyond removing the
additionalProperties: falseexclusion and documentingguardedon the route item (the property shape itself is the engine's existing generic$defs/routeguarded— nothing new to define). - Should compose with the existing spec-derived guarding rather than replace it — an operator-declared route
guarded:and a spec-derived one aren't mutually exclusive concepts.
Activity
feat(binding-mcp-openapi): support operator-declared guarded routes (#…
feat(binding-mcp-schema-registry): support routes[].when.tool + guarded
binding-mcp-schema-registry: composite mcp_schema_registry · client b…