Unit Test MCP
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
📦 InstallationInstall From GitHub (
|
| 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.

- 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, 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"
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?
- 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.jsonexists in your project root - Verify Jest is installed:
npm list jest
For Vitest:
- Ensure
package.jsonexists 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)