MCP Hub
Back to servers

mcp-jest

Automated testing for Model Context Protocol servers. Ship MCP Servers with confidence.

Stars
12
Updated
Nov 27, 2025
Validated
Jan 9, 2026

MCP-Jest

npm version npm downloads License: MIT Node.js CI TypeScript PRs Welcome

The testing framework for Model Context Protocol (MCP) servers - like Jest, but for MCP.

The Problem

You built an MCP server that connects AI assistants to your database, file system, or API. But how do you know it actually works?

  • Manual testing for every change
  • Silent failures that break AI workflows
  • No CI/CD integration for MCP servers
  • Debugging nightmares when things go wrong

MCP-Jest solves this with automated, repeatable testing for your MCP servers.

Quick Start

Install

npm install mcp-jest        # As dependency
npm install -g mcp-jest     # Or globally for CLI

Test Your Server

import { mcpTest } from 'mcp-jest';

const results = await mcpTest(
  { command: 'node', args: ['./server.js'] },
  { tools: ['search', 'email'] }
);

console.log(`${results.passed}/${results.total} tests passed`);

Or Use CLI

mcp-jest node ./server.js --tools search,email

That's it! Your MCP server is now tested.

Features

Core Testing

  • Automated Testing - Write tests once, run them everywhere
  • Comprehensive Coverage - Test connections, tools, resources, and prompts
  • Flexible Expectations - Simple strings or custom validation functions
  • CI/CD Ready - Works with GitHub Actions, Jenkins, CircleCI, etc.

Advanced Features

  • Snapshot Testing - Capture and compare MCP outputs over time
  • Test Filtering - Run specific tests with --filter and --skip
  • Watch Mode - Auto-rerun tests when files change
  • HTML Reports - Generate beautiful, shareable test reports

Transport Support

  • stdio - Default transport for local servers
  • HTTP Streaming - Test remote HTTP servers
  • SSE - Server-Sent Events support

Developer Tools

  • Auto-Discovery - Automatically discover and generate tests for all capabilities
  • Protocol Validator - Check MCP compliance with detailed scoring
  • GitHub Action - Native CI/CD integration

CLI Quick Reference

CommandDescription
mcp-jest node ./server.js --tools searchTest specific tools
mcp-jest --config test.jsonUse config file
mcp-jest discover node ./server.jsAuto-discover capabilities
mcp-jest validate node ./server.jsCheck protocol compliance
mcp-jest watch node ./server.js --tools searchWatch mode

Common Options

OptionDescription
-t, --tools <tools>Comma-separated tools to test
-c, --config <file>Config file path
--timeout <ms>Test timeout (default: 30000)
-u, --update-snapshotsUpdate snapshot files
--reporter htmlGenerate HTML report

See CLI Reference for all options.

Example: CI/CD Integration

# .github/workflows/test.yml
- name: Test MCP Server
  run: |
    npm install -g mcp-jest
    mcp-jest node ./dist/server.js --tools "search,analyze"

Example: Config File

{
  "server": {
    "command": "node",
    "args": ["./server.js"]
  },
  "tests": {
    "tools": {
      "search": {
        "args": { "query": "test" },
        "expect": "content.length > 0"
      }
    },
    "timeout": 30000
  }
}

Documentation

GuideDescription
Getting StartedStep-by-step setup guide
CLI ReferenceComplete CLI documentation
API ReferenceLibrary API documentation
ExamplesReal-world examples
ArchitectureHow MCP-Jest works
TroubleshootingCommon issues and solutions

Feature Guides

Requirements

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

git clone https://github.com/josharsh/mcp-jest.git
cd mcp-jest
npm install
npm run dev
npm test

Security

See SECURITY.md for our security policy and vulnerability reporting.

Support

License

MIT License - Use freely in commercial and open source projects.


Built for the MCP ecosystem | Documentation | Examples | Contributing

Reviews

No reviews yet

Sign in to write a review