11# Python Todo List App with MCP Integration
22
3- A Flask -based todo list application that exposes operations as MCP (Model Context Protocol) tools over HTTP and can be deployed to Azure App Service.
3+ 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.
44
55## Features
66
77- ✅ ** CRUD Operations** : Create, read, update, delete todos
88- 🎯 ** Priority Management** : Set priority levels (low, medium, high)
99- ✅ ** Mark Complete/Incomplete** : Toggle completion status
10- - 🌐 ** Web Interface** : Clean, responsive Bootstrap UI
11- - 💬 ** Chat Interface** : Placeholder for future LLM integration
10+ - 🌐 ** Web Interface** : Clean, responsive UI with copy-to-clipboard functionality
1211- 🔧 ** MCP Tools** : HTTP-accessible tools for external integrations
12+ - 📋 ** MCP URL Display** : Dynamic MCP server URL with one-click copy functionality
1313- ☁️ ** Azure Ready** : Optimized for Azure App Service deployment
1414
1515## MCP Tools Available
@@ -26,15 +26,15 @@ The application exposes the following MCP tools over HTTP:
2626
2727### Prerequisites
2828
29- - Python 3.12 +
29+ - Python 3.11 +
3030- Virtual environment (venv)
3131
3232### Setup
3333
34341 . ** Clone and setup environment** :
3535 ``` bash
36- git clone < repository-url >
37- cd python-todo-mcp-agent
36+ git clone https://github.com/Azure-Samples/app-service-python-todo-mcp
37+ cd app-service- python-todo-mcp
3838 python -m venv .venv
3939 .venv\S cripts\a ctivate # Windows
4040 # or
@@ -46,22 +46,15 @@ The application exposes the following MCP tools over HTTP:
4646 pip install -r requirements.txt
4747 ```
4848
49- 3 . ** Set environment variables** (optional):
50- ``` bash
51- set SECRET_KEY=your-secret-key-here
52- set DATABASE_URL=sqlite:///todos.db
53- ```
54-
55- 4 . ** Run the application** :
49+ 3 . ** Run the application** :
5650 ``` bash
5751 python main.py
5852 ```
5953
60- 5 . ** Access the application** :
54+ 4 . ** Access the application** :
6155 - Web Interface: http://localhost:8000
62- - Chat Interface: http://localhost:8000/chat
6356 - Health Check: http://localhost:8000/health
64- - MCP Endpoint: http://localhost:8000/mcp
57+ - MCP Endpoint: http://localhost:8000/mcp/stream
6558 - MCP Tools: http://localhost:8000/mcp/tools/ *
6659
6760## Azure Deployment
@@ -78,13 +71,7 @@ The application exposes the following MCP tools over HTTP:
7871 azd init
7972 ```
8073
81- 2 . ** Set environment variables** :
82- ``` bash
83- azd env set SECRET_KEY " your-production-secret-key"
84- azd env set DATABASE_URL " sqlite:///todos.db"
85- ```
86-
87- 3 . ** Deploy to Azure** :
74+ 2 . ** Deploy to Azure** :
8875 ``` bash
8976 azd up
9077 ```
@@ -94,20 +81,19 @@ The application exposes the following MCP tools over HTTP:
9481The deployment creates:
9582
9683- ** App Service Plan** : P0V3 (Premium V3, Linux)
97- - ** App Service** : Python 3.12 runtime
98- - ** Managed Identity** : Secure Azure resource access
84+ - ** App Service** : Python 3.11 runtime with Uvicorn ASGI server
9985
10086## Architecture
10187
10288```
10389┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
104- │ Web Browser │────│ Flask App │────│ SQLite DB │
90+ │ Web Browser │────│ FastAPI App │────│ SQLite DB │
10591│ (Todo UI) │ │ (CRUD API) │ │ (Data Store) │
10692└─────────────────┘ └──────────────────┘ └─────────────────┘
10793 │
10894 ┌──────────────────┐
10995 │ MCP Server │
110- │ (HTTP Tools) │
96+ │ (HTTP Stream) │
11197 └──────────────────┘
11298 │
11399 ┌──────────────────┐
@@ -127,46 +113,38 @@ The deployment creates:
127113- ` PATCH /api/todos/{id}/complete ` - Toggle completion
128114
129115### MCP Integration
130- - ` GET /mcp ` - MCP server info and available tools
131- - ` POST /mcp ` - MCP protocol endpoint (JSON-RPC 2.0)
116+ - ` GET /mcp/stream ` - MCP server endpoint (HTTP streaming)
117+ - ` POST /mcp/stream ` - MCP protocol endpoint (JSON-RPC 2.0)
132118- ` GET/POST /mcp/tools/create_todo ` - Direct tool access
133119- ` GET/POST /mcp/tools/list_todos ` - Direct tool access
134120- ` POST /mcp/tools/update_todo ` - Direct tool access
135121- ` POST /mcp/tools/delete_todo ` - Direct tool access
136122- ` POST /mcp/tools/mark_todo_complete ` - Direct tool access
137123
138- ## Environment Variables
124+ ## MCP Configuration
139125
140- | Variable | Description | Default |
141- | ----------| -------------| ---------|
142- | ` SECRET_KEY ` | Flask secret key for sessions | ` dev-secret-key ` |
143- | ` DATABASE_URL ` | Database connection string | ` sqlite:///todos.db ` |
126+ The application automatically displays the MCP server URL in the web interface with environment-aware detection:
144127
145- ## Development Notes
128+ - ** Local Development** : ` http://localhost:8000/mcp/stream `
129+ - ** Azure App Service** : ` https://your-app-name.azurewebsites.net/mcp/stream `
146130
147- - ** Database** : Uses SQLite for simplicity (can be upgraded to Azure SQL)
148- - ** Styling** : Bootstrap 5 with Font Awesome icons
149- - ** Frontend** : Vanilla JavaScript with fetch API
150- - ** Backend** : Flask with SQLAlchemy ORM
151- - ** MCP** : Native JSON-RPC 2.0 implementation in Flask
152- - ** Security** : HTTPS only, managed identity, CORS enabled
131+ ### VS Code MCP Integration
153132
154- ## Future Enhancements
133+ To use this app as an MCP server in VS Code, add the following to your ` .vscode/mcp.json ` :
155134
156- - 🤖 ** LLM Integration** : Connect chat interface to language models
157- - 🗄️ ** Database Upgrade** : Migrate to Azure SQL Database
158- - 🔐 ** Authentication** : Add user accounts and auth
159- - 📱 ** Mobile App** : React Native or Flutter companion
160- - 🔍 ** Search** : Full-text search capabilities
161- - 📊 ** Analytics** : Usage metrics and insights
162-
163- ## Contributing
135+ ``` json
136+ {
137+ "servers" : {
138+ "todo-mcp-server" : {
139+ "url" : " http://localhost:8000/mcp/stream" ,
140+ "type" : " http"
141+ }
142+ },
143+ "inputs" : []
144+ }
145+ ```
164146
165- 1 . Fork the repository
166- 2 . Create a feature branch
167- 3 . Make your changes
168- 4 . Add tests if applicable
169- 5 . Submit a pull request
147+ For the deployed Azure version, replace the URL with your App Service URL.
170148
171149## License
172150
0 commit comments