Task Tracker MCP Server
by mailmirza
README.md
# Task Tracker MCP Server (FastMCP + SQLite)
A small [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server, built with
[FastMCP](https://gofastmcp.com), that gives an AI assistant a to-do list stored in SQLite. It is a worked
example of a server that **changes data**, including how to ask the user to confirm first.
> **Demo only.** It uses mock data and has no authentication. Run it locally, and do not expose it to the
> internet as-is (see [docs/deployment.md](docs/deployment.md#security)).
**Tools**
| Tool | Type | Notes |
|---|---|---|
| `list_tasks(status?)` | read | Optional filter: `pending` or `done` |
| `add_task(title, priority)` | write | `low`, `medium` or `high` |
| `mark_task_done(task_id)` | write | Checks the task exists first |
| `update_priority(task_id, new_priority)` | write | Asks for confirmation (elicitation) |
| `delete_task(task_id)` | write | Asks for confirmation (elicitation) |
**What it demonstrates**
- SQLite access with **parameterized queries** (`?` placeholders), the defence against SQL injection
- A fresh database connection per call, and existence checks before every write
- **Elicitation**: the server pauses mid-call and asks the user to confirm before changing anything
## Quick start
```bash
git clone https://github.com/mailmirza/task-tracker-mcp-server.git
cd task-tracker-mcp-server
python -m venv venv
source venv/bin/activate # Windows PowerShell: .\venv\Scripts\Activate.ps1
pip install -r requirements.txt
python setup_db.py # creates tasks.db with a few mock tasks
```
`setup_db.py` inserts the mock rows each time it runs. Delete `tasks.db` first if you want a clean start.
Test it with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector). Let the Inspector
launch the server, and do not type into the server's own terminal:
```bash
npx @modelcontextprotocol/inspector python server.py
```
Call `delete_task` in the Tools tab: a confirmation form appears, and the task is only deleted if you
accept it. Decline or cancel and the task stays.
## Use it from an MCP client
For Claude Desktop, add this to `claude_desktop_config.json` (full paths; on Windows use
`venv\\Scripts\\python.exe` with double backslashes). Set `TASKS_DB_PATH` to the full path of `tasks.db`,
because the default is relative to whatever folder the client starts the server from:
```json
{
"mcpServers": {
"task-tracker": {
"command": "/full/path/to/venv/bin/python",
"args": ["/full/path/to/task-tracker-mcp-server/server.py"],
"env": { "TASKS_DB_PATH": "/full/path/to/tasks.db" }
}
}
}
```
**Client support for confirmation.** When this was written (August 2026), Claude Desktop answered
`update_priority` and `delete_task` with "no elicitation handler configured". Nothing is changed in that
case: the tools fail closed. `list_tasks`, `add_task` and `mark_task_done` work normally. MCP Inspector
supports elicitation. Check your client's current support.
## Configuration
| Variable | Meaning |
|---|---|
| `MCP_TRANSPORT` | `stdio` (default) or `http` |
| `MCP_HOST` | Bind address for HTTP, default `127.0.0.1` |
| `MCP_PORT` | HTTP port, default `8001` |
| `TASKS_DB_PATH` | Path to the SQLite file, default `tasks.db` in the working directory |
For network use see [docs/deployment.md](docs/deployment.md).
## Lessons learned
1. **Type hints are enforced.** `status: str = None` fails validation; write `status: str | None = None`.
2. **Never build SQL with string formatting.** Use `?` placeholders and pass values separately.
3. **Open a connection per call** instead of keeping one global connection open.
4. **Elicitation results have an `action` and `data`.** Check `result.action == "accept"` and then read
`result.data`. A user can also decline or cancel, which is different from answering "no".
5. **Check before you write.** Look the row up first and return a clear error if it is missing.
6. **A write tool with no confirmation is risky.** For servers shared with other people, prefer read-only tools.
7. **stdio and `print()` do not mix.** stdout carries the protocol; print to `sys.stderr` and never type into
the terminal of a running stdio server.
8. **Windows notes.** The command is `python`, not `python3`. If `Activate.ps1` is blocked, run
`Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned`.
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues