
trun mcp
Thepia Test Runner MCP
Repository Info
About This Server
Thepia Test Runner MCP
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
TRun MCP - Test Runner Module for Claude Code
A Python module for running tests and fixing code issues, designed to be used with Claude Code.
Features
- Run pytest and mypy commands with structured output
- Analyze test failures and type errors
- Suggest and apply fixes automatically
- CLI for interactive use
- Integration with uv for virtual environment management
Installation
Using pip
pip install trun-mcp
Using uv
uv pip install trun-mcp
Usage
CLI
The trun-mcp CLI provides various commands for running tests, checking types, and applying fixes.
# Run tests
trun-mcp test tests/test_file.py
# Run type checking
trun-mcp type path/to/file.py
# Analyze test results
trun-mcp analyze-test tests/test_file.py
# Analyze type checking results
trun-mcp analyze-type path/to/file.py
# Run tests and apply fixes
trun-mcp fix-test tests/test_file.py
# Run type checking and apply fixes
trun-mcp fix-type path/to/file.py
# Create a uv virtual environment
trun-mcp uv-create --packages pytest mypy
Python API
from trun_mcp.core.runner import TestRunner
from trun_mcp.core.analyzer import ErrorAnalyzer
from trun_mcp.core.fixer import CodeFixer
# Initialize components
runner = TestRunner("/path/to/project")
analyzer = ErrorAnalyzer()
fixer = CodeFixer("/path/to/project")
# Run tests
result = runner.run_pytest("tests/test_file.py")
# Analyze results
analysis = analyzer.analyze_pytest_output(result["stdout"])
# Get suggestions
suggestions = analyzer.suggest_fixes(analysis)
# Apply fixes
for suggestion in suggestions["suggestions"]:
fixer.fix_based_on_suggestion(suggestion)
Examples
Running Tests and Applying Fixes
# Run tests and automatically apply fixes
trun-mcp fix-test tests/test_file.py
# Run tests and interactively apply fixes
trun-mcp fix-test tests/test_file.py --interactive
Type Checking and Fixing Issues
# Run type checking and automatically apply fixes
trun-mcp fix-type path/to/file.py
# Run type checking and interactively apply fixes
trun-mcp fix-type path/to/file.py --interactive
Setting Up a Project with uv
# Create a uv virtual environment with pytest and mypy
trun-mcp uv-create
# Create a uv virtual environment with specific packages
trun-mcp uv-create --packages pytest mypy black isort
Integration with Claude Code
TRun MCP is designed to be used with Claude Code for Python testing and fixing. It provides a structured way for Claude Code to:
- Run tests to identify failing tests
- Run type checking to identify type errors
- Analyze the results to understand the issues
- Apply fixes to resolve the issues
- Verify the fixes by re-running the tests and type checking
Using TRun MCP, Claude Code can effectively identify and fix common issues in Python code, such as:
- Import errors
- Type errors
- None-related errors
- Key errors
- And more
License
MIT
(c) 2025 by Henrik Vendelbo
Quick Start
Clone the repository
git clone https://github.com/thepian/trun-mcpInstall dependencies
cd trun-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.