--- 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 Integration' subsection: true sitemap: priority: 0.8 changefreq: 'monthly' lastmod: 2026-05-22T00:00:00+00:00 ---

MockServer includes a built-in MCP (Model Context Protocol) server that enables AI coding assistants to programmatically create mock expectations, verify requests, retrieve recorded traffic, and debug HTTP issues — all through natural language conversations.

Prerequisites

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.).

MCP Endpoint

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.

Configuring Your AI Assistant

Choose your AI coding assistant or client library below and follow the configuration instructions.

 

Cursor

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.

 

Claude Code

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.

 

Windsurf

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.

 

Cline

Create a .cline/mcp_settings.json file in your project root:

{
  "mcpServers": {
    "mockserver": {
      "type": "streamable-http",
      "url": "http://localhost:1080/mockserver/mcp"
    }
  }
}

Cline will detect the new MCP server automatically.

 

Continue

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.

 

OpenCode

Add the following to your .opencode/config.toml file:

[mcpServers.mockserver]
type = "streamable-http"
url = "http://localhost:1080/mockserver/mcp"

OpenCode will detect the new MCP server on the next session.

 

Programmatic clients (LangChain, LangGraph, ...)

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 expectations, verify requests, retrieve recorded traffic, and debug mismatches through the same MCP tools as the IDE assistants above.

Quick Test

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.

Next Steps