Docs menu · MCP server

APIMock documentation

MCP server

APIMock runs a remote Model Context Protocol server, so a coding agent can create mock endpoints and resources, read your workspace's contract, debug failed requests and break the mock on purpose, all from the chat. Nothing to install: it's one URL, and you either sign in or paste a token.

Updated

Connect

The server speaks Streamable HTTP at https://app.apimock.dev/api/mcp. In claude.ai, Claude Desktop or Claude mobile, add it as a custom connector with that URL and sign in to APIMock when asked. In Claude Code, add the URL, then run /mcp to sign in:

claude mcp add --transport http apimock https://app.apimock.dev/api/mcp

Signing in connects the app to your account; manage connected apps under Settings → Connected apps. Clients that can't sign in, such as Cursor, take an API token in a header instead (see below):

claude mcp add --transport http apimock https://app.apimock.dev/api/mcp \
  --header "Authorization: Bearer am_pat_your_token_here"

Other clients that read an mcpServers file take the same URL and header. Clients without remote HTTP support can use npx mcp-remote as a bridge; the Claude Desktop guide walks through it.

{
  "mcpServers": {
    "apimock": {
      "type": "http",
      "url": "https://app.apimock.dev/api/mcp",
      "headers": {
        "Authorization": "Bearer am_pat_your_token_here"
      }
    }
  }
}

Tokens and scopes

  • Create a personal access token under Settings → API Tokens. It starts with am_pat_ and is shown once.
  • A read token can list, get and inspect. Creating, changing or deleting anything needs write, which includes read. When you sign in from an app, untick "Create, change and delete" to connect it read-only.
  • Tokens expire after 90 days by default (30 days, a year or never are also offered) and can be revoked at any time.
  • A token acts as you in every workspace you belong to. Each tool call names its target with a workspace slug from list_workspaces.

Tools

Workspaces and foldersScopeWhat it does
list_workspacesreadYour workspaces, with the slug every other tool takes.
list_foldersreadFolders and subfolders, with ids and paths.
create_folderwriteCreate a folder or subfolder.
delete_folderwriteDelete a folder, its subfolders and their endpoints. Refuses folders holding resources.
EndpointsScopeWhat it does
list_endpointsreadEvery endpoint's method, route and status.
get_endpointreadOne endpoint's full configuration, response variants and live URL.
create_endpointwriteCreate a static or templated mock response, optionally with response variants.
update_endpointwriteChange any setting, including response variants; only the fields you pass change.
simulate_requestreadWhich endpoint and response variant a request would get, and why, without sending it.
delete_endpointwriteDelete one endpoint.
import_openapiwriteImport an OpenAPI or Swagger spec from text or a URL.
ResourcesScopeWhat it does
scaffold_backendwriteCreate several resources with seed records, plus custom endpoints, in one call.
create_resourcewriteCreate one stateful CRUD collection.
list_resourcesreadResources with their URL, fields and record count.
delete_resourcewriteDelete a resource with its records and CRUD routes. Other routes in its folder stay.
Debugging and faultsScopeWhat it does
inspect_failed_requestsreadRecent 4xx, 5xx and unmatched requests, with headers, bodies and match diagnostics.
heal_mock_endpointwriteFix an endpoint's body, status or request schema after a failure.
set_fault_rulewriteInject errors, latency or broken payloads for a while.
list_fault_rulesreadActive fault rules and the minutes they have left.
clear_fault_ruleswriteRemove one fault rule, or all of them.

Tools are annotated as read-only or destructive, so clients can run reads without asking and confirm before a change. A resource's generated CRUD routes can't be edited or deleted one by one; use delete_resource for those.

Resources and prompts

Each workspace's contract is available as an MCP resource, so the agent can read the exact shapes it should code against: apimock://workspaces/{slug}/openapi.json (OpenAPI 3.1) and apimock://workspaces/{slug}/types.d.ts (TypeScript). They match the /openapi.json and /types.d.ts files served on the workspace's mock domain.

The server also ships prompts, which Claude Code lists as slash commands:

  • mock_backend_for_frontend: Reads your frontend code, models its data and scaffolds CRUD mocks with seed records.
  • debug_failing_requests: Groups recent failures, decides whether the mock or the client is wrong, and fixes the mock.
  • test_error_states: Injects a 503, a 429, latency and null fields one at a time and reviews how your code copes.

Limits

  • 120 MCP requests per minute per user.
  • import_openapi, scaffold_backend and create_resource share a tighter budget: 10 calls a minute and 60 an hour.
  • Everything the agent creates counts toward the same workspace quotas as the dashboard, and shows up there straight away.

Connect your agent

Create a token, paste the config, and ask your agent to list your workspaces.

Create a token