Vitest

AI-optimized Vitest runner with clean, structured output, log capturing, and coverage analysis.
  • typescript

13

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "djankies-vitest-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@djankies/vitest-mcp"
      ],
      "env": {
        "VITEST_MCP_DEBUG": "true",
        "BYPASS_VITEST_HOOK": "1",
        "VITEST_MCP_DEV_MODE": "true"
      }
    }
  }
}

You run a Vitest MCP Server to transform verbose test output into structured, noise-filtered results, capture console logs, and analyze test coverage line by line. This setup lets you orchestrate Vitest across multiple projects in a single session and keep your AI-assisted testing focused on what matters most.

How to use

After you configure a Vitest MCP Server, you can interact with it through your MCP-enabled IDE or tool. Set the project root for all operations, then run tests for a specific file or directory. The server returns structured results, includes captured console output, and provides detailed coverage insights with line-by-line gaps. You can switch context between multiple repositories in one session, enabling efficient testing across your frontend and backend codebases.

How to install

Prerequisites: you need Node.js 18 or newer.

Install Vitest and the coverage adapter as development dependencies.

npm install --save-dev vitest@latest @vitest/coverage-v8@latest

Configuration and usage notes

Configure the MCP server in your project to enable the Vitest MCP workflow. Use a stdio-based (local) server configuration that runs via the MCP client. The following configuration starts the MCP server using npx to invoke the Vitest MCP package.

{
  "mcpServers": {
    "vitest": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@djankies/vitest-mcp"] ,
      "env": {}
    }
  }
}

Troubleshooting and tips

If you encounter common issues, try the following tips. Ensure Vitest is installed locally, verify the MCP server is reachable, and confirm that the correct environment variables are set if you rely on debug or bypass modes.

Additional notes

Multirepository support lets you run tests for multiple projects within a single MCP session by switching context between project roots. You can enable debug mode to get deeper logs during development, and you can bypass the hook that redirects Vitest commands if needed.

License

MIT — See LICENSE.

Tools and capabilities

  • set_project_root: Set the project root for all operations.
  • list_tests: List test files to help keep AI-driven flows focused on test files.
  • run_tests: Execute tests with structured output and optional log visibility.
  • analyze_coverage: Generate coverage reports with optional exclude patterns and detailed insights.

Available tools

set_project_root

Set the project root for all operations in MCP workflows.

list_tests

List test files in your project to help keep AI-assisted testing focused on valid targets.

run_tests

Execute tests with structured output and optional logs, targeting a file or directory.

analyze_coverage

Analyze test coverage and provide insights, with optional exclusions.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational