Mockhop has a hosted MCP server. A coding agent that is connected to it can build REST, GraphQL and WebSocket mocks, import an OpenAPI file, write the mock URL into your code and read the request logs to see what your app sent. This guide covers the API key, the setup for six clients, the tools and the limits.
| Setting | Value |
|---|---|
| Address | https://app.mockhop.com/api/mcp |
| Transport | Streamable HTTP, stateless |
| Authentication | Authorization: Bearer <key> with a personal API key |
There is no OAuth sign-in yet. A client works if you can give it a URL and a request header. Clients that can only connect through an OAuth sign-in flow are not supported at the moment.
What you need
- A Mockhop account. API keys are available on every plan, including Free. The quickstart explains the account and the address of your organization.
- An API key (next section).
- A client that connects to an MCP server with a URL and a header. This guide shows Claude Code, Cursor, Visual Studio Code (VS Code), Antigravity CLI, Codex CLI and Windsurf.
Create an API key
- Sign in at
https://app.mockhop.com, open the account menu and select API keys. - Select Create key and give the key a name.
- Under Access, choose Read only or Read and write.
- Under Expires after, choose 30 days, 90 days or 1 year.
- Select Create key. Copy the key and keep it somewhere safe. It starts with
mhp_and is shown once. Then confirm with I have saved this key. If you lose the key, create a new one.
A key belongs to one organization. An agent that uses it sees the projects of that organization and no other. Each user can have up to 10 active keys per organization.
Which access to choose:
- Read and write for an agent that sets up mocks: it creates projects and endpoints and changes responses.
- Read only for an agent that only looks: it lists projects and reads request logs. Use this for debugging.
Set up your client
Replace YOUR_API_KEY with your key. Where an example names MOCKHOP_API_KEY, the client reads the key from that environment variable, so set it in the environment the client starts in. A configuration file that contains a key does not belong in a shared repository.
Claude Code
Run this in your terminal:
claude mcp add --transport http mockhop https://app.mockhop.com/api/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
The server is added for the current project. Add --scope user to use it in all your projects. claude mcp list shows whether the connection works.
Cursor
Create .cursor/mcp.json in your project, or ~/.cursor/mcp.json to use the server in every project:
{
"mcpServers": {
"mockhop": {
"url": "https://app.mockhop.com/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Cursor can read the key from an environment variable instead: write "Bearer ${env:MOCKHOP_API_KEY}" and set MOCKHOP_API_KEY in your environment.
VS Code
For GitHub Copilot agent mode, create .mcp.json in the root of your workspace:
{
"mcpServers": {
"mockhop": {
"type": "http",
"url": "https://app.mockhop.com/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
To keep the key out of the file, write "Bearer ${MOCKHOP_API_KEY}" and set MOCKHOP_API_KEY in the environment VS Code starts in. For all your workspaces, put the same entry into ~/.copilot/mcp-config.json.
A workspace that still uses the older .vscode/mcp.json has a top-level servers key instead of mcpServers. The entry itself has the same three fields: type, url and headers.
Antigravity CLI
Antigravity CLI reads MCP servers from ~/.gemini/config/mcp_config.json for all your projects, or from .agents/mcp_config.json in a workspace. Add the entry to the global file, so the key stays out of the repository:
{
"mcpServers": {
"mockhop": {
"serverUrl": "https://app.mockhop.com/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Type /mcp in Antigravity CLI to see whether the server is connected.
Codex CLI
Add this to ~/.codex/config.toml:
[mcp_servers.mockhop]
url = "https://app.mockhop.com/api/mcp"
bearer_token_env_var = "MOCKHOP_API_KEY"
Codex reads the key from the environment variable MOCKHOP_API_KEY and sends it as a Bearer token. The key itself is not in the file.
Windsurf
In Cascade's MCP menu, select Open MCP config file and add the entry to the mcp_config.json file it opens:
{
"mcpServers": {
"mockhop": {
"serverUrl": "https://app.mockhop.com/api/mcp",
"headers": {
"Authorization": "Bearer ${env:MOCKHOP_API_KEY}"
}
}
}
}
Windsurf fills in ${env:MOCKHOP_API_KEY} from your environment. Refresh the server list after you save the file.
A first prompt
With a Read and write key, ask your agent:
Create a Mockhop project from the users template.
Then call GET /users on its mock URL and show me the first user.
The agent creates a project with the base path /users-api and five endpoints, and calls it at your organization's address, for example https://acme.mockhop.cloud/users-api/users. The fake user API page describes what the template answers. Your mocks answer from outside once you've confirmed your email address.
Tools
The server offers more than 60 tools. Once your client is connected, it shows the full list with a description of each tool. The table below groups them. Most groups have the same operations: create or add, list, get, update and delete. Tools that create, change or delete something need a Read and write key.
| Group | What the agent does with it |
|---|---|
| Projects | Lists, creates, pauses and deletes projects. get_project returns a whole project in one call: endpoints, responses, rules, GraphQL and WebSocket endpoints and scenarios. Examples: create_project, get_project. |
| Endpoints and responses | Creates REST endpoints, one at a time or up to 50 in one call, adds and changes responses, and sets how an endpoint chooses between them: default, sequential, random or weighted. Examples: create_endpoints, add_response. |
| Matching rules | Lets a response answer only certain calls, selected by header, query parameter, path parameter, a field of the JSON body or an XML body. Example: add_match_rule. |
| GraphQL | Creates GraphQL endpoints with an optional schema, and resolvers that answer an operation or a field with fixed JSON. Examples: create_graphql_endpoint, add_graphql_resolver. |
| WebSocket | Creates WebSocket endpoints with a welcome message, and replies to the text messages a client sends. Examples: create_websocket_endpoint, add_websocket_response. |
| Scenarios | Answers calls to one path step by step, with a separate position for each client session, and puts a scenario back to its first step. Examples: create_scenario, reset_scenario. |
| Project variables | Stores values that response templates read. The values are stored in clear, so they are not a place for secrets. Example: set_project_variable. |
| Import and export | Creates endpoints from OpenAPI or Swagger, a Postman collection, a HAR file, a cURL command or a WSDL. Exports a project as OpenAPI, as a Postman collection or in Mockhop's own format. An export in Mockhop's own format can be imported as a new project. Examples: import_document, export_project. |
| Request logs and usage | Lists the requests your mocks received, returns one request together with the mock's answer, and shows the plan, the request quota and the project count. Examples: list_request_logs, get_usage. |
| Helpers | Explains how Mockhop behaves, renders a response body for a sample request without storing anything, and lists the template functions. Examples: get_guide, render_preview, list_template_functions. |
create_project creates an empty project or one from a template: shop, users, blog, todos, auth, payments, bookings, invoices, tickets, chat, notifications or inventory.
The tool descriptions are short. The details are in get_guide, which the agent reads by topic: responses, matching, templates, graphql, websocket, scenarios, imports and limits.
An import takes the document as text. The server doesn't fetch a document from a URL, and a request to the server can be at most 1 MiB.
An example from start to finish
With a Read and write key, ask your agent:
Create a Mockhop project "Users" with GET /users/:id.
It answers 200 with a made-up user, and 404 when the id is 0.
Then import openapi.yaml from this repository into the project,
call both cases and show me what the request log recorded.
The agent then works through these steps:
create_projectcreates the project. Its base path is the first segment of all its mock URLs.create_endpointcreatesGET /users/:idtogether with its first response. That response answers every call. Its body can use template functions, for example to return the id from the path.add_responseadds the404with a matching rule: the path parameteridequals0. Responses with matching rules are checked first, and every other call still gets the first response.import_documentreceives the content ofopenapi.yamland creates the endpoints described in it.- The agent calls the mock URL with
/users/7and/users/0.list_request_logsandget_request_logthen show what the mock received and what it answered.
A second response without a matching rule changes nothing on a new endpoint: the default response keeps answering. To switch, the agent makes the other response the default with update_response, or changes the endpoint's strategy with set_response_strategy.
Limits and safety
- Read or write. A Read only key can use the tools that read, and
render_preview. Every tool that changes something answers withapi_key_read_only. For an agent that only debugs, use a Read only key. - A key is bound to one organization. It can't reach the projects of another organization, even if you are a member there. Anything outside its organization answers "not found".
- What a key can't do. It can't manage members, billing, webhooks or other keys, and it can't change the proxy or forwarding settings of a project.
- Deleting needs a confirmation.
delete_projectonly works when the agent passes the exact current name of the project asconfirm_name. Otherwise nothing is deleted. A deleted project, endpoint or response can't be restored. To pause a project instead, the agent sets it to inactive withupdate_project. - Three calls at a time. One key runs at most 3 tool calls at the same time. A further call is refused with
too_many_concurrent_callsand can be sent again. A single call is stopped after 30 seconds or after 250 requests to the Mockhop API (call_timeout,call_too_large). What it did up to that point stays done. Requests are also rate limited per key. - Plan features. WebSocket mocks, scenarios and SOAP mocks (WSDL import) are plan features. On a plan without them the tool answers with
feature_not_in_planand changes nothing. Pricing shows what each plan includes. - Plan limits apply as usual. Projects the agent creates count towards the project limit of your plan, and calls to your mocks count as requests. The Free plan includes one project. See limits and request counting.
- Request logs are untrusted text. A request log contains whatever a caller sent to your mock: paths, headers and bodies. An agent that reads the logs reads text written by someone else, and that text may contain instructions aimed at the agent.
- Revoke a key with Revoke under API keys in the account menu when you no longer need it or when it may have leaked. Changing your password revokes your keys as well.
Troubleshooting
| What you see | What it means |
|---|---|
401 |
The key is wrong, expired or revoked, or the header is missing. Check that the header reads Authorization: Bearer followed by a space and the key. |
403 with api_key_read_only |
The tool changes something and the key is Read only. Use a Read and write key. |
403 with api_key_not_allowed |
The function isn't open to API keys, for example account, billing or proxy settings. Do this in the app. |
feature_not_in_plan |
The mock type isn't part of your plan, for example WebSocket mocks or scenarios. The owner of the organization can change the plan in the app. |
plan_limit |
A limit of your plan is reached, for example when the agent creates a second project on the Free plan. Delete a project or change the plan. |
too_many_concurrent_calls |
The key already runs 3 tool calls. Nothing was done. The agent sends the call again once one of them has finished. |
429 or rate_limited |
Too many requests in a short time. The answer names the wait time. |
413 |
The request is larger than 1 MiB. Split the document or the call. |
The mock answers 403 with owner_email_unverified |
The owner of the organization hasn't confirmed their email address yet. |
Next
The tool names on this page are trademarks of their respective owners. Mockhop is not affiliated with them and is not endorsed by them.