Direct API Wrapper
Expose an existing API as MCP tools by mapping each operation one-to-one β fastest path from 'we have an API' to 'agents can call it'.
Intent & Description
π― Intent
Make any well-documented API agent-callable with minimal wrapper logic.
π Context
You already run a stable HTTP API with an OpenAPI spec or typed SDK. You want agents to call it without re-implementing business logic or writing tool definitions by hand.
π‘ Solution
Map each API operation to one MCP tool, deriving name, input schema, and output shape directly from the API contract. A generator reads the OpenAPI doc and emits the server β tools track the API automatically. FastMCP’s from_openapi/from_fastapi, fastapi-mcp, and Speakeasy/Stainless generators all follow this shape. Keep the wrapper free of new business logic so regeneration stays cheap.
Real-world Use Case
- An existing API is stable and described by an OpenAPI doc or typed SDK.
- The goal is the fastest route to making the API agent-callable.
- The API surface is small enough that one tool per operation doesn’t overwhelm the model.
- The team wants tools to track the API automatically, not be hand-maintained.
Source
π TL;DR
Generate MCP tools straight from your OpenAPI spec. Zero business logic in the wrapper, regenerate when the API changes. Fastest path to agent-callable.
Advantages
- Fastest path from existing API to agent-callable tool surface.
- Low maintenance β regenerate from the contract when the API changes.
- Works for any OpenAPI-described API regardless of implementation language.
- No new semantics to design or document.
Disadvantages
- Tool sprawl β a large API becomes a long list of low-level tools that overwhelms model selection.
- Programmer-oriented operation names and error shapes can mislead tool selection.
- No orchestration or error smoothing β multi-step tasks still require the model to chain calls.
- Inherits the API’s chattiness; token cost scales with round-trips.