nasarali03/todo-mcp-server
If you are the rightful owner of todo-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project is a modern To-Do application with REST API and MCP server integration, designed for managing tasks efficiently.
๐ To-Do API with MCP Server
A modern To-Do application with REST API and MCP server integration
๐ฌ Watch the Demo Video
Click above to watch the complete project demonstration!
๐ Features โข ๐ฆ Installation โข ๐ง Usage โข ๐ API Documentation โข ๐ฅ Demo Video
๐ฏ Overview
This project is a comprehensive To-Do application built with FastAPI and integrated with MCP (Model Context Protocol) server capabilities. It provides both traditional REST API endpoints and modern MCP tool-based interactions for managing tasks.
๐ Key Highlights
- Dual Interface: Both REST API and MCP server for maximum flexibility
- Modern Architecture: Built with FastAPI for high performance and automatic documentation
- Type Safety: Full Pydantic model validation
- Developer Friendly: Auto-generated API docs and comprehensive error handling
- CORS Ready: Configured for frontend integration
- Tool-Based Interactions: MCP server enables AI agent integration
๐ Features
๐ Core Functionality
- โ Create new todo items with title and description
- ๐ Read all todos or individual items by ID
- โ๏ธ Update todo items (title, description, completion status)
- ๐๏ธ Delete todo items
- ๐ Summary Statistics with completion rates
๐ ๏ธ Technical Features
- REST API Endpoints for traditional web integration
- MCP Server Integration for AI agent interactions
- Auto-generated Documentation (Swagger UI & ReDoc)
- CORS Support for cross-origin requests
- Type Validation with Pydantic models
- Error Handling with proper HTTP status codes
- Health Check endpoint for monitoring
๐ฏ MCP Tools Available
create_todo
- Create new todo itemslist_todos
- Get all todosget_todo
- Get specific todo by IDupdate_todo
- Update existing todosdelete_todo
- Remove todostodo_summary
- Get statistics and completion rates
๐ฆ Installation
Prerequisites
- Python 3.8 or higher
- pip (Python package installer)
Step 1: Clone the Repository
git clone <your-repo-url>
cd mcp
Step 2: Install Dependencies
pip install -r requirements.txt
Step 3: Run the Application
# Development server with auto-reload
uvicorn main:app --reload
# Or run directly
python main.py
๐ง Usage
๐ Access Points
Once the server is running, you can access:
Service | URL | Description |
---|---|---|
API Root | http://localhost:8000 | Basic API information |
Interactive Docs | http://localhost:8000/docs | Swagger UI documentation |
Alternative Docs | http://localhost:8000/redoc | ReDoc documentation |
MCP Server | http://localhost:8000/mcp | MCP server interface |
Health Check | http://localhost:8000/health | Server health status |
๐ก REST API Examples
Create a Todo
curl -X POST "http://localhost:8000/todos/" \
-H "Content-Type: application/json" \
-d '{"title": "Learn FastAPI", "description": "Complete the FastAPI tutorial"}'
Get All Todos
curl -X GET "http://localhost:8000/todos/"
Update a Todo
curl -X PUT "http://localhost:8000/todos/1" \
-H "Content-Type: application/json" \
-d '{"completed": true}'
Delete a Todo
curl -X DELETE "http://localhost:8000/todos/1"
๐ค MCP Server Usage
List Available Tools
curl -X GET "http://localhost:8000/mcp/tools"
Use MCP Tools
# Create a todo via MCP
curl -X POST "http://localhost:8000/mcp/tools/create_todo" \
-H "Content-Type: application/json" \
-d '{"title": "MCP Todo", "description": "Created via MCP"}'
# Get todo summary
curl -X GET "http://localhost:8000/mcp/resources/todo_summary"
๐ API Documentation
๐ Todo Model
{
"id": int, # Unique identifier
"title": str, # Todo title (required)
"description": str, # Optional description
"completed": bool, # Completion status (default: false)
"created_at": datetime # Creation timestamp
}
๐ Endpoints
REST API Endpoints
Method | Endpoint | Description |
---|---|---|
GET | / | API information |
GET | /health | Health check |
GET | /todos/ | Get all todos |
POST | /todos/ | Create new todo |
GET | /todos/{id} | Get specific todo |
PUT | /todos/{id} | Update todo |
DELETE | /todos/{id} | Delete todo |
MCP Server Endpoints
Method | Endpoint | Description |
---|---|---|
GET | /mcp/ | MCP server info |
GET | /mcp/tools | List available tools |
POST | /mcp/tools/{tool_name} | Execute MCP tool |
GET | /mcp/resources | List available resources |
GET | /mcp/resources/{resource_name} | Get MCP resource |
๐ฅ Demo Video
๐ฌ Watch the Project Demo
Click the button above or the video below to watch the complete project demonstration!
This video demonstrates the complete functionality of the To-Do API with MCP Server integration
๐๏ธ Project Structure
mcp/
โโโ ๐ routes/
โ โโโ __pycache__/
โ โโโ todo.py # Todo route handlers
โโโ ๐ main.py # FastAPI application & MCP server
โโโ ๐ models.py # Pydantic data models
โโโ ๐ requirements.txt # Python dependencies
โโโ ๐ mcp_server.json # MCP server configuration
โโโ ๐ todo-api-mcp-demo.mp4 # Demo video
โโโ ๐ README.md # This file
โโโ ๐ LICENSE # MIT License
๐ ๏ธ Development
๐ง Configuration
The application uses the following configuration:
- Host:
0.0.0.0
(all interfaces) - Port:
8000
- Auto-reload: Enabled in development
- CORS: Configured for all origins (adjust for production)
๐ Adding New Features
- New API Endpoints: Add to
routes/todo.py
- New MCP Tools: Add to
main.py
with@mcp.tool()
decorator - New Models: Add to
models.py
- Dependencies: Update
requirements.txt
๐งช Testing
# Test the API endpoints
curl -X GET "http://localhost:8000/health"
# Test MCP server
curl -X GET "http://localhost:8000/mcp/"
๐ค Contributing
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
๐ Contribution Guidelines
- Follow PEP 8 style guidelines
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass
๐ License
This project is licensed under the MIT License - see the file for details.
๐จโ๐ป Author
Nasar Ali
- GitHub: @nasarali
- Project: To-Do API with MCP Server
- Video:
๐ Acknowledgments
- FastAPI - The modern, fast web framework for building APIs
- Pydantic - Data validation using Python type annotations
- MCP Protocol - Model Context Protocol for AI agent integration
- Uvicorn - Lightning-fast ASGI server
๐ Support
If you have any questions or need help:
- Check the API Documentation
- Watch the
- Open an issue on GitHub
- Contact the author