Skip to content

Commit 798633a

Browse files
committed
readme
1 parent cc1538d commit 798633a

3 files changed

Lines changed: 90 additions & 231 deletions

File tree

README.md

Lines changed: 85 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,135 @@
1-
# Python Todo List App with MCP Integration
1+
# Todo MCP Agent with Azure AI
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 with Azure AI Agents integration and Model Context Protocol (MCP) server functionality.
44

55
## Features
66

7-
-**CRUD Operations**: Create, read, update, delete todos
8-
- 🎯 **Priority Management**: Set priority levels (low, medium, high)
9-
-**Mark Complete/Incomplete**: Toggle completion status
10-
- 🌐 **Web Interface**: Clean, responsive Bootstrap UI
11-
- 💬 **Chat Interface**: Placeholder for future LLM integration
12-
- 🔧 **MCP Tools**: HTTP-accessible tools for external integrations
13-
- ☁️ **Azure Ready**: Optimized for Azure App Service deployment
7+
- 🤖 **AI-Powered Chat**: Azure AI Agents with GPT-4o for natural language todo management
8+
- 🔧 **MCP Integration**: Model Context Protocol server for AI tool access
9+
-**Todo Management**: Full CRUD operations with priority levels
10+
- 🌐 **Web Interface**: Clean, responsive UI with chat functionality
11+
- ☁️ **Azure Deployment**: Ready for Azure App Service with AI Foundry
1412

15-
## MCP Tools Available
16-
17-
The application exposes the following MCP tools over HTTP:
18-
19-
- `create_todo(title, description, priority)` - Create a new todo item
20-
- `list_todos(filter_completed)` - Get all todos with optional filtering
21-
- `update_todo(id, title, description, priority, completed)` - Update existing todo
22-
- `delete_todo(id)` - Delete a todo item
23-
- `mark_todo_complete(id, completed)` - Mark todo as complete/incomplete
24-
25-
## Local Development
13+
## Quick Start
2614

2715
### Prerequisites
2816

29-
- Python 3.12+
30-
- Virtual environment (venv)
17+
- Python 3.11+
18+
- Azure subscription (for AI features)
19+
- Azure Developer CLI (azd)
3120

32-
### Setup
21+
### Local Development
3322

34-
1. **Clone and setup environment**:
23+
1. **Clone and setup**:
3524
```bash
36-
git clone <repository-url>
25+
git clone <your-repo-url>
3726
cd python-todo-mcp-agent
3827
python -m venv .venv
3928
.venv\Scripts\activate # Windows
40-
# or
41-
source .venv/bin/activate # Linux/Mac
42-
```
43-
44-
2. **Install dependencies**:
45-
```bash
4629
pip install -r requirements.txt
4730
```
4831

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**:
32+
2. **Run locally**:
5633
```bash
5734
python main.py
5835
```
5936

60-
5. **Access the application**:
61-
- Web Interface: http://localhost:8000
62-
- Chat Interface: http://localhost:8000/chat
37+
3. **Access the app**:
38+
- Todo List: http://localhost:8000
39+
- AI Chat: http://localhost:8000/chat
6340
- Health Check: http://localhost:8000/health
64-
- MCP Endpoint: http://localhost:8000/mcp
65-
- MCP Tools: http://localhost:8000/mcp/tools/*
66-
67-
## Azure Deployment
6841

69-
### Prerequisites
42+
### Azure Deployment
7043

71-
- Azure CLI installed and logged in
72-
- Azure Developer CLI (azd) installed
44+
Deploy with one command:
7345

74-
### Deploy with AZD
46+
```bash
47+
azd up
48+
```
7549

