mcp-server-e2e-testing-example
A minimal example repository demonstrating two patterns for end-to-end (E2E) testing a TypeScript MCP server using Vitest.
The MCP Server E2E Testing Example is a repository designed to showcase two distinct methods for conducting end-to-end testing on a TypeScript-based Model Context Protocol (MCP) server. The repository utilizes Vitest, a testing framework, to implement these testing strategies. The first method, referred to as the 'Raw approach', involves spawning the command-line interface (CLI) using 'tsx' and communicating over standard input/output (stdio) using JSON-RPC. The second method, known as the 'SDK approach', leverages the official MCP SDK's 'Client' and 'InMemoryTransport' to perform in-memory remote procedure calls (RPC) without the need to spawn a child process. This repository serves as a template for developers looking to implement similar testing strategies in their own MCP server projects.
Features
- Raw approach using stdio for JSON-RPC communication.
- SDK approach with in-memory RPC using MCP SDK.
- Comprehensive E2E testing with Vitest.
- Template for MCP server testing.
- Integration with CI pipelines.
Usage with Different Platforms
mcp
bash
# 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
# Run Raw (spawn + stdio) tests
pnpm vitest run tests/e2e/raw.spec.ts
# Run SDK (in-memory) tests
pnpm vitest run tests/e2e/sdk.spec.ts
Related MCP Servers
View all developer_tools servers →Sequential Thinking
by modelcontextprotocol
An MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.
git-mcp
by idosal
GitMCP is a free, open-source, remote Model Context Protocol (MCP) server that transforms GitHub projects into documentation hubs, enabling AI tools to access up-to-date documentation and code.
Everything MCP Server
by modelcontextprotocol
The Everything MCP Server is a comprehensive test server designed to demonstrate the full capabilities of the Model Context Protocol (MCP). It is not intended for production use but serves as a valuable tool for developers building MCP clients.
context7
by upstash
Context7 MCP provides up-to-date, version-specific documentation and code examples directly into your prompt, enhancing the capabilities of LLMs by ensuring they use the latest information.
exa-mcp-server
by exa-labs
A Model Context Protocol (MCP) server allows AI assistants to use the Exa AI Search API for real-time web searches in a secure manner.
repomix
by yamadashy
Repomix is a tool that packs your codebase into AI-friendly formats, making it easier to use with AI tools like LLMs.
mcpdoc
by langchain-ai
MCP LLMS-TXT Documentation Server provides a structured way to manage and retrieve LLM documentation using the Model Context Protocol.