A lightweight, type-safe starter for building ChatGPT MCP apps with Next.js and Skybridge.
This template provides a simplified, production-ready foundation with:
- Next.js App Router structure
- Skybridge integration for type-safe widgets
- Better Auth (OAuth 2.1)
- Stripe subscription support (optional)
- Drizzle ORM with PostgreSQL
- 🚀 Type-Safe End-to-End - Automatic type inference from backend tools to frontend widgets.
- 🔐 OAuth 2.1 - Built-in auth for ChatGPT/Claude integration.
- ⚡ Next.js Native - Widgets are standard Next.js pages.
- 🔌 Skybridge Powered - Use typed hooks (
useCallTool,useToolInfo) instead of raw SDK calls.
pnpm installCopy .env.example to .env and fill in your details.
pnpm devYour MCP server is running at http://localhost:3000/mcp.
server.registerWidget(
"my_tool",
{ title: "My Tool", widgetPath: "/widgets/my-tool" },
{
description: "Does something cool",
inputSchema: z.object({ query: z.string() })
},
async ({ query }) => {
return createSuccessResponse("Done", { result: query });
}
);import MyWidget from "@/src/components/my-widget";
export default function MyToolPage() {
return <MyWidget />;
}"use client";
import { useToolInfo } from "@/src/skybridge";
export default function MyWidget() {
// Types are automatically inferred!
const { output } = useToolInfo();
if (!output) return <div>Loading...</div>;
return <div>Result: {output.structuredContent.result}</div>;
}app/mcp/route.ts- Main server entry pointsrc/skybridge.ts- Type definitions and hookslib/db/schema.ts- Database schema
MIT