---
title: "MCP (Model Context Protocol) JSON-RPC endpoint"
method: POST
path: "/mockserver/mcp"
tags: ["mcp"]
---

# MCP (Model Context Protocol) JSON-RPC endpoint

`POST /mockserver/mcp`

## Request

- Base URL: `http://localhost:1080`
- URL: `http://localhost:1080/mockserver/mcp`
- Auth: none declared

Streamable-HTTP MCP endpoint, letting AI agents and LLM tooling drive MockServer as an MCP server. The body is a JSON-RPC 2.0 request object or a batch array. Call `initialize` first; the response carries a new session id in the `Mcp-Session-Id` response header, which subsequent calls must send back in the `Mcp-Session-Id` request header. Protocol versions 2025-06-18 (default), 2025-03-26 and 2024-11-05 are negotiated. Note that a missing or invalid session is reported as a JSON-RPC error inside a 200 response, not as a 4xx. Unlike its sibling endpoints this path has no bare `/mcp` alias, and sub-paths under `/mockserver/mcp/` also route here.

## Headers

- `Mcp-Session-Id` string

## Request body

- object: a JSON-RPC 2.0 request object, or an array of them for a batch

## Response `200`

JSON-RPC response. Also used for JSON-RPC-level errors such as an missing or invalid session. On `initialize` the response carries the new session id in the Mcp-Session-Id header.

- object

## Other responses

- `202`: notification accepted (empty body; notifications receive no JSON-RPC response)
- `400`: empty body, unparseable JSON, or not a valid JSON-RPC request or batch
- `401`: control-plane authentication failed
- `503`: server busy, retry later

---

[API](https://skmtc.dev/mock-server/apis/mockserver-api.md) · [All operations](https://skmtc.dev/mock-server/apis/mockserver-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mock-server/apis/mockserver-api/revisions/9239b693996e?raw)
