CLI Reference

Complete reference for MCP Jest's command line options.

Basic Usage

mcp-jest [OPTIONS] [SERVER_COMMAND]

All CLI Options

OptionDescriptionExample
-h, --helpShow help messagemcp-jest --help
-v, --versionShow version numbermcp-jest --version
-c, --config <file>Load configuration from JSON filemcp-jest --config test.json
-s, --server <cmd>Server command to test (stdio only)mcp-jest --server "node server.js"
--transport <type>NEWTransport type: stdio, sse, streamable-httpmcp-jest --transport streamable-http
--url <url>NEWServer URL (required for HTTP transports)mcp-jest --url http://localhost:3000
--args <args>Comma-separated server argumentsmcp-jest node server.js --args "port=3000"
-t, --tools <tools>Comma-separated list of tools to testmcp-jest --tools search,calculate
-r, --resources <res>Comma-separated list of resources to testmcp-jest --resources "data/*,config.json"
-p, --prompts <prompts>Comma-separated list of prompts to testmcp-jest --prompts analyze,summarize
--timeout <ms>Test timeout in millisecondsmcp-jest --timeout 60000
-u, --update-snapshotsUpdate snapshots instead of comparingmcp-jest -u
-f, --filter <pattern>NEWRun only tests matching patternmcp-jest --filter "search*"
--skip <pattern>NEWSkip tests matching patternmcp-jest --skip "*test*"
--watchWatch for file changes and re-run testsmcp-jest --watch
--verboseEnable verbose output for debuggingmcp-jest --verbose

Examples

Test with config file

mcp-jest --config my-tests.json

Test specific tools via stdio

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

Test HTTP server with filtering

mcp-jest --transport streamable-http \
  --url http://localhost:3000 \
  --tools search,email \
  --filter "search*" \
  --timeout 60000

Development workflow with watch

mcp-jest node ./server.js --tools search --watch --verbose

Test 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`);