MCP Hello World - MCP Server Mock for Testing

by lobehub

22 136.3k downloads Not rated yet MIT

About

A minimal MCP server mock in TypeScript for testing MCP clients, supporting both STDIO and HTTP/SSE protocols.

Details

License
MIT

Explore

mcp-hello-world provides the following fixed capabilities for interaction and assertion in your tests:

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Hello World - MCP Server Mock for Testing
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Add this package as a dev dependency to your project:

``bash

You can programmatically start and stop the mcp-hello-world` server within your test framework (like Jest, Vitest, Mocha, etc.) for automated testing.

echo

Echoes back a message with 'Hello' prefix

debug

Lists all available tools and methods

add

Adds two numbers

- echo
- Description: Echoes the input message, prefixed with "Hello ".
- Method: tools/invoke
- Parameters: { name: 'echo', parameters: { message: string } }
- Returns: { content: [{ type: 'text', text: 'Hello {message}' }] } (e.g., { content: [{ type: 'text', text: 'Hello test' }] })
- debug
- Description: Lists all available MCP method definitions on the server.
- Method: tools/invoke
- Parameters: { name: 'debug', parameters: {} }
- Returns: A JSON structure containing definitions for all registered resources, tools, and prompts.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp hello world - mcp server mock for testing": {
            "mcp-hello-world": {
                "command": "npx",
                "args": [
                    "mcp-hello-world"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-hello-world": {
        "command": "npx",
        "args": [
            "mcp-hello-world"
        ]
    }
}

[![][npm-release-shield]][npm-release-link]
[![][npm-downloads-shield]][npm-downloads-link]
[![][github-action-test-shield]][github-action-test-link]
[![][github-action-release-shield]][github-action-release-link]

[github-action-release-link]: https://github.com/lobehub/mcp-hello-world/actions/workflows/release.yml
[github-action-release-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/mcp-hello-world/release.yml?label=Release&logo=githubactions&logoColor=white&style=flat-square
[github-action-test-link]: https://github.com/lobehub/mcp-hello-world/actions/workflows/test.yml
[github-action-test-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/mcp-hello-world/test.yml?label=Test&logo=githubactions&logoColor=white&style=flat-square
[npm-downloads-link]: https://www.npmjs.com/package/mcp-hello-world
[npm-downloads-shield]: https://img.shields.io/npm/dt/mcp-hello-world?label=Downloads&logo=npm&style=flat-square
[npm-release-link]: https://www.npmjs.com/package/mcp-hello-world
[npm-release-shield]: https://img.shields.io/npm/v/mcp-hello-world?logo=npm&style=flat-square

This is a minimal Model Context Protocol (MCP) server implemented in TypeScript, primarily intended to serve as a Test Double / Mock Server.

Core Purpose: To provide a lightweight, controllable, and predictable MCP server environment for unit testing or integration testing client code that needs to interact with an MCP server.

Note: This project is not suitable for production environments or deployment as a general-purpose MCP server.

MCP Badge

Why Use mcp-hello-world in Tests?

When testing code related to MCP clients, you usually don't want to depend on a real, potentially complex, and unpredictably responsive AI backend service. Using mcp-hello-world as a test double offers several advantages:

1. Isolation: Focus your tests on client logic without worrying about network issues or the availability of the real server.
2. Predictability: The provided echo and debug tools have simple, fixed behaviors, making it easy to write assertions.
3. Speed: Fast startup and response times, suitable for frequent use in unit tests.
4. Lightweight: Few dependencies, easy to integrate into test environments.
5. Protocol Coverage: Supports both STDIO and HTTP/SSE MCP transport protocols, allowing you to test client behavior under different connection methods.

Installation

Add this package as a dev dependency to your project:

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.

Videos about MCP Hello World - MCP Server Mock for Testing

Relevant YouTube tutorials, setups, and demos