About Todo App using MCP Server
An Express.js todo app that uses the Google Gemini API to interpret natural-language commands and MongoDB for persistence. It is for users managing tasks through commands, with real-time updates delivered over SSE.
Key features
- 01Add todos with natural language
- 02List todos, including completed ones
- 03Complete todos by MongoDB ID
- 04Delete todos by MongoDB ID
- 05Stream real-time updates over SSE
Use cases
- 01Create a shopping task with a sentence
- 02Review open or all todos
- 03Mark a specific todo complete
- 04Receive todo changes in an MCP client
MCP support
The project uses MCP with SSE for real-time updates and provides an `/sse` endpoint for compatible clients.
Configuration
Remote servers need no local install. Pick your client, then copy the config or install in one click.
http://localhost:3000/sseclaude mcp add --transport http to-do http://localhost:3000/sse{"mcpServers":{"to-do":{"type":"http","url":"http://localhost:3000/sse"}}}Open in Cursor{"servers":{"to-do":{"type":"http","url":"http://localhost:3000/sse"}}}Open in VS Code{"mcpServers":{"to-do":{"type":"http","url":"http://localhost:3000/sse"}}}{"mcpServers":{"to-do":{"serverUrl":"http://localhost:3000/sse"}}}Run commands in a terminal; paste JSON into the client’s MCP config and restart. Servers that need sign-in will prompt on first connect.
Tools
Details
From the project READMETodo App using MCP Server
A simple Todo application enhanced with natural language processing using the Google Gemini API, MongoDB for persistence, and MCP (Model Context Protocol) for real-time updates via Server-Sent Events (SSE). Built using a modular MVC architecture with Express.js.
Features
- Add todos using natural language (e.g., "Add a task to buy milk")
- List todos (optionally include completed ones)
- Mark todos as complete using their MongoDB ID
- Delete todos by their MongoDB ID
- Receive real-time updates using Server-Sent Events (SSE) with MCP
Tech Stack
- Node.js: Server runtime
- Express.js: Routing and middleware
- MongoDB (Atlas): Cloud-based NoSQL database
- Mongoose: ODM for MongoDB
- Google Gemini API: Handles natural language command interpretation
- @modelcontextprotocol/sdk: For MCP integration and SSE
- dotenv: For managing environment variables
Prerequisites
- Node.js (v18 or higher)
- MongoDB Atlas cluster (credentials required)
- Google Gemini API Key (available from Google AI Studio)
Installation
-
Clone the repository
git clone https://github.com/theatulanand/to-do-mcp-server.git cd todo-mcp-single -
Install dependencies
npm install -
Set up environment variables
Create a
.envfile in the root directory:PORT=3000 MONGO_URI=URI GEMINI_API_KEY=
Running the App
Start the server:
npm start
You should see:
Connected to MongoDB with Mongoose
Server running on http://localhost:3000
To stop the server, press Ctrl + C.
How to Use
Send a POST request to /api/command with a JSON body:
{ "command": "Add a task to buy milk" }
Example Commands
-
Add:
curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "Add a task to buy milk"}' -
List:
curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "List my todos"}' -
Complete:
curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "Complete todo with ID some_mongodb_id"}' -
Delete:
curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "Delete todo with ID some_mongodb_id"}' -
List including completed:
curl -X POST http://localhost:3000/api/command -H "Content-Type: application/json" -d '{"command": "List my todos including completed"}'
Real-time Updates (SSE)
Connect to /sse to receive live updates. (Requires MCP-compatible client.)
Project Structure
todo-mcp-single/
├── models/ # Mongoose schemas
│ └── Todo.js
├── controllers/ # Business logic
│ └── todoController.js
├── routes/ # API routes
│ └── todoRoutes.js
├── utils/ # Utility functions (e.g., Gemini integration)
│ └── gemini.js
├── .env # Environment configuration
└── server.js # App entry point
Troubleshooting
- MongoDB Connection Failed: Check MONGO_URI and IP whitelist in Atlas.
- Gemini API Errors: Validate API key and network access to
generativelanguage.googleapis.com. - Unrecognized Commands: Check Gemini raw output in logs for debugging.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.