Todo MCP Server
A Model Context Protocol server with a built-in OAuth 2.1 authorization server and a Next.js todo app, enabling authenticated task management (create, read, update, delete tasks) via natural language through an MCP client.
README
Todo MCP Server
A Model Context Protocol server with a from-scratch OAuth 2.1 authorization server, built inside a Next.js todo app. Connect Claude (or any MCP client) to it and the full flow works end to end: dynamic client registration → PKCE authorization → token exchange → authenticated tool calls scoped to the signed-in user.
I built this to understand what actually happens when an LLM client connects to a remote MCP server — not just the tool definitions, but the entire auth handshake underneath. No auth library for the OAuth server; every endpoint is hand-rolled against the RFCs.
What's implemented
MCP server (src/mcp/, served at /api/mcp via Streamable HTTP):
- 6 task tools:
list_tasks,get_task,create_task,update_task,complete_task,delete_task - Zod input validation and tool annotations (
readOnlyHint,destructiveHint,idempotentHint) userIdcomes only from the validated Bearer token, never from tool arguments — an LLM cannot ask for another user's tasks- Stateless per-request handling, serverless-friendly
OAuth 2.1 authorization server (hand-rolled):
- Dynamic Client Registration — RFC 7591 (
/register) - Authorization Code + PKCE S256 (
/authorizewith a real consent page) - Server metadata discovery — RFC 8414
(
/.well-known/oauth-authorization-server) plus protected-resource metadata for MCP clients - Token endpoint with
authorization_codeandrefresh_tokengrants - Access tokens: stateless JWTs, 1h TTL, audience-bound to
/api/mcp(a token minted for this resource is rejected everywhere else) - Single-use authorization codes with 5-minute expiry; persisted refresh tokens with 30-day TTL
The app itself: Next.js 16 + React 19 + Prisma 7 + PostgreSQL, task CRUD behind a service layer that both the web UI and the MCP tools share.
Quick start
Requires Node 20+ and PostgreSQL.
npm install
cp .env.example .env # set DATABASE_URL and JWT_SECRET
npx prisma migrate deploy
node scripts/seed-mock-users.mjs
npm run dev
Then either use the web UI at http://localhost:3000, or run the proof
scripts:
# Bearer-token MCP session: lists tools, calls them, proves per-user scoping
node scripts/mcp-test.mjs
# Full OAuth 2.1 handshake: DCR → PKCE authorize → token exchange →
# authenticated MCP call → refresh grant. Exactly what Claude does internally.
node scripts/oauth-e2e.mjs
# Against a public tunnel instead of localhost:
BASE=https://your-tunnel.example.com node scripts/oauth-e2e.mjs
Connecting Claude
Add the server URL (https://<host>/api/mcp) as a custom connector — the
client discovers the authorization server via .well-known, registers
itself, and walks the PKCE flow against the consent page.
Security notes
- Auth codes are consumed atomically before validation — replay gets a 400
- PKCE S256 verified on every code exchange
- JWT
audclaim pins tokens to the MCP resource (no token passthrough) - Every service-layer query is scoped
where: { userId }— ownership is enforced below the tool layer, so a buggy tool can't leak across users - Sign-in is passwordless-by-email for local development only; wiring a real identity provider is the obvious next step for production use
Design
The phased plan and decisions (why audience binding, why stateless access tokens + persisted refresh tokens, why the service layer owns scoping) are in docs/specs/2026-07-03-todo-mcp-server-design.md.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.