Skip to content
| Marketplace
Sign in
Visual Studio Code>Testing>Unit Test MCPNew to Visual Studio Code? Get it now.
Unit Test MCP

Unit Test MCP

Kenneth Huang

|
137 installs
| (0) | Free
AI-powered test generation for Jest, Pytest & .NET via GitHub Copilot using Model Context Protocol
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Unit Test MCP

Intelligent test generation and execution for GitHub Copilot

A VS Code extension that enables GitHub Copilot to generate, run, and improve Jest, Vitest, Pytest, and .NET tests using the Model Context Protocol (MCP).


✨ Features

  • 🚀 Zero Setup: Install and use immediately - no configuration needed
  • 🧪 Multi-Framework Support: Jest/Vitest (JS/TS), Pytest (Python), and .NET (C#)
  • 🤖 AI-Powered: Works seamlessly with GitHub Copilot Chat
  • 📊 Coverage Reports: Get instant test coverage feedback
  • 🔧 Auto-Configuration: Automatically sets up MCP server on first activation
  • 📝 Smart Instructions: Optional workspace instruction files for better test generation

📦 Installation

Install From GitHub (.vsix)

This extension is distributed via a GitHub .vsix package (not the VS Code Marketplace).

  1. Download the latest .vsix from GitHub Releases
  2. In VS Code, open the Extensions view (Ctrl+Shift+X).
  3. Click the ... (More Actions) menu.
  4. Select Install from VSIX...
  5. Choose the downloaded .vsix file.

Optional (CLI):

code --install-extension path/to/unittest-mcp-<version>.vsix --force

🚀 Quick Start

1. Install the Extension

Install the extension via .vsix as described above.

2. Start Using with Copilot

Open GitHub Copilot Chat and try:

Generate Tests:

Generate unit tests for this file

Run Tests:

Run tests with coverage

Find Tests:

Find all Jest test files in this directory

The extension will automatically activate and handle the requests.


📋 Requirements

Requirement Version Notes
VS Code 1.85.0+ Required
GitHub Copilot Latest Must be active
Node.js N/A Bundled with VS Code
Python Any Only needed if running Pytest tests
.NET SDK 6.0+ Only needed if running .NET tests

🎯 What You Can Do

With Jest or Vitest (JavaScript/TypeScript)

  • ✅ Generate JS/TS unit tests (including React component tests)
  • ✅ Run tests with coverage
  • ✅ Watch mode support
  • ✅ Targeted test execution
  • ✅ Update snapshots (Jest, via --updateSnapshot, when applicable)

With Pytest (Python)

  • ✅ Generate Python unit tests
  • ✅ Run tests with coverage
  • ✅ Parametrized test support
  • ✅ Fixture-based testing

With .NET (C#)

  • ✅ Generate xUnit/NUnit tests
  • ✅ Run tests via dotnet test
  • ✅ Coverage reporting
  • ✅ Solution-aware test generation

⚙️ Configuration

The extension works out-of-the-box, but you can customize it using the Unit Test MCP side panel.

Side Panel UI

  1. Open the Unit Test MCP view in the VS Code sidebar (look for the flask icon).
  2. Use the UI to:
    • Browse and select custom instruction files for Jest, Vitest, Pytest, or .NET.
    • View currently loaded instructions.
    • Set target code coverage percentage.
    • Configure custom test commands.

Changes take effect immediately - no restart required!

📝 Custom Instructions

Customize test generation with your own instructions! See CUSTOM_INSTRUCTIONS.md for details.


💡 How It Works

┌─────────────────────────┐
│   GitHub Copilot Chat   │
└───────────┬─────────────┘
            │ MCP Protocol
┌───────────▼─────────────┐
│  TypeScript MCP Server  │
│  (Bundled in Extension) │
└───────────┬─────────────┘
            │
┌───────────▼─────────────┐
│ Jest / Vitest / Pytest  │
│        / Dotnet         │
└─────────────────────────┘
  1. You ask Copilot to generate/run tests
  2. Copilot calls the MCP server via standard protocol
  3. Server executes Jest/Vitest/Pytest/.NET and returns results
  4. Copilot shows you formatted output

🐛 Troubleshooting

Extension Not Working?

Check Status:

  1. Open the Unit Test MCP sidebar view.
  2. Verify that the server is connected and configuration is valid.

Still not working?

  1. Reload VS Code: Ctrl+Shift+P → "Reload Window"
  2. Check Output panel: View → Output → Select "Log (Extension Host)" and search for "Unit Test MCP"

Updating/Reinstalling The VSIX

If you install a newer .vsix and VS Code doesn't pick it up, reinstall with --force:

code --install-extension path/to/unittest-mcp-<version>.vsix --force

Copilot Doesn't See the Tools?

  1. Ensure GitHub Copilot extension is installed and active
  2. Reload VS Code
  3. Try asking: "What MCP tools are available?"

Tests Not Running?

For Jest:

  • Ensure package.json exists in your project root
  • Verify Jest is installed: npm list jest

For Vitest:

  • Ensure package.json exists in your project root
  • Verify Vitest is installed: npm list vitest

For Pytest:

  • Ensure Python is installed: python --version
  • Verify Pytest is installed: pip list | grep pytest

For .NET:

  • Ensure .NET SDK is installed: dotnet --version
  • Ensure your project is a valid .NET project

📚 Examples

Example 1: Generate React Tests

You: Generate unit tests for src/components/Button.tsx

Copilot: [Uses generate_test tool]
Creates: src/components/__tests__/Button.test.tsx

Example 2: Run Tests with Coverage

You: Run tests with coverage for the Button component

Copilot: [Uses run_tests tool]
Shows: Test results + coverage report

Example 3: Find All Tests

You: Find all test files in this workspace

Copilot: [Uses find_test_files tool]
Lists: All discovered test files

🏗️ For Developers

See DEVELOPMENT.md for:

  • Local development setup
  • Building from source
  • Testing the extension
  • Publishing to Marketplace

📄 License

MIT License - see LICENSE file for details


📮 Support

  • Issues: Please report issues via email to kennethhuang@microsoft.com
  • Repository: GitHub (Internal Microsoft access only)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft