待办事项管理服务器

一个通过模型上下文协议(MCP)管理待办事项的服务器,支持与AI助手和MCP兼容客户端的集成,使用Redis进行持久化存储并可在Vercel上部署。

  • by vpress000
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 V1997/To-Do-Manager-MCP-Server

使用说明

待办事项管理器MCP服务器

通过模型上下文协议(MCP)管理待办事项的服务器。专为与AI助手和MCP兼容客户端集成而设计。使用Redis提供持久、自动到期的待办事项存储,并可在Vercel上部署。


项目描述

该项目实现了一个具有添加、列表、更新和删除操作的待办事项管理器API。它旨在与MCP客户端和AI工具一起使用,适合作为基于MCP的集成的参考或起点。


特性

  • 添加、列出、更新和删除待办事项
  • 自动过期:待办事项将在3小时后删除
  • 使用Redis的持久存储
  • MCP协议支持人工智能和自动化工作流程
  • 可在Vercel上部署


克劳德桌面AI集成

要将此待办事项管理器MCP服务器与Claude Desktop AI一起使用,请将以下块添加到您的 mcp.json 配置文件:

{
  "mcpServers": {
    "to-do-manager": {
      "url": "https://to-do-manager-mcp-server.vercel.app/mcp"
    }
  }
}

这将使Claude Desktop AI能够直接与您的待办事项管理器服务器进行交互。

安装

  1. 克隆存储库:
    git clone https://github.com/V1997/To-Do-Manager-MCP-Server.git
    cd To-Do-Manager-MCP-Server
    
  2. 安装依赖项:
    npm install
    
  3. 配置Redis:
    • 使用托管Redis服务(Uptash、Redis Cloud或Vercel Redis集成)。
    • 将Redis连接字符串添加到 .env.local:
      REDIS_URL=your_redis_connection_url
      
  4. 启动开发服务器:
    npm run dev
    
    服务器将在以下时间可用 http://localhost:3000

部署和技术细节

Vercel部署

  • 将您的GitHub存储库连接到Vercel。
  • 设置 REDIS_URL Vercel项目设置中的环境变量。
  • Vercel将在每次向主分支推送时进行构建和部署。
  • 该应用程序将在Vercel提供的URL上提供。

Redis使用情况

  • 每个待办事项都存储为Redis哈希(todo:{id})带字段: id, text, completed, createdAt.
  • Redis列表(todos)保持待办事项ID的顺序。
  • 所有Redis操作都是按请求执行的;Redis客户端在每个处理程序中创建并关闭,以实现无服务器兼容性。

自动过期

  • 创建待办事项时,使用Redis设置3小时的TTL EXPIRE.
  • 3小时后,Redis会自动删除待办事项哈希。
  • 在列表/更新中,过期的ID将从 todos 列表。

在线聊天示例

添加待办事项

User: Remind me to buy groceries later today.
Assistant: Added "buy groceries" to your to-do list.

待办事项列表

User: What do I need to get done?
Assistant:
Here are your current to-dos:
• Buy groceries [ ]

将待办事项标记为已完成

User: I finished buying groceries. Mark that as done.
Assistant: Marked "buy groceries" as completed.

删除待办事项

User: Remove "buy groceries" from my list.
Assistant: Deleted "buy groceries" from your to-dos.

删除所有待办事项

User: Clear my entire to-do list.
Assistant: All to-dos have been deleted.

用法

通过任何兼容MCP的客户端或HTTP请求与待办事项管理器交互。

添加待办事项

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "To-Do Manager", "arguments": {"action": "add", "text": "Buy groceries"}}}'

待办事项列表

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "To-Do Manager", "arguments": {"action": "list"}}}'

更新待办事项

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "To-Do Manager", "arguments": {"action": "update", "todoId": "YOUR_TODO_ID", "completed": true}}}'

删除所有待办事项

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": {"name": "To-Do Manager", "arguments": {"action": "delete"}}}'

使用的技术

  • TypeScript
  • Next.js
  • 雷迪斯
  • @vercel/mcp适配器
  • 萨德
  • 维塞尔

贡献

  1. 分叉存储库
  2. 创建新分支(git checkout -b feature/your-feature)
  3. 进行更改并提交
  4. 推到叉子上,打开Pull Request

联系

  • GitHub问题: 打开一个问题
  • 电子邮件:patelvasu1997@gmail.com
  • 维护人员:Vasu Patel

这个项目是开源的——将其用作参考或您自己的MCP开发的起点。