Joke Button MCP Server
Provides a joke button UI for ChatGPT that, when clicked, asks the assistant to respond with one short, family-friendly joke.
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., "@Joke Button MCP ServerShow the joke button"
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.
MCP App Experiments
This project is a tiny MCP server with three MCP App experiments:
Joke Button sends a message to the host asking the assistant for a short joke.
Popup Messenger presents one button labeled Open Sesame, opens a separate message window, and lets the assistant send text into that window through an MCP tool.
Colorific displays a color square, lets the assistant translate natural-language colors into hex values, and asks the assistant for a creative color name when clicked.
It intentionally uses only Node.js built-in modules. There are no runtime package dependencies.
What It Demonstrates
MCP core protocol version
2026-07-28, with legacy Streamable HTTP compatibility for the 2025 revisionsStateless Streamable HTTP on one endpoint:
/mcpserver/discover,tools/list,tools/call,resources/list, andresources/readMCP Apps UI resource metadata with
_meta.ui.resourceUriA sandbox-friendly
text/html;profile=mcp-appwidgetThe MCP Apps
ui/initializelifecycle, host context, size reporting, andui/messageoverpostMessageTool-result-driven UI updates through
ui/notifications/tool-resultDecoupled Colorific render and data tools that update one mounted app panel
Model-to-window messaging through
send_popup_messageand an ephemeral server-side channelStandards-based
ui/open-linkfallback when a host iframe blocks direct popups
Related MCP server: Jokes MCP Server
Popup Feasibility and Design
MCP Apps run in host-controlled sandboxed iframes. The stable MCP Apps permissions cover camera, microphone, geolocation, and clipboard write, but do not provide a way for an app to request the iframe allow-popups sandbox token. Popup behavior is therefore host-dependent.
Popup Messenger attempts window.open() synchronously from the Open Sesame click, which produces a sized popup in browsers that allow it. If the sandbox blocks that call, the app requests ui/open-link; compatible hosts should open the same URL in the default browser or a new tab. A true popup cannot be guaranteed across all MCP hosts.
The model-to-popup path does not depend on direct iframe access:
The app generates an unguessable channel ID and registers it with the app-only
register_popup_channeltool.The app gives that channel ID to the model with
ui/update-model-contextandui/message.The model calls
send_popup_messagewith the channel ID and its text.The server queues the message in memory, and the standalone window polls the server and displays it.
This completes the message requirements on a single server process. Channels expire after two hours and keep at most 100 messages. Because storage is in memory, channels do not survive a restart and are not shared across multiple server instances. A durable shared store would be required for production scaling.
Colorific Interaction
Call show_colorific once to open a transparent square and create an ephemeral game ID. When a user asks to see a color, the assistant converts the request to a six-digit hex value and calls set_colorific_color with that active game ID:
Show me electric lavender.Only show_colorific owns the UI resource, so later color changes do not render more app panels. The mounted app polls the app-only get_colorific_state tool and repaints itself when the server-side revision changes. It also publishes the active game ID through ui/update-model-context so the assistant can keep routing later requests to the same game.
Clicking the square sends a follow-up request asking the assistant to reply with the exact current value and an original two-to-four-word color name.
Colorific game state is held in memory, expires after two hours of inactivity, and does not survive server restarts or span multiple server processes. Production scaling would require shared storage.
Requirements
Install Node.js 20 or newer from nodejs.org. The LTS download is fine.
You do not need to run npm install; this project has no third-party libraries.
Start the Server
Open a terminal in this folder and run:
npm startYou should see:
MCP App Experiments server listening on http://127.0.0.1:8787/mcp
Preview Joke Button at http://127.0.0.1:8787/preview
Preview Popup Messenger at http://127.0.0.1:8787/preview/popup-messenger
Preview Colorific at http://127.0.0.1:8787/preview/colorificLeave that terminal open while you test.
MCP requests are logged by method while the server is running. For an interactive app render, the log should include a successful UI resource read similar to:
[mcp] request method=resources/read name=ui://joke-button/app.html
[mcp] response method=resources/read status=200Set MCP_LOG_REQUESTS=false if you want to disable these development logs.
Heroku Deployment
The joke-button Heroku app is deployed at:
https://joke-button-31cddc4bc964.herokuapp.comIts MCP endpoint is:
https://joke-button-31cddc4bc964.herokuapp.com/mcpDeploy the current branch with:
git push heroku HEAD:mainQuick Local Check
Open this address in a browser:
http://127.0.0.1:8787/previewPreview Popup Messenger at:
http://127.0.0.1:8787/preview/popup-messengerPreview Colorific at:
http://127.0.0.1:8787/preview/colorificThe Popup Messenger preview can open its standalone window, but only an MCP Apps host can ask the assistant to send messages into it.
Use with ChatGPT Desktop or ChatGPT Web
ChatGPT needs an HTTPS URL for a remote MCP server during development. Keep npm start running, then expose port 8787 with a tunnel tool such as ngrok or Cloudflare Tunnel.
Example with ngrok:
ngrok http 8787Copy the HTTPS forwarding URL and add /mcp to the end, for example:
https://example.ngrok.app/mcpThen connect it in ChatGPT:
Open ChatGPT.
Open Settings.
Open Security and login.
Turn on Developer mode if it is not already enabled.
Open Plugins. If you are in the desktop app and do not see it in the sidebar, open
https://chatgpt.com/pluginsin a browser while signed in to the same account.Select the plus button to add a developer MCP server connection.
Paste the HTTPS URL ending in
/mcp.Name it
MCP App Experiments.Start a new chat, select the plugin from the More menu, and ask:
Show the Popup Messenger.Click
Open Sesame.The app asks the assistant to send a welcome message. Ask for more with a prompt such as:
Send another message to the open popup saying hello again.
You do not need a setting named MCP servers for this ChatGPT UI test. That setting is for Codex's local MCP host configuration, not for adding a ChatGPT developer plugin connection.
If Developer mode or the plus button is missing, check that the desktop app is up to date and that your account or workspace allows plugin development.
If the app is working, ChatGPT should receive the button's message and respond with a short joke.
Use with Codex in the ChatGPT Desktop App
Codex can connect to Streamable HTTP MCP servers from the shared MCP settings.
The MCP servers setting appears only on Codex-capable local clients and may not appear in a regular ChatGPT chat settings view. If it is available:
Keep
npm startrunning.Open the ChatGPT desktop app.
Open Settings, then MCP servers.
Select Add server.
Choose Streamable HTTP.
Name the server
joke_button.Use this URL:
http://127.0.0.1:8787/mcpSave, then restart when prompted.
In a Codex task, type
/mcpto confirm the server is connected.Ask Codex:
Use the Joke Button MCP server.
Codex MCP tool support may show the text fallback rather than rendering the iframe UI, depending on the surface. For the actual one-button UI, use ChatGPT with MCP Apps UI support.
If the setting is not visible, copy the sample configuration from codex-config.example.toml into a trusted project's .codex/config.toml or into your user ~/.codex/config.toml, then restart the ChatGPT desktop app or Codex client.
Useful URLs
Health check:
http://127.0.0.1:8787/healthMCP endpoint:
http://127.0.0.1:8787/mcpJoke Button preview:
http://127.0.0.1:8787/previewPopup Messenger preview:
http://127.0.0.1:8787/preview/popup-messengerColorific preview:
http://127.0.0.1:8787/preview/colorific
Security Notes
The server validates the protocol version and mirrored MCP headers required by the 2026-07-28 Streamable HTTP transport. The same endpoint also accepts the legacy initialize handshake used by protocol versions 2025-03-26, 2025-06-18, and 2025-11-25.
For local development, requests without an Origin header are accepted, loopback browser origins are accepted, and common OpenAI host origins are accepted. For another host origin, start the server with:
$env:MCP_ALLOWED_ORIGINS="https://your-host.example"
npm startUse authentication before exposing a real MCP server that can access private data or perform actions. This sample does neither.
Project Files
server.js: dependency-free MCP serverpublic/joke-button.html: MCP App UI widgetpublic/popup-messenger.html: Open Sesame MCP App UIpublic/popup-window.html: standalone assistant-message windowpublic/colorific.html: Colorific MCP App UIcodex-config.example.toml: sample Codex MCP configuration
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that fetches jokes from multiple sources (Chuck Norris, Dad jokes, and Yo Mama jokes) and integrates with Microsoft Copilot Studio to create a humor-focused conversational experience.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server implementation that delivers various joke types (Chuck Norris, Dad jokes, etc.) to Microsoft Copilot Studio and GitHub Copilot through the Model Context Protocol.MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that provides joke-fetching capabilities, demonstrating how to deploy an MCP Server and integrate it with Microsoft Copilot Studio.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides jokes on demand, allowing users to request different types of jokes (Chuck Norris, Dad jokes, etc.) through natural language in both GitHub Copilot and Microsoft Copilot Studio.MIT