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 and Pytest tests using the Model Context Protocol (MCP).
✨ Features
- 🚀 Zero Setup: Install and use immediately - no configuration needed
- 🧪 Dual Framework Support: Jest (JavaScript/TypeScript) and Pytest (Python)
- 🤖 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
From Marketplace (Recommended)
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X)
- Search for "Unit Test MCP"
- Click Install
From VSIX File
- Download the
.vsix file
- In VS Code:
Ctrl+Shift+P → "Extensions: Install from VSIX"
- Select the downloaded file
🚀 Quick Start
1. Install the Extension
Just install from the Marketplace - that's it!
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 |
🎯 What You Can Do
With Jest (JavaScript/TypeScript)
- ✅ Generate React component tests
- ✅ Run tests with coverage reports
- ✅ Update snapshots
- ✅ Watch mode support
- ✅ Targeted test execution
With Pytest (Python)
- ✅ Generate Python unit tests
- ✅ Run tests with coverage
- ✅ Parametrized test support
- ✅ Fixture-based testing
⚙️ 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 flask icon).
- Use the UI to:
- Browse and select custom instruction files for Jest or Pytest.
- 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.
🔧 Available Commands
| Command |
Description |
Show Unit Test MCP Server Status |
View server configuration and status |
Access via: Ctrl+Shift+P → Type command name
💡 How It Works
┌─────────────────────────┐
│ GitHub Copilot Chat │
└───────────┬─────────────┘
│ MCP Protocol
┌───────────▼─────────────┐
│ TypeScript MCP Server │
│ (Bundled in Extension) │
└───────────┬─────────────┘
│
┌───────────▼─────────────┐
│ Jest / Pytest CLI │
└─────────────────────────┘
- You ask Copilot to generate/run tests
- Copilot calls the MCP server via standard protocol
- Server executes Jest/Pytest 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 Pytest:
- Ensure Python is installed:
python --version
- Verify Pytest is installed:
pip list | grep pytest
📚 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