An AI coding agent can write a user list, a checkout form or a dashboard in a few minutes. Then the screen needs data, and the backend doesn't exist yet. Without an API, the agent tends to hard-code sample data in the components or to write a throwaway server that you have to run and remove later.
With Mockhop, the agent sets up a hosted mock API itself. Mockhop has an MCP server, and an agent that is connected to it can create a project and its endpoints, write the mock URL into your code and read the request logs when a call doesn't behave as expected.
How it works
- Connect the agent. Create an API key in the app and add Mockhop's MCP server to your client. The guide Connect an AI agent to Mockhop shows the setup for Claude Code, Cursor, Visual Studio Code and other clients.
- Let the agent create the API. It can start from one of the templates, import an OpenAPI file, or add endpoints and responses one by one. Besides REST, it can set up GraphQL mocks and, on plans that include them, WebSocket mocks and scenarios.
- Point the app at the mock URL. The agent writes the address of your organization into an environment variable, and the app calls it like a real API.
- Debug with the request logs. When a screen stays empty or a form fails, the agent looks up the request your app sent: method, path, headers and body, and the answer the mock gave.
A worked example
You ask the agent:
Build a user list page with a form for new users.
There is no backend yet, so use Mockhop for the API.
The agent creates a project from the users template. The project has the base path /users-api and five endpoints that answer right away. The agent writes the address into your environment file:
API_BASE=https://acme.mockhop.cloud/users-api
It builds the page against GET /users and the form against POST /users. Then saving a new user fails in the browser. The agent reads the request log, sees that the app called /user instead of /users and got a 404, and fixes the path. It found the cause in what the app sent.
Next you want to see the validation state. The agent adds a second response to POST /users with the status 422 and a list of messages, and builds the error display against it. Simulate API errors, timeouts and rate limits describes delays, errors and matching rules.
When the real backend arrives
The mock has become a description of the API your frontend expects. The agent, or you in the app, exports the project as an OpenAPI file. The backend team can use it as the contract to build against, and you can keep it in the repository.
When the real API is ready, change API_BASE. If only part of it is ready, see Build the frontend before the backend is ready for the step-by-step switch.
Keep the agent's access small
- An API key belongs to one organization and has the access Read only or Read and write. Give an agent that only debugs a Read only key.
- Request logs contain whatever callers sent to your mock. An agent that reads them is reading untrusted text.
- A key can't manage members, billing or other keys. To delete a project, the agent has to pass the project's exact name as a confirmation.
The guide describes the tools, limits and error codes.
Good to know
- API keys and the MCP server are available on every plan, including Free. The Free plan includes one project.
- The mock keeps no state: a user created with
POST /usersdoesn't appear inGET /users. The fake user API page describes what the template answers. - Your mocks answer from outside once you've confirmed your email address.
Plans and limits: pricing.