Setup Mock API
setup_mock_apiStart or reconfigure a persistent local mock REST API with CORS, using a schema to seed collections so data survives refreshes and tool calls.
Instructions
Starts (or reconfigures) a local, persistent REST API that a Claude Artifact can call directly (fetch) with full CORS support, instead of losing state on every refresh. Give it a schema describing the resources you need as seed data; each key becomes a collection served at http://localhost:/api/ supporting GET/POST/PUT/PATCH/DELETE. Data is written to sandbox_db.json next to this server and survives across Artifact refreshes and tool calls: collections that already exist from a previous call are left as-is, not overwritten. Use get_mock_api_status to check whether a server is already running before calling this.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"schema": "<schema>"
},
"name": "setup_mock_api"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | TCP port for the local mock API. Defaults to 3001. | |
| schema | Yes | Map of resource name to an array of seed objects, e.g. {"tasks": [{"title": "Buy milk", "done": false}], "users": [{"name": "Ana"}]}. Items don't need an id field; one is generated automatically if missing. |