refactor(mcp): generate the tool definitions from the spec

Produced by k8s-platform/tools/generate-mcp-tools.py: deck file openapi2mcp
does the conversion, and the wrapper re-injects the five things Kong's
generator cannot emit — per-tool ACLs, the MCP behavioural annotations, the
response schemas the plugin uses for structuredOutput, the real upstream host,
and JSON-only request bodies. Each is a documented gap; see
k8s-platform/MCP-TOOL-GENERATION.md.

tools-policy.yaml carries the ACLs and doubles as the allow-list: an operation
becomes a tool only if the policy names it. Kong would otherwise expose every
operation in the spec, DELETE included, and can express no authorization at all
from a bearer-token spec — silently, exit 0, no warning.

Same tools as before, same ACLs. What changed: query parameters are now
declared and callable, each tool carries its response schema so calls return
structured content instead of raw JSON, and request bodies are no longer
tripled across three identical content types.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Stéphane Tailland
2026-08-29 08:48:45 +02:00
parent 87d7f7ef44
commit 8db2bb6e39
2 changed files with 812 additions and 211 deletions
+780 -211
View File
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
# Which operations of openapi.yaml become MCP tools, and who may call each.
#
# This file is the allow-list as well as the ACL: an operation that is not
# named here does not become a tool. Kong's generator exposes every operation
# it finds and can express no authorization at all from a bearer-token spec —
# see k8s-platform/MCP-TOOL-GENERATION.md, limits 1 and 5.
#
# `allow` lists consumer groups, which come from realm_access.roles in the end
# user's own token. Kong applies them at tools/list, so a caller never sees a
# tool it may not call.
mcp_name: workforce-mcp
tools:
list-offices:
allow: [admin, read_only, product_manager, support]
get-office:
allow: [admin, read_only, product_manager, support]
get-office-employees:
allow: [admin, read_only, product_manager, support]
create-office:
allow: [admin]
list-employees:
allow: [admin, read_only, product_manager, support]
get-employee:
allow: [admin, read_only, product_manager, support]
get-employee-reports:
allow: [admin, read_only, product_manager, support]
get-employee-customers:
allow: [admin, read_only, product_manager, support]
create-employee:
allow: [admin]