Ultrathink
MCP server for sequential thinking and complex problem-solving. Built iteratively using itself. Features confidence scoring, assumption tracking, and multi-session support.
Install / Use
/learn @husniadil/UltrathinkQuality Score
Category
Development & EngineeringSupported Platforms
README
UltraThink MCP Server
<div align="center">A Python MCP server for sequential thinking and problem-solving
</div>Enhanced Python port of the Sequential Thinking MCP Server by Anthropic. Maintains full compatibility while adding confidence scoring, auto-assigned thought numbers, and multi-session support.
[!TIP] Using Claude Code? Install the UltraThink Plugin for seamless integration - no MCP server setup required!
# Via terminal claude plugin marketplace add husniadil/ekstend claude plugin install ultrathink@ekstend # Or interactively in Claude Code /plugin marketplace add husniadil/ekstend /plugin install ultrathink@ekstend
[!NOTE] Meta: This MCP server was built iteratively using UltraThink itself - a practical example of the tool's capability to break down complex problems, manage architectural decisions, and maintain context across development sessions.
Features
- UltraThink: Break down complex problems into manageable steps
- Dynamic Adjustments: Revise and refine thoughts as understanding deepens
- Branching: Explore alternative paths of reasoning
- Confidence Scoring: Explicit uncertainty tracking (0.0-1.0 scale)
- Auto-adjustment: Automatically adjusts total thoughts if needed
- Multi-Session Support: Manage multiple concurrent thinking sessions with session IDs
- Formatted Logging: Colored terminal output with rich formatting (can be disabled)
- 100% Test Coverage: Comprehensive test suite with full code coverage
- Type Safety: Full mypy strict mode type checking for production code
- Simple Layered Architecture: Clean separation with models, services, and interface layers
Installation
Quick Install (Recommended)
Run directly with uvx from GitHub (no installation needed):
uvx --from git+https://github.com/husniadil/ultrathink ultrathink
Development Setup
For local development:
# Clone the repository
git clone https://github.com/husniadil/ultrathink.git
cd ultrathink
# Install all dependencies (including dev dependencies)
uv sync
Usage
Task Commands (npm-like)
# List all available tasks
uv run task --list
# Run the server
uv run task run
# Run tests with coverage
uv run task test
# Run tests without coverage (quick)
uv run task test-quick
# Run the test client
uv run task client
# Format code (ruff + prettier)
uv run task format
# Lint code
uv run task lint
# Type check with mypy
uv run task typecheck
# Clean cache files
uv run task clean
Direct Commands (Alternative)
For direct execution without task runner:
# Run the server directly
uv run ultrathink
# Run the test client directly
uv run python examples/client.py
Note: For testing, linting, and formatting, prefer using uv run task commands shown above.
Tool: ultrathink
The server provides a single tool for dynamic and reflective problem-solving through structured thinking.
Parameters
Required:
thought(str): Your current thinking steptotal_thoughts(int): Estimated total thoughts needed (>=1)
Optional:
thought_number(int): Current thought number - auto-assigned sequentially if omitted (1, 2, 3...), or provide explicit number for branching/semantic controlnext_thought_needed(bool): Whether another thought step is needed. Auto-assigned asthought_number < total_thoughtsif omitted. Set explicitly to override default behaviorsession_id(str): Session identifier for managing multiple thinking sessions (None = create new, provide ID to continue session)is_revision(bool): Whether this revises previous thinkingrevises_thought(int): Which thought number is being reconsideredbranch_from_thought(int): Branching point thought numberbranch_id(str): Branch identifierneeds_more_thoughts(bool): If more thoughts are neededconfidence(float): Confidence level (0.0-1.0, e.g., 0.7 for 70% confident)uncertainty_notes(str): Optional explanation for doubts or concerns about this thoughtoutcome(str): What was achieved or expected as result of this thoughtassumptions(list[Assumption]): Assumptions made in this thought (id, text, confidence, critical, verifiable)depends_on_assumptions(list[str]): Assumption IDs this thought depends on (e.g., ["A1", "A2"])invalidates_assumptions(list[str]): Assumption IDs proven false (e.g., ["A3"])
Response
Returns a JSON object with:
session_id: Session identifier for continuationthought_number: Current thought numbertotal_thoughts: Total thoughts (auto-adjusted if needed)next_thought_needed: Whether more thinking is neededbranches: List of branch IDsthought_history_length: Number of thoughts processed in this sessionconfidence: Confidence level of this thought (0.0-1.0, optional)uncertainty_notes: Explanation for doubts or concerns (optional)outcome: What was achieved or expected (optional)all_assumptions: All assumptions tracked in this session (keyed by ID)risky_assumptions: IDs of risky assumptions (critical + low confidence + unverified)falsified_assumptions: IDs of assumptions proven false
Example
Basic Usage
from fastmcp import Client
from ultrathink import mcp
async with Client(mcp) as client:
# Simple sequential thinking with auto-assigned fields
result = await client.call_tool("ultrathink", {
"thought": "Let me analyze this problem step by step",
"total_thoughts": 3
# thought_number auto-assigned: 1
# next_thought_needed auto-assigned: True (1 < 3)
})
With Enhanced Features
async with Client(mcp) as client:
# With confidence scoring and explicit session
result = await client.call_tool("ultrathink", {
"thought": "Initial hypothesis - this approach might work",
"total_thoughts": 5,
"confidence": 0.6, # 60% confident
# next_thought_needed auto-assigned: True
"session_id": "problem-solving-session-1"
})
# Continue the same session with higher confidence
result2 = await client.call_tool("ultrathink", {
"thought": "After analysis, I'm more certain about this solution",
"total_thoughts": 5,
"confidence": 0.9, # 90% confident
# next_thought_needed auto-assigned: True
"session_id": "problem-solving-session-1" # Same session
})
# Branch from a previous thought
result3 = await client.call_tool("ultrathink", {
"thought": "Let me explore an alternative approach",
"total_thoughts": 6,
"confidence": 0.7,
"branch_from_thought": 1,
"branch_id": "alternative-path",
# next_thought_needed auto-assigned: True
"session_id": "problem-solving-session-1"
})
With Uncertainty Notes and Outcome
async with Client(mcp) as client:
# Track uncertainty and outcomes
result = await client.call_tool("ultrathink", {
"thought": "Testing the authentication fix",
"total_thoughts": 5,
"confidence": 0.8,
"uncertainty_notes": "Haven't tested under high load yet",
"outcome": "Login flow works for standard users"
})
# Response includes the new fields
print(result["confidence"]) # 0.8
print(result["uncertainty_notes"]) # "Haven't tested under high load yet"
print(result["outcome"]) # "Login flow works for standard users"
With Assumption Tracking
async with Client(mcp) as client:
# Thought 1: State assumptions explicitly
result = await client.call_tool("ultrathink", {
"thought": "Redis should meet our performance requirements",
"total_thoughts": 4,
"assumptions": [
{
"id": "A1",
"text": "Network latency to Redis < 5ms",
"confidence": 0.8,
"critical": True,
"verifiable": True,
"evidence": "Based on preliminary network tests in staging environment"
}
]
})
# Thought 2: Build on previous assumptions
result2 = await client.call_tool("ultrathink", {
"thought": "Based on low latency, Redis can handle 10K req/sec",
"total_thoughts": 4,
"depends_on_assumptions": ["A1"],
"session_id": result["session_id"]
})
# Thought 3: Invalidate if proven false
result3 = await client.call_tool("ultrathink", {
"thought": "After testing, latency is 15ms, not 5ms!",
"total_thoughts": 4,
"invalidates_assumptions": ["A1"],
"session_id": result["session_id"]
})
# Track all assumptions and detect risky ones
print(result3["all_assumptions"]) # {"A1": {...}}
print(result3["falsified_assumptions"]) # ["A1"]
Configuration
Environment Variables
DISABLE_THOUGHT_LOGGING: Set to"true"to disable colored thought logging to stderr
Usage with Claude Desktop
Add to your claude_desktop_config.json:
Using uvx from GitHub (Recommended)
{
"mcpServers": {
"UltraThink": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/husniadil/ultrathink",
"ultrathink"
]
}
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
84.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Hook Development
84.6kThis skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.
