CLI Reference
Complete reference for MCP Jest's command line options.
Basic Usage
mcp-jest [OPTIONS] [SERVER_COMMAND]All CLI Options
| Option | Description | Example |
|---|---|---|
| -h, --help | Show help message | mcp-jest --help |
| -v, --version | Show version number | mcp-jest --version |
| -c, --config <file> | Load configuration from JSON file | mcp-jest --config test.json |
| -s, --server <cmd> | Server command to test (stdio only) | mcp-jest --server "node server.js" |
| --transport <type>NEW | Transport type: stdio, sse, streamable-http | mcp-jest --transport streamable-http |
| --url <url>NEW | Server URL (required for HTTP transports) | mcp-jest --url http://localhost:3000 |
| --args <args> | Comma-separated server arguments | mcp-jest node server.js --args "port=3000" |
| -t, --tools <tools> | Comma-separated list of tools to test | mcp-jest --tools search,calculate |
| -r, --resources <res> | Comma-separated list of resources to test | mcp-jest --resources "data/*,config.json" |
| -p, --prompts <prompts> | Comma-separated list of prompts to test | mcp-jest --prompts analyze,summarize |
| --timeout <ms> | Test timeout in milliseconds | mcp-jest --timeout 60000 |
| -u, --update-snapshots | Update snapshots instead of comparing | mcp-jest -u |
| -f, --filter <pattern>NEW | Run only tests matching pattern | mcp-jest --filter "search*" |
| --skip <pattern>NEW | Skip tests matching pattern | mcp-jest --skip "*test*" |
| --watch | Watch for file changes and re-run tests | mcp-jest --watch |
| --verbose | Enable verbose output for debugging | mcp-jest --verbose |
Examples
Test with config file
mcp-jest --config my-tests.jsonTest specific tools via stdio
mcp-jest node ./server.js --tools search,calculate,emailTest HTTP server with filtering
mcp-jest --transport streamable-http \
--url http://localhost:3000 \
--tools search,email \
--filter "search*" \
--timeout 60000Development workflow with watch
mcp-jest node ./server.js --tools search --watch --verboseTest Configuration Schema
interface MCPTestConfig {
// Test suite name
name: string;
// Server configuration
server: {
command?: string; // Command to start the server (stdio)
args?: string[]; // Command arguments
env?: Record<string, string>; // Environment variables
cwd?: string; // Working directory
transport?: 'stdio' | 'sse' | 'streamable-http'; // Transport type
url?: string; // Server URL (for HTTP transports)
};
// Global timeout (applies to all tests)
timeout?: number;
// Test definitions
tests: TestDefinition[];
// Snapshot configuration
snapshots?: {
updateSnapshots?: boolean;
snapshotDir?: string;
};
}Programmatic API
Use MCP Jest programmatically in your Node.js scripts:
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`);