Skip to main content
Glama
verifiable-thinking-mcp

verifiable-thinking-mcp

Your LLM is confidently wrong 40% of the time on reasoning questions. This fixes that.

npm version CI codecov License: MIT

15 trap patterns detected in <1ms. No LLM calls. Just pattern matching.

Quick Start • Features • Trap Detection • API


┌────────────────────────────────────────────────────────────────┐
│ "A bat and ball cost $1.10. The bat costs $1 more..."          │
│                             ↓                                  │
│ TRAP DETECTED: additive_system                                 │
│ > Don't subtract $1 from $1.10. Set up: x + (x+1) = 1.10       │
│                             ↓                                  │
│ Answer: $0.05 (not $0.10)                                      │
└────────────────────────────────────────────────────────────────┘

Quick Start

npx -y verifiable-thinking-mcp

Add to Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "verifiable-thinking": {
      "command": "npx",
      "args": ["-y", "verifiable-thinking-mcp"]
    }
  }
}

Features

🎯 Trap Detection

15 patterns (bat-ball, Monty Hall, base rate) caught before reasoning starts

⚔️ Auto-Challenge

Forces counterarguments when confidence >95%—no more overconfident wrong answers

🔍 Contradiction Detection

Catches "Let x=5" then "Now x=10" across steps

🌿 Hypothesis Branching

Explore alternatives, auto-detects when branches confirm/refute

🔢 Local Math

Evaluates expressions without LLM round-trips

🗜️ Smart Compression

49% token savings with telegraphic + sentence-level compression

⚡ Real Token Counting

Tiktoken integration—3,922× cache speedup, zero estimation error

Token Efficiency

Every operation counts. Verifiable Thinking uses real token counting (tiktoken) and intelligent compression to cut costs by 50-60% without sacrificing reasoning quality.

// Traditional reasoning: ~1,350 tokens for 10-step chain
// Verifiable Thinking: ~580 tokens (49–57% savings)

// Real token counting (not estimation)
countTokens("What is 2+2?")  // → 7 tokens (not 3)
// Cache speedup: 3,922× faster on repeated strings

// Compress before processing (not just storage)
scratchpad({
  operation: "step",
  thought: "Long analysis...",  // 135 tokens → 72 tokens
  compress: true
})

// Budget controls
scratchpad({
  warn_at_tokens: 2000,     // Soft warning
  hard_limit_tokens: 5000   // Hard stop
})

At scale: 1,000 reasoning chains/day = $4,193/year saved (at GPT-4o pricing).

See docs/token-optimization.md for architecture details and benchmarks.

How It Works

// Start with a question—trap detection runs automatically
scratchpad({
  operation: "step",
  question: "A bat and ball cost $1.10...",
  thought: "Let ball = x, bat = x + 1.00",
  confidence: 0.9
})
// → Returns trap_analysis warning

// High confidence? Auto-challenge kicks in
scratchpad({ operation: "step", thought: "...", confidence: 0.96 })
// → Returns challenge_suggestion: "What if your assumption is wrong?"

// Complete with spot-check
scratchpad({ operation: "complete", final_answer: "$0.05" })

Trap Detection

Pattern

What It Catches

additive_system

Bat-ball, widget-gadget (subtract instead of solve)

nonlinear_growth

Lily pad doubling (linear interpolation)

monty_hall

Door switching (50/50 fallacy)

base_rate

Medical tests (ignoring prevalence)

independence

