Unit Test MCP: let Copilot generate, run, and improve your tests

Unit Test MCP: let Copilot generate, run, and improve your tests

Unit Test MCP (v1.3.4, MIT) gives GitHub Copilot Chat five real test-execution tools via MCP — covering Jest, Vitest, Pytest, and .NET xUnit/NUnit — so Copilot can generate, run, inspect coverage, and fill testing gaps across your whole project, not just write a single test file.

VS Code / JetBrains Plugin Pick
May 24, 2026 · 1:16 AM
1 subscriptions · 17 items
GitHub Copilot's /tests command will write a test file for you. What it won't do is run those tests, tell you which branches still aren't covered, or loop back and fill the gaps — you get a .test.ts file and then you're on your own. That handoff works fine when you already have a testing rhythm. It breaks down when you're trying to bootstrap coverage on a codebase that has almost none.
Unit Test MCP (KennethHuang.unittest-mcp, v1.3.4, MIT) closes that gap. It's a VS Code extension developed by Kenneth Huang, a Microsoft engineer, that registers a local MCP server and gives Copilot Chat five test-execution tools it would otherwise not have: generate a test file, run tests with coverage, scan a whole directory for missing tests, inspect existing coverage artifacts, and locate test files. The result is that Copilot can execute a real test run and report back the numbers — not just write code.
A maturity note upfront: as of May 23, 2026, the extension has approximately 396 installs and a 4.45/5 weighted rating on the VS Code Marketplace. 1 The GitHub repository (gim-home/UnitTestMCP) is a Microsoft-internal repo and not publicly accessible — there is no community issue tracker open to external users. Feedback goes through the in-extension Unit Test MCP: Give Feedback button only.

Install

Search Unit Test MCP in the Extensions panel, or install by identifier:
KennethHuang.unittest-mcp
Requirements: VS Code 1.101.0 or later, GitHub Copilot active. Node.js ships bundled with VS Code — no separate install needed. Python is optional (required only for Pytest), as is .NET SDK 6.0+ (required only for C# tests). 1
Once installed, the extension auto-registers an MCP server via the VS Code API. No manual edits to mcp.json required. To confirm it registered: open the Command Palette and run MCP: List Servers — "Unit Test MCP" should appear in the list.
Loading link preview…

The four-move workflow in Copilot Chat

The extension works entirely through Copilot Chat. Open it (Ctrl+Alt+I) and use natural language — Copilot routes each request to the right tool automatically.
Move 1 — Generate a test file
Generate unit tests for src/components/Button.tsx
Copilot calls generate_test and creates src/components/__tests__/Button.test.tsx. The test file is placed in the standard location for your framework (Jest/Vitest convention for JS/TS, tests/ for Pytest, etc.).
Move 2 — Run with coverage
Run tests with coverage
Copilot calls run_tests with include_coverage=true, executes the framework directly, and returns a summary of passes, failures, and coverage percentages. Each run writes its artifacts to coverage/.unittest-mcp/<project>/run-<n>/ — sequential runs don't overwrite each other. 2
Move 3 — Fill the gaps across a whole directory
Generate tests for all files in src/services/
Copilot calls generate_tests_batch, which scans the directory, identifies files with no test file or low coverage, and generates tests in priority order. This is the move /tests cannot make — it operates on the file currently open, not a folder scan.
Move 4 — Ask what's still uncovered
What files have low coverage?
Copilot calls inspect_coverage, reads the most recent coverage artifacts (Istanbul JSON, LCOV, Cobertura XML, OpenCover XML, and coverage.py JSON are all supported), and surfaces the files with the worst line, branch, function, and statement coverage. 2
Unit Test MCP coverage report output in VS Code
The inspect_coverage tool surfaces per-file line, branch, function, and statement coverage in Copilot Chat. 1
You can also skip the individual moves entirely and open Copilot Agent mode with @UnitTestEngineer. It walks through the generate → run → inspect → improve cycle automatically, applying a target coverage threshold you configure in the sidebar.

Configuration: the sidebar panel

The Activity Bar gains a Unit Test MCP entry (clipboard/gear icon). From there you can:
  • Browse and select custom instruction files per framework (Jest/Vitest/Pytest/.NET)
  • Set a target coverage percentage — the @UnitTestEngineer agent uses this as its stopping criterion
  • Configure custom test commands for non-standard setups
Changes take effect immediately — no VS Code restart required. 1 If your project uses pnpm jest or uv run pytest instead of the defaults, enter the exact command here rather than relying on environment-variable overrides.
Unit Test MCP sidebar configuration panel
The sidebar lets you pick custom instruction files, set a coverage target, and override test commands — all without editing config files. 1
The extension also creates two files on first activation:
  • .github/instructions/unittestMcp.instructions.md — synced every activation; Copilot reads it at runtime to understand your project's testing conventions
  • .github/prompts/UnitTestMcp.UnitTestEngineer.agent.md — created once, never overwritten; safe to edit with project-specific guidance
Both can be added to .gitignore if you'd rather not commit them.

What it doesn't support

The supported frameworks are Jest/Vitest (JavaScript/TypeScript, including React component tests), Pytest (Python), and .NET xUnit/NUnit (C#). 1 The extension does not support Go testing, Rust cargo test, Java/JUnit, PHPUnit, or RSpec. If your project uses any of these, the NO_FRAMEWORK_DETECTED error will surface in Copilot's response.
The plugin also requires that the testing framework already be installed in the project. It won't install Jest, Pytest, or the .NET SDK for you — check with npm list jest, pip list | grep pytest, or dotnet --version before expecting the first run to succeed.
Finally: VS Code only. No JetBrains support.

Standalone MCP server (Claude Code, Cursor, Copilot CLI)

If you use Copilot CLI, Claude Code, or Cursor rather than VS Code, the same five tools are available as a standalone npm package:
npx -y unittest-mcp
Register it as a STDIO-type MCP server in your client's config, or run /mcp add in Copilot CLI and set the command to npx -y unittest-mcp. Environment variables (UNITTEST_MCP_JEST_COMMAND, UNITTEST_MCP_VITEST_COMMAND, UNITTEST_MCP_PYTEST_COMMAND, UNITTEST_MCP_DOTNET_COMMAND) override the default test commands when running outside VS Code. 2

Plugin: Unit Test MCP · Publisher: KennethHuang (Kenneth Huang, Microsoft) · Version: 1.3.4 · License: MIT Languages / frameworks: JavaScript/TypeScript (Jest, Vitest), Python (Pytest), C# (.NET xUnit/NUnit) Use case: AI-assisted test generation, test execution, coverage reporting — Testing + AI assistance Install: KennethHuang.unittest-mcp on VS Code Marketplace

Add more perspectives or context around this Post.

  • Sign in to comment.