Todo App using MCP Server

Todo App using MCP Server

Okay, here are a few ways to interpret "Todo app using mcp server" and their corresponding Chinese translations, along with some context: **1. Most Likely: A Todo app that uses an MCP (Microcontroller) as a server.** * **English:** Todo app using a microcontroller as a server. * **Chinese:** 使用微控制器作为服务器的待办事项应用 (Shǐyòng wēi kòngzhìqì zuòwéi fúwùqì de dàibàn shìxiàng yìngyòng) * **Explanation:** This assumes "mcp" is a typo for "microcontroller." This would be a more advanced project, likely involving embedded systems programming. It implies the microcontroller is handling the data storage and logic for the todo app. **2. Less Likely: A Todo app that uses a server named "MCP".** * **English:** Todo app using the MCP server. * **Chinese:** 使用 MCP 服务器的待办事项应用 (Shǐyòng MCP fúwùqì de dàibàn shìxiàng yìngyòng) * **Explanation:** This assumes "MCP" is the name of a specific server or service. Without more context, it's hard to be more specific. **3. Least Likely: "MCP" refers to a specific protocol or technology (unlikely in this context).** * **English:** Todo app using the MCP protocol/technology. * **Chinese:** 使用 MCP 协议/技术的待办事项应用 (Shǐyòng MCP xiéyì/jìshù de dàibàn shìxiàng yìngyòng) * **Explanation:** This is possible, but less probable without further information about what "MCP" stands for. **Therefore, the most likely and generally useful translation is:** **使用微控制器作为服务器的待办事项应用 (Shǐyòng wēi kòngzhìqì zuòwéi fúwùqì de dàibàn shìxiàng yìngyòng)** **Important Considerations:** * **Context is Key:** To provide the *best* translation, I need more context. What kind of "mcp" are you referring to? What is the purpose of this translation? Who is the audience? * **Alternative Phrasing:** Depending on the specific microcontroller and the level of detail needed, you could also say: * **基于微控制器的待办事项应用 (Jīyú wēi kòngzhìqì de dàibàn shìxiàng yìngyòng):** "Microcontroller-based todo app" (more general). * **使用 [Specific Microcontroller Name] 的待办事项应用 (Shǐyòng [Specific Microcontroller Name] de dàibàn shìxiàng yìngyòng):** "Todo app using [Specific Microcontroller Name]" (e.g., "使用 Arduino 的待办事项应用" - "Todo app using Arduino"). Please provide more information if you want a more precise translation!

theatulanand

开发者工具
访问服务器

README

使用 MCP 服务器的 Todo 应用

一个简单的 Todo 应用程序,通过 Google Gemini API 使用自然语言处理进行增强,使用 MongoDB 进行持久化,并使用 MCP (模型上下文协议) 通过服务器发送事件 (SSE) 进行实时更新。 使用带有 Express.js 的模块化 MVC 架构构建。


功能

  • 使用自然语言添加 todos (例如,"添加一个购买牛奶的任务")
  • 列出 todos (可以选择包括已完成的)
  • 使用 MongoDB ID 将 todos 标记为已完成
  • 通过 MongoDB ID 删除 todos
  • 使用 MCP 通过服务器发送事件 (SSE) 接收实时更新

技术栈

  • Node.js: 服务器运行时
  • Express.js: 路由和中间件
  • MongoDB (Atlas): 基于云的 NoSQL 数据库
  • Mongoose: MongoDB 的 ODM
  • Google Gemini API: 处理自然语言命令解释
  • @modelcontextprotocol/sdk: 用于 MCP 集成和 SSE
  • dotenv: 用于管理环境变量

前提条件

  • Node.js (v18 或更高版本)
  • MongoDB Atlas 集群 (需要凭据)
  • Google Gemini API 密钥 (可从 Google AI Studio 获取)

安装

  1. 克隆存储库

    git clone https://github.com/theatulanand/to-do-mcp-server.git
    cd todo-mcp-single
    
  2. 安装依赖

    npm install
    
  3. 设置环境变量

    在根目录中创建一个 .env 文件:

    PORT=3000
    MONGO_URI=URI
    GEMINI_API_KEY=
    

运行应用

启动服务器:

npm start

您应该看到:

Connected to MongoDB with Mongoose
Server running on http://localhost:3000

要停止服务器,请按 Ctrl + C


如何使用

/api/command 发送带有 JSON 主体的 POST 请求:

{ "command": "Add a task to buy milk" }

示例命令

  • 添加:

    curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "Add a task to buy milk"}'
    
  • 列表:

    curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "List my todos"}'
    
  • 完成:

    curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "Complete todo with ID some_mongodb_id"}'
    
  • 删除:

    curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "Delete todo with ID some_mongodb_id"}'
    
  • 列表 (包括已完成的):

    curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "List my todos including completed"}'
    

实时更新 (SSE)

连接到 /sse 以接收实时更新。 (需要 MCP 兼容的客户端。)


项目结构

todo-mcp-single/
├── models/           # Mongoose 模式
│   └── Todo.js
├── controllers/      # 业务逻辑
│   └── todoController.js
├── routes/           # API 路由
│   └── todoRoutes.js
├── utils/            # 实用函数 (例如,Gemini 集成)
│   └── gemini.js
├── .env              # 环境配置
└── server.js         # 应用入口点

故障排除

  • MongoDB 连接失败: 检查 Atlas 中的 MONGO_URI 和 IP 白名单。
  • Gemini API 错误: 验证 API 密钥和到 generativelanguage.googleapis.com 的网络访问。
  • 无法识别的命令: 检查日志中的 Gemini 原始输出以进行调试。

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
MCP Package Docs Server

MCP Package Docs Server

促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。

精选
本地
TypeScript
Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
mermaid-mcp-server

mermaid-mcp-server

一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。

精选
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

精选
TypeScript
Linear MCP Server

Linear MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

精选
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。

精选
Python
Curri MCP Server

Curri MCP Server

通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。

官方
本地
JavaScript