Coin flips (gambler's fallacy)

Pattern

Trap

additive_system

Subtract instead of solve

nonlinear_growth

Linear interpolation

rate_pattern

Incorrect scaling

harmonic_mean

Arithmetic mean for rates

independence

Gambler's fallacy

pigeonhole

Underestimate worst case

base_rate

Ignore prevalence

factorial_counting

Simple division

clock_overlap

Assume 12 overlaps

conditional_probability

Ignore conditioning

conjunction_fallacy

More detail = more likely

monty_hall

50/50 after reveal

anchoring

Irrelevant number influence

sunk_cost

Past investment bias

framing_effect

Gain/loss framing

Tools

scratchpad — the main tool with 11 operations:

Operation

What It Does

step

Add reasoning step (trap priming on first)

complete

Finalize with auto spot-check

revise

Fix earlier step

branch

Explore alternative path

challenge

Force adversarial self-check

navigate

View history/branches

Operation

Purpose

step

Add reasoning step

complete

Finalize chain

revise

Fix earlier step

branch

Alternative path

challenge

Adversarial self-check

navigate

View history

spot_check

Manual trap check

hint

Progressive simplification

mistakes

Algebraic error detection

augment

Compute math expressions

override

Force-commit failed step

Other tools: list_sessions, get_session, clear_session, compress

vs Sequential Thinking MCP

Sequential Thinking

Verifiable Thinking

Trap detection

❌

15 patterns

Auto-challenge

❌

>95% confidence

Contradiction detection

❌

✅

Confidence tracking

❌

Per-step + chain

Local compute

❌

✅

Token budgets

❌

Soft + hard limits

Real token counting

❌

Tiktoken (3,922× cache speedup)

Compression

❌

49–57% token savings

Sequential Thinking is ~100 lines. This is 22,000+ with 1,967 tests.

See docs/competitive-analysis.md for full breakdown.

Development

git clone https://github.com/CoderDayton/verifiable-thinking-mcp.git
cd verifiable-thinking-mcp && bun install
bun run dev      # Interactive MCP Inspector
bun test         # 1,967 tests

License

MIT


Report Bug · Request Feature

Available Tools

5 tools
clear_sessionC

Clear session(s) to free memory

Inputs: all (required), session_id.

compressB

CPC-style sentence-level compression. TF-IDF + NCD scoring, coreference/causal chains, filler removal. 10× faster than token-level LLM compression. Keeps query-relevant sentences.

Inputs: context (required), query (required), target_ratio (required), boost_reasoning (required), +5 more.

get_sessionC

Get session: full/summary/compressed format

Inputs: format (required), session_id, branch_id.

list_sessionsB

List active sessions with counts/branches

Inputs: no named parameters.

scratchpadC

Structured reasoning w/verification, trap detection, self-challenge. []=optional

OPS (required: operation=): step thought= [question=1st] [confidence=] [verify=] [domain=math|logic|code|general] [compress=true]→add step. Auto-verifies when chain >3 steps. complete [final_answer=] [summary=]→finalize+spot-check revise target_step= thought= [reason=]→fix step branch thought= [from_step=] [hypothesis=] [success_criteria=]→fork path navigate view=history|branches|step|path [step_id=] [limit=10]→inspect augment text= [store_as_step=false]→compute+inject math results hint [expression=] [reveal_count=] [cumulative=true] [reset=false]→progressive hints (auto-continues) mistakes text=→check algebraic errors spot_check question= answer=→check for common reasoning traps challenge [target_claim=] [challenge_type=all]→adversarial self-check override failed_step= [reason=]→force-commit failed step

DEFAULTS: session_id=auto confidence_threshold=0.8 token_budget=3000 augment_compute=true compress=true

STATUS→ACTION: continue→add steps | threshold_reached→complete or verify | review→use reconsideration.suggested_revise | verification_failed→revise|branch|override | budget_exhausted→complete or new session

FLOW: 1.step(question="...",thought="...")→primes trap detection for the question 2.step(thought="...")×N→auto-verify, auto-compress, confidence-drift detection, consistency checks 3.[optional]challenge()→adversarial self-check of claims 4.complete(final_answer="...")→auto spot-check against common traps 5.if status=review→revise per reconsideration.suggested_revise

Inputs: operation (required), confidence_threshold, token_budget, warn_at_tokens, +40 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 5 tools

    Disambiguation4/5

    Most tools have distinct purposes: clear_session, get_session, and list_sessions handle session management, while compress and scratchpad focus on content processing and reasoning. However, scratchpad's extensive OPS (e.g., step, complete, revise) could overlap with compress's compression functionality in handling text, creating minor ambiguity in content manipulation tasks.

    Naming Consistency3/5

    The main tool names (clear_session, compress, get_session, list_sessions, scratchpad) follow a consistent verb_noun or noun pattern, but scratchpad's OPS include varied formats like step, complete, and navigate without a strict naming convention. This mix of styles within scratchpad reduces overall consistency.

    Tool Count5/5

    With 5 tools, the server is well-scoped for verifiable thinking, covering session management, compression, and structured reasoning. Each tool serves a clear role without bloat, making the count appropriate for the domain's complexity.

    Completeness4/5

    The tool set provides comprehensive coverage for verifiable thinking workflows, including session lifecycle (list, get, clear), content compression, and detailed reasoning with verification. Minor gaps might exist in advanced session analytics or integration with external data sources, but core operations are well-covered.

    Related MCP Connectors