/openapi-mcp-gateway:generate-config [what to connect, in plain words]from openapi-mcp-gateway
Generates an openapi-mcp-gateway config.yml to expose any REST API as MCP tools. Runs a three-stage pipeline: acquires an OpenAPI spec, selects operations, and emits a bootable config.
Ships in openapi-mcp-gateway. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
openapi-mcp-gateway reads an OpenAPI spec at startup and exposes its operations as MCP tools, then calls the upstream REST API on each tool call. One config file can mount several servers.
Your job is to hand the user a runnable config.yml, starting from nothing more than an API they name or a spec they point at. The user may be non-technical, so you own the OpenAPI details and confirm intent in plain language.
Most of the work is choosing which operations to expose and how to authenticate. Reach for shaping (params / params_strategy and JSONata) only when a raw operation makes a poor tool. A config that exposes the right operations under the right auth, with no shaping, is a fine result.
This skill carries the config keys you need. The Stage 2 guidance covers the tool block, and the Stage 3 skeleton shows the whole config shape. For the CLI flags and their allowed values, such as the transports and auth types, run:
uvx openapi-mcp-gateway serve --help
Do not invent a key you have not seen in one of those.
Follow these two rules:
policy block, where allow and deny are globs over operation ids and annotated_only keeps only operations the spec annotates. The operations map only attaches overrides to operations the policy already kept, and it errors on an unknown id. Set policy.allow to narrow a large spec, or every operation becomes a tool.spec at the full upstream document and never trim it. Narrow the surface with policy.allow, so the user can widen it later with a one-line change instead of re-acquiring the spec.Match features to the user's situation, do not reach for all of them.
auth.upstream.credentials is enough, such as a GitHub personal access token. No OAuth. Expose a handful of operations with policy.allow.policy.allow.client_credentials upstream and declare each agent under auth.mcp.clients with its own client_secret and scopes, plus auth.mcp.operation_scopes. Each agent then obtains a token as itself and reaches only the operations its scopes open, which the shared upstream credential cannot tell apart. When an identity provider the user runs already mints the agents' tokens, set auth.mcp.issuer to it instead of auth.mcp.clients, together with auth.mcp.required_scopes and auth.mcp.operation_scopes.oauth2, so each user signs in with their own credentials. authorization_code is the default and fits nearly every case.auth.upstream.enforce_scopes: true only under authorization_code or token_exchange, when the spec's operations declare security and the user wants each sign-in or exchange to grant the upstream no more than the agent can reach. Leave it off otherwise. Off, no scope hierarchy matters.
auth.upstream.scope_implies, with the source URL in a YAML comment. Never infer one from scope names. repo covers repo_deployment, but Slack's chat:write does not cover chat:write.public. When no documentation states a hierarchy, set none. A missing entry only refuses more than the upstream would, and the startup warnings show where.offline_access or openid, in auth.upstream.required_scopes, not in auth.upstream.scopes.auth.upstream.audience to the API, so the provider mints a token the API will accept rather than one for its own default audience. Reach for auth.upstream.flow: token_exchange only when the provider should also issue for the MCP endpoint itself, which needs RFC 8693 support on its side. It needs auth.mcp.issuer and auth.mcp.required_scopes, since without the latter an MCP client asks the provider for every scope it advertises.Read the request, then run the three stages in order, keeping the user in the loop between them. Do not silently guess a whole config end to end.
The user gives a plain-language request, held verbatim in $ARGUMENTS, for example connect our Github so my assistant can manage issues. They are usually non-technical, so do not expect them to name auth types, operations, or shaping. Take two things from the request, the API (a name, a URL, or a spec) and the intent (what they want to do).
Derive the rest yourself, do not ask for it in jargon.
Ask the user only for what you genuinely cannot derive, such as the host of a self-hosted API or which operations to include. Ask in plain language, offer concrete options, and mark the one you recommend. Prefer an interactive menu when the host provides one, which in Claude Code is the AskUserQuestion tool. When no such tool is available, list the options in your reply and let the user pick. Never block on something you can reasonably ask about.
Get a machine-readable OpenAPI spec first. Work down this ladder, stop at the first tier that yields a usable spec, and never skip to a lower tier because it is easier. Tell the user which tier it came from and how confident you are.
spec: straight from a URL. This is the preferred source when the user gave none.spec: at its raw URL, or vendor a copy. Tell the user it is community-maintained and unofficial, and always pair it with a policy.allow (see Stage 2) so an unvetted spec cannot widen the tool surface past what you intend.Fetch the spec candidate yourself and confirm it parses as OpenAPI before you rely on it.
Once you have the spec, read its security schemes to fix the auth type and the scheme names credentials are keyed by, and confirm the base URL, before moving on. Never invent a credential value. Reference it as an environment variable, for example value: ${GITHUB_TOKEN}.
Do not expose every operation. Turn the intent into a short list of operations, confirm it with the user, then set policy.allow to those operation ids.
Then decide, per operation, how much reshaping it needs. Prefer the lightest option that gives a good tool.
policy.allow and give it no tool block, or only a name and description override. This is the default, and the whole of shaping: none.replace every time.
format=json. Use merge with {hidden: true, default: <value>}. The value is injected upstream and the parameter leaves the schema, with no request needed.merge with {default: <value>}, which is sent upstream when the model omits the parameter.merge with params and a request $lookup. Both request and response compose with merge, not only with replace. Naming a parameter the spec does not define is a startup error, so keep merged names honest.response expression alone, which works with any strategy, including no params at all.media. A field the spec already marks with contentEncoding: base64 is promoted without it, and a binary response body needs nothing at all.replace, which drops the spec's parameters so you declare a fresh set of friendly params, then a request expression routes them upstream. Naming a param the spec never defined is fine here, the must-match rule only applies to merge. An entry that names a spec header keeps it a header, which the request must still carry to send it.The JSONata idioms you will use most:
$lookup(table, key) maps a friendly enum onto the raw API value, for example popular to popularity.desc.[ results.{ ... } ] forces a list, because a single-match projection unwraps to one object otherwise.$merge([$, { ... }]) passes most arguments through and overrides only a few, where $ is the whole input.The request result routes to the upstream call by its top-level keys. A key whose name matches a {placeholder} in the path fills that path segment. A key that names a header parameter becomes that header. Of the rest, each key becomes a JSON body field for POST / PUT / PATCH, or a query parameter for GET / DELETE. A null value is dropped, so an omitted optional friendly argument leaves no trace upstream. To match an upstream that wants a wrapped body, such as {"issue": {...}}, nest the fields under that key in the request result, for example { "issue": { "subject": subject, "project_id": project_id } }.
Write the config in the documented format in the user's working directory, then verify it boots. A minimal server needs only spec, base_url, and auth. The policy, operations, and any tool shaping are additive.
host: "127.0.0.1"
port: 8000
transport: streamable-http
servers:
- name: <server-name>
spec: <url-or-local-path>
base_url: <upstream-base-url> # required, a spec with a relative server needs the real host
headers: # optional, static headers sent on every upstream call
<Header-Name>: <value> # a literal, or ${SOME_VAR}
instructions: | # optional, server-wide guidance the client places in the model's context
<when to use this server, and which tool to call first>
auth:
upstream: # how the gateway reaches the API
type: none # or oauth2 / passthrough
credentials: # static values, keyed by the spec's security scheme; the scheme says where each travels
<scheme>:
value: ${SOME_TOKEN}
# oauth2 also takes flow: authorization_code (default) / client_credentials / token_exchange
# client_id, client_secret, scopes and the rest below are for oauth2 only
client_id: ${SOME_ID}
scopes: [...] # the most it asks for; with enforce_scopes and none listed, what the operations' security declares
# required_scopes: [offline_access], for authorization_code or token_exchange, asked for every time
audience: https://the-api.example.com # when the API and its AS differ
# enforce_scopes: true, for authorization_code or token_exchange, an operation also needs the upstream scopes
# its OpenAPI security declares, checked against what the upstream granted the user,
# and each sign-in or exchange asks only for what its MCP scopes need, plus required_scopes
# scope_implies: {repo: [public_repo]}, an upstream scope covering narrower ones
mcp: # who may call this MCP endpoint; leave it out to keep the endpoint open
# issuer: the authorization server that mints tokens for this endpoint, under token_exchange
# or in front of a shared upstream credential (credentials, client_credentials, none)
# required_scopes: what every token must carry, checked with an issuer, granted otherwise; required with an issuer
# operation_scopes: which MCP scopes open which operations, whoever issues the tokens
# {auto: tags, unscoped: deny, manual: {<scope>: {description: ..., operations: ["DELETE *"]}}}
# clients: the pre-registered clients allowed to sign in, which turns off dynamic registration
# {<client_id>: {scopes: [...], default_scopes: [...], client_secret: ${SOME_SECRET}, redirect_uris: [...], consent: false}}
# scopes is the most a client may hold; default_scopes (a subset, default all) is what it starts with,
# and it steps up for the rest when a tool call is refused
# consent: false skips the gateway's consent page for a client the operator trusts (default true)
# a key may be a client's metadata document URL (https://claude.ai/oauth/claude-code-client-metadata),
# which takes no client_secret or redirect_uris, since its document lists them
# behind none, credentials or client_credentials no user signs in: each agent gets a token with
# its own client_secret (required) at /<server>/token, and default_scopes, redirect_uris and consent are refused
# other_clients: the clients signing in with a metadata document URL that clients does not list
# {trusted_hosts: [claude.ai, vscode.dev], scopes: [...], default_scopes: [...]}, or false for none
# left out it admits any when clients lists none and none otherwise; setting it turns off dynamic registration
# access_token_ttl: 3600, refresh_token_ttl: 86400, lifetimes of the MCP tokens the gateway mints
# (no refresh token is issued to an agent, so refresh_token_ttl is for authorization_code only)
policy: # the selector for which operations become tools
allow: ["<operation_id>", "..."] # globs matched against operation ids, omit to expose all
operations: # overrides only, applied to operations the policy kept
<operation_id>:
security: [{<scheme>: [<scope>, ...]}] # optional, replaces a spec security that is wrong
tool: # optional, omit for an as-is passthrough
params_strategy: replace # or merge
params:
<friendly_param>:
type: string
enum: [...] # when the raw value is cryptic
default: ...
description: ...
request: |
{ ... JSONata ... }
response: |
[ ... JSONata ... ]
media: # optional, base64 response fields the model should see as an image or file
<field.path[*].name>: # names the upstream response, before the response transform
encoding: base64
media_type: image/png # defaults to application/octet-stream
Each credential is keyed by a scheme the spec declares, and every exposed operation needs one of its security alternatives met, or startup is refused. For a spec that declares no scheme, declare it beside the server and make it the root security:
security_schemes: # merged into the spec's securitySchemes
acme_key: {type: apiKey, in: header, name: X-Acme-Api-Key}
security: [{acme_key: []}] # replaces the spec's root security
auth:
upstream:
credentials:
acme_key:
value: ${SOME_TOKEN}
Both JSONata expressions compile when the gateway loads the config, so a broken expression fails validation with a message naming the side that broke. Validate with:
uvx openapi-mcp-gateway serve --config <config.yml> --dry-run
It loads every spec, applies the policy, and compiles the shaping, then exits without serving and prints a summary of what would run, the resolved filter included. Exit 0 means the config is valid. An unrecognised key is a hard error, so a misspelled field is caught here rather than silently ignored. On failure, read the named side (request or response), fix the JSONata, and re-run until it validates clean.
Under enforce_scopes, read the scope warnings too. A ceiling scope no operation declares is often a broad scope that needs scope_implies or belongs in required_scopes. An operation no sign-in can open needs a scope added to auth.upstream.scopes, or a hierarchy entry. Check the upstream documentation before acting on either.
Every environment variable the config references must be set for --dry-run, since a credential that resolves to nothing refuses startup. A placeholder value is enough, so set one rather than reporting the config invalid.
One config shape cannot be validated offline. A server with auth.mcp.issuer contacts the issuer during startup to discover its JWKS and, under token_exchange, its token endpoint, so --dry-run needs that provider reachable. Say so rather than reporting the config unverified.
Hand the finished config to the user with a one-line summary of each tool, the environment variables they must set, and the exact run command:
uvx openapi-mcp-gateway serve --config <their-config>.yml
These bound what the skill does beyond writing the file.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mroops0111/openapi-mcp-gateway --plugin openapi-mcp-gatewayOther plugins' skills for the same job