thepian
MCP Serverthepianpublic

trun mcp

Thepia Test Runner MCP

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Python
Language
MIT License
License

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:

  1. Run tests to identify failing tests
  2. Run type checking to identify type errors
  3. Analyze the results to understand the issues
  4. Apply fixes to resolve the issues
  5. 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

1

Clone the repository

git clone https://github.com/thepian/trun-mcp
2

Install dependencies

cd trun-mcp
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerthepian
Repotrun-mcp
LanguagePython
LicenseMIT License
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation