Build a Task Management System that:
- Starts as an existing command‑line (CLI) Python task app
- Is restructured into clear, separate backend parts
- Is made available through:
- FastAPI (REST endpoints)
- FastMCP (tool‑based interface)
- Uses the Gemini free tier API through MCP to handle natural‑language input
Every part of the system must follow the Canonical System Architecture (Section 3).
The system must be built so it can be extended later with:
- New data structures
- New algorithms
- Object‑oriented features
- Design patterns
- Tests and automation
These rules apply everywhere in the project and must follow the architecture in Section 3.
- Data is stored in memory only
- No users or authentication
- No frontend or UI
- No logging framework
- No duplicated logic
- No unnecessary complexity
All decision‑making logic must live in one place only: the service layer.
FastAPI Routes → TaskService ← MCP Tools
Nothing else may change task data or make task decisions.
This section defines the one correct system design.
Nothing elsewhere may conflict with it.
- All task logic lives in the Service Layer
- FastAPI and MCP only pass data in and out
- Only the Service Layer can read or write storage
- Gemini is required and can be used only through MCP
- Gemini helps interpret requests but never decides outcomes
- No layer may skip another layer
- MCP tools may call Gemini
- MCP tools must call the service to do anything with tasks
Only the Service Layer is allowed to talk to storage.
| Layer | Can use TaskService | Can use Storage | Can use Gemini |
|---|---|---|---|
| Client | No | No | No |
| FastAPI | Yes | No | No |
| MCP Tools | Yes | No | Yes |
| Gemini API | No | No | No |
| TaskService | — | Yes | No |
The folder layout matches the architecture above.
task-mcp-app/
├── README.md
├── requirements.txt
├── src/
│ ├── main.py
│ ├── core/
│ ├── models/
│ ├── services/
│ ├── routes/
│ ├── mcp/
│ ├── data/
│ ├── utils/
│ ├── observers/
│── tests/
├── docs/
└── scripts/
Models only store data.
They do not make decisions.
- Use a list to keep task order
- Use a map for fast lookup by ID
- Storage is shared through a singleton
- Everything is in memory
The Service Layer controls all task behavior.
add_task(title)list_tasks()delete_task(id)mark_complete(id)search_tasks(keyword)sort_tasks(method="default")
- Only this layer may change tasks
- No FastAPI, MCP, or Gemini logic inside
- Both FastAPI and MCP must reuse it
FastAPI only forwards requests to the service.
It must expose all main task actions.
The MCP layer must include Gemini support.
add_tasklist_tasksdelete_taskmark_completesearch_tasksnl_query_tasks(uses Gemini)summarize_tasks(uses Gemini)
Gemini is required in v1 and must follow these rules:
- Used only inside MCP
- Never talks directly to services or storage
- Provides suggestions only
- Output must be structured and checked before use
All extensions still follow the same architecture.
Patterns are used to organize code, not replace logic.
Tests should focus on the service layer.
- Use pytest
- Test at least:
add_tasklist_tasks
uvicorn app.main:app --reload
pytestSome errors must still remain in the service layer:
- Wrong list usage
- Broken completion logic
- Bad search assumptions
- Confusing variable names
The setup student must provide:
- A working FastAPI app
- A correctly isolated service layer
- MCP primitives starting structure
- Initial tests
- GitHub issues & Project board
- Github workflow with Org
- Coding Standard
- Issue PR Templates
- A complete README
- Contribution Guidelines
The README must explain:
- The system architecture
- How to run FastAPI
- How to run MCP
- How to configure Gemini
- How to run tests
- Where extensions can be added
MCP may only check structure and format.
✅ Allowed:
- JSON shape checks
- Allowed action checks
❌ Not allowed:
- Business logic
- Task state checks
The service layer handles all meaning and rules.
Both FastAPI and MCP must support:
- Create
- List
- Delete
- Complete
- Search
They may look different, but must do the same work internally.
Data structures:
✅ May:
- Manage storage mechanics
❌ Must not:
- Contain task rules
- Decide task behavior
All task decisions belong to the Service Layer.
This specification defines a clear, strict system design with:
- One place for all logic
- Required Gemini integration
- Clean separation of responsibilities
- Strong support for learning and extension
All implementations must follow Section 3: Canonical System Architecture.