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 with
inspect_coverage
- 📁 Batch Test Generation: Generate tests for entire folders at once with prioritization
- 🔧 Auto-Configuration: Automatically sets up MCP server on first activation
- 📝 Copilot Instructions: Auto-creates and syncs workspace instruction files that teach Copilot the test workflow
- 📖 Getting Started Walkthrough: Built-in tutorial accessible via
Unit Test MCP: Show Welcome & Tutorial
📦 Installation
Install from the VS Code Marketplace or search for "Unit Test MCP" in the Extensions view (Ctrl+Shift+X).
🚀 Quick Start
1. Install the Extension
Install from the Marketplace link above. The extension auto-configures on first activation.
2. Start Using with Copilot
Open GitHub Copilot Chat and try:
Generate unit tests for this file
Generate tests for all files in src/
Run tests with coverage
What files have low coverage?
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
Coverage Reports
Ask Copilot "Run tests with coverage" or "What files have low coverage?" to get an interactive coverage report showing per-file line, branch, function, and statement coverage.

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

- Open the Unit Test MCP view in the VS Code sidebar (look for the clipboard/gear icon in the Activity Bar).
- 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 │
└─────────────────────────┘
- You ask Copilot to generate/run tests
- Copilot calls the MCP server via standard protocol
- Server executes Jest/Vitest/Pytest/.NET and returns results
- Copilot shows you formatted output
🐛 Troubleshooting
Extension Not Working?
Check Status:
- Open the Unit Test MCP sidebar view.
- Verify that the server is connected and configuration is valid.
Still not working?
- Reload VS Code:
Ctrl+Shift+P → "Reload Window"
- Check Output panel: View → Output → Select "Log (Extension Host)" and search for "Unit Test MCP"
- Ensure GitHub Copilot extension is installed and active
- Reload VS Code
- 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: Batch Test Generation
You: Generate tests for all files in src/services/
Copilot: [Uses generate_tests_batch tool]
Scans folder, prioritizes by missing tests/low coverage
Creates tests for each file sequentially
Example 4: Inspect Coverage
You: What files have low test coverage?
Copilot: [Uses inspect_coverage tool]
Shows: Worst-covered files and branches from existing coverage artifacts
🏗️ For Developers
See DEVELOPMENT.md for:
- Local development setup
- Building from source
- Testing the extension
- Publishing to Marketplace
📚 Additional Resources
🐳 Dev Container
This repository includes a pre-configured dev container with all necessary dependencies:
- Node.js & npm - For extension and MCP server development
- Python 3 & pip - For Pytest integration testing
- Git, ESLint, and common CLI tools - Pre-installed and ready to use
The dev container ensures consistent development environments across all contributors. Simply open in VS Code with the Remote-Containers extension installed.
🔧 Standalone MCP Server
The mcp-dist folder contains a standalone MCP server that works independently from the VS Code extension.
Use cases:
- Integration with other MCP clients (Claude Desktop, custom tools)
- Command-line test generation workflows
- CI/CD pipeline integration
- Copilot CLI with
--additional-mcp-config
See mcp-dist/README.md for build and usage instructions.
🧪 Test Quality Evaluator Notebook
The notebooks/evaluator.ipynb demonstrates using GitHub Copilot CLI with the MCP server to automatically generate and evaluate tests.
Features:
- Integrates Copilot CLI with the standalone MCP server via
--additional-mcp-config
- Generates test files using natural language prompts
- Evaluates test quality, coverage, and mutation scores
- Requires Python virtual environment and GitHub token with Copilot scope
See the notebook's first cell for complete setup instructions and available MCP tools.
�📄 License
MIT License - see LICENSE file for details
📮 Support
- Issues/Feedback: Use the "Give Feedback" button in the Unit Test MCP sidebar panel
- Repository: GitHub (Internal Microsoft access only)