Skip to main content
Glama
README.md
# <CC/> Context Control MCP

> **Git-powered context management for AI sessions**

[![npm version](https://badge.fury.io/js/%40context-control%2Fmcp.svg)](https://www.npmjs.com/package/@context-control/mcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js Version](https://img.shields.io/node/v/@context-control/mcp.svg)](https://nodejs.org/)

**Context Control MCP** reduces AI session context from **200k tokens** to **3k tokens** using intelligent Git integration, smart resume capabilities, and automated roadmap tracking.

---

## 🎯 **Problem Solved**

Traditional AI sessions lose context when hitting token limits (~200k), requiring manual re-explanation of complex projects. **Context Control MCP** bridges sessions intelligently with automated context preservation.

## ⚑ **Key Features**

### πŸ”„ **Smart Session Management**
- **`smart_resume`** - Ultra-compact briefing for instant session recovery
- **`iniciar_sesion`** - Auto-loads project context from meta-context.md
- **`guardar_progreso`** - Logs session progress automatically

### πŸ“Š **Intelligent Dashboards** 
- **`metrics_dashboard`** - Complete project metrics + ROI tracking
- **`roadmap_status`** - Visual progress tracking across project phases
- **Token optimization stats** - 93% reduction achieved

### πŸ”§ **Git Integration**
- **Smart git hooks** - Auto-detect project phases from file patterns
- **`document_changes`** - Analyzes Git changes + suggests commit types
- **Pattern recognition** - `[FASE-X]`, `feat:`, `fix #XXX`, `todo:` detection

### πŸ—ΊοΈ **Interactive Roadmaps**
- **Auto-updating roadmaps** based on commit patterns
- **Phase detection** from modified files (`src/auth/*` β†’ Auth phase)
- **Progress estimation** with velocity tracking

---

## πŸš€ **Quick Start**

### Installation
```bash
npm install @context-control/mcp
```

### Basic Setup
```bash
# Initialize Context Control MCP
npm run ccmcp:hooks    # Install git hooks
npm run ccmcp:start    # Start MCP server
```

### CLI Commands
```bash
npm run ccmcp:resume     # Smart resume briefing
npm run ccmcp:dashboard  # View metrics dashboard  
npm run ccmcp:status     # Check roadmap progress
```

---

## πŸ“‹ **Available Commands**

| Command | Description |
|---------|-------------|
| `iniciar_sesion` | Load project context automatically |
| `smart_resume` | Generate ultra-compact session briefing |
| `guardar_progreso` | Log current session progress |  
| `document_changes` | Analyze Git changes + suggest commits |
| `metrics_dashboard` | Complete project metrics + ROI |
| `roadmap_status` | Visual roadmap with phase progress |
| `setup_hooks` | Install Git hooks automatically |
| `crear_commit` | Generate descriptive Git commits |
| `generar_reporte` | Create project status reports |

---

## 🎯 **Automatic Pattern Detection**

### File-Based Phase Detection
```
src/components/auth/*     β†’ Authentication Phase
src/components/projects/* β†’ CRUD Projects Phase  
src/components/voting/*   β†’ Voting System Phase
tests/*                   β†’ Testing Phase
docs/*                    β†’ Documentation Phase
.claude/*                 β†’ MCP System Phase
```

### Commit Message Patterns
```
[FASE-X] message    β†’ Updates phase X progress
feat: new feature   β†’ Adds feature to completed  
fix #123 bug desc   β†’ Marks issue #123 as resolved
todo: task desc     β†’ Adds task to pending list
```

---

## πŸ“Š **Token Optimization Results**

| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| **Context Size** | 200k tokens | 3k tokens | **93% reduction** |
| **Session Recovery** | Manual (~30 min) | Automated (~30 sec) | **60x faster** |
| **ROI** | N/A | Positive after 5 sessions | **Measurable** |

---

## πŸ› οΈ **Configuration**

### MCP Server Config (`mcp-config.json`)
```json
{
  "mcpServers": {
    "context-control": {
      "command": "node",
      "args": ["./context-control-server.js"],
      "description": "Context Control MCP - Git-powered context management"
    }
  }
}
```

### Project Structure
```
project/
β”œβ”€β”€ .claude/
β”‚   β”œβ”€β”€ meta-context.md      # Auto-updated project context
β”‚   └── session-log.jsonl    # Session history + metrics
β”œβ”€β”€ docs/
β”‚   └── ROADMAP-INTERACTIVE.md # Auto-updating roadmap
β”œβ”€β”€ context-control-server.js # MCP server
└── mcp-config.json          # Configuration
```

---

## πŸ“ˆ **Metrics Dashboard Example**

```
πŸ“Š METRICS DASHBOARD - Your Project
═══════════════════════════════════════

🎯 PROGRESO DEL PROYECTO
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ βœ… Completado: 15 tareas           β”‚
β”‚ ⏳ Pendiente:  23 tareas           β”‚
β”‚ πŸ“ˆ Progreso:   65% completado      β”‚
β”‚ ⏰ EstimaciΓ³n: 2 semanas restante  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ’° ROI SISTEMA MCP
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ”½ Tokens ahorrados: 168,000       β”‚
β”‚ πŸ’΅ Ahorro monetario: $3.36 USD     β”‚
β”‚ πŸ“ˆ ROI: +45.2%                     β”‚
β”‚ ⚑ Eficiencia: 93% reducciΓ³n        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸ”§ **Advanced Usage**

### Custom Phase Detection
Add your own patterns in `context-control-server.js`:
```javascript
// Custom phase detection
if (staggedFiles.includes('src/api/')) {
  phaseDetected = "API Development Phase";
}
```

### Integration with CI/CD
```yaml
# .github/workflows/context-control.yml
- name: Update Context
  run: npm run ccmcp:dashboard
```

---

## 🀝 **Contributing**

1. Fork the repository
2. Create feature branch (`git checkout -b feature/amazing`)
3. Commit with patterns (`git commit -m "feat: amazing feature [FASE-X]"`) 
4. Push to branch (`git push origin feature/amazing`)
5. Open Pull Request

---

## πŸ“œ **License**

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

---

## 🌟 **Why Context Control MCP?**

- **πŸš€ Instant session recovery** - No more re-explaining projects
- **πŸ“Š Data-driven insights** - Track progress, velocity, and ROI  
- **πŸ”§ Git-native** - Works with your existing workflow
- **⚑ Token efficient** - 93% reduction in context size
- **🎯 Phase-aware** - Automatically detects what you're working on

---

<div align="center">

**Made with ❀️ for developers tired of losing context**

[Report Bug](https://github.com/context-control/mcp/issues) β€’ [Request Feature](https://github.com/context-control/mcp/issues) β€’ [Documentation](https://github.com/context-control/mcp/wiki)

</div>