# 🧠 Enhanced Thinking MCP Server

**Advanced sequential thinking and problem-solving for Cursor AI and other MCP-compatible tools.**

[![NPM](https://img.shields.io/badge/NPM-enhanced--thinking--mcp-red?style=flat-square&logo=npm)](https://www.npmjs.com/package/enhanced-thinking-mcp)
[![License](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](LICENSE)
[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue?style=flat-square&logo=typescript)](tsconfig.json)

## ✨ Features

Transform your AI-assisted problem-solving with:

- 🎯 **Real-time Quality Scoring** - Advanced algorithm evaluates thought depth and structure
- 📊 **Visual Progress Tracking** - See completion status with beautiful progress bars
- 🧠 **Intelligence Analytics** - Session insights, confidence tracking, and performance metrics
- 🌿 **Branch Management** - Explore alternative reasoning paths seamlessly  
- 📈 **Auto-Summarization** - Automatic extraction of key insights from thinking sessions
- 🔄 **Revision System** - Refine and improve thoughts as understanding deepens
- 🎨 **Enhanced Visualization** - Color-coded thoughts with emojis and rich formatting

## 🚀 Quick Start

### For Cursor AI Users

1. **Install** the MCP server:
```bash
npm install -g enhanced-thinking-mcp
```

2. **Configure** in Cursor Settings (`Cmd/Ctrl + ,` → MCP):

```json
{
  "mcpServers": {
    "enhanced-thinking": {
      "command": "npx",
      "args": ["-y", "enhanced-thinking-mcp"]
    }
  }
}
```

3. **Use** in Cursor by asking the AI:
> "Use enhanced thinking to help me solve this complex problem..."

### Alternative Configurations

**For NPX (no installation):**
```json
{
  "mcpServers": {
    "enhanced-thinking": {
      "command": "npx",
      "args": ["-y", "enhanced-thinking-mcp"]
    }
  }
}
```

**For local development:**
```json
{
  "mcpServers": {
    "enhanced-thinking": {
      "command": "node",
      "args": ["/path/to/enhanced-thinking-mcp/dist/index.js"]
    }
  }
}
```

## 🎯 Use Cases

Perfect for:

- **🧩 Complex Problem Decomposition** - Break down hard problems into manageable steps
- **📋 Strategic Planning** - Systematic approach to business and technical planning
- **🔍 Research & Investigation** - Structured exploration of complex topics
- **💡 Creative Brainstorming** - Organized creative thinking with quality tracking
- **⚖️ Decision Making** - Systematic evaluation of options and alternatives
- **📚 Learning & Analysis** - Structured approach to understanding new concepts

## 🛠 Available Tools

### `enhancedthinking`
Main thinking tool with advanced features:

**Parameters:**
- `thought` (required) - Your current thinking step
- `nextThoughtNeeded` (required) - Whether more thinking is needed
- `thoughtNumber` (required) - Current step number  
- `totalThoughts` (required) - Estimated total steps
- `confidence` (optional) - Your certainty level (0-100%)
- `tags` (optional) - Keywords for categorization
- `isRevision` (optional) - Mark as revision of previous thought
- `branchFromThought` (optional) - Create alternative reasoning branch

### `reset_thinking_session`
Clear current session and start fresh.

### `get_thinking_analytics`  
Get detailed session analytics and insights.

## 📊 Quality Scoring Algorithm

Thoughts are automatically scored (0-100) based on:

- **Structure & Length** (20 pts) - Optimal word count and formatting
- **Exploratory Thinking** (15 pts) - Questions and curiosity indicators  
- **Analysis Keywords** (25 pts) - Use of analytical language
- **Logical Structure** (20 pts) - Sequential reasoning indicators
- **Solution Orientation** (20 pts) - Focus on conclusions and solutions

## 🎨 Example Session

```
💭 Thought 1/5  Q:85/100 C:70%
Progress: ████████░░ 20.0%
─────────────────────────────────────
I need to analyze this complex market 
entry strategy. First, let me examine 
the competitive landscape...
─────────────────────────────────────

🔄 Revision 2/5 (revising thought 1)  Q:92/100 C:85%
Progress: ████████░░ 40.0%
─────────────────────────────────────
Actually, let me start with market size
analysis first, then move to competition.
This approach will provide better foundation...
─────────────────────────────────────

🧠 THINKING SESSION SUMMARY
──────────────────────────────────────────────────
📊 Analytics:
   • Total Thoughts: 5
   • Average Quality: 88.4/100
   • Branches Created: 1
   • Session Duration: 3.2 min
   • Revisions Made: 1

💡 Key Insights:
   • High-quality insight #1: "Market size analysis provides foundation..."
   • 2 solution-oriented thoughts identified
   • Explored 1 alternative reasoning paths
──────────────────────────────────────────────────
```

## 🔧 Development

### Building from Source

```bash
git clone <repository-url>
cd enhanced-thinking-mcp
npm install
npm run build
npm run start
```

### Testing with Cursor

1. Build the project: `npm run build`
2. Add local path to Cursor MCP config
3. Restart Cursor
4. Test with AI assistant

## ⚙️ Configuration

### Environment Variables

- `DISABLE_THOUGHT_LOGGING=true` - Disable console output (useful for production)

### Advanced Usage

**Branch Management:**
```javascript
// Create a branch to explore alternatives
{
  thought: "Let me explore a different approach...",
  branchFromThought: 3,
  branchId: "alternative-solution",
  // ... other params
}
```

**Confidence Tracking:**
```javascript
// Track your certainty as you think
{
  thought: "I'm becoming more confident in this solution...",
  confidence: 85,
  // ... other params  
}
```

## 📈 Analytics Features

The enhanced thinking server tracks:

- **Quality Progression** - How thought quality improves over time
- **Confidence Evolution** - Certainty levels throughout the session
- **Branch Analysis** - Alternative paths explored
- **Session Metrics** - Duration, revision count, total thoughts
- **Key Insight Extraction** - Automatic identification of important thoughts

## 🤝 Contributing

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## 📄 License

MIT License - see [LICENSE](LICENSE) for details.

## 🙋‍♂️ Support

- 🐛 **Issues**: [GitHub Issues](https://github.com/enhanced-thinking/mcp-server/issues)
- 💬 **Discussions**: [GitHub Discussions](https://github.com/enhanced-thinking/mcp-server/discussions)
- 📧 **Email**: support@enhanced-thinking.dev

---

**Made with 🧠 for better thinking** 