Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

OpenAI Apps MCP

FreeRuns bundled scriptsNot checked

Build ChatGPT apps with MCP servers on Cloudflare Workers. Extend ChatGPT with custom tools and interactive widgets (HTML/JS UI). Use when: developing ChatGPT…

ovachieverby ovachiever★ 56 GitHub stars13 installs in other catalogs

About this skill

Building OpenAI Apps with Stateless MCP Servers

Status: Production Ready Last Updated: 2025-11-17 Dependencies: cloudflare-worker-base, hono-routing (optional, helpful for routing patterns) Latest Versions: @modelcontextprotocol/[email protected], [email protected], [email protected]


Overview

This skill provides production-tested patterns for building OpenAI Apps - applications that extend ChatGPT's functionality through the Model Context Protocol (MCP). Focus on stateless MCP servers using Cloudflare Workers, which covers 80% of OpenAI Apps use cases.

What Are OpenAI Apps?

OpenAI Apps are extensions that integrate into the ChatGPT interface, allowing users to:

  • Access third-party services directly in conversations
  • Display interactive widgets (maps, carousels, lists, etc.)
  • Execute tools that return structured UI components
  • Enhance ChatGPT with domain-specific capabilities

Architecture

ChatGPT User
    ↓
ChatGPT (discovers and invokes tools)
    ↓
MCP Server (your Cloudflare Worker)
    ├── Tool handlers (business logic)
    ├── Widget resources (HTML/JS UI)
    └── OpenAI metadata (output templates)

Key Components

  1. MCP Server - HTTP endpoint exposing tools via Model Context Protocol
  2. Tool Handlers - Functions that process inputs and return results
  3. Widget Resources - HTML pages that render in ChatGPT's iframe
  4. OpenAI Metadata - Special annotations for widget routing and display

Quick Start (10 Minutes)

1. Scaffold Project

npm create cloudflare@latest my-openai-app -- --type hello-world --ts --git --deploy false
cd my-openai-app

# Install dependencies
npm install @modelcontextprotocol/[email protected] [email protected] [email protected]
npm install -D @cloudflare/[email protected] [email protected]

Why this matters:

  • @modelcontextprotocol/sdk is the official MCP protocol implementation
  • hono provides lightweight routing perfect for API endpoints
  • Vite + CloudFlare plugin enable building and serving widgets

2. Configure wrangler.jsonc

{
  "name": "my-openai-app",
  "main": "dist/index.js",
  "compatibility_date": "2025-10-08",
  "compatibility_flags": ["nodejs_compat"],
  "assets": {
    "directory": "dist/client",
    "binding": "ASSETS"
  },
  "observability": {
    "enabled": true
  }
}

CRITICAL:

  • nodejs_compat flag is required for MCP SDK
  • assets.binding: "ASSETS" must match TypeScript binding name
  • assets.directory must match Vite build output

3. Create MCP Server

// src/index.ts
import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';

type Bindings = {
  ASSETS: Fetcher;
};

const app = new Hono<{ Bindings: Bindings }>();

// CORS - must allow ChatGPT
app.use('/mcp/*', cors({
  origin: 'https://chatgpt.com',
  credentials: true,
  allowMethods: ['GET', 'POST', 'OPTIONS'],
  allowHeaders: ['Content-Type', 'Authorization']
}));

// Create MCP server
const mcpServer = new Server(
  { name: 'my-openai-app', version: '1.0.0' },
  { capabilities: { tools: {}, resources: {} } }
);

// Register a simple tool
mcpServer.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [{
    name: 'hello_world',
    description: 'Use this when the user wants to see a hello world message',
    inputSchema: {
      type: 'object',
      properties: {
        name: { type: 'string', description: 'Name to greet' }
      },
      required: ['name']
    },
    annotations: {
      openai: {
        outputTemplate: 'ui://widget/hello.html'
      }
    }
  }]
}));

mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
  if (request.params.name === 'hello_world') {
    const { name } = request.params.arguments as { name: string };
    return {
      content: [{ type: 'text', text: `Hello, ${name}!` }],
      _meta: { initialData: { name } }
    };
  }
  throw new Error(`Unknown tool: ${request.params.name}`);
});

// MCP endpoint
app.post('/mcp', async (c) => {
  const body = await c.req.json();
  const response = await mcpServer.handleRequest(body);
  return c.json(response);
});

// Serve widgets
app.get('/widgets/*', async (c) => c.env.ASSETS.fetch(c.req.raw));

export default app;

The 5-Step Setup Process

Step 1: Project Scaffolding

Use Cloudflare's official scaffolding:

npm create cloudflare@latest my-openai-app -- --type hello-world --ts --git --deploy false

Key Points:

  • Creates Workers project with TypeScript
  • Includes wrangler.jsonc
  • Initializes git repository

Step 2: Install Dependencies

npm install @modelcontextprotocol/[email protected] [email protected] [email protected]
npm install -D @cloudflare/[email protected] [email protected]

What each package does:

  • @modelcontextprotocol/sdk - Official MCP protocol (Anthropic)
  • hono -
Full SKILL.md on GitHub

Install OpenAI Apps MCP in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

Read
Write
Edit
Bash
Glob
Grep

Bundled files

.claude-plugin/plugin.jsonREADME.mdassets/example-template.txtreferences/example-reference.mdreferences/openai-metadata-format.mdscripts/example-script.shtemplates/basic/package.jsontemplates/basic/vite.config.tstemplates/basic/wrangler.jsonc

FAQ

What does the OpenAI Apps MCP skill do?

Build ChatGPT apps with MCP servers on Cloudflare Workers. Extend ChatGPT with custom tools and interactive widgets (HTML/JS UI). Use when: developing ChatGPT extensions, implementing MCP servers, or troubleshooting CORS blocking (allow chatgpt.com), widget 404s (missing ui://widget/), wrong MIME type (text/html+skybridge), or ASSETS binding undefined.

How do I install the OpenAI Apps MCP skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the OpenAI Apps MCP skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare OpenAI Apps MCP with