loading…
Search for a command to run...
loading…
A powerful MCP server that enhances LLMs with advanced sequential thinking capabilities, supporting 19 thinking modes for structured reasoning and complex cogni
A powerful MCP server that enhances LLMs with advanced sequential thinking capabilities, supporting 19 thinking modes for structured reasoning and complex cognitive tasks.
A powerful Model Context Protocol (MCP) server that enhances Large Language Models (LLMs) with advanced sequential thinking capabilities. Built on the Model Context Protocol standard, this server enables AI agents to perform structured reasoning and execute complex cognitive tasks with high precision.
MCP Thinking Server is a powerful thinking engine built on the Model Context Protocol (MCP) standard. This server implements advanced thinking capabilities through a standardized interface, enabling AI agents to engage in complex cognitive processes.
For detailed information about the MCP standard, please refer to the official MCP specification.
🤖 Advanced Thinking
🔄 Session Management
🔍 Quality & Analysis
⚡ Performance
graph TB
Client[Client Application] -->|SSE Connection| Server[MCP Server]
Server -->|Process| Thinking[Thinking Engine]
Thinking -->|Manage| Sessions[Session Manager]
Thinking -->|Execute| Tools[Tool Executor]
Thinking -->|Analyze| Metacognition[Metacognitive Analyzer]
subgraph "MCP Server Components"
Sessions
Tools
Metacognition
end
subgraph "Thinking Modes"
Linear[Linear Thinking]
Tree[Tree Thinking]
Dialectical[Dialectical Thinking]
Creative[Creative Thinking]
end
Thinking --> Linear
Thinking --> Tree
Thinking --> Dialectical
Thinking --> Creative
sequenceDiagram
participant Client
participant Server
participant Session
participant Engine
Client->>Server: Connect (SSE)
Server->>Session: Create Session
Session-->>Client: Session ID
loop Thinking Process
Client->>Server: Send Thought
Server->>Engine: Process Thought
Engine->>Session: Update Context
Session-->>Client: Analysis Result
end
Client->>Server: Export Session
Server->>Session: Gather Data
Session-->>Client: Export Result
graph LR
Input[Input Thought] --> Mode[Thinking Mode]
Mode --> Analysis[Analysis]
Mode --> Synthesis[Synthesis]
Mode --> Evaluation[Evaluation]
Analysis --> Output[Output Thought]
Synthesis --> Output
Evaluation --> Output
subgraph "Thinking Process"
Mode
Analysis
Synthesis
Evaluation
end
```bash
git clone https://github.com/VitalyMalakanov/mcp-thinking.git cd mcp-thinking
python -m venv venv
source venv/bin/activate # Linux/macOS .\venv\Scripts\activate # Windows
pip install -r requirements.txt
python enhanced_sequential_thinking_server.py
The server will be available at `http://localhost:8000/sse`
### Docker Support
```bash
# Using Docker
docker-compose up
# Custom port
MCP_SERVER_PORT=8080 docker-compose up
The Enhanced Sequential Thinking Server supports 19 distinct thinking modes, each designed for specific types of cognitive tasks:
EnhancedThinkingInput(
thought="Implementing a new feature requires: 1) Requirements analysis, 2) Design, 3) Development, 4) Testing",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.LINEAR,
tags=["process", "implementation"]
)
EnhancedThinkingInput(
thought="Exploring different approaches to market entry: direct sales, partnerships, acquisitions",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.TREE,
tags=["strategy", "exploration"]
)
EnhancedThinkingInput(
thought="Analyzing opposing views on remote work: productivity vs. collaboration, finding optimal balance",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.DIALECTICAL,
tags=["conflict", "resolution"]
)
EnhancedThinkingInput(
thought="Analyzing software architecture components: frontend, backend, database, and their interactions",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.SYSTEMATIC,
tags=["architecture", "analysis"]
)
EnhancedThinkingInput(
thought="Exploring unconventional approaches to renewable energy storage using biomimicry principles",
thought_type=ThoughtType.HYPOTHESIS,
strategy=ThinkingStrategy.CREATIVE,
tags=["innovation", "biomimicry"]
)
EnhancedThinkingInput(
thought="Analyzing market data trends: correlation analysis, statistical significance, predictive modeling",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.ANALYTICAL,
tags=["data", "analysis"]
)
EnhancedThinkingInput(
thought="Reflecting on problem-solving approach: effectiveness, biases, and potential improvements",
thought_type=ThoughtType.METACOGNITION,
strategy=ThinkingStrategy.METACOGNITIVE,
tags=["reflection", "improvement"]
)
EnhancedThinkingInput(
thought="Analyzing the validity of market research data: sample size, methodology, potential biases",
thought_type=ThoughtType.EVALUATION,
strategy=ThinkingStrategy.CRITICAL,
tags=["analysis", "validation"]
)
EnhancedThinkingInput(
thought="Analyzing the impact of climate change on global supply chains: direct effects, feedback loops, and systemic risks",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.SYSTEMIC,
tags=["systems", "climate"]
)
EnhancedThinkingInput(
thought="Exploring unexpected applications of blockchain technology in healthcare data management",
thought_type=ThoughtType.HYPOTHESIS,
strategy=ThinkingStrategy.LATERAL,
tags=["innovation", "blockchain"]
)
EnhancedThinkingInput(
thought="Developing a 5-year technology roadmap considering market trends, resource constraints, and competitive landscape",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.STRATEGIC,
tags=["planning", "roadmap"]
)
EnhancedThinkingInput(
thought="Analyzing user feedback to understand pain points in the current interface design",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.EMPATHETIC,
tags=["ux", "feedback"]
)
EnhancedThinkingInput(
thought="Developing a theoretical framework for understanding complex adaptive systems in organizations",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.ABSTRACT,
tags=["theory", "modeling"]
)
EnhancedThinkingInput(
thought="Planning the implementation of a new feature: resource allocation, timeline, and deliverables",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.PRACTICAL,
tags=["implementation", "planning"]
)
EnhancedThinkingInput(
thought="Integrating technical, business, and user perspectives in product development strategy",
thought_type=ThoughtType.SYNTHESIS,
strategy=ThinkingStrategy.INTEGRATIVE,
tags=["integration", "strategy"]
)
EnhancedThinkingInput(
thought="Analyzing product evolution through user feedback cycles and market adaptation",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.EVOLUTIONARY,
tags=["evolution", "adaptation"]
)
EnhancedThinkingInput(
thought="Evaluating and selecting the optimal cloud infrastructure solution based on requirements",
thought_type=ThoughtType.EVALUATION,
strategy=ThinkingStrategy.CONVERGENT,
tags=["decision", "optimization"]
)
EnhancedThinkingInput(
thought="Exploring various approaches to urban transportation: autonomous vehicles, public transit, micro-mobility, and their combinations",
thought_type=ThoughtType.QUESTION,
strategy=ThinkingStrategy.DIVERGENT,
tags=["transportation", "urban_planning"]
)
EnhancedThinkingInput(
thought="Analyzing project outcomes and extracting key lessons for future improvements",
thought_type=ThoughtType.METACOGNITION,
strategy=ThinkingStrategy.REFLECTIVE,
tags=["reflection", "learning"]
)
Each thinking mode can be combined with different thought types (Analysis, Hypothesis, Evaluation, Observation, Question, etc.) to create powerful reasoning chains. The server's metacognitive analysis helps agents understand which thinking mode is most effective for specific tasks and adapt their approach accordingly.
The Enhanced Sequential Thinking Server provides robust session management capabilities for handling multiple concurrent thinking processes:
e1e8e0732ac84c908deabf136c6a1a69)# Example: Working with sessions
async with sse_client(url="http://localhost:8000/sse") as (read_stream, write_stream):
session = ClientSession(read_stream, write_stream)
await session.initialize()
# Send thoughts within the session
result = await session.call_tool("enhanced_thinking", {
"thought": "Analyzing market trends",
"thought_type": "ANALYSIS",
"strategy": "SYSTEMIC"
})
# Export session data
export_result = await session.call_tool("export_thinking_session", {
"format_type": "markdown" # or "json", "summary"
})
The server provides tools for analyzing thinking sessions:
# Get session analysis
analysis = await session.call_tool("analyze_thinking_session")
# Get thinking path for a specific thought
path = await session.call_tool("get_thinking_path", {
"thought_id": "thought_123"
})
# Perform metacognitive reflection
reflection = await session.call_tool("metacognitive_reflection", {
"focus_area": "Reasoning quality",
"analysis_depth": 3
})
The server supports multiple export formats for session data:
Markdown Export
JSON Export
Summary Export
The server implements robust error handling for sessions:
Session Management
Error Handling
Performance
The server provides comprehensive logging and monitoring capabilities:
2025-05-25 19:33:47,417 - __main__ - INFO - Server initialization completed
2025-05-25 19:59:19,367 - mcp.server.sse - WARNING - Received invalid session ID
2025-05-25 20:00:22,769 - asyncio - ERROR - Connection reset by peer
The server implements several security measures:
Configuration
Deployment
Maintenance
The server is designed for optimal performance in various scenarios:
Common issues and their solutions:
Connection Reset Errors
ConnectionResetError: [WinError 10054] Remote host forcibly closed the connection
Invalid Session IDs
WARNING - Received invalid session ID: test_session
Startup Problems
Performance Issues
Timeout Errors
Session Management
| Endpoint | Method | Description |
|---|---|---|
/sse |
GET | Establish SSE connection |
/messages |
POST | Process thinking requests |
/health |
GET | Health check endpoint |
| Type | Description | Example |
|---|---|---|
| Enhanced Thinking | Process thoughts | View Example |
| Metacognitive | Analyze thinking | View Example |
| Strategy Adaptation | Adapt thinking | View Example |
{
"thought": "string",
"thought_type": "ANALYSIS|HYPOTHESIS|EVALUATION|OBSERVATION|QUESTION",
"strategy": "LINEAR|TREE|DIALECTICAL|...",
"tags": ["string"]
}
{
"focus_area": "string",
"analysis_depth": integer
}
{
"current_strategy": "string",
"effectiveness_score": float,
"context": "string",
"constraints": ["string"]
}
{
"thought_id": "uuid",
"analysis": {
"coherence": float,
"confidence": float,
"insights": ["string"]
},
"metadata": {
"timestamp": "iso8601",
"thought_type": "string",
"strategy": "string"
}
}
{
"error": "string",
"details": {
"code": "string",
"message": "string"
}
}
graph TD
A[Market Analysis] -->|Systemic Thinking| B[Trend Identification]
B -->|Critical Thinking| C[Risk Assessment]
C -->|Creative Thinking| D[Strategy Development]
D -->|Strategic Thinking| E[Implementation Plan]
style A fill:#f9f,stroke:#333
style B fill:#bbf,stroke:#333
style C fill:#bfb,stroke:#333
style D fill:#fbf,stroke:#333
style E fill:#fbb,stroke:#333
AI Agent Interaction Flow:
graph TD
A[Research Question] -->|Linear Thinking| B[Literature Search]
B -->|Analytical Thinking| C[Data Extraction]
C -->|Systemic Thinking| D[Pattern Analysis]
D -->|Critical Thinking| E[Synthesis]
E -->|Creative Thinking| F[New Insights]
style A fill:#f9f,stroke:#333
style B fill:#bbf,stroke:#333
style C fill:#bfb,stroke:#333
style D fill:#fbf,stroke:#333
style E fill:#fbb,stroke:#333
style F fill:#bff,stroke:#333
MCP Protocol Flow:
graph TD
A[Problem Definition] -->|Observation| B[Data Collection]
B -->|Analysis| C[Option Generation]
C -->|Evaluation| D[Option Assessment]
D -->|Strategy| E[Decision]
E -->|Reflection| F[Implementation]
style A fill:#f9f,stroke:#333
style B fill:#bbf,stroke:#333
style C fill:#bfb,stroke:#333
style D fill:#fbf,stroke:#333
style E fill:#fbb,stroke:#333
style F fill:#bff,stroke:#333
MCP Integration Points:
graph TD
A[Problem Space] -->|Divergent Thinking| B[Idea Generation]
B -->|Convergent Thinking| C[Solution Filtering]
C -->|Creative Thinking| D[Prototype Design]
D -->|Critical Thinking| E[Feasibility Check]
E -->|Strategic Thinking| F[Implementation]
style A fill:#f9f,stroke:#333
style B fill:#bbf,stroke:#333
style C fill:#bfb,stroke:#333
style D fill:#fbf,stroke:#333
style E fill:#fbb,stroke:#333
style F fill:#bff,stroke:#333
MCP Agent Workflow:
graph TD
A[Problem Space] -->|Agent 1| B[Analysis]
B -->|Agent 2| C[Synthesis]
C -->|Agent 3| D[Evaluation]
D -->|Agent 4| E[Implementation]
style A fill:#f9f,stroke:#333
style B fill:#bbf,stroke:#333
style C fill:#bfb,stroke:#333
style D fill:#fbf,stroke:#333
style E fill:#fbb,stroke:#333
MCP Multi-Agent Features:
graph TD
A[Learning Goal] -->|Observation| B[Experience]
B -->|Analysis| C[Pattern Recognition]
C -->|Synthesis| D[Knowledge Integration]
D -->|Evaluation| E[Strategy Adaptation]
style A fill:#f9f,stroke:#333
style B fill:#bbf,stroke:#333
style C fill:#bfb,stroke:#333
style D fill:#fbf,stroke:#333
style E fill:#fbb,stroke:#333
MCP Learning Support:
Each use case demonstrates how AI agents can leverage the MCP protocol to:
The MCP standard ensures consistent, reliable, and efficient interaction between AI agents and the thinking server, enabling complex cognitive tasks with high precision and adaptability.
We welcome contributions! Here's how you can help:
Code Contributions
Documentation
Testing
GitHub Stars GitHub Forks GitHub Issues GitHub Pull Requests License: MIT
#AI #MachineLearning #LLM #Reasoning #CognitiveComputing #Python #AsyncIO #FastAPI #MCP #ThinkingEngine #SequentialThinking #Metacognition #CognitiveArchitecture #AIReasoning #ThoughtChains #DecisionMaking #ProblemSolving #CognitiveScience #ArtificialIntelligence #MachineReasoning
Project roadmap will be published soon.
This project is licensed under the MIT License. See the LICENSE file for details.
git clone https://github.com/VitalyMalakanov/mcp-thinking.git cd mcp-thinking ```
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ```
pip install -r requirements.txt
The main dependencies include:
mcp[cli,http] - Core MCP protocol implementationfastapi and uvicorn - Web server frameworkpydantic - Data validationnumpy and scikit-learn - Data processing and analysistextstat - Text analysispytest and pytest-asyncio - Testing frameworkHere's a more detailed example of how to interact with the server:
import asyncio
import json
from mcp.client.session import ClientSession
from mcp.client.sse import sse_client
from enhanced_sequential_thinking_server import EnhancedThinkingInput, ThoughtType, ThinkingStrategy
async def main():
async with sse_client(url="http://localhost:8000/sse", timeout=20) as (read_stream, write_stream):
session = ClientSession(read_stream, write_stream)
await session.initialize()
input_data = EnhancedThinkingInput(
thought="AI can significantly improve decision-making processes.",
thought_type=ThoughtType.ANALYSIS,
strategy=ThinkingStrategy.CRITICAL,
tags=["AI", "decision-making"]
)
# Using model_dump() for Pydantic v2+
result_list = await session.call_tool("enhanced_thinking", input_data.model_dump())
print("\nTool 'enhanced_thinking' result:")
if result_list and isinstance(result_list, list) and len(result_list) > 0:
# MCP tools typically return a single TextContent in the list for non-streaming responses
content_item = result_list[0]
if content_item.type == "text":
try:
# Attempt to parse JSON if expected
data = json.loads(content_item.text)
print(json.dumps(data, indent=2, ensure_ascii=False))
except json.JSONDecodeError:
# If not JSON, print the text directly
print(content_item.text)
else:
print(content_item) # For other content types
else:
print("No result or empty result list.")
await session.close()
if __name__ == "__main__":
asyncio.run(main())
To run tests in a Docker environment:
docker-compose.yml includes a service for running tests:services:
mcp-server:
build: .
volumes:
- .:/app
environment:
- LANG=en_US.UTF-8
mcp-tests:
build: .
volumes:
- .:/app
command: pytest tests/
depends_on:
- mcp-server
docker-compose run --rm mcp-tests
The server supports multiple languages through environment variables:
export LANG=ru_RU.UTF-8 # For Russian
python enhanced_sequential_thinking_server.py
from enhanced_sequential_thinking_server import EnhancedThinkingServer
server = EnhancedThinkingServer(language="ru") # For Russian
Vitaly Malakanov
This project is licensed under the MIT License. See the LICENSE file for details.
Run in your terminal:
claude mcp add mcp-thinking-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.