这是一个基于Model Context Protocol (MCP) 的服务器,用于管理待办事项列表和事项,并支持通过Webhook进行通知。它使用Bun和TypeScript构建。
# 克隆仓库
git clone
cd mcp-todo
# 安装依赖
bun install
# 设置环境变量
cp .env.example .env
# 编辑.env文件,进行配置
# 任务通知的Webhook URL(可选)
NOTIFICATION_WEBHOOK=http://localhost:3000/api/webhooks/your-webhook-url
# 数据库配置
DATABASE_PATH=./todo.db
# 服务器配置
MCP_SERVER_NAME=mcp-todo
MCP_SERVER_VERSION=1.0.0
# 以开发模式启动,支持自动重新加载
bun run dev
# 运行类型检查
bun run typecheck
# 运行测试
bun test
# 启动服务器
bun run start
# 或者使用Docker构建并运行
docker-compose up -d
{
"name": "Work Tasks",
"description": "Tasks related to work projects"
}
{
"list_id": "list-uuid",
"title": "Complete project documentation",
"description": "Write comprehensive docs for the new feature",
"assignee": "john.doe@example.com",
"priority": "high",
"tags": ["documentation", "urgent"],
"due_date": "2024-12-31T23:59:59Z",
"recurrence": {
"type": "weekly",
"weekdays": [1, 3, 5]
}
}
{
"query": "documentation",
"status": ["pending", "in_progress"],
"priority": ["high", "medium"],
"assignee": "john.doe@example.com",
"due_before": "2024-12-31T23:59:59Z",
"sort_field": "due_date",
"sort_order": "asc",
"limit": 10
}
服务器提供以下MCP工具:
createTodoList
- 创建新的待办事项列表getTodoList
- 根据ID获取待办事项列表getAllTodoLists
- 获取所有待办事项列表updateTodoList
- 更新待办事项列表deleteTodoList
- 删除待办事项列表createTodoItem
- 创建新的待办事项getTodoItem
- 根据ID获取待办事项searchTodoItems
- 搜索和过滤待办事项updateTodoItem
- 更新待办事项markTodoDone
- 将待办事项标记为已完成deleteTodoItem
- 删除待办事项服务器使用SQLite,包含以下表:
# 启动服务
docker-compose up -d
# 查看日志
docker-compose logs -f
# 停止服务
docker-compose down
# 构建镜像
docker build -t mcp-todo .
# 运行容器
docker run -d \
--name mcp-todo \
-v todo-data:/data \
-e NOTIFICATION_WEBHOOK=your-webhook-url \
mcp-todo
当配置了NOTIFICATION_WEBHOOK
时,服务器将:
{
"content": "Task deadline approaching!",
"data": {
"id": "string",
"list_id": "string",
"title": "string",
"description": "string",
"assignee": "string",
"priority": "none", // none, low, medium, high
"status": "completed", // pending, in_progress, completed, cancelled
"tags": [],
"due_date": "Date",
"snoozed_until": "Date",
"recurrence": {
"type": "daily", // daily, weekly, monthly, weekdays
"weekdays": [], // 0-6 for Sunday-Saturday
"day_of_month": 1, // 1-31
"next_due": "Date"
},
"completed_at": "Date",
"created_at": "Date",
"updated_at": "Date",
"metadata": {}
}
}
daily
:每天重复weekly
:在特定工作日重复(0=周日,6=周六)monthly
:在每月的特定日期重复weekdays
:仅在工作日重复(周一至周五)none
:未设置优先级low
:低优先级medium
:中等优先级high
:高优先级pending
:任务未开始in_progress
:任务正在进行中completed
:任务已完成cancelled
:任务已取消src/
├── db/ # 数据库连接和架构
├── models/ # 数据访问的仓库类
├── server/ # MCP服务器实现
├── types/ # TypeScript类型定义
└── utils/ # 实用函数
# 运行所有测试
bun test
# 运行带覆盖率的测试
bun test --coverage
# 运行特定测试文件
bun test tests/todo-list.repository.test.ts
本项目采用MIT许可证。
设置NODE_ENV=development
以启用额外的日志记录。
如有问题和疑问,请: