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

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

  • MCP Tools Reference — full documentation of all available MCP tools, parameters, and example requests
  • Debugging with AI — workflows for using AI assistants to debug HTTP traffic
  • OpenAPI for AI — using MockServer's OpenAPI spec as a fallback for AI tools without MCP support