Example TypeScript MCP server with E2E test patterns

Example TypeScript MCP server with E2E test patterns

mcp-server-e2e-testing-example•bymkusaka

A minimal TypeScript Model Context Protocol server provided as a template, with an E2E testing setup demonstrating a raw stdio approach and an SDK in-memory transport approach.

License: MIT License•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Provides a createServer() factory exposing resources, prompts and tools.
  • •Includes a CLI entrypoint using tsx and stdio transport.
  • •Tests the server end-to-end by spawning the CLI and sending JSON-RPC over stdin/stdout.
  • •Tests the same server logic in memory using the MCP SDK Client and InMemoryTransport without spawning a child process.

BEST FOR

  • •Developers wanting a template for building a TypeScript MCP server.
  • •Engineers setting up E2E tests for an MCP server using Vitest.

ABOUT MCP-SERVER-E2E-TESTING-EXAMPLE

Example TypeScript MCP server with E2E test patterns is cataloged as an MCP server attributed to mkusaka. A minimal TypeScript Model Context Protocol server provided as a template, with an E2E testing setup demonstrating a raw stdio approach and an SDK in-memory transport approach. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Example TypeScript MCP server with E2E test patterns are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What testing patterns does this example show for MCP servers?

It demonstrates a raw approach that spawns the CLI with tsx and communicates over stdio using JSON-RPC, and an SDK approach using the official MCP SDK Client and InMemoryTransport for in-memory RPC.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 9ee08d382949 · 采集于 2026-11-13 13:42:36 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

MCP Server E2E Testing Example

A minimal example repository demonstrating two patterns for end‑to‑end (E2E) testing a TypeScript MCP (Model Context Protocol) server using Vitest:

  • Raw approach: Spawning the CLI with tsx and communicating over stdio (JSON‑RPC).
  • SDK approach: Using the official MCP SDK’s Client and InMemoryTransport for in‑memory RPC.

Repository: https://github.com/mkusaka/mcp-server-e2e-testing-example


📁 Repository Layout

.
├── LICENSE
├── README.md
├── package.json
├── pnpm-lock.yaml
├── src
│   ├── cli.ts         # CLI entrypoint (tsx + stdio transport)
│   └── server.ts      # createServer() factory (resources, prompts, tools)
├── tests
│   └── e2e
│       ├── raw.spec.ts  # spawn‑based E2E tests
│       └── sdk.spec.ts  # SDK/InMemoryTransport‑based E2E tests
└── tsconfig.json

🚀 Getting Started

Prerequisites

  • Node.js ≥ 16
  • pnpm installed globally
  • Git

Installation

# Clone the repo
git clone https://github.com/mkusaka/mcp-server-e2e-testing-example.git
cd mcp-server-e2e-testing-example

# Install dependencies
pnpm install

🧪 Running E2E Tests

1. Raw (spawn + stdio) tests

This suite launches the CLI (src/cli.ts) via npx tsx and sends JSON‑RPC over stdin/stdout.

pnpm vitest run tests/e2e/raw.spec.ts

2. SDK (in‑memory) tests

This suite uses the MCP SDK’s Client + InMemoryTransport to invoke the same server logic without spawning a child process.

pnpm vitest run tests/e2e/sdk.spec.ts

🛠️ Scripts

Add these to package.json if desired:

{
  "scripts": {
    "test:raw": "vitest run tests/e2e/raw.spec.ts",
    "test:sdk": "vitest run tests/e2e/sdk.spec.ts",
    "test": "vitest run"
  }
}
  • pnpm run test:raw – Run only the raw/stdio tests
  • pnpm run test:sdk – Run only the in‑memory SDK tests
  • pnpm run test – Run all tests

📦 Publishing & Usage

This repository is intended as an example/template. Feel free to:

  • Adapt the src/server.ts factory for your own MCP server
  • Expand raw.spec.ts and sdk.spec.ts with additional test cases
  • Integrate into your CI pipeline

📄 License

Released under the MIT License.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Example TypeScript MCP server with E2E test patterns from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-server-e2e-testing-example)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools