![]() |
A virtual pet game built with the Model Context Protocol (MCP) and OpenAI Apps SDK. Raise pets, unlock achievements, and experience the nostalgia of digital companions—all inside ChatGPT. Built with Stytch, Alpic, and Vercel. |
Chatagotchi is an MCP server that brings interactive pet care to ChatGPT using the Apps SDK. Users can:
- 🐣 Start a new game and raise different kinds of pets (bird, cat, dog, lizard, or fish)
- 🍎 Feed their pet with different foods (apples, cookies, salad, pizza)
- 🎮 Play activities (video games, running, skiing)
- 🏆 Unlock 11 discovery achievements
Chatagotchi uses a three-layer architecture:
Node.js/TypeScript server that exposes game tools via the Model Context Protocol. Built with:
- Controllers (
server.ts) - MCP tool definitions for ChatGPT integration - Business Logic (
game-service.ts) - Game state management and message generation - Game Mechanics (
game-logic.ts) - Pure functions for pet actions, lifecycle, and achievements - Authentication - Stytch Connected Apps for MCP authentication
A traditional React SPA responsible for marketing, user signup, and OAuth authorization.
- Hosted as standalone website on Vercel
- Functions as an OAuth Authorization Server
React components rendered inside ChatGPT via the Apps SDK:
- Pet Widget - Displays pet emoji, name, stats, lifecycle stage, and action buttons
- Achievements Widget - Gallery of locked/unlocked achievements with progress tracking
- Utilities - Shared hooks for accessing OpenAI global context and widget state
- Node.js 18+
- pnpm (recommended) or npm/yarn
- Stytch, Alpic, and Vercel accounts
Fork the repository in Github so you can connect your personal repository to Vercel and Alpic.
- Create a Vercel account at https://vercel.com/
- Grant Vercel access to your forked repository, and deploy it
- Remember your Vercel domain, which will look like
https://chatagotchi-$adjective.vercel.app
- Create a Stytch account at https://stytch.com
- Create a "Consumer" project and get your credentials from the Project Overview page
- You'll need the
STYTCH_PROJECT_ID,STYTCH_SECRET,STYTCH_DOMAIN, andSTYTCH_PUBLIC_TOKENfor later
- You'll need the
- Navigate to Frontend SDK
- Enable the Javascript SDK, and add your Vercel domain as an approved domain
- Navigate to Connected Apps > Settings
- Enable Dynamic Client Registration
- Set
${VERCEL_DOMAIN}/oauth/authorizeas your project Authorization URL
- Return to Vercel. Set your
STYTCH_PUBLIC_TOKENas aVITE_STYTCH_PUBLIC_TOKENenvironment variable
- Create an Alpic account at https://alpic.ai
- Grant Alpic access to your forked repository
- Configure the following build settings:
- Build Command:
pnpm run build:mcp - Output Directory:
./ - Start Command:
pnpm run --silent start:mcp
- Build Command:
- Configure the following environment variables:
STYTCH_PROJECT_ID- your project ID from StytchSTYTCH_PROJECT_SECRET- your project secret from StytchSTYTCH_DOMAIN- your project domain from StytchFRONTEND_DOMAIN- your Vercel Domain
- Redeploy the MCP server to ensure all settings have been applied
To add Chatagotchi to ChatGPT:
- Enable developer mode
- Add the ngrok URL to ChatGPT: Settings > Connectors
- Use the MCP endpoint:
https://chatagotchi-xxxxx.alpic.live
- Use the MCP endpoint:
Once connected, try saying "Let's start a brand new chatagotchi game" to get started.
Build widgets into static assets for deployment:
pnpm run buildThis produces versioned .html, .js, and .css files in assets/. Each widget is self-contained with its own styles.
For local development with hot reload:
pnpm run devThe dev server runs on http://localhost:4444
Start the MCP server:
pnpm start:mcpContributions are welcome! Open an issue or submit a PR to improve the game.
This project is licensed under the MIT License. See LICENSE for details.
