Skip to main content

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_code tool: Analyzes provided code snippets for violations of the defined unit testing standards.
  • get_testing_principles tool: Provides the core unit testing principles to guide LLMs in generating better tests.
  • unit-testing-principles resource: Exposes testing principles as an MCP resource.

Installation

Option 1: Install from PyPI (Recommended)

The easiest way to install MCP Testing Sensei is via pip:

pip install mcp-testing-sensei

This installs the mcp-testing-sensei command globally.

Option 2: Install from npm

If you prefer using npm:

npm install -g @kourtni/mcp-testing-sensei

Note: This still requires Python to be installed on your system.

Option 3: Using Docker

docker pull kourtni/mcp-testing-sensei

Option 4: Development Setup with Nix

For development or if you want to build from source:

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.

Configuration for Claude Desktop

If installed via pip:

{
  "mcpServers": {
    "testing-sensei": {
      "command": "mcp-testing-sensei"
    }
  }
}

If installed via npm:

{
  "mcpServers": {
    "testing-sensei": {
      "command": "npx",
      "args": ["@kourtni/mcp-testing-sensei"]
    }
  }
}

If using Docker:

{
  "mcpServers": {
    "testing-sensei": {
      "command": "docker",
      "args": ["run", "-i", "kourtni/mcp-testing-sensei"]
    }
  }
}

If running from source:

{
  "mcpServers": {
    "testing-sensei": {
      "command": "python",
      "args": ["/path/to/mcp-testing-sensei/mcp_server.py"]
    }
  }
}

Testing the Server

To verify the server is working correctly, you can use the integration test script:

# For development testing
python test_mcp_integration.py

This will:

  • Start the MCP server
  • Send test requests to verify the tools are working
  • Display the responses

The server itself doesn't have a standalone test mode - it's designed to be used with MCP clients.

Development

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.

Additional Documentation

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

mcp_testing_sensei-0.1.5.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_testing_sensei-0.1.5-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file mcp_testing_sensei-0.1.5.tar.gz.

File metadata

  • Download URL: mcp_testing_sensei-0.1.5.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for mcp_testing_sensei-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2e75348e91f2a105f2f0308e0f9d2ad353d1ec4cc1f6acbcaa2edd78d56783e1
MD5 f95313ff89218b7dd360f0498142162c
BLAKE2b-256 4b8699f3f616ed1ccc6392f4af8189d049993adb506690487d624d351e5d5cc1

See more details on using hashes here.

File details

Details for the file mcp_testing_sensei-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_testing_sensei-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 421a0965790e7347e4d6fb9d712764b20c7a42a1772ee8b0c35dac068984a103
MD5 408bceabb07c2bb34d2173b5cf5a2a93
BLAKE2b-256 24e009e81654311af0e02fdcfb5f5c4600f529731ab5fdb6f97313d31e5ca5cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page