76-
1. **Initialize AZD**:
77-
```bash
78-
azd init
79-
```
50+
This creates:
51+
- Azure AI Foundry resource with GPT-4o
52+
- Azure AI Foundry project
53+
- App Service with managed identity
54+
- All necessary role assignments
8055

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-
```
56+
## How It Works
8657

87-
3. **Deploy to Azure**:
88-
```bash
89-
azd up
90-
```
58+
The application combines three key components:
9159

92-
### Infrastructure
60+
1. **Todo Management**: Standard CRUD operations for managing tasks
61+
2. **MCP Server**: Exposes todo operations as tools that AI agents can use
62+
3. **AI Chat Interface**: Azure AI Agents that can interact with your todos through natural language
9363

94-
The deployment creates:
64+
### Example Chat Interactions
9565

96-
- **App Service Plan**: P0V3 (Premium V3, Linux)
97-
- **App Service**: Python 3.12 runtime
98-
- **Managed Identity**: Secure Azure resource access
66+
- "Create a high priority todo to finish the project"
67+
- "Show me all my incomplete todos"
68+
- "Mark the project todo as complete"
69+
- "What todos do I have for today?"
9970

10071
## Architecture
10172

10273
```
10374
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
104-
Web Browser │────│ Flask App │────│ SQLite DB
105-
│ (Todo UI) │ │ (CRUD API) │ │ (Data Store)
75+
Chat UI │────│ FastAPI App │────│ In-Memory
76+
│ (AI Agent) │ │ + MCP Server │ │ Todo Store
10677
└─────────────────┘ └──────────────────┘ └─────────────────┘
10778
10879
┌──────────────────┐
109-
│ MCP Server │
110-
│ (HTTP Tools) │
111-
└──────────────────┘
112-
113-
┌──────────────────┐
114-
│ External Tools │
115-
│ & Integrations │
80+
│ Azure AI │
81+
│ Foundry + │
82+
│ GPT-4o │
11683
└──────────────────┘
11784
```
11885

86+
## MCP Tools
87+
88+
The application exposes these tools for AI agents:
89+
90+
- `create_todo` - Create new todos
91+
- `list_todos` - List all or filtered todos
92+
- `update_todo` - Update existing todos
93+
- `delete_todo` - Delete todos
94+
- `mark_todo_complete` - Toggle completion status
95+
11996
## API Endpoints
12097

98+
### Web Interface
99+
- `GET /` - Todo list page
100+
- `GET /chat` - AI chat interface
101+
- `GET /health` - Health check
102+
121103
### REST API
122-
- `GET /api/todos` - List all todos
123-
- `POST /api/todos` - Create new todo
124-
- `GET /api/todos/{id}` - Get specific todo
104+
- `GET /api/todos` - List todos
105+
- `POST /api/todos` - Create todo
125106
- `PUT /api/todos/{id}` - Update todo
126107
- `DELETE /api/todos/{id}` - Delete todo
127-
- `PATCH /api/todos/{id}/complete` - Toggle completion
128-
129-
### MCP Integration
130-
- `GET /mcp` - MCP server info and available tools
131-
- `POST /mcp` - MCP protocol endpoint (JSON-RPC 2.0)
132-
- `GET/POST /mcp/tools/create_todo` - Direct tool access
133-
- `GET/POST /mcp/tools/list_todos` - Direct tool access
134-
- `POST /mcp/tools/update_todo` - Direct tool access
135-
- `POST /mcp/tools/delete_todo` - Direct tool access
136-
- `POST /mcp/tools/mark_todo_complete` - Direct tool access
137-
138-
## Environment Variables
139-
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` |
144-
145-
## Development Notes
146-
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
153-
154-
## Future Enhancements
155-
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
164-
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
108+
109+
### AI Chat API
110+
- `POST /api/chat/session` - Create chat session
111+
- `POST /api/chat/message` - Send message to AI agent
112+
113+
### MCP Server
114+
- `GET /mcp/stream` - MCP server info
115+
- `POST /mcp/stream` - MCP JSON-RPC endpoint
116+
117+
## Configuration
118+
119+
Environment variables are automatically configured during Azure deployment:
120+
121+
- `AZURE_AI_PROJECT_ENDPOINT` - AI Foundry endpoint
122+
- `AZURE_OPENAI_DEPLOYMENT_NAME` - GPT-4o deployment name
123+
- `AZURE_APP_SERVICE_URL` - App service URL for MCP
124+
125+
## Development
126+
127+
The app uses:
128+
- **FastAPI** for the web framework
129+
- **Azure AI Agents** for AI functionality
130+
- **Bootstrap 5** for UI styling
131+
- **In-memory storage** for simplicity (easily upgradeable)
170132

171133
## License
172134

173-
This project is licensed under the MIT License.
135+
MIT License

infra/main.bicep

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ resource appService 'Microsoft.Web/sites@2023-12-01' = {
161161
name: 'AZURE_AI_PROJECT_ENDPOINT'
162162
value: aiFoundryResource.properties.endpoint
163163
}
164+
{
165+
name: 'AZURE_AI_PROJECT_NAME'
166+
value: aiFoundryProject.name
167+
}
164168
{
165169
name: 'AZURE_APP_SERVICE_URL'
166170
value: 'https://${appServiceName}.azurewebsites.net'
@@ -208,4 +212,5 @@ output AZURE_OPENAI_ENDPOINT string = aiFoundryResource.properties.endpoint
208212
output AZURE_OPENAI_NAME string = aiFoundryResource.name
209213
output AZURE_AI_PROJECT_ENDPOINT string = aiFoundryResource.properties.endpoint
210214
output AZURE_AI_FOUNDRY_RESOURCE_NAME string = aiFoundryResource.name
215+
output AZURE_AI_PROJECT_NAME string = aiFoundryProject.name
211216
output AZURE_OPENAI_DEPLOYMENT_NAME string = gpt4oDeployment.name

new-script.py

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)