Zurich Pet Insurance MCP Server
Provides pet insurance tools (research, quotes, applications, and binding) that can be invoked by ChatGPT through the OpenAI Apps SDK.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Zurich Pet Insurance MCP ServerGet a quote for my 3-year-old Labrador"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ChatGPT Apps SDK Next.js Starter — Zurich Pet Insurance
A minimal Next.js application demonstrating how to build an OpenAI Apps SDK compatible MCP server with widget rendering in ChatGPT.
Use case docs: See docs/README.md for the Zurich Agentic Commerce challenge brief, DA Direkt AS-IS journey, pain points, and Petolo API documentation.
Pet insurance journey
ChatGPT-native flow for DA Direkt dog insurance:
Research —
research_pet_insuranceloads Komfort / Premium / Premium Plus plansQuote —
get_pet_quotereturns live monthly prices from the Petolo APIApply —
start_or_update_applicationcreates/updates a leadSign & bind —
bind_pet_insuranceaccepts documents and submits the application
Widget UI: /widgets/journey (rendered in ChatGPT iframe)
Environment variables
Copy .env.example to .env.local:
PETOLO_API_BASE_URL=https://beta.dentolo-test.de
PETOLO_API_KEY=<from docs/use-case-data/READ_ME_API_ACCESS.pdf>Connect to ChatGPT
Deploy to Vercel (or run
pnpm devwith a tunnel)In ChatGPT → Settings → Connectors → add
https://your-app.vercel.app/mcpAsk: "I need dog insurance for my Labrador born 2020-01-01"
Related MCP server: Rover MCP Server
Overview
This project integrates a Next.js application with the ChatGPT Apps SDK using the Model Context Protocol (MCP). It exposes pet insurance tools and a journey widget that renders inside ChatGPT.
Key Components
1. MCP Server Route (app/mcp/route.ts)
The core MCP server implementation that exposes tools and resources to ChatGPT.
Key features:
Tool registration with OpenAI-specific metadata
Resource registration that serves HTML content for iframe rendering
Cross-linking between tools and resources via
templateUri
OpenAI-specific metadata:
{
"openai/outputTemplate": widget.templateUri, // Links to resource
"openai/toolInvocation/invoking": "Loading...", // Loading state text
"openai/toolInvocation/invoked": "Loaded", // Completion state text
"openai/widgetAccessible": false, // Widget visibility
"openai/resultCanProduceWidget": true // Enable widget rendering
}Full configuration options: OpenAI Apps SDK MCP Documentation
2. Asset Configuration (next.config.ts)
Critical: Set assetPrefix to ensure /_next/ static assets are fetched from the correct origin:
const nextConfig: NextConfig = {
assetPrefix: baseURL, // Prevents 404s on /_next/ files in iframe
};Without this, Next.js will attempt to load assets from the iframe's URL, causing 404 errors.
3. CORS Middleware (middleware.ts)
Handles browser OPTIONS preflight requests required for cross-origin RSC (React Server Components) fetching during client-side navigation:
export function middleware(request: NextRequest) {
if (request.method === "OPTIONS") {
// Return 204 with CORS headers
}
// Add CORS headers to all responses
}4. SDK Bootstrap (app/layout.tsx)
The <NextChatSDKBootstrap> component patches browser APIs to work correctly within the ChatGPT iframe:
What it patches:
history.pushState/history.replaceState- Prevents full-origin URLs in historywindow.fetch- Rewrites same-origin requests to use the correct base URL<html>attribute observer - Prevents ChatGPT from modifying the root element
Required configuration:
<html lang="en" suppressHydrationWarning>
<head>
<NextChatSDKBootstrap baseUrl={baseURL} />
</head>
<body>{children}</body>
</html>Note: suppressHydrationWarning is currently required because ChatGPT modifies the initial HTML before the Next.js app hydrates, causing hydration mismatches.
Getting Started
Installation
npm install
# or
pnpm installDevelopment
npm run dev
# or
pnpm devOpen http://localhost:3000 to see the app.
Testing the MCP Server
The MCP server is available at:
http://localhost:3000/mcpConnecting from ChatGPT
In ChatGPT, navigate to Settings → Connectors → Create and add your MCP server URL with the
/mcppath (e.g.,https://your-app.vercel.app/mcp)
Note: Connecting MCP servers to ChatGPT requires developer mode access. See the connection guide for setup instructions.
Project Structure
app/
├── mcp/
│ └── route.ts # MCP server with tool/resource registration
├── layout.tsx # Root layout with SDK bootstrap
├── page.tsx # Homepage content
└── globals.css # Global styles
middleware.ts # CORS handling for RSC
next.config.ts # Asset prefix configurationHow It Works
Tool Invocation: ChatGPT calls a tool registered in
app/mcp/route.tsResource Reference: Tool response includes
templateUripointing to a registered resourceWidget Rendering: ChatGPT fetches the resource HTML and renders it in an iframe
Client Hydration: Next.js hydrates the app inside the iframe with patched APIs
Navigation: Client-side navigation uses patched
fetchto load RSC payloads
Learn More
Deployment
This project is designed to work seamlessly with Vercel deployment. The baseUrl.ts configuration automatically detects Vercel environment variables and sets the correct asset URLs.
The configuration automatically handles:
Production URLs via
VERCEL_PROJECT_PRODUCTION_URLPreview/branch URLs via
VERCEL_BRANCH_URLAsset prefixing for correct resource loading in iframes
This server cannot be deployed
Maintenance
Related MCP Connectors
Insurance brokerage for AI agents — quote, bind, and settle in USDC
- Connext MCPOAuthcom.rti
Integrate Connext AI into agentic workflows, enabling Connext product-aware assistance.
Create, launch, and manage Meta + Google ads from Claude and ChatGPT.
11Connect Google Analytics to ChatGPT. Query GA4 data in plain English and get instant insights.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables interaction with a sample Pet Store API based on OpenAPI 3.1 specification, allowing users to manage pet store operations through natural language commands.-
- AlicenseAqualityDmaintenanceEnables AI assistants to search for pet sitters, manage bookings, and handle pet profiles through the Rover pet services marketplace. It facilitates direct communication with sitters and service management using Playwright-based browser automation.138 npm1MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Lemonade's insurance services for renters, homeowners, pet, and car insurance using Playwright browser automation. Users can retrieve quotes, manage existing policies, file claims, and access policy documents through natural language.78 npmMIT
- AlicenseAqualityDmaintenanceEnables AI assistants to search for pet products, manage shopping carts, and book grooming or training services directly through PetSmart's website. It also facilitates finding nearby store locations and accessing detailed product specifications.78 npmMIT