Tetrad logo

Tetrad

Quadruple consensus MCP server for code validation using Codex, Gemini, and Qwen

Install Tetrad

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "tetrad": {
      "command": "npx",
      "args": [
        "-y",
        "@samoradc/tetrad"
      ]
    }
  }
}

Settings β†’ Developer β†’ Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Claude Code command
claude mcp add --transport stdio tetrad -- npx -y @samoradc/tetrad

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

npx -y @samoradc/tetrad

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives β€” missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

Tools6

What Tetrad lets your agent do. Expand a tool for its parameters.

Self-reported~74 tokens of context

Security & health

What it can reach and how reliably it runs β€” from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

18/22 checks healthy over the last 117d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 11d ago via OSV.dev Β· @samoradc/tetrad (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks β€” not a rating.

GitHub stars1Stargazers on the source repository.
npm downloads394Package downloads in the last 30 days.
Last commit10mo agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.
Tools exposed6Callable tools this server registers over MCP.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

From the project README

Tetrad

CI MCP Registry npm Crates.io Rust License: MIT

Quadruple Consensus MCP Server for Claude Code

Tetrad is a high-performance MCP (Model Context Protocol) server written in Rust that orchestrates three AI-powered CLI code evaluation tools (Codex, Gemini CLI, Qwen) to validate all code produced by Claude Code.

The system implements a quadruple consensus protocol where no code or plan is accepted without approval from four intelligences: the three external evaluators + Claude Code itself.

Features

  • Quadruple Consensus: 4 AI models must agree to approve code
  • ReasoningBank: Continuous learning system with RETRIEVEβ†’JUDGEβ†’DISTILLβ†’CONSOLIDATE cycle
  • High Performance: Written in Rust with parallel execution via Tokio
  • MCP Server: JSON-RPC 2.0 server over stdio for Claude Code integration
  • Full CLI: Intuitive commands (init, serve, status, doctor, config, etc.)
  • LRU Cache: Result caching with configurable TTL
  • Hook System: Pre/post evaluation callbacks for customization
  • Extensible: Plugin system for custom executors
  • Cross-session: SQLite persistence for patterns and history

Quick Start

1. Install Tetrad

bash
# Via npm (recommended - works seamlessly with Claude Code)
npm install -g @samoradc/tetrad

# Or via cargo (requires additional setup)
cargo install tetrad
sudo cp ~/.cargo/bin/tetrad /usr/local/bin/

1.1 Initialize in Your Project (Optional)

Terminal
npx @samoradc/tetrad init

This will:

  • Create tetrad.toml configuration file
  • Create .tetrad/ directory for the database
  • Add .tetrad/ to your .gitignore

2. Install and Configure External CLI Tools

Tetrad requires at least one of the following AI CLI tools. Good news: you don't need separate API keys if you have existing subscriptions!

Codex CLI (OpenAI)

Terminal
npm install -g @openai/codex

Authentication options:

MethodRequirementsAPI Key Needed?
ChatGPT LoginChatGPT Plus, Pro, Business, Edu, or Enterprise subscriptionNo
API KeyOpenAI API account with creditsYes
server.ts
# Option 1: Login with your ChatGPT subscription (recommended)
codex login
# Opens browser for OAuth - follow the prompts

# Option 2: Use API key
export OPENAI_API_KEY="your-openai-key"

Note: For headless/remote servers, use codex login --device-auth and follow the device code flow.

πŸ“– Codex CLI Authentication Docs


Gemini CLI (Google)

Terminal
npm install -g @google/gemini-cli

Authentication options:

MethodRequirementsAPI Key Needed?Free Tier
Google LoginPersonal Google accountNo60 req/min, 1,000 req/day
API KeyGoogle AI Studio accountYesSame limits
server.ts
# Option 1: Login with Google account (recommended)
gemini auth login
# Opens browser for OAuth - follow the prompts

# Option 2: Use API key from Google AI Studio
export GEMINI_API_KEY="your-gemini-key"

Free Tier: With a personal Google account, you get access to Gemini 2.5 Pro with 1M token context window at no cost!

πŸ“– Gemini CLI Authentication Docs


Qwen CLI (Alibaba)

Terminal
npm install -g qwen-code

Authentication options:

MethodRequirementsAPI Key Needed?Free Tier
DashScope APIAlibaba Cloud accountYes2,000 req/day
Coding PlanQwen Coding subscriptionYes (different format)Included
server.ts
# Get your API key from DashScope console
export DASHSCOPE_API_KEY="your-dashscope-key"

# For international users (outside China)
export OPENAI_BASE_URL="https://dashscope-intl.aliyuncs.com/compatible-mode/v1"

Regional Endpoints:

  • Singapore: dashscope-intl.aliyuncs.com
  • Virginia: dashscope-us.aliyuncs.com
  • Beijing: dashscope.aliyuncs.com

πŸ“– Qwen API Docs

3. Verify Installation

bash
# Check Tetrad version
tetrad version

# Check CLI availability
tetrad status

# Diagnose any issues
tetrad doctor

4. Add to Claude Code CLI

bash
# Add Tetrad as MCP server (all projects)
claude mcp add --scope user tetrad -- npx @samoradc/tetrad serve

# Verify it's configured
claude mcp list
Alternative installation methods
bash
# Current project only
claude mcp add tetrad -- npx @samoradc/tetrad serve

# If installed via cargo
claude mcp add --scope user tetrad -- tetrad serve

Note: Tetrad is published on the MCP Registry for discoverability and documentation.

5. Alternative: Manual Configuration

Create or edit .mcp.json in your project root:

config.json
{
  "mcpServers": {
    "tetrad": {
      "type": "stdio",
      "command": "npx",
      "args": ["@samoradc/tetrad", "serve"],
      "env": {
        "OPENAI_API_KEY": "${OPENAI_API_KEY}",
        "GOOGLE_API_KEY": "${GOOGLE_API_KEY}",
        "DASHSCOPE_API_KEY": "${DASHSCOPE_API_KEY}"
      }
    }
  }
}

Or for global user configuration in ~/.claude.json (mcpServers section):

config.json
{
  "mcpServers": {
    "tetrad": {
      "type": "stdio",
      "command": "npx",
      "args": ["@samoradc/tetrad", "serve"]
    }
  }
}

How It Works

When you ask Claude Code to write code, Tetrad automatically validates it:

Code
You: "Create a function in Rust that calculates the average of a vector"

Claude Code:
1. Writes the code
2. Calls tetrad_review_code automatically
3. Tetrad sends to Codex, Gemini and Qwen for evaluation
4. Returns consolidated consensus from all 3 evaluators

Tetrad Response:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DECISION: PASS βœ“                            β”‚
β”‚ Score: 92/100                               β”‚
β”‚ Consensus: Yes (3/3 approved)               β”‚
β”‚                                             β”‚
β”‚ Votes:                                      β”‚
β”‚   β€’ Codex:  Pass (95)                       β”‚
β”‚   β€’ Gemini: Pass (90)                       β”‚
β”‚   β€’ Qwen:   Pass (92)                       β”‚
β”‚                                             β”‚
β”‚ Suggestions:                                β”‚
β”‚   - Consider handling empty vector case     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Claude Code: Saves the approved code

When Issues Are Found:

Code
Tetrad Response:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DECISION: BLOCK βœ—                           β”‚
β”‚ Score: 26/100                               β”‚
β”‚ Consensus: Yes (3/3 rejected)               β”‚
β”‚                                             β”‚
β”‚ Votes:                                      β”‚
β”‚   β€’ Codex:  Fail (30) - division by zero    β”‚
β”‚   β€’ Gemini: Fail (25) - no error handling   β”‚
β”‚   β€’ Qwen:   Fail (25) - unsafe operation    β”‚
β”‚                                             β”‚
β”‚ Issues:                                     β”‚
β”‚   - Division by zero not handled            β”‚
β”‚   - Missing input validation                β”‚
β”‚   - No Result/Option return type            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Claude Code: Fixes the code and resubmits

CLI Commands

server.ts
tetrad - Quadruple Consensus CLI for Claude Code

COMMANDS:
    init              Initialize configuration in current directory
    serve             Start the MCP server (used by Claude Code)
    status            Show CLI status (codex, gemini, qwen)
    config            Configure options interactively
    doctor            Diagnose configuration issues
    version           Show version
    evaluate          Evaluate code manually (without MCP)
    history           Show evaluation history from ReasoningBank
    export            Export patterns from ReasoningBank
    import            Import patterns into ReasoningBank

OPTIONS:
    -c, --config <FILE>    Configuration file (default: tetrad.toml)
    -v, --verbose          Verbose mode
    -q, --quiet            Quiet mode
    -h, --help             Show help

MCP Tools

When running as MCP server, Tetrad exposes 6 tools:

ToolDescription
tetrad_review_planReview implementation plans before coding
tetrad_review_codeReview code before saving
tetrad_review_testsReview tests before finalizing
tetrad_confirmConfirm agreement with received feedback
tetrad_final_checkFinal verification before commit
tetrad_statusCheck health of evaluators

Workflow Example

Code
1. Claude Code generates plan β†’ tetrad_review_plan β†’ Feedback
2. Claude Code implements   β†’ tetrad_review_code β†’ Feedback
3. Claude Code adjusts      β†’ tetrad_confirm     β†’ Confirmation
4. Claude Code finalizes    β†’ tetrad_final_check β†’ Certificate

Architecture

Reviews

No reviews yet β€” be the first to share how it worked for you.

Frequently Asked Questions about Tetrad

tetrad is an MCP server that orchestrates Codex, Gemini, and Qwen CLI tools to evaluate code and plans produced by Claude Code. It uses a quadruple consensus protocol requiring approval from the three external evaluators and Claude Code itself before acceptance. Written in Rust, it communicates over stdio.

Install Tetrad with npm using `npm install -g @samoradc/tetrad`, which the README recommends for Claude Code integration. You can also install it with `cargo install tetrad`, although the Cargo installation requires additional setup. Optionally run `npx @samoradc/tetrad init` to create configuration and project data files.

Tetrad uses Codex CLI, Gemini CLI, and Qwen CLI as external code evaluators.

Tetrad validates code through quadruple consensus: Codex, Gemini, Qwen, and Claude Code evaluate the code or plan, and approval from all four intelligences is required for acceptance. Evaluations run in parallel through Tokio, and results can use configurable LRU caching.

Related MCP servers

Add a badge to your READMEShow it’s listed β€” live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewTetrad AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/tetrad?style=directory)](https://allmcps.com/mcp/tetrad)
HTML Embed
<a href="https://allmcps.com/mcp/tetrad"><img src="https://allmcps.com/api/badge/tetrad?style=directory" alt="Tetrad on AllMCPs" /></a>