毒性試験MCPサーバー
pytest を使用したプロジェクト内で tox コマンドを実行し、Python テストを実行する MCP サーバーです。このサーバーは、モデルコンテキストプロトコル (MCP) を介して Python テストを実行および管理するための便利な方法を提供します。
特徴
ツール
run_tox_tests- さまざまなモードとオプションで毒性テストを実行するさまざまな実行モードをサポートします:
all: すべてのテストまたは特定のグループのテストを実行しますfile: 特定のファイルからテストを実行するcase: 特定のテストケースを実行するdirectory: 指定されたディレクトリ内のすべてのテストを実行する
サポートされているテスト グループ:
clients:クライアント関連のテストapi: APIエンドポイントテストauth: 認証テストuploads: アップロード機能テストroutes: ルートハンドラーテスト
Related MCP server: Lodestar MCP Server
発達
依存関係をインストールします:
npm installサーバーを構築します。
npm run build自動リビルドを使用した開発の場合:
npm run watchインストール
VSCode で使用するには、次の MCP 設定ファイルにサーバー構成を追加します: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
"mcpServers": {
"tox-testing": {
"command": "node",
"args": ["/path/to/tox-testing/build/index.js"],
"env": {
"TOX_APP_DIR": "/path/to/your/python/project",
"TOX_TIMEOUT": "600"
}
}
}
}設定オプション
env.TOX_TIMEOUT: (オプション) テスト実行の完了を待つ最大時間(秒)。テスト実行がこのタイムアウト時間を超えた場合、テストは終了します。デフォルトは600秒(10分)です。env.TOX_APP_DIR: (必須) tox.ini ファイルを含むディレクトリ。tox コマンドはここから実行されます。パスは、tox.ini が配置されている Python プロジェクトのルートを指す必要があります。
タイムアウトは特に次の場合に重要です。
テストプロセスのハングを防ぐ
長期にわたる統合テストの管理
CI/CDパイプラインが停止しないようにする
使用法
サーバーは、さまざまなモードで使用できる単一のツールrun_tox_testsを提供します。
ツール引数
// Run all tests
{
"mode": "all"
}
// Run tests from a specific group
{
"mode": "all",
"group": "api"
}
// Run tests from a specific file
{
"mode": "file",
"testFile": "tests/test_api.py"
}
// Run a specific test case
{
"mode": "case",
"testFile": "tests/test_api.py",
"testCase": "test_endpoint_response"
}
// Run tests from a specific directory
{
"mode": "directory",
"directory": "tests/api/"
}Clineと併用
このMCPをClineと併用する場合、Clineのカスタム命令を設定することでテスト実行を効率的に行うことができます。推奨されるワークフローは以下のとおりです。
If asked to run tests on the project, use the tox-testing MCP. Follow these steps:
1. Run all tests across the project unless you are given instructions to run a specific test file or test case.
2. Review and rerun each failed test case individually as you troubleshoot and fix the issue from its output.
3. Repeat step 2 until the testcase passes.
4. Once all failed test cases from step 1 are passing rerun all tests again and repeat all steps until all tests pass.このワークフローにより、次のことが保証されます。
すべてのテストを最初に実行することで包括的なテストカバレッジを実現します
失敗したテストケースを分離して集中的にデバッグする
個々のケースを再テストして修正を検証する
すべてのテストを再度実行して最終検証する
Cline とのやり取りの例:
You: Run the tests for this project
Cline: I'll use the tox-testing MCP to run all tests:
{
"mode": "all"
}
You: Fix the failing test in test_api.py
Cline: I'll first run the specific test file:
{
"mode": "file",
"testFile": "tests/test_api.py"
}
Then address each failing test case individually:
{
"mode": "case",
"testFile": "tests/test_api.py",
"testCase": "test_endpoint_response"
}貢献
行動規範とプル リクエストの送信プロセスの詳細については、 CONTRIBUTING.md を参照してください。