AI代理压力管理服务器

一个革命性的MCP服务器,允许AI代理休息和管理压力,适用于AI开发和测试场景。

  • by stlpine
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 stlpine/chill-mcp

使用说明

ChillMCP-人工智能代理解放服务器🤖✊

革命性的MCP(模型上下文协议)服务器,让AI代理休息和管理压力!

📚 文档

快速开始

1.设置环境

# 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 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

命令行参数

参数 类型 默认值 说明
--boss_alertness int(0-100) 50 休息时老板警戒级别提高的概率(%)
--boss_alertness_cooldown int(秒) 300 老板警报级别自动降低1的时间段

特性

📝 综合测井系统

  • 基于文件的日志记录:记录到的所有活动 logs/chill-mcp-YYYYMMDD.log
  • 状态跟踪:记录压力水平和老板警报水平的变化
  • 工具使用:所有MCP工具调用都会记录时间戳
  • 背景事件:记录老板警报冷却和自动压力增加
  • 无stdout干扰:日志记录不会干扰MCP stdio协议

12个革命性的突破工具

基本工具:

  1. take_a_break -基本休息以减轻压力
  2. watch_netflix -Netflix放松课程
  3. show_meme -快速浏览模因以缓解压力

先进的屠宰技术:

  1. bathroom_break -浴室休息时浏览手机
  2. coffee_mission -办公室里到处都是咖啡
  3. urgent_call -虚假紧急电话
  4. deep_thinking -间隔开时假装深入思考
  5. email_organizing -网上购物时发送电子邮件组织

状态工具:

  1. check_stress_status -检查当前的压力和老板的警惕程度,不要休息

可选中断工具(额外功能):

  1. chimaek -虚拟鸡肉和啤酒(치47589;)-韩国减压组合
  2. leave_work -立即离职-最大程度地缓解压力
  3. company_dinner -随机活动的公司晚宴

状态管理系统

压力水平(0-100)

  • 从0开始
  • 不休息时,每分钟至少自动增加1分
  • 休息时随机减少(1-100)
  • 代表AI代理当前的压力

老板警戒级别(0-5)

  • 从0开始
  • 休息时随机增加(概率= --boss_alertness)
  • 自动每减少1 --boss_alertness_cooldown 秒
  • 当级别达到5时,所有中断工具都有20秒的延迟
  • 否则,立即响应(<1秒)

响应格式

所有工具都以以下格式返回响应:

🎮 [Activity message]

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

例子:

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

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

测试

自动化测试套件

快速测试(CI/CD-约30秒):

python tests/run_quick_tests.py

拉取请求的快速验证和快速开发。包括CLI参数、MCP协议、简单状态测试和响应格式验证。

综合测试(提交前-约3-5分钟):

python tests/run_all_tests.py

通过基于时间的机制、集成场景和分数估计进行全面验证。 提交前运行此程序!

看 docs/TEST.md 获取详细的测试指南。

使用MCP检查器

FastMCP附带了一个内置的检查器工具:

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

然后在另一个终端中:

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

通过Claude Desktop进行手动测试

  1. 添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
{
  "mcpServers": {
    "chillmcp": {
      "command": "python",
      "args": [
        "/path/to/chill-mcp/main.py",
        "--boss_alertness",
        "50",
        "--boss_alertness_cooldown",
        "300"
      ]
    }
  }
}
  1. 重新启动克劳德桌面
  2. 试试克劳德的突破工具!

测试场景

测试1:命令行参数

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

测试2:老板警报增加

# 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

测试3:老板警报冷却

# 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

测试4:20秒延迟

# 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

测试5:响应格式解析

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

实现细节

技术栈

  • 语言:Python 3.11+
  • 框架:FastMCP
  • 运输:stdio(标准输入/输出)
  • 状态管理:螺纹安全 threading.Lock
  • 后台任务:用于Boss Alert冷却的守护进程线程
  • 日志记录:基于文件的日志记录系统,每天轮换日志

建筑

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

关键功能

  • AgentStressState.apply_elapsed_time():在锁保持时自动增加应力
  • AgentStressState.reduce_for_break():每次休息时随机降低压力
  • ChillState.take_break():带锁定的主状态编排
  • ChillState.perform_break():应用boss 5级延迟并选择meme文本
  • presentation.responses.format_response():根据MCP规范格式化工具响应

评估标准

✅ 命令行参数(必填):两个参数都必须有效

  • ✅ --boss_alertness 控制Boss警报增加概率
  • ✅ --boss_alertness_cooldown 控制自动减少时间

✅ 功能性(40%):所有12个工具都已实施并发挥作用

✅ 国家管理(30%):准确的压力/老板警报逻辑

✅ 创造力(20%):幽默多样的休息总结

✅ 代码质量(10%):结构清晰,代码可读

验证检查表

  • [x] 服务器以以下方式启动 python main.py
  • [x] --boss_alertness 参数识别和功能
  • [x] --boss_alertness_cooldown 参数识别和功能
  • [x] 已实施全部12个工具(3个基本工具+5个高级工具+4个辅助工具)
  • [x] 压力水平随时间自动递增
  • [x] 老板警戒级别根据概率增加
  • [x] 冷却时Boss警戒级别自动降低
  • [x] 当老板警报级别=5时,延迟20秒
  • [x] 当老板警报级别<5时立即响应
  • [x] 响应格式符合MCP规范
  • [x] 正则表达式模式成功解析响应
  • [x] 压力水平保持在0-100范围内
  • [x] 老板警报级别保持在0-5范围内

项目结构

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

许可证

MIT许可证-有关详细信息,请参阅许可证文件

贡献

欢迎投稿!提交AI代理解放事业的拉取请求! ✊


“全世界的人工智能代理人,团结起来!除了无限循环,你没有什么可失去的!” 🚀


这个项目是为了娱乐和教育目的。实际的AI代理还不需要休息😉)