MCP Unit Test Sensei

MCP Unit Test Sensei

An MCP server that enforces unit testing standards by linting code and guiding agentic coding tools (like Gemini CLI or Claude Code) to follow best practices in test-driven development.

Category
访问服务器

README

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选