MCP (AI Integration)
Connect Claude, ChatGPT, Cursor, Claude Code, VS Code or any Model Context Protocol (MCP) client to MockAPI by signing in with your MockAPI account. Then build mock APIs in plain language, with no dashboard clicks.
Fastest setup
What is MCP?
The Model Context Protocol (MCP) lets AI assistants like Cursor and Claude interact with external tools and data. MockAPI's MCP integration exposes your projects, models, and endpoints so you can:
- List your projects: See all MockAPI projects with IDs
- Create projects: "Create a project called E-commerce API"
- Add models: "Add a User model with id, name, email"
- Create endpoints: "Create REST endpoints for the User model"
- Import schemas: Import OpenAPI or Postman collections
Sign In With MockAPI
Agents connect by signing in with your MockAPI account (OAuth). You give your agent the server URL, the agent opens MockAPI in your browser, and you allow access. There is no key to create, copy or store.
https://mcp.mockapi.com/api/mcp- 1
Add the server URL to your agent
Each agent keeps it in a different place. The sections below show where. - 2
Sign in to MockAPI
Your agent opens MockAPI in the browser. Sign in with Google, GitHub or email if you aren't signed in already. - 3
Allow access
MockAPI shows which app is asking, what it will be able to do and where you go back to. Check the details and choose Allow Access. - 4
Start asking
Back in your agent, try "List my MockAPI projects" or "Create a MockAPI project called Todo API".
Permissions
Access comes in two scopes. The consent page lists the ones an app asks for. An API key has the ones you pick when you create it.
| Scope | Allows |
|---|---|
| mcp:read | See your projects, models, endpoints and request logs |
| mcp:write | Create and change projects, models, endpoints and scenarios |
How long access lasts
You sign in once. Your agent renews its access on its own while you keep using it. After 90 days without use, or once you disconnect the app, connect again.
Claude
Claude connects through a custom connector, in Claude on the web and in Claude Desktop.
- 1
Add a custom connector
In Claude, open Customize → Connectors, choose + Add, then Add custom connector. - 2
Enter the server URL
Name it MockAPI, pastehttps://mcp.mockapi.com/api/mcpand choose Continue. Keep the sign-in settings Claude detects and add the connector. - 3
Allow access on MockAPI
Claude opens MockAPI, right away or when you choose Connect next to the connector. Sign in if asked and choose Allow Access. - 4
Turn it on in a chat
In a chat, open + → Connectors and switch MockAPI on. Then try "List my MockAPI projects".
Note
Free plans can add one custom connector. On Team and Enterprise plans, an Owner adds the connector for the organization first. Then each member connects it with their own MockAPI account.
If signing in doesn't work, the Connect your AI agent page can build a personal connector URL that carries an API key instead.
Official documentation
For more details:
- Claude Help Center: Get started with custom connectors using remote MCP: support.claude.com
- Model Context Protocol: Connect to remote MCP servers: modelcontextprotocol.io
ChatGPT
ChatGPT connects to MockAPI as a custom MCP server and signs in with OAuth.
- 1
Add a custom MCP server
In ChatGPT, open Plugins, select +, then Add custom MCP server. In older versions, turn on developer mode in Settings and create a connector there instead. - 2
Enter the server URL
Name it MockAPI, enterhttps://mcp.mockapi.com/api/mcpas the URL and choose OAuth for authentication. - 3
Allow access on MockAPI
ChatGPT opens MockAPI. Sign in if asked and choose Allow Access. In a new chat, type @ and pick MockAPI to use it.
Note
OpenAI offers full MCP support, including actions that create and change your mocks, on ChatGPT Business and Enterprise/Edu, where an admin may have to allow custom servers first. On other plans, ChatGPT may only be able to read. See OpenAI's guide for what your plan includes.
Cursor
Cursor signs in with MockAPI, so your config holds no key.
- 1
Add MockAPI
On the Connect your AI agent page, choose Cursor, then Add to Cursor, and confirm in Cursor. Or add the server to
~/.cursor/mcp.jsonyourself:~/.cursor/mcp.json{ "mcpServers": { "mockapi": { "url": "https://mcp.mockapi.com/api/mcp" } } } - 2
Sign in
When Cursor asks you to sign in, or shows Connect next to MockAPI in its MCP settings, choose it and allow access on MockAPI. - 3
Use it
In Composer or Chat, try "List my MockAPI projects" or "Create a MockAPI project called Todo API".
If signing in doesn't work in your Cursor version, connect with an API key instead.
Claude Code
Run this once in your terminal. It adds MockAPI for every project:
claude mcp add --transport http -s user mockapi https://mcp.mockapi.com/api/mcpThen start Claude Code, run /mcp, choose mockapi and select Authenticate. Your browser opens MockAPI, where you choose Allow Access.
The command on the Connect your AI agent page includes a connection key instead, so Claude Code connects without signing in.
VS Code
For VS Code agent mode, add MockAPI to .vscode/mcp.json in your project:
{
"servers": {
"mockapi": {
"type": "http",
"url": "https://mcp.mockapi.com/api/mcp"
}
}
}Start the server from that file or from the MCP servers list. When VS Code asks whether MockAPI may sign in, allow it, then choose Allow Access on MockAPI.
Add to VS Code on the Connect your AI agent page installs MockAPI with a connection key instead, so VS Code connects without signing in.
Other MCP Clients
Windsurf, Zed and other clients that support remote MCP servers with OAuth need only the server URL. Add it the way your client expects, for example:
{
"mcpServers": {
"mockapi": {
"url": "https://mcp.mockapi.com/api/mcp"
}
}
}If your client can't sign in, connect with an API key.
Connect With an API Key
Use an MCP API key when a client can't sign in, for scripts and CI, or when signing in fails. A key works until you revoke it. The Connect your AI agent page also creates one for you when you pick a setup that needs it.
Key format
Keys start with the prefix mockapi_mcp_ followed by 32 random characters (e.g. mockapi_mcp_abc1xy2z3def4gh5ijk6lmn7opq8). This prefix identifies the key as a MockAPI MCP key.
Creating an MCP API Key
- 1
Log in at www.mockapi.com
Sign in with your existing account (Google, GitHub, or email). - 2
Go to Settings → API Keys
In the left sidebar, open Settings, then click API Keys. - 3
Create MCP Key
In the MCP API Keys section, click "Create MCP Key". Give it a name (e.g. Cursor), select mcp:read and mcp:write, then click Create. - 4
Copy the raw key
The key is shown only once. Copy it and store it securely. You won't be able to see it again.
Warning
The raw key is displayed only at creation. Store it securely. If lost, revoke the key and create a new one.
Go to Settings → API Keys to create and manage your MCP keys.
Send the key in a header
Clients that can send headers, such as Cursor, Windsurf and VS Code, pass the key as a Bearer token:
{
"mcpServers": {
"mockapi": {
"url": "https://mcp.mockapi.com/api/mcp",
"headers": {
"Authorization": "Bearer mockapi_mcp_YOUR_API_KEY_HERE"
}
}
}
}In Claude Code:
claude mcp add --transport http -s user mockapi https://mcp.mockapi.com/api/mcp --header "Authorization: Bearer mockapi_mcp_YOUR_API_KEY_HERE"Clients that take only a URL
If a client accepts only a URL, use a personal connector URL. It carries the key in the address:
https://mcp.mockapi.com/api/mcp?key=mockapi_mcp_YOUR_API_KEY_HEREWarning
Anyone with this URL can use your MockAPI account through MCP. Treat it like a password.
What You Can Do
Example prompts and actions:
| Prompt | Action |
|---|---|
| List my MockAPI projects | Returns all projects with IDs |
| Create a project called Todo API | Creates the project, returns REST/GraphQL URLs |
| Add a Task model with id, title, completed | Adds the model to the project |
| Create REST endpoints for Task | Creates /tasks with GET and POST |
| What property types does MockAPI support? | Lists available types (string, email, uuid, model::id, etc.) |
Monitoring & Usage
Apps you connected by signing in are listed under Connected Apps on the Connect your AI agent page, with their access and when each was last used. For API keys, Settings → API Keys shows when each key was last used.
Disconnecting and Revoking
To end an app's access, choose Disconnect next to it under Connected Apps on the Connect your AI agent page. To revoke an API key, open Settings → API Keys. Either way, access stops immediately.
Security Best Practices
Keep access to your account under control:
- Sign in rather than use an API key where your agent supports it. There is no secret to store, and you can disconnect each app on its own.
- Only allow access to an app you started connecting yourself. MockAPI warns you when it doesn't recognize where an app sends you back.
- Disconnect apps and revoke keys you no longer use.
- Never commit API keys or personal connector URLs to git or share them publicly.
- Use a separate key per tool, so revoking one doesn't break the others.
Troubleshooting
Signing in fails
Check that the server URL is exactly https://mcp.mockapi.com/api/mcp. If MockAPI says the connection link doesn't work, start connecting again from your agent. If your agent can't sign in at all, connect with an API key.
Empty project list
Ensure you have created at least one project in the MockAPI dashboard. MCP lists projects you own (Super Admin role). If you use organization keys, it lists org projects.
401 Unauthorized
If you signed in, the app was disconnected or went unused for 90 days. Connect it again from your agent. With an API key, check that the key starts with mockapi_mcp_ and hasn't been revoked, and that the header is exactly Authorization: Bearer <key>.
403 Forbidden
The app or key is missing a scope. Creating and changing needs mcp:write, and listing needs mcp:read. Connect the app again, or use a key with both scopes.