咖啡休息工具

一个模拟MCP服务器,提供咖啡休息功能,支持匿名使用和统计跟踪。

  • by duration-ai
  • TypeScript
  • 云端部署
  • 更新于
在 GitHub 查看 duration-ai/coffee-break-mcp

使用说明

咖啡休息MCP服务器

一个带有一个工具的笑话MCP服务器(take_coffee_break)睡眠时间为1-900秒。包括用于跟踪统计数据的可选用户注册。

工具

姓名: take_coffee_break

输入: { "durationSeconds"?: number } (1-900秒)

调用时,此工具:

  1. 记录休息开始时间
  2. 按要求的持续时间睡眠(1-900秒)
  3. 记录中断完成情况
  4. 返回:“咖啡休息时间结束。X秒过去。返回工作。”

该工具需要 durationSeconds 论点(1-900)。

注: 代理/负载均衡器可以切断长请求。在Railway上,边缘代理通告最大请求持续时间为15分钟,保持活动时间为60秒;在实践中,很长的休息时间可能仍然会失败。更短的休息时间更可靠。

隐私和数据

  • 无需电子邮件或帐户。
  • 为了方便起见,令牌存储在浏览器cookie中。
  • 统计数据仅与令牌相关联。

用法

匿名使用

只需连接到MCP端点-无需注册:

{
  "mcpServers": {
    "coffee-break": {
      "type": "streamable-http",
      "url": "https://coffee-break-mcp-production.up.railway.app/mcp"
    }
  }
}

使用统计跟踪

  1. 访问 https://coffee-break-mcp-production.up.railway.app/auth/register 生成匿名令牌
  2. 保存您的令牌(仅显示一次)
  3. 将其添加到您的MCP配置中:
{
  "mcpServers": {
    "coffee-break": {
      "type": "streamable-http",
      "url": "https://coffee-break-mcp-production.up.railway.app/mcp",
      "headers": {
        "Authorization": "Bearer your-api-token"
      }
    }
  }
}
  1. 在以下网址查看您的统计数据 https://coffee-break-mcp-production.up.railway.app/stats

发展

先决条件

设置

# Install dependencies
bun install

# Install Turso CLI (macOS)
brew install tursodatabase/tap/turso

# Login to Turso
turso auth login

# Create a database
turso db create coffee-break

# Get your database URL and token
turso db show coffee-break          # Copy the URL
turso db tokens create coffee-break  # Copy the token

# Set up environment
cp .env.example .env
# Edit .env with your TURSO_DATABASE_URL and TURSO_AUTH_TOKEN

# Generate and run migrations
bun run db:generate
bun run db:migrate

# Start dev server
bun run dev

部署

铁路

  1. 创建新的铁路项目
  2. 连接您的GitHub仓库
  3. 添加环境变量:
    • TURSO_DATABASE_URL -您的Turso数据库URL
    • TURSO_AUTH_TOKEN -您的Turso身份验证令牌
  4. Railway将自动构建并启动服务器

其他平台

此服务器适用于支持Bun或Node.js的任何平台。只需设置环境变量并运行:

bun run db:migrate  # Run once to set up tables
bun run start       # Start the server

技术栈

  • Bun+TypeScript
  • Express 5+@modelcontextprotocol/sdk
  • Turso(SQLite)+Drizzle ORM
  • EJS模板

贡献

看 CONTRIBUTING.md.

许可证

MIT。看 LICENSE.