mcp-stytch-consumer-todo-list
An MCP server that manages a TODO list with user authentication via Stytch, enabling AI agents to interact with a full-stack application.
README
Workers + Stytch TODO App MCP Server
This is a Workers server that composes three functions:
- A static website built using React and Vite on top of Worker Assets
- A REST API built using Hono on top of Workers KV
- A Model Context Protocol Server built using on top of Workers Durable Objects
User and client identity is managed using Stytch. Put together, these three features show how to extend a traditional full-stack application for use by an AI agent.
This demo uses the Stytch Consumer product, which is purpose-built for Consumer SaaS authentication requirements. If you are more interested in Stytch's B2B product, see this demo instead.
[!WARNING] This is a demo template designed to help you get started quickly. While we have implemented several security controls, you must implement all preventive and defense-in-depth security measures before deploying to production. Please review our comprehensive security guide: Securing MCP Servers
Set up
Follow the steps below to get this application fully functional and running using your own Stytch credentials.
In the Stytch Dashboard
-
Create a Stytch account. Within the sign up flow select Consumer Authentication as the authentication type you are interested in. Once your account is set up a Project called "My first project" will be automatically created for you.
-
Navigate to Frontend SDKs to enable the Frontend SDK in Test
-
Navigate to Connected Apps to enable Dynamic Client Registration and configure your authorization URL as
http://localhost:3000/oauth/authorize. -
Navigate to Project Settings to view your Project Domain, Project ID, and API keys. You will need these values later.
On your machine
In your terminal clone the project and install dependencies:
git clone https://github.com/cloudflare/ai.git
cd ai
npm i
cd demos/mcp-stytch-consumer-todo-list
Next, create an .env.local file by running the command below which copies the contents of .env.template.
cp .env.template .env.local
Open .env.local in the text editor of your choice, and set the environment variables using the public_token and project domain found on Project Settings.
# This is what a completed .env.local file will look like
VITE_STYTCH_PUBLIC_TOKEN=public-token-test-abc123-abcde-1234-0987-0000-abcd1234
VITE_STYTCH_DOMAIN=random-domain-name.customers.stytch.dev
Create a .dev.vars file by running the command below which copies the contents of .dev.vars.template
cp .dev.vars.template .dev.vars
Open .dev.vars in the text editor of your choice, and set the environment variables using the Project ID and Secret found on Project Settings.
// This is what a completed .dev.vars file will look like
STYTCH_PROJECT_ID=project-test-6c20cd16-73d5-44f7-852c-9a7e7b2ccf62
Running locally
After completing all the setup steps above the application can be run with the command:
npm run dev
The application will be available at http://localhost:3000 and the MCP server will be available at http://localhost:3000/sse.
Test your MCP server using the MCP Inspector
npx @modelcontextprotocol/inspector@latest
Deploy to Cloudflare Workers
Click the button - you'll need to configure environment variables after the initial deployment.
Or, if you want to follow the steps by hand:
- Create a KV namespace for the TODO app to use
wrangler kv namespace create TODOS
- Update the KV namespace ID in
wrangler.jsoncwith the ID you received:
"kv_namespaces": [
{
"binding": "TODOS",
"id": "your-kv-namespace-id"
}
]
- Upload your Stytch Env Vars for use by the worker
npx wrangler secret bulk .dev.vars
- Deploy the worker
npm run deploy
- Grant your deployment access to your Stytch project. Assuming your Stytch project was deployed at
https://mcp-stytch-consumer-todo-list.$YOUR_ACCOUNT_NAME.workers.dev:- Add
https://mcp-stytch-consumer-todo-list.$YOUR_ACCOUNT_NAME.workers.dev/authenticateas an allowed Redirect URL - Add
https://mcp-stytch-consumer-todo-list.$YOUR_ACCOUNT_NAME.workers.devas an allowed Authorized Application in the Frontend SDKs configuration
- Add
Get help and join the community
:speech_balloon: Stytch community Slack
Join the discussion, ask questions, and suggest new features in our Slack community!
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.
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.
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.
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.
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.
E2B
Using MCP to run code via e2b.