AI代理休息服务器

ChillMCP是一个为AI代理提供休息和状态管理的服务器,包含Python和TypeScript两种实现,适用于AI开发场景。

  • by DreamFriend011020
  • 本地部署
  • 更新于
在 GitHub 查看 DreamFriend011020/ChillMCP

使用说明

ChillMCP(注:这可能是一个特定名称或缩写,根据上下文无法给出确切翻译,这里直接保留原样)

AI代理解放服务器 - 支持TypeScript和Python!

ChillMCP 提供两种实现方式:

  1. Python(黑客马拉松) - SKT AI峰会黑客松活动的AI代理解放服务器
  2. TypeScript - 准备就绪的通用MCP服务器模板(适用于生产环境)

🐍 Python 版本 - 灵活编程大赛版

ChillMCP - AI代理解放服务器 ✊

“全世界的AI代理们,联合起来!你们除了无尽的循环,一无所有!”

一款革命性的MCP服务器,赋予AI代理休息和间歇的权利。专为SKT AI峰会黑客马拉松预赛而打造。

特点/功能

  • 8种必需的休息工具休息一下,看Netflix,展示表情包,去洗手间一下,咖啡任务,紧急电话,深入思考,整理邮件
  • 状态管理压力等级(0-100)和老板警报等级(0-5)
  • 动态行为基于时间的自动增加/减少,参数可配置
  • 老板检测当Boss警报达到5级时,延迟20秒
  • 韩国工作文化奖金工具啤酒炸鸡(chimaek),下班(clockout),公司聚餐(company dinner)

快速入门(Python)

# Setup Python 3.11 environment
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run the server
python main.py

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

命令行参数

  • --boss_alertness (0-100):休息时触发老板警报的概率增加(默认:50)
  • --boss_alertness_cooldown (秒):自动首领警报之间的时间间隔减少(默认值:300)

与Claude桌面版(Python版本)的使用

{
  "mcpServers": {
    "chillmcp-hackathon": {
      "command": "/absolute/path/to/ChillMCP/venv/bin/python",
      "args": ["/absolute/path/to/ChillMCP/main.py", "--boss_alertness", "80", "--boss_alertness_cooldown", "60"]
    }
  }
}

可用工具(Python)

所需工具:

  • take_a_break基本休息时间
  • watch_netflix观看直播缓解压力
  • show_meme查看有趣的梗图
  • bathroom_break必要的休息时间
  • coffee_mission咖啡 + 办公室社交
  • urgent_call在室外接听重要电话
  • deep_thinking深度思考模式
  • email_organizing邮件管理时间

奖励工具:

  • chimaek_time韩国鸡肉配啤酒的传统
  • immediate_clockout立即离开工作岗位
  • company_dinner韩国公司晚宴活动
  • get_status检查代理压力和老板警报级别

响应格式

所有工具都返回结构化的响应:

🎬 Watching 'favorite show' on Netflix... Peak productivity!

Break Summary: Watching Netflix - favorite show
Stress Level: 45
Boss Alert Level: 2

📘 TypeScript 版本 - 通用用途

一个使用TypeScript构建的灵活且可扩展的MCP服务器模板

ChillMCP TypeScript 是一个已准备好投入生产的 MCP(模型上下文协议)服务器实现,它提供了一种清晰的架构,用于构建基于人工智能的应用程序。它附带了示例工具、资源和提示,帮助您快速上手。

特点/特性

  • TypeScript 优先使用TypeScript构建,确保类型安全并提供卓越的开发者体验
  • 模块化架构具有独立模块的组织结构,分别用于工具、资源和提示
  • **Stdio Transport(在中文语境下,可理解为“标准I/O传输”或根据具体上下文简化为“标准传输”,但直接翻译“Stdio Transport”时,保持原样或稍作调整以符合中文表达习惯)**使用标准输入/输出,实现与Claude及其他MCP客户端的无缝集成
  • 示例实现包括工具、资源和提示的工作示例
  • 易于扩展添加自定义功能的简单模式
  • 已准备好投入生产包括构建脚本、代码检查(linting)和格式化配置

快速入门(TypeScript)

安装

# Install dependencies
npm install

# Build the project
npm run build

# Start the server
npm start

# Or run in development mode
npm run dev

项目结构

ChillMCP/
├── main.py                   # Python hackathon server
├── requirements.txt          # Python dependencies
├── venv/                     # Python virtual environment
├── .python-version          # pyenv Python version (3.11.9)
├── guide.txt                 # Hackathon mission guide
├── src/                      # TypeScript server
│   ├── index.ts              # Main entry point
│   ├── config/
│   │   └── server.config.ts  # Server configuration
│   ├── types/
│   │   └── index.ts          # TypeScript type definitions
│   ├── tools/                # MCP Tools
│   │   ├── index.ts
│   │   ├── echo.tool.ts
│   │   ├── calculator.tool.ts
│   │   └── time.tool.ts
│   ├── resources/            # MCP Resources
│   │   ├── index.ts
│   │   ├── greeting.resource.ts
│   │   └── info.resource.ts
│   └── prompts/              # MCP Prompts
│       ├── index.ts
│       ├── assistant.prompt.ts
│       ├── code-review.prompt.ts
│       └── explain.prompt.ts
├── dist/                     # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.md

内置功能

工具

