FromOpenAPI: project an OpenAPI spec as a urfave/cli tree + MCP server #5

Closed
opened 2026-05-23 20:53:53 +00:00 by coilysiren · 0 comments
Owner

Originally filed by @coilysiren on 2026-05-13T14:23:23Z - https://github.com/coilysiren/cli-mcp/issues/38

FastMCP ships FastMCP.from_openapi(spec, client) which converts an OpenAPI spec into MCP tools. Configurable via ordered RouteMap objects, route_map_fn callback for complex logic, mcp_component_fn for post-creation modification (tags, descriptions). Default rule: "All routes become tools".

Proposal: climcp.FromOpenAPI(spec []byte, opts) (*cli.Command, error) or similar. Returns a urfave/cli v3 command tree that can be app.Run() directly or projected to MCP via the existing NewServer. Two-projections-for-the-price-of-one is the cli-mcp angle.

Adjacent prior art on Kai's side: coilyco-ai/scripts/openapi-to-coily.py already does OpenAPI → static Go codegen for coily's ops modio/discord/sentry/trello/forgejo wrappers. cli-mcp's version could be runtime-shaped instead of codegen-shaped, and it could power the same workflow from a single binary.

Open questions:

  • Spec source: file path, []byte, URL? All three?
  • Auth: how does the generated tool capture bearer/key auth - flag, env, or Options.HTTPClient injection?
  • Body handling: JSON body as a single --body flag, or expand schema properties into individual flags?
  • Operation naming: prefer operationId, fall back to METHOD_/path collapse?

Sibling feature request: a FromFastAPI-style helper isn't applicable in Go, but FromOpenAPI is the substrate.

_Originally filed by @coilysiren on 2026-05-13T14:23:23Z - [https://github.com/coilysiren/cli-mcp/issues/38](https://github.com/coilysiren/cli-mcp/issues/38)_ [FastMCP][fastmcp] ships `FastMCP.from_openapi(spec, client)` which converts an OpenAPI spec into MCP tools. Configurable via ordered `RouteMap` objects, `route_map_fn` callback for complex logic, `mcp_component_fn` for post-creation modification (tags, descriptions). Default rule: *"All routes become tools"*. Proposal: `climcp.FromOpenAPI(spec []byte, opts) (*cli.Command, error)` or similar. Returns a urfave/cli v3 command tree that can be `app.Run()` directly *or* projected to MCP via the existing `NewServer`. Two-projections-for-the-price-of-one is the cli-mcp angle. Adjacent prior art on Kai's side: `coilyco-ai/scripts/openapi-to-coily.py` already does OpenAPI → static Go codegen for coily's `ops modio/discord/sentry/trello/forgejo` wrappers. cli-mcp's version could be runtime-shaped instead of codegen-shaped, and it could power the same workflow from a single binary. Open questions: - Spec source: file path, []byte, URL? All three? - Auth: how does the generated tool capture bearer/key auth - flag, env, or `Options.HTTPClient` injection? - Body handling: JSON body as a single `--body` flag, or expand schema properties into individual flags? - Operation naming: prefer `operationId`, fall back to `METHOD_/path` collapse? Sibling feature request: a `FromFastAPI`-style helper isn't applicable in Go, but `FromOpenAPI` is the substrate. [fastmcp]: https://github.com/jlowin/fastmcp
coilysiren 2026-05-30 05:44:17 +00:00
  • closed this issue
  • added the
    icebox
    label
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilysiren/cli-mcp#5
No description provided.