- Home
- Skills
- APIs & Backend
- REST API MCP Scaffold — OpenAPI to Mock to Live
REST API MCP Scaffold — OpenAPI to Mock to Live
OpenAPI/REST to MCP tool contracts, mock fixtures, then live auth — confirm before writes and live flip.
$39
Works with the AI Agents you already use
REST API MCP Scaffold — OpenAPI to Mock to Live
Example session with this skill installed
I have an OpenAPI spec for a simple inventory API at inventory-api.json. Scaffold a mock MCP server with read tools for items and warehouses, and one write tool for stock updates.
- Read your context and instructions
- Compiled the rest api mcp
Scaffolded a TypeScript MCP server for the Inventory API. The project includes a mock handler system, JSON fixtures for items and warehouses, and the tool contract for stock updates.
MCP Inventory Scaffold
// src/index.ts
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
CallToolRequestSchema,
ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
const server = new Server(
{ name: "inventory-mcp", version: "1.0.0" },
{ capabilities: { tools: {} } }
);
const MOCK_DATA = {
items: [{ id: "inv_1", name: "Widget", qty: 100 }],
warehouses: [{ id: "wh_a", location: "North" }]
};
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [
{
name: "get_items",
description: "List all inventory items",
inputSchema: { type: "object", properties: {} }
},
{
name: "update_stock",
description: "Update item quantity (Requires confirmation)",
inputSchema: {
type: "object",
properties: {
id: { type: "string" },
qty: { type: "number" }
},
required: ["id", "qty"]
}
}
]
}));
server.setRequestHandler(CallToolRequestSchema, async (request) => {
const { name, arguments: args } = request.params;
const isMock = process.env.USE_MOCK === "true";
if (name === "get_items") {
return { content: [{ type: "text", text: JSON.stringify(MOCK_DATA.items) }] };
}
if (name === "update_stock") {
return {
content: [{ type: "text", text: `[Mock] Updated ${args?.id} to ${args?.qty}` }],
isError: false
};
}
throw new Error("Tool not found");
});
const transport = new StdioServerTransport();
await server.connect(transport);
Next steps
- Run
npm install @modelcontextprotocol/sdkin the project root. - Set
USE_MOCK=truein your environment to test the generated fixtures. - Review the
api-structure-mapto ensure the stock update tool maps to the correct PATCH endpoint.
Connects securely to your tools. The creator never sees your data.
About this skill
Building a bridge between AI agents and REST backends usually involves hours of boilerplate, auth handling, and schema mapping. This skill automates the creation of Model Context Protocol (MCP) servers from OpenAPI specs or sample JSON. It delivers a local stdio bridge with a clear path from mock fixtures to live production traffic.
What it does
- OpenAPI mapping transforms endpoint definitions into strictly typed MCP tool schemas.
- Mock-first scaffolding generates a TypeScript MCP server that runs on local JSON fixtures for safe testing.
- Auth implementation scaffolds secure handlers for API Key, Bearer, and Basic auth using environment variables.
- Safety controls builds mandatory confirm-before-write logic and prevents accidental data deletion.
- Rate limit handling implements backoff strategies for 429 errors and sliding window limits.
How it works
- Scope and Discovery analyze your OpenAPI file or JSON samples to map resources and identify potential API traps.
- Contract Generation creates tool definitions including slugs, input schemas, and read/write designations.
- Mock Server Setup initializes a Node.js project using the MCP SDK and populates local fixtures.
- Live Integration flips the client to HTTPS once the mock flow is approved by the user.
- Configuration Delivery outputs the final MCP JSON for Cursor or Claude Desktop with absolute path placeholders.
Frameworks & tools
Built for Node 18+ environments using TypeScript and the @modelcontextprotocol/sdk. Compatible with any REST/OpenAPI backend.
Why this beats prompting it yourself
Standard prompts often fail to maintain strict type safety across many endpoints or forget to implement backoff logic for rate limits. This skill follows a structured phase checklist that separates side-effect tools from read-only tools, ensuring a production-ready scaffold that handles auth and pagination correctly from the start.
Use cases
- Connect an AI agent to a private internal API for data retrieval.
- Build a safe testing environment for an agent before granting live write access.
- Bridge legacy REST services to Claude Desktop or Cursor for dev tool automation.
- Rapidly prototype MCP tools for a new SaaS product using OpenAPI docs.
Known limitations
Does not support GraphQL or gRPC natively. Out-of-the-box auth covers machine-to-machine flows; interactive OAuth requires custom implementation. Local stdio transport only.
Supports Node 18+ TypeScript environments. Stdio transport only. No native GraphQL/gRPC support. Interactive OAuth requires custom design. Local execution focus.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 24 days ago