mcpField
W
Workers + Stytch TODO App MCP Server

Workers + Stytch TODO App MCP Server

Local
mcp-stytch-consumer-todo-list.maxwell-gerber42.workers.devProductivity27Updated 62w ago

About Workers + Stytch TODO App MCP Server

A TODO app example running on Cloudflare Workers that combines a React and Vite website, a Hono REST API on Workers KV, and an MCP server. Stytch Consumer handles user and client identity, making it a reference for extending a full-stack app to AI agents.

Key features

  1. 01Website, REST API and MCP server in one Worker
  2. 02REST API built with Hono on Workers KV
  3. 03MCP server hosted on Workers Durable Objects
  4. 04User and client authentication through Stytch Consumer
  5. 05Streamable HTTP endpoint at /mcp

Use cases

  1. 01Reference for adding AI agent access to an existing full-stack app
  2. 02Learning how to combine a website, API and MCP server on Cloudflare Workers
  3. 03Testing TODO operations over MCP with Stytch authentication

MCP support

This project is an MCP server that exposes its endpoint at /mcp to MCP clients and uses Stytch to manage access identity.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"stytch-consumer-todo-list": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/inspector"
]
}
}
}
Run commandnpx -y @modelcontextprotocol/inspector

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@modelcontextprotocol/inspector

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Workers + Stytch TODO App MCP Server

This is a Workers server that composes three functions:

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.

Set up

Follow the steps below to get this application fully functional and running using your own Stytch credentials.

In the Stytch Dashboard
  1. 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.

  2. Navigate to Frontend SDKs to enable the Frontend SDK in Test

  3. Navigate to Connected Apps to enable Dynamic Client Registration

  4. Navigate to Project Settings to view your 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/stytchauth/mcp-stytch-consumer-todo-list.git
cd mcp-stytch-consumer-todo-list
npm i

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 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

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, Secret, and Project Domain 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
STYTCH_SECRET=your-stytch-secret-key
STYTCH_DOMAIN=https://cname-word-1234.customers.stytch.dev

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/mcp.

Test your MCP server using the MCP Inspector

npx @modelcontextprotocol/inspector@latest

Navigate to the URL where the Inspector is running, and input the following values:

  • Transport Type: Streamable HTTP
  • URL: http://localhost:3000/mcp

Deploy to Cloudflare Workers

Click the button - you'll need to configure environment variables after the initial deployment.

Deploy to Cloudflare

Or, if you want to follow the steps by hand:

  1. Create a KV namespace for the TODO app to use
wrangler kv namespace create TODOS
  1. Update the KV namespace ID in wrangler.jsonc with the ID you received:
"kv_namespaces": [
   {
      "binding": "TODOS",
      "id": "your-kv-namespace-id"
   }
]
  1. Upload your Stytch Env Vars for use by the worker
npx wrangler secret bulk .dev.vars
  1. Deploy the worker
npm run deploy
  1. 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:
    1. Add https://mcp-stytch-consumer-todo-list.$YOUR_ACCOUNT_NAME.workers.dev/authenticate as an allowed Redirect URL
    2. Add https://mcp-stytch-consumer-todo-list.$YOUR_ACCOUNT_NAME.workers.dev as an allowed Authorized Application in the Frontend SDKs configuration

Get help and join the community

:speech_balloon: Stytch community Slack

Join the discussion, ask questions, and suggest new features in our Slack community!

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.