Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

OpenAI Apps MCP

БесплатноЗапускает вложенные скриптыНе проверен

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

ovachieverот ovachiever★ 56 звёзд на GitHub13 установок в других каталогах

Об этом скилле

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 -
Полный SKILL.md на GitHub

Установить OpenAI Apps MCP в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Bash
Glob
Grep

Вложенные файлы

.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

Что делает скилл OpenAI Apps MCP?

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.

Как установить скилл OpenAI Apps MCP?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл OpenAI Apps MCP запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить OpenAI Apps MCP с