Let Claude build your mock APIs and stateful backends
APIMock speaks the Model Context Protocol. Connect it to Claude Desktop, Claude Code, or Cursor, and you can scaffold relational backends, import OpenAPI specs, organize folders, and auto-heal broken mocks—just by describing what you need in plain English.
The Model Context Protocol (MCP) bridges AI assistants directly to APIMock's engine. Instead of hand-crafting JSON fixtures or writing temporary Express routes, Claude can inspect your workspaces, scaffold relational collections with realistic seed data, import OpenAPI contracts, and diagnose integration errors in real time.
Instant backends
Scaffold multi-resource relational CRUD backends with typed fields and seed records in one prompt.
OpenAPI ingestion
Import Swagger/OpenAPI specs from URLs or files to generate mocks and stateful resources instantly.
Self-healing mocks
Inspect 404s and schema mismatches from live telemetry and patch endpoints autonomously.
Create a Personal Access Token
The connection authenticates with a Personal Access Token (PAT). Sign in to APIMock, navigate to Settings → API tokens (or click your avatar in the top-right corner and choose API tokens). Give the token a name like claude-desktop and click Generate Token.
Copy your token immediately—it starts with am_pat_ and is revealed only once. APIMock only ever stores a secure cryptographic hash.
Add APIMock to Claude Desktop
Open Claude Desktop's configuration file (create it if it does not exist):
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
Add APIMock using the remote HTTP streamable transport. This direct configuration is native, fast, and requires no local bridge dependencies:
{
"mcpServers": {
"apimock": {
"type": "http",
"url": "https://app.apimock.dev/api/mcp",
"headers": {
"Authorization": "Bearer am_pat_your_token_here"
}
}
}
}Replace am_pat_your_token_here with your token (or paste the snippet copied from APIMock Settings), save the file, and fully restart Claude Desktop (quit the app completely, not just close the window).
npx), use mcp-remote:{
"mcpServers": {
"apimock": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://app.apimock.dev/api/mcp",
"--header",
"Authorization: Bearer am_pat_your_token_here"
]
}
}
}Using Claude Code or Cursor? The exact same direct HTTP configuration works in your project's .mcp.json file.
Confirm the connection & explore tools
After restarting Claude Desktop, start a new chat and click the tools icon (). APIMock exposes a comprehensive suite of 10 specialized agent tools:
Discovery & Workspace
list_workspaces See accessible workspaces, slugs, and your roles
Domain Scaffolding & State
scaffold_backend Atomically scaffold relational resources, typed schemas, seed data & custom endpoints
create_resource Declare a stateful CRUD collection with typed fields (GET, POST, PATCH, DELETE)
Endpoints & Organization
list_folders Inspect folder and subfolder hierarchy with paths and IDs
create_folder Create nested folders or subfolders
list_endpoints List existing endpoints and routes to avoid duplicates
create_endpoint Create mock HTTP endpoints with status codes, templates, delays, and auth
Contracts & Specs
import_openapi Import OpenAPI/Swagger specs (URL or YAML/JSON) with automatic resource detection
Observability & Self-Healing
inspect_failed_requests Query recent 4xx/5xx logs, unmatched routes, and offending payloads
heal_mock_endpoint Update response bodies, status codes, or schemas to fix integration failuresNot seeing them? Double-check that the JSON syntax is valid, your token is active in APIMock Settings, and that you restarted Claude Desktop.
What Claude can build for you
With the full tool suite connected, Claude transitions from a simple mock assistant to an autonomous backend orchestrator. Here are the core patterns:
1. One-shot backend scaffolding
Instead of declaring routes one by one, instruct Claude to design an entire domain model. Claude uses scaffold_backend to create folders, typed database collections, realistic seed records, and custom routes atomically:
In workspace "acme", scaffold an e-commerce backend with:
- A "products" collection with fields: name (string, required), price (number, required), in_stock (boolean), and category (enum: electronics, apparel, home). Include 5 seed records.
- An "orders" collection with fields: user_id (string, required), total (number, required), status (enum: pending, paid, shipped).
- A custom POST /api/checkout endpoint that accepts cart items and returns an order confirmation.APIMock immediately materializes stateful CRUD endpoints for /api/products and/api/orders alongside your custom checkout route.
2. Instant OpenAPI spec ingestion
Already have a Swagger or OpenAPI v2/v3 document? Give Claude the URL or paste the raw YAML/JSON. Claude calls import_openapi to parse the spec, organize routes in a folder, and automatically promote clean CRUD path-groups into live stateful resources:
Import the OpenAPI spec from https://petstore.swagger.io/v2/swagger.json into workspace "acme". Automatically generate mock endpoints and identify any CRUD collections as stateful resources.3. Closed-loop failure inspection and healing
When developing a frontend, unmatched routes return a 404 with telemetry logged to APIMock. Ask Claude to diagnose integration failures; it calls inspect_failed_requests to view the missing route, payload, and headers, then invokes heal_mock_endpoint orcreate_endpoint to fix it on the fly:
My frontend just received a 404 when requesting GET /api/v1/user-profiles. Inspect recent failed requests in workspace "acme", diagnose the missing route or schema mismatch, and heal the mock endpoint so my client succeeds.4. Granular mock customization
Need precision control over status codes, response delays, or dynamic Handlebars templates? Claude uses create_folder and create_endpoint with full schema validation:
List my APIMock workspaces.
Then, in workspace "acme", create a folder "auth" and add:
- POST /api/auth/login returning a fake JWT and user profile
- POST /api/auth/refresh refreshing the auth token
- POST /api/auth/logout returning 204 No ContentTest live and iterate
Every resource and endpoint created by Claude is live instantly under your workspace subdomain. Because resources are fully stateful, you can test complete CRUD cycles immediately without a real backend:
# 1. List existing products
curl https://acme.apimock.dev/api/products
# 2. Add a new product (persisted statefully)
curl -X POST https://acme.apimock.dev/api/products \
-H "Content-Type: application/json" \
-d '{"name": "Mechanical Keyboard", "price": 129.99, "in_stock": true, "category": "electronics"}'
# 3. Retrieve the newly created product by ID
curl https://acme.apimock.dev/api/products/6- Stateful persistence: POST creates real records that appear in subsequent GET calls and can be patched or deleted.
- Request Inspector: Open APIMock to watch live request traces, latency, headers, and request bodies in real time.
- Autonomous healing: When tests or UI components fail, ask Claude to inspect the failure logs and patch the contract.
- Revoke anytime: Revoke or rotate tokens in Settings → API tokens whenever needed without affecting your workspace data.
Ship faster
Describe your backend. Get live APIs.
Generate a token, connect Claude Desktop, Claude Code, or Cursor, and scaffold complete relational backends while staying focused on your frontend.