A FastAPI-based todo list application that exposes operations as MCP (Model Context Protocol) tools over HTTP and can be deployed to Azure App Service.
- ✅ CRUD Operations: Create, read, update, delete todos
- 🎯 Priority Management: Set priority levels (low, medium, high)
- ✅ Mark Complete/Incomplete: Toggle completion status
- 🌐 Web Interface: Clean, responsive UI with copy-to-clipboard functionality
- 🔧 MCP Tools: HTTP-accessible tools for external integrations
- 📋 MCP URL Display: Dynamic MCP server URL with one-click copy functionality
- ☁️ Azure Ready: Optimized for Azure App Service deployment
The application exposes the following MCP tools over HTTP:
create_todo(title, description, priority)
- Create a new todo itemlist_todos(filter_completed)
- Get all todos with optional filteringupdate_todo(id, title, description, priority, completed)
- Update existing tododelete_todo(id)
- Delete a todo itemmark_todo_complete(id, completed)
- Mark todo as complete/incomplete
- Python 3.11+
- Virtual environment (venv)
-
Clone and setup environment:
git clone https://github.com/Azure-Samples/app-service-python-todo-mcp cd app-service-python-todo-mcp python -m venv .venv .venv\Scripts\activate # Windows # or source .venv/bin/activate # Linux/Mac
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python main.py
-
Access the application:
- Web Interface: http://localhost:8000
- Health Check: http://localhost:8000/health
- MCP Endpoint: http://localhost:8000/mcp/stream
- MCP Tools: http://localhost:8000/mcp/tools/*
- Azure CLI installed and logged in
- Azure Developer CLI (azd) installed
-
Initialize AZD:
azd init
-
Deploy to Azure:
azd up
The deployment creates:
- App Service Plan: P0V3 (Premium V3, Linux)
- App Service: Python 3.11 runtime with Uvicorn ASGI server
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Web Browser │────│ FastAPI App │────│ SQLite DB │
│ (Todo UI) │ │ (CRUD API) │ │ (Data Store) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
┌──────────────────┐
│ MCP Server │
│ (HTTP Stream) │
└──────────────────┘
│
┌──────────────────┐
│ External Tools │
│ & Integrations │
└──────────────────┘
GET /api/todos
- List all todosPOST /api/todos
- Create new todoGET /api/todos/{id}
- Get specific todoPUT /api/todos/{id}
- Update todoDELETE /api/todos/{id}
- Delete todoPATCH /api/todos/{id}/complete
- Toggle completion
GET /mcp/stream
- MCP server endpoint (HTTP streaming)POST /mcp/stream
- MCP protocol endpoint (JSON-RPC 2.0)GET/POST /mcp/tools/create_todo
- Direct tool accessGET/POST /mcp/tools/list_todos
- Direct tool accessPOST /mcp/tools/update_todo
- Direct tool accessPOST /mcp/tools/delete_todo
- Direct tool accessPOST /mcp/tools/mark_todo_complete
- Direct tool access
The application automatically displays the MCP server URL in the web interface with environment-aware detection:
- Local Development:
http://localhost:8000/mcp/stream
- Azure App Service:
https://your-app-name.azurewebsites.net/mcp/stream
To use this app as an MCP server in VS Code, add the following to your .vscode/mcp.json
:
{
"servers": {
"todo-mcp-server": {
"url": "http://localhost:8000/mcp/stream",
"type": "http"
}
},
"inputs": []
}
For the deployed Azure version, replace the URL with your App Service URL.
This project is licensed under the MIT License.