Get the FREE Ultimate OpenClaw Setup Guide →

mcp-mock

simple mcp mock server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio fengf233-mcp-mock-server docker run -i fengf233/mcp-mock-server \
  --env PORT="9999" \
  --env TRANSPORT="StreamableHTTP"

How to use

This MCP server is a mock implementation for developing and testing MCP clients. It exposes configurable tools, dynamic prompts, and simulated resources, with support for multiple transport methods (StreamableHTTP and SSE). After starting, clients can connect to the MCP endpoint at http://localhost:9999/mcp and invoke defined tools or request prompts and resources. You can define tools (with parameters and mock templates), prompts (with argument structures and mock responses), and resources (with MIME types and mock content) in a mock.yaml configuration file, enabling realistic MCP interactions for client development and testing.

How to install

Prerequisites:

  • Docker installed (for the provided docker-based run) or a Go environment if you choose to build locally from source.
  • git to clone the repository (optional if you already have the code).

Installation steps (Docker-based run):

  1. Ensure Docker is running on your machine.
  2. Pull and run the mock server image: docker run -i fengf233/mcp-mock-server
  3. The server will be available at http://localhost:9999/mcp by default (as configured via TRANSPORT and PORT in the environment).
  4. Place and edit mock.yaml to configure tools, prompts, and resources as needed.

If you prefer building from source (Go), prerequisites are:

  • Go 1.20+ installed
  • GOPATH/module mode enabled (go mod in use)

Build steps (local Go build):

  1. git clone <repository-url>
  2. cd mcp-mock
  3. go mod tidy
  4. go build
  5. ./mcp_server

Configuration example (mock.yaml): server: host: "0.0.0.0" port: 9999 transport: "StreamableHTTP" # or "sse"

Tools example: tools:

  • name: "get_weather" description: "Get current weather for a city" parameters:
    • name: "city" type: string required: true mock_template: "The current weather in {{city}} is sunny, 25°C."

Prompts example: prompts:

  • name: "summarize_article" description: "Summarize a given article" arguments:
    • name: "article" required: true mock_template: "Summarize: {{article}}"

Resources example: resources:

  • name: "user_profile" mime_type: "application/json" uri: "internal://resources/user_profile.json" mock_content: "{"user_id": "{{user_id}}"}"

Additional notes

Tips:

  • Ensure mock.yaml is valid YAML; indentation and spacing are important.
  • If you change the transport to SSE, verify clients use an SSE-capable MCP client.
  • When debugging, check the server logs for configuration loading errors and invalid tool/prompt/resource definitions.
  • The mock server supports dynamic content generation through templates; customize mock_template values to reflect realistic responses.
  • For production-like testing, simulate resource MIME types and content to validate client handling of binary vs text data.

Related MCP Servers

Sponsor this space

Reach thousands of developers