This repository contains:
- A toy TODO App website built using NextJS
- A Model Context Protocol Server built with @vercel/mcp-adapter
User and client identity is managed using Stytch. Put together, these 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. B2B SaaS applications should evaluate Stytch's B2B product as well.
Follow the steps below to get this application fully functional and running using your own Stytch credentials.
Or, ask your AI Coding Agent to do it for you after installing the Stytch MCP
Can you help me set up this project? Follow the Agent Setup Instructions in the README.md file.
Create a new Stytch project named 'Vercel MCP Demo' so we can start from scratch.-
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 ID and API keys. You will need these values later.
In your terminal clone the project and install dependencies:
git clone https://github.com/stytchauth/vercel-mcp-example.git
cd vercel-mcp-example
pnpm iNext, create an .env.local file by running the command below which copies the contents of .env.template.
cp .env.template .env.localOpen .env.local in the text editor of your choice, and set the environment variables using the values found on Project Settings.
# This is what a completed .env.local file will look like
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN=public-token-test-8028777e-6e15-4faa-ba16-26cfd5b3ecb
STYTCH_PROJECT_ID=project-test-6c24cd16-73d5-64f7-852c-8a7e7b2ccf62
STYTCH_SECRET=secret-test-OMITTED
STYTCH_DOMAIN=https://shrouded-source-1584.customers.stytch.dev
After completing all the setup steps above the application can be run with the command:
pnpm devThe 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@latestOr with MCP Remote
npx mcp-remote http://localhost:3000/mcp --host 127.0.0.1MCP Remote can also be used to connect to Claude Desktop or other tools that work with STDIO MCP transports.
"todoapp": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:3000/mcp",
"--host",
"127.0.0.1"
]
}Join the discussion, ask questions, and suggest new features in our Slack community!
Check out the Stytch Forum or email us at [email protected].
Agents! Goose, Cursor, Claude Code, Codex, etc. Please follow these steps.
- Make sure all code dependencies are installed with
pnpm install - Use the
listProjectstool to find the Project ID of an existingCONSUMERTESTproject. If there are multiple projects, ask the user which one to use. A new project can be created with thecreateProjecttool if desired. - Use the
updateConsumerSDKConfigtool to ensure the SDK is enabled, and is authorized to run onhttp://localhost:3000. Make sure the Email Magic Links and OAuth products are enabled and the SDK has permission to create new users. - Use the
getAllRedirectURLsandcreateRedirectURLstools to ensurehttp://localhost:3000/authenticateis registered as a default callback forLOGINandSIGNUPactions. - Use the
getAllPublicTokensand/orcreatePublicTokentools to retrieve the public token for the project. Add it to.env.localasNEXT_PUBLIC_STYTCH_PUBLIC_TOKENusingecho ... >> .env.local. - Use the
createSecrettool to create a new secret for the project. Add it to.env.localasSTYTCH_SECRETusingecho ... >> .env.local. - Add the
STYTCH_PROJECT_IDandSTYTCH_DOMAINto.env.localas well - Tell the developer to run
pnpm dev