Todo MCP
A task application with a Next.js interface and an MCP server operating on the same SQLite database.
- Next.js
- React
- TypeScript
- Prisma
- SQLite

Problem
The application aimed to let humans and AI agents operate on the same task state without duplicating business logic or maintaining two sources of truth.
Role
I worked on the complete dual architecture: interface, Server Actions, Prisma layer, MCP server, token authentication, and tests.
Decisions
- A single business layer.
lib/tasks.ts centralizes task operations. Server Actions and the MCP server are thin adapters that validate and format responses but share the same implementation and SQLite database.
- MCP tokens with hashing and expiration.
Each token is shown once, stored as a SHA-256 hash with a visible prefix, expires after ninety days, and can be revoked from the interface. Once revoked, requests with that token are no longer authenticated.
- Zod validation on both access paths.
Title, description, and pagination limits are enforced in both Server Actions and MCP tools, so the agent receives controlled error messages in Spanish.
- A self-contained architecture document.
The /arquitectura route serves an HTML document with embedded CSS, JavaScript, and diagrams, with no CDN or network requests, generated from a versioned source.
Result
The interface and the MCP endpoint share SQLite and validation. Tokens are generated, copied once, expired, and revoked from /mcp, and the architecture documentation is published with the build.