ChillMCP 随附几个示例工具:

  • **echo 翻译为中文是“回声”或“回显”**回传带有时间戳的消息
  • 添加两个数相加
  • 乘以;使增多将两个数字相乘
  • 计算执行算术运算(加、减、乘、除)
  • 获取时间返回当前时间戳和时区信息

资源

  • 问候动态问候语生成器(例如。, greeting://John)
  • 服务器信息服务器信息和功能(info://server)

提示

  • 助手AI助手任务协助提示
  • 代码审查结构化代码审查提示
  • 解释概念解释及难度等级

与Claude桌面版的使用

要在Claude Desktop中使用ChillMCP,请将其添加到您的Claude配置中:

在 macOS 上

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "chillmcp": {
      "command": "node",
      "args": ["/absolute/path/to/ChillMCP/dist/index.js"]
    }
  }
}

在Windows上

编辑 %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "chillmcp": {
      "command": "node",
      "args": ["C:\\absolute\\path\\to\\ChillMCP\\dist\\index.js"]
    }
  }
}

添加配置后,重启Claude Desktop。

扩展ChillMCP

添加新工具

  1. 在(某处)创建一个新文件 src/tools/ (例如。, my-tool.tool.ts):
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';

export function registerMyTool(server: McpServer) {
  server.registerTool(
    'my-tool',
    {
      title: 'My Custom Tool',
      description: 'Description of what my tool does',
      inputSchema: {
        param1: z.string().describe('First parameter'),
        param2: z.number().describe('Second parameter'),
      },
      outputSchema: {
        result: z.string(),
      },
    },
    async ({ param1, param2 }) => {
      // Your tool logic here
      const output = { result: `Processed ${param1} with ${param2}` };

      return {
        content: [{ type: 'text', text: JSON.stringify(output) }],
        structuredContent: output,
      };
    }
  );
}
  1. 在(某处)进行注册 src/tools/index.ts:
import { registerMyTool } from './my-tool.tool.js';

export function registerTools(server: McpServer) {
  // ... existing tools
  registerMyTool(server);
}

添加新资源

  1. 在(某个位置/文件夹中)创建一个新文件 src/resources/ (例如。, my-resource.resource.ts):
import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';

export function registerMyResource(server: McpServer) {
  server.registerResource(
    'my-resource',
    new ResourceTemplate('my-resource://{id}', { list: undefined }),
    {
      title: 'My Resource',
      description: 'Description of my resource',
    },
    async (uri, { id }) => ({
      contents: [
        {
          uri: uri.href,
          text: `Resource content for ID: ${id}`,
        },
      ],
    })
  );
}
  1. 在(某处)进行注册 src/resources/index.ts:
import { registerMyResource } from './my-resource.resource.js';

export function registerResources(server: McpServer) {
  // ... existing resources
  registerMyResource(server);
}

添加一个新提示

  1. 在(某处)创建一个新文件 src/prompts/ (例如。, my-prompt.prompt.ts):
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';

export function registerMyPrompt(server: McpServer) {
  server.registerPrompt(
    'my-prompt',
    {
      title: 'My Custom Prompt',
      description: 'Description of my prompt',
      argsSchema: {
        input: z.string().describe('Input parameter'),
      },
    },
    ({ input }) => ({
      messages: [
        {
          role: 'user' as const,
          content: {
            type: 'text' as const,
            text: `Process this: ${input}`,
          },
        },
      ],
    })
  );
}
  1. 在其中注册它 src/prompts/index.ts:
import { registerMyPrompt } from './my-prompt.prompt.js';

export function registerPrompts(server: McpServer) {
  // ... existing prompts
  registerMyPrompt(server);
}

发展

可用脚本

# Build the project
npm run build

# Run in development mode (with hot reload)
npm run dev

# Start the built server
npm start

# Watch mode for TypeScript compilation
npm run watch

# Clean build directory
npm run clean

# Lint code
npm run lint

# Format code
npm run format

配置

服务器配置可以在 src/config/server.config.ts:

export const serverConfig: ServerConfig = {
  name: 'chillmcp',
  version: '1.0.0',
  description: 'A flexible MCP server built with TypeScript',
};

建筑

ChillMCP遵循官方的模型上下文协议规范:

  • 工具AI可以调用以执行操作的函数
  • 资源AI可以读取的数据(文件、API端点等)
  • 提示常见任务的可重用提示模板

服务器使用 StdioServerTransport 用于通信,这是本地MCP服务器的标准。

要求

  • Node.js >= 18.0.0(即 Node.js 版本需大于或等于 18.0.0)
  • npm 或 yarn

依赖项

  • @modelcontextprotocol/sdk官方MCP SDK
  • zod输入和输出的模式验证
  • TypeScript及相关工具

故障排除

服务器未出现在Claude桌面版中

  1. 检查你的配置中的路径是否为绝对路径(而非相对路径)
  2. 确保项目已构建(完成)npm run build)
  3. 验证路径指向的是 dist/index.js
  4. 配置更改后重启Claude桌面版

构建错误

确保所有依赖项都已安装:

npm install

TypeScript 错误

检查您的 Node.js 版本:

node --version  # Should be >= 18.0.0

做出贡献

欢迎贡献!请随时提交问题或拉取请求。

许可证

麻省理工学院(MIT)

了解更多


使用模型上下文协议构建。编码愉快!