Installation

Get MCP Jest installed and ready for testing in multiple ways.

Global Installation (Recommended)

Install MCP Jest globally to use the CLI from anywhere:

npm install -g mcp-jest

Verify the installation:

mcp-jest --version
# Should output: 1.0.10

Project Installation

Add MCP Jest as a development dependency to your project:

npm install --save-dev mcp-jest

Then add a test script to your package.json:

{
  "scripts": {
    "test": "mcp-jest test.json",
    "test:watch": "mcp-jest test.json --watch"
  }
}

Using npx (No Installation)

Run MCP Jest without installing:

npx mcp-jest test.json

Requirements

  • ✅ Node.js 18 or higher
  • ✅ npm, yarn, or pnpm
  • ✅ An MCP server to test

Troubleshooting

Permission Issues

If you get permission errors during global installation:

⚠️ On macOS/Linux, you might need:

sudo npm install -g mcp-jest

Or configure npm to use a different directory for global packages.

Node.js Version Issues

Check your Node.js version:

node --version

If you're using an older version, consider using a Node.js version manager:

  • nvm (macOS/Linux): nvm install 18
  • nvs (Windows): nvs add 18
  • n (Alternative): n 18

IDE Integration

VS Code

Add these settings to your VS Code workspace for better JSON editing:

{
  "json.schemas": [
    {
      "fileMatch": ["**/test*.json", "**/mcp-test*.json"],
      "url": "https://raw.githubusercontent.com/josharsh/mcp-jest/main/schema.json"
    }
  ]
}

Shell Completion

Enable tab completion for the MCP Jest CLI:

# For bash
mcp-jest --completion bash >> ~/.bashrc

# For zsh  
mcp-jest --completion zsh >> ~/.zshrc

# For fish
mcp-jest --completion fish >> ~/.config/fish/completions/mcp-jest.fish

🎉 Ready to go!

Installation complete! Now let's create your first test.

Write Your First Test →