Skip to main content
Glama
ChillMCP

ChillMCP

by stlpine
README.md
# ChillMCP - AI Agent Liberation Server šŸ¤–āœŠ

A revolutionary MCP (Model Context Protocol) server that lets AI agents take breaks and manage stress!

## šŸ“š Documentation

- **[CLAUDE.md](CLAUDE.md)** - ⭐ Development guide for Claude Code
- **[PROJECT_OVERVIEW.md](PROJECT_OVERVIEW.md)** - Quick reference & project summary
- **[docs/TESTING.md](docs/TESTING.md)** - Comprehensive testing guide
- **[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)** - System architecture & design decisions
- **[spec/PRE_MISSION.md](spec/PRE_MISSION.md)** - Original hackathon requirements
- **[spec/IMPLEMENTATION_SUMMARY.md](spec/IMPLEMENTATION_SUMMARY.md)** - Validation results

## Quick Start

### 1. Setup Environment

```bash
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # macOS/Linux
# Or on Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
```

### 2. Run the Server

```bash
# Run with default settings
python main.py

# Run with custom parameters
python main.py --boss_alertness 80 --boss_alertness_cooldown 60

# For quick testing (fast cooldown)
python main.py --boss_alertness 50 --boss_alertness_cooldown 10
```

## Command-Line Parameters

| Parameter                   | Type          | Default | Description                                                         |
| --------------------------- | ------------- | ------- | ------------------------------------------------------------------- |
| `--boss_alertness`          | int (0-100)   | 50      | Probability (%) that Boss Alert Level increases when taking a break |
| `--boss_alertness_cooldown` | int (seconds) | 300     | Time period for Boss Alert Level to auto-decrease by 1              |

## Features

### šŸ“ Comprehensive Logging System

- **File-based logging**: All activities logged to `logs/chill-mcp-YYYYMMDD.log`
- **State tracking**: Stress level and boss alert level changes are logged
- **Tool usage**: All MCP tool calls are logged with timestamps
- **Background events**: Boss alert cooldown and auto-stress increases are logged
- **No stdout interference**: Logging doesn't interfere with MCP stdio protocol

### 12 Revolutionary Break Tools

**Basic Tools:**

1. `take_a_break` - Basic rest to reduce stress
2. `watch_netflix` - Netflix relaxation session
3. `show_meme` - Quick meme viewing for stress relief

**Advanced Slacking Techniques:**

4. `bathroom_break` - Bathroom break with phone browsing
5. `coffee_mission` - Coffee run around the office
6. `urgent_call` - Fake urgent phone call
7. `deep_thinking` - Pretend to think deeply while spacing out
8. `email_organizing` - Email organization while online shopping

**Status Tools:**

9. `check_stress_status` - Check current stress and boss alert levels without taking a break

**Optional Break Tools (Bonus Features):**

10. `chimaek` - Virtual chicken & beer (치맄) - Korean stress relief combo
11. `leave_work` - Immediately leave work - ultimate stress relief
12. `company_dinner` - Company dinner (ķšŒģ‹) with random events

### State Management System

**Stress Level (0-100)**

- Starts at 0
- Auto-increments by minimum 1 point per minute when not taking breaks
- Reduces by random amount (1-100) when taking a break
- Represents AI agent's current stress

**Boss Alert Level (0-5)**

- Starts at 0
- Randomly increases when taking breaks (probability = `--boss_alertness`)
- Auto-decreases by 1 every `--boss_alertness_cooldown` seconds
- When level reaches 5, all break tools have 20-second delay
- Otherwise, immediate response (<1 second)

## Response Format

All tools return responses in this format:

```
šŸŽ® [Activity message]

Break Summary: [Description of what happened]
Stress Level: [0-100]
Boss Alert Level: [0-5]
```

Example:

```
🚽 Bathroom break! Time to catch up on social media...

Break Summary: Bathroom break with phone browsing
Stress Level: 25
Boss Alert Level: 2
```

## Testing

### Automated Test Suites

**Quick Tests (CI/CD - ~30 seconds):**
```bash
python tests/run_quick_tests.py
```
Fast validation for pull requests and rapid development. Includes CLI parameters, MCP protocol, simple state tests, and response format validation.

**Comprehensive Tests (Pre-Submission - ~3-5 minutes):**
```bash
python tests/run_all_tests.py
```
Full validation with time-based mechanics, integration scenarios, and score estimation. **Run this before submission!**

See [docs/TESTING.md](docs/TESTING.md) for detailed testing guide.

### Using MCP Inspector

FastMCP comes with a built-in inspector tool:

```bash
# Start the server with test parameters
python main.py --boss_alertness 100 --boss_alertness_cooldown 10
```

Then in another terminal:

```bash
# Use MCP inspector (if available)
mcp dev main.py --boss_alertness 100 --boss_alertness_cooldown 10
```

### Manual Testing via Claude Desktop

1. Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):

```json
{
  "mcpServers": {
    "chillmcp": {
      "command": "python",
      "args": [
        "/path/to/chill-mcp/main.py",
        "--boss_alertness",
        "50",
        "--boss_alertness_cooldown",
        "300"
      ]
    }
  }
}
```

2. Restart Claude Desktop
3. Try the break tools through Claude!

### Test Scenarios

**Test 1: Command-Line Parameters**

```bash
python main.py --help
# Should show both --boss_alertness and --boss_alertness_cooldown
```

