ChatGPT App Starter MCP Server

ChatGPT App Starter MCP Server

Enables building ChatGPT apps with custom UI widgets via a minimal Node.js MCP server, allowing tools to return structured content rendered in an iframe widget.

Category
访问服务器

README

ChatGPT App Starter

The fastest way to get a working ChatGPT App — one server file, one widget, zero build step.

Built on the OpenAI Apps SDK (MCP). Clone it, run it, connect it to ChatGPT in under 5 minutes.

License: MIT Node >= 20 PRs welcome

Why this exists

The Apps SDK docs are good but spread across a dozen pages, and the official examples assume a React + bundler setup. This starter is the opposite: plain Node, plain HTML, every moving part visible in ~200 lines. Read two files and you understand the whole platform. Then replace the example tool with your own logic.

Quickstart (5 minutes)

Prerequisites: Node 20+, cloudflared (free HTTPS tunnel, no account needed — brew install cloudflared).

git clone https://github.com/lologocrm/chatgpt-app-starter.git
cd chatgpt-app-starter
npm install
npm start          # MCP server on http://localhost:8787/mcp

In a second terminal:

npm run tunnel     # prints a public https://xxx.trycloudflare.com URL

Then connect it to ChatGPT:

  1. Settings → Apps & Connectors → Advanced settings → enable Developer mode (one-time)
  2. Settings → Connectors → Create → paste https://xxx.trycloudflare.com/mcp
  3. Open a new chat → +More → select your connector
  4. Try: "Show me a card titled Hello World that says it works, linking to example.com"

ChatGPT calls your show_card tool and renders the widget inline. That's a ChatGPT App.

How it works

ChatGPT ──HTTP──▶ server.js (MCP server)
   │                 ├── tool: show_card        → returns structuredContent
   │                 └── resource: ui://widget/… → the widget HTML
   └──iframe──▶ public/widget.html
                     └── JSON-RPC over postMessage bridge (ui/initialize,
                         ui/notifications/tool-result, tools/call…)

Every tool result carries three payloads — getting this split right is 80% of Apps SDK design:

Payload Who sees it Use for
structuredContent model and widget The data your widget renders. Keep it small — the model reads it too.
content model only Optional narration for the assistant's text reply.
_meta widget only Large or sensitive data. Never reaches the model.

Widget-initiated actions (forms, lead capture)

The example tool is read-only. To let the widget trigger an action — submit a form, capture a lead — add a second tool, mark it widget-callable with openai/widgetAccessible, and call it from the widget with data collected in the widget UI (so personal data never routes through the model):

// server.js — a write tool the widget is allowed to call
registerAppTool(server, "submit_request", {
  title: "Submit request",
  inputSchema: { email: z.string().email(), note: z.string().optional() },
  annotations: { readOnlyHint: false, openWorldHint: true },
  _meta: { "openai/widgetAccessible": true },   // <-- without this, the widget's call is blocked
}, async ({ email, note }) => {
  /* store or forward the lead */
  return { structuredContent: { ok: true } };
});

The widget collects the fields and calls that tool via the Apps SDK's tool-call bridge; the model only ever sees structuredContent, never the raw PII.

Gotchas the docs won't shout about

  • Widget caching: ChatGPT caches widget templates by URI. If you edit widget.html and nothing changes, bump WIDGET_URI in server.js (card-v1card-v2).
  • Tunnel URLs rotate: each npm run tunnel gives a new trycloudflare URL — update your connector, or use a named tunnel / ngrok with a reserved domain.
  • MIME type is strict: widget resources must be served as text/html;profile=mcp-app (use the RESOURCE_MIME_TYPE constant, don't hardcode).
  • Stateless by design: this starter creates one MCP server + transport per request. No sessions, no sticky routing — it deploys anywhere HTTPS runs.
  • Monetization reality (2026): no in-app purchases or digital goods yet. Link-outs to your own site are the supported pattern — the example card's CTA button is exactly that.

Deploy to production

The server is a single Node process — any HTTPS host works:

  • Fly.io / Render: deploy server.js as-is (set PORT from env — already handled).
  • Cloudflare Workers: needs a transport adapter (no node:http); PRs welcome.

Then submit for review to get listed in the ChatGPT app directory. Building the app is the easy part — passing review is its own playbook (screenshots to spec, real test cases, a privacy policy that actually resolves). It's all written up in Ship it below, from a real approved submission.

Ship it: submission, approval & legal

Building a working app is the first 20%; passing OpenAI's review is the other 80%. These guides are written from a real, approved submission — including the two things that got it rejected the first time:

  • docs/SUBMISSION.md — the six-section submission form, what each field wants, the two real rejection reasons + fixes, and the actual timeline.
  • docs/LEGAL.md — Privacy Policy (the #1 silent rejection: the URL must resolve to a real page, not an empty SPA shell), Terms, legal notice / mentions légales, GDPR, regulated-industry notes, and the compliance boxes you legally attest to at submit.
  • docs/SCREENSHOTS.md — exact specs (706 px wide, widget-only, no baked-in prompt) + a puppeteer script (scripts/generate-screenshots.mjs) that produces them.

The one thing to remember: both rejections were misdiagnosed by their labels. "Test cases failed" was really a server bug on an edge case; "privacy incomplete" was really a broken URL serving an empty page. Fix the real cause, validate live, resubmit.

Make it yours

  1. Replace show_card in server.js with your tool(s) — one registerAppTool call each.
  2. Rewrite the render() function in public/widget.html.
  3. Bump WIDGET_URI. Test in developer mode. Submit.

Resources

License

MIT — do whatever you want with it.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选