--- title: MCP Setup - Connect AI Assistants description: Connect Claude Code, Cursor, Windsurf, Cline, or OpenCode to MockServer via the built-in MCP endpoint at /mockserver/mcp -- no glue code required. shortTitle: MCP Setup layout: page pageOrder: 1 section: 'AI & MCP' subsection: true sitemap: priority: 0.8 changefreq: 'monthly' lastmod: 2026-05-22T00:00:00+00:00 keywords: "mcp server, claude code mcp, cursor mcp, model context protocol setup, mockserver mcp" schema_faq: - question: "How do I connect Claude Code to MockServer?" answer: "Run: claude mcp add mockserver --transport streamable-http http://localhost:1080/mockserver/mcp. Claude Code will detect the MCP server on the next conversation. You need a running MockServer instance first — the quickest way is: docker run -d --rm -p 1080:1080 mockserver/mockserver." - question: "What is the MockServer MCP endpoint URL?" answer: "The MCP endpoint is http://localhost:1080/mockserver/mcp on any running MockServer instance — no additional configuration is required. It uses the Streamable HTTP transport defined by the MCP specification. Adjust the host and port if your MockServer is running elsewhere." - question: "Which AI assistants support MockServer MCP?" answer: "Cursor, Claude Code, Windsurf, Cline, Continue, and OpenCode are all supported via the Streamable HTTP MCP transport. Programmatic MCP clients such as LangChain (langchain-mcp-adapters) and LangGraph also work. AI tools that do not support MCP can use MockServer's OpenAPI spec as a REST API fallback." - question: "Do I need to write code to use MockServer with an AI assistant?" answer: "No. Once you add the MCP endpoint to your AI assistant's configuration, you interact entirely through natural language. Ask your assistant to create a mock, verify a request, or debug a mismatch and it calls the appropriate MCP tool automatically — no client code, no glue." ---
Let your AI coding assistant (Claude Code, Cursor, Windsurf, Cline, OpenCode) create mocks, verify calls, and debug HTTP failures by asking in plain English — no client code, no glue. This page connects your assistant in one step.
You need a running MockServer instance. The quickest way to start one is with Docker:
docker run -d --rm -p 1080:1080 mockserver/mockserver
Alternatively, see Running MockServer for other ways to start MockServer (Java API, Maven plugin, npm, etc.).
The MCP server is available at the following URL on any running MockServer instance — no additional configuration is required:
http://localhost:1080/mockserver/mcp
The endpoint supports the Streamable HTTP transport as defined by the MCP specification. If your MockServer is running on a different host or port, adjust the URL accordingly.
Choose your AI coding assistant or client library below and follow the configuration instructions.
Create a .cursor/mcp.json file in your project root:
{
"mcpServers": {
"mockserver": {
"type": "streamable-http",
"url": "http://localhost:1080/mockserver/mcp"
}
}
}
Restart Cursor to pick up the new configuration.
Run the following command in your terminal:
claude mcp add mockserver --transport streamable-http http://localhost:1080/mockserver/mcp
Claude Code will automatically detect the MCP server on the next conversation.
Create a .windsurf/mcp.json file in your project root:
{
"mcpServers": {
"mockserver": {
"type": "streamable-http",
"url": "http://localhost:1080/mockserver/mcp"
}
}
}
Restart Windsurf to pick up the new configuration.
Open Cline's MCP settings file — in VS Code, click the MCP Servers icon in the Cline panel, then Configure MCP Servers to edit it — and add MockServer under mcpServers:
{
"mcpServers": {
"mockserver": {
"type": "streamable-http",
"url": "http://localhost:1080/mockserver/mcp"
}
}
}
Cline will detect the new MCP server automatically.
Add the following to your .continue/config.yaml file:
mcpServers:
- name: mockserver
type: streamable-http
url: http://localhost:1080/mockserver/mcp
Restart Continue to pick up the new configuration.
Add the following to your opencode.json file:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mockserver": {
"type": "remote",
"url": "http://localhost:1080/mockserver/mcp",
"enabled": true
}
}
}
OpenCode will detect the new MCP server on the next session.
The assistants above are IDE and CLI tools configured through a file or command. You can also connect to the MCP endpoint programmatically — for example from an agent built with LangChain or LangGraph using the langchain-mcp-adapters library. The same approach applies to any MCP client library:
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
client = MultiServerMCPClient({
"mockserver": {
"transport": "streamable_http",
"url": "http://localhost:1080/mockserver/mcp",
}
})
# MockServer's MCP tools are now available to the agent
tools = await client.get_tools()
agent = create_react_agent(model, tools)
The agent can now create and list expectations, verify requests, retrieve recorded traffic, switch operating mode (SIMULATE / SPY / CAPTURE), promote recorded traffic into mocks, and debug mismatches through the same MCP tools as the IDE assistants above. This lets an agent both author mocks from scratch and "record then mock" a real API without leaving the IDE.
Once configured, verify the integration by asking your AI assistant:
"Create a mock that returns 200 OK for GET /api/health"
The assistant should use the create_expectation MCP tool to configure the expectation on your running MockServer instance. You can verify it worked by running:
curl -v http://localhost:1080/api/health
You should see a 200 OK response.