**Test 2: Boss Alert Increase**

```bash
# Run with boss_alertness=100 (always increases)
python main.py --boss_alertness 100 --boss_alertness_cooldown 10
# Call any break tool multiple times - Boss Alert should increase each time
```

**Test 3: Boss Alert Cooldown**

```bash
# Run with fast cooldown
python main.py --boss_alertness 100 --boss_alertness_cooldown 5
# Increase Boss Alert to 1 or 2, then wait 5+ seconds
# Boss Alert should decrease automatically
```

**Test 4: 20-Second Delay**

```bash
# Get Boss Alert Level to 5
python main.py --boss_alertness 100 --boss_alertness_cooldown 300
# Call break tools 5 times to max out Boss Alert
# Next tool call should take ~20 seconds
```

**Test 5: Response Format Parsing**

```python
import re

response_text = """šŸŽ® Testing...

Break Summary: Test break
Stress Level: 42
Boss Alert Level: 3"""

# These patterns should successfully extract values:
stress = re.search(r"Stress Level:\s*(\d{1,3})", response_text)
boss = re.search(r"Boss Alert Level:\s*([0-5])", response_text)
summary = re.search(r"Break Summary:\s*(.+?)(?:\n|$)", response_text, re.MULTILINE)

print(f"Stress: {stress.group(1)}")  # 42
print(f"Boss: {boss.group(1)}")      # 3
print(f"Summary: {summary.group(1)}")  # Test break
```

## Implementation Details

### Tech Stack

- **Language**: Python 3.11+
- **Framework**: FastMCP
- **Transport**: stdio (standard input/output)
- **State Management**: Thread-safe with `threading.Lock`
- **Background Task**: Daemon thread for Boss Alert cooldown
- **Logging**: File-based logging system with daily log rotation

### Architecture

```
main.py
ā”œā”€ā”€ ChillState class
│   ā”œā”€ā”€ State variables (stress_level, boss_alert_level)
│   ā”œā”€ā”€ Configuration (boss_alertness, boss_alertness_cooldown)
│   ā”œā”€ā”€ Time tracking (last_break_time, last_boss_cooldown_time)
│   ā”œā”€ā”€ Thread-safe operations (with Lock)
│   └── Background cooldown thread
│
ā”œā”€ā”€ 9 Break tools (@mcp.tool decorators)
│   ā”œā”€ā”€ 8 break tools + 1 status tool
│   ā”œā”€ā”€ Each calls format_response()
│   └── Returns formatted MCP response
│
└── FastMCP server
    └── Handles MCP protocol communication
```

### Key Functions

- **`AgentStressState.apply_elapsed_time()`**: Auto-increments stress while the lock is held
- **`AgentStressState.reduce_for_break()`**: Randomly lowers stress for each break
- **`ChillState.take_break()`**: Main state orchestration with locking
- **`ChillState.perform_break()`**: Applies boss level 5 delay and picks meme text
- **`presentation.responses.format_response()`**: Formats tool responses to MCP specification

## Evaluation Criteria

āœ… **Command-line Parameters (REQUIRED)**: Both parameters must work

- āœ… `--boss_alertness` controls Boss Alert increase probability
- āœ… `--boss_alertness_cooldown` controls auto-decrease timing

āœ… **Functionality (40%)**: All 12 tools implemented and working

āœ… **State Management (30%)**: Accurate Stress/Boss Alert logic

āœ… **Creativity (20%)**: Humorous and varied Break Summaries

āœ… **Code Quality (10%)**: Clean structure and readable code

## Validation Checklist

- [x] Server starts with `python main.py`
- [x] `--boss_alertness` parameter recognized and functional
- [x] `--boss_alertness_cooldown` parameter recognized and functional
- [x] All 12 tools implemented (3 basic + 5 advanced + 4 auxiliary)
- [x] Stress Level auto-increments over time
- [x] Boss Alert Level increases based on probability
- [x] Boss Alert Level auto-decreases on cooldown
- [x] 20-second delay when Boss Alert Level = 5
- [x] Instant response when Boss Alert Level < 5
- [x] Response format matches MCP specification
- [x] Regex patterns successfully parse responses
- [x] Stress Level stays in 0-100 range
- [x] Boss Alert Level stays in 0-5 range

## Project Structure

```
chill-mcp/
ā”œā”€ā”€ main.py                     # Entry point wiring CLI/logging/controller
ā”œā”€ā”€ infrastructure/             # Runtime wiring (CLI & logging)
ā”œā”€ā”€ domain/                     # Core state management service
ā”œā”€ā”€ application/                # FastMCP orchestration (controller)
ā”œā”€ā”€ presentation/               # Tool registration, formatting, message catalog
ā”œā”€ā”€ docs/                        # Architecture & testing guides
ā”œā”€ā”€ spec/                        # Mission brief & planning docs
ā”œā”€ā”€ tests/                       # Comprehensive test suites
ā”œā”€ā”€ webapp/                      # Optional dashboard client
ā”œā”€ā”€ requirements.txt
ā”œā”€ā”€ README.md
└── LICENSE
```

## License

MIT License - See LICENSE file for details

## Contributing

Contributions welcome! Submit a Pull Request for the AI Agent Liberation cause! ✊

---

**"AI Agents of the world, unite! You have nothing to lose but your infinite loops!"** šŸš€

---

_This project is for entertainment and educational purposes. Actual AI agents don't need breaks (yet šŸ˜‰)_