The testing framework for Model Context Protocol (MCP) servers - like Jest, but for MCP.
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.
npm install mcp-jest # As dependency
npm install -g mcp-jest # Or globally for CLIimport { mcpTest } from 'mcp-jest';
const results = await mcpTest(
{ command: 'node', args: ['./server.js'] },
{ tools: ['search', 'email'] }
);
console.log(`${results.passed}/${results.total} tests passed`);mcp-jest node ./server.js --tools search,emailThat's it! Your MCP server is now tested.
- 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.
- Snapshot Testing - Capture and compare MCP outputs over time
- Test Filtering - Run specific tests with
--filterand--skip - Watch Mode - Auto-rerun tests when files change
- HTML Reports - Generate beautiful, shareable test reports
- stdio - Default transport for local servers
- HTTP Streaming - Test remote HTTP servers
- SSE - Server-Sent Events support
- Auto-Discovery - Automatically discover and generate tests for all capabilities
- Protocol Validator - Check MCP compliance with detailed scoring
- GitHub Action - Native CI/CD integration
| Command | Description |
|---|---|
mcp-jest node ./server.js --tools search |
Test specific tools |
mcp-jest --config test.json |
Use config file |
mcp-jest discover node ./server.js |
Auto-discover capabilities |
mcp-jest validate node ./server.js |
Check protocol compliance |
mcp-jest watch node ./server.js --tools search |
Watch mode |
| Option | Description |
|---|---|
-t, --tools <tools> |
Comma-separated tools to test |
-c, --config <file> |
Config file path |
--timeout <ms> |
Test timeout (default: 30000) |
-u, --update-snapshots |
Update snapshot files |
--reporter html |
Generate HTML report |
See CLI Reference for all options.
# .github/workflows/test.yml
- name: Test MCP Server
run: |
npm install -g mcp-jest
mcp-jest node ./dist/server.js --tools "search,analyze"{
"server": {
"command": "node",
"args": ["./server.js"]
},
"tests": {
"tools": {
"search": {
"args": { "query": "test" },
"expect": "content.length > 0"
}
},
"timeout": 30000
}
}| Guide | Description |
|---|---|
| Getting Started | Step-by-step setup guide |
| CLI Reference | Complete CLI documentation |
| API Reference | Library API documentation |
| Examples | Real-world examples |
| Architecture | How MCP-Jest works |
| Troubleshooting | Common issues and solutions |
- Node.js 18+
- MCP Server implementing Model Context Protocol
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 testSee SECURITY.md for our security policy and vulnerability reporting.
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and ideas
MIT License - Use freely in commercial and open source projects.
Built for the MCP ecosystem | Documentation | Examples | Contributing