An MCP server to enforce/guide agentic coding tools to use general unit testing standards.
Project description
MCP Testing Sensei
This project implements an MCP (Model Context Protocol) stdio server designed to enforce and guide agentic coding tools (like Gemini CLI or Claude Code) in adhering to language agnostic unit testing principles.
Core Principles Enforced
This tool aims to promote the following unit testing principles:
- Tests should be written before implementation. (BDD/TDD for the win)
- Tests should document the behavior of the system under test.
- Tests should be small, clearly written, and have a single concern.
- Tests should be deterministic and isolated from the side effects of their environment and other tests.
- Tests should be written in a declarative manner and never have branching logic.
Features
lint_codetool: Analyzes provided code snippets for violations of the defined unit testing standards.get_testing_principlestool: Provides the core unit testing principles to guide LLMs in generating better tests.unit-testing-principlesresource: Exposes testing principles as an MCP resource.
Getting Started
Prerequisites
- Nix (for reproducible development environment)
Development Environment Setup
To enter the development environment with all dependencies:
nix develop
Building the Standalone Executable
To build the standalone executable using Nix, run the following command:
nix build
This will create a result symlink in your project root, pointing to the built executable.
Running the Server
Using the Standalone Executable
After building, you can run the MCP stdio server directly from the result symlink:
./result/bin/mcp-testing-sensei
This will start the MCP server that communicates via standard input/output.
Running from Development Environment
Alternatively, if you are in the nix develop shell, you can run the MCP server:
python mcp_server.py
The server communicates via stdio, reading JSON-RPC messages from stdin and writing responses to stdout.
Using with MCP Clients
The server can be integrated with MCP-compatible clients like Claude Desktop or other tools that support the Model Context Protocol.
Example configuration for Claude Desktop
Add the following to your Claude Desktop configuration:
{
"mcpServers": {
"testing-sensei": {
"command": "python",
"args": ["/path/to/mcp-testing-sensei/mcp_server.py"]
}
}
}
Testing the Server
You can test the MCP server using the included test script:
python test_mcp_integration.py
This will send JSON-RPC messages to the server and display the responses.
Running Tests
To run the unit tests locally, first ensure you are in the Nix development environment:
nix develop
Then, execute pytest:
pytest
Project Structure
flake.lock
flake.nix
linter.py # Core linting logic
mcp_server.py # MCP stdio server implementation
main.py # Legacy HTTP server (can be removed)
pyproject.toml
test_mcp_integration.py # Integration test script for the MCP server
tests/
test_linter.py # Unit tests for the linter logic
Contributing
Contributions are welcome! Please ensure your changes adhere to the established unit testing principles and project conventions.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_testing_sensei-0.1.4.tar.gz.
File metadata
- Download URL: mcp_testing_sensei-0.1.4.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aafb781d5c23a2ae620b8ac5746a53c0e3f5b781acc7a01e1a91050ee9e19812
|
|
| MD5 |
d966a91a26e3e97f2a940d8689f2c540
|
|
| BLAKE2b-256 |
4143df89e623e20b341207e895da19da5a72d635024dd6eb2209fc9bb9eedce7
|
File details
Details for the file mcp_testing_sensei-0.1.4-py3-none-any.whl.
File metadata
- Download URL: mcp_testing_sensei-0.1.4-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c9a1a44c51c1a61d67bcdf07f69f965a7b6c4b5b108ab46d18a0fe104ffb1e2
|
|
| MD5 |
daf9551fda16951d90f02417f02b9ab8
|
|
| BLAKE2b-256 |
f1ac3c2c8899ad5919b4f51d63f0032f8b23eb766d1cca57203035803b332d00
|