Flip-a-Coin MCP
Click on "Install 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., "@Flip-a-Coin MCPflip a coin"
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.
Flip-a-Coin MCP
A small, open-source-friendly Model Context Protocol (MCP) server that gives compatible AI clients one tool: flip_coin.
The tool performs a fair virtual coin flip and returns either heads or tails. It can be tested locally with MCP Inspector or connected to ChatGPT as a developer-mode app.
What it provides
A Streamable HTTP MCP endpoint at
/mcpA health endpoint at
/A single zero-argument tool named
flip_coinHuman-readable text and structured JSON output
Configurable port through the
PORTenvironment variable
Example tool response:
{
"content": [
{
"type": "text",
"text": "The coin landed on heads."
}
],
"structuredContent": {
"result": "heads"
}
}Related MCP server: Demo MCP Server
Requirements
Before starting, install:
Node.js 18 or newer
npm, which is included with Node.js
Optional: ngrok for connecting a local server to ChatGPT
Install
Clone or download this repository, then open a terminal in the project directory.
npm installStart the server
npm startThe default MCP endpoint is:
http://localhost:8787/mcpYou should see:
Flip-a-Coin MCP listening at http://localhost:8787/mcpTo use a different port:
PORT=3000 npm startKeep this terminal open while testing or using the server.
Verify the health endpoint
Open http://localhost:8787 in a browser or run:
curl http://localhost:8787/Expected response:
Flip-a-Coin MCP server is running.Test with MCP Inspector
Keep the server running and open a second terminal in the project directory:
npm run inspectIn MCP Inspector:
Connect to
http://localhost:8787/mcpusing Streamable HTTP.Open Tools.
Select
flip_coin.Click Run Tool.
Confirm the result is
headsortails.
Connect it to ChatGPT
ChatGPT must be able to reach the MCP server over HTTPS. localhost and 127.0.0.1 are only available on your computer and cannot be entered as the ChatGPT MCP URL.
1. Start the MCP server
In the first terminal:
npm start2. Create a public HTTPS tunnel
In a second terminal:
ngrok http 8787ngrok will display a forwarding URL resembling:
https://example-subdomain.ngrok-free.appThe MCP URL is that forwarding URL followed by /mcp:
https://example-subdomain.ngrok-free.app/mcp
http://127.0.0.1:4040is ngrok's local inspection dashboard. It is not the URL to enter in ChatGPT.
You can verify the tunnel by opening the forwarding URL without /mcp in a browser. It should display the server health message.
3. Enable ChatGPT developer mode
Open ChatGPT.
Open Settings → Security and login.
Turn on Developer mode.
If the option is unavailable in a managed workspace, ask the workspace administrator to enable developer mode.
4. Create the ChatGPT app
Open Settings → Plugins, or visit chatgpt.com/plugins.
Select the plus button to create a developer-mode app.
Enter the following information:
Name:
Flip a CoinDescription:
Flips a fair virtual coin when the user asks to flip or toss a coin.MCP server URL: your complete ngrok URL ending in
/mcpAuthentication: none
Select Create.
Confirm ChatGPT discovers the
flip_cointool.
See OpenAI's current Connect from ChatGPT guide if the interface differs.
5. Test it in a conversation
Start a new ChatGPT conversation.
Click + → More near the message composer.
Select Flip a Coin.
Try one of these prompts:
Flip a coin using the Flip a Coin app.Toss a coin for me.Choose between pizza and tacos. Heads is pizza and tails is tacos.Both npm start and ngrok must remain running. Free ngrok URLs may change after ngrok restarts; if that happens, update the MCP URL in ChatGPT.
Test with curl
Initialize the MCP server:
curl -sS http://localhost:8787/mcp \
-X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {
"name": "manual-test",
"version": "1.0.0"
}
}
}'List the available tools:
curl -sS http://localhost:8787/mcp \
-X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {}
}'Call flip_coin:
curl -sS http://localhost:8787/mcp \
-X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "flip_coin",
"arguments": {}
}
}'Project structure
.
├── README.md
├── package-lock.json
├── package.json
└── server.jsserver.jsdefines the MCP tool and HTTP server.package.jsoncontains the runtime dependencies and npm scripts.
Troubleshooting
ChatGPT cannot connect
Confirm
npm startis still running.Confirm ngrok is still running.
Use the HTTPS forwarding URL, not
localhostor127.0.0.1:4040.Ensure the URL ends with
/mcp.Open the forwarding URL without
/mcpand confirm the health message appears.Refresh the developer-mode app after changing tool metadata.
Port 8787 is already in use
Stop the process already using the port or choose another port:
PORT=3000 npm start
ngrok http 3000The server exits on the first MCP request
Run npm install to ensure the locked dependency versions are installed, then restart the server. If it still exits, inspect the terminal running npm start for the complete error message.
MCP Inspector does not open
The first npm run inspect may download MCP Inspector through npx. Confirm the machine has internet access and try again.
Production considerations
The ngrok workflow is intended for development. For a persistent installation:
Deploy the server to a host that supports a continuously running Node.js HTTP process.
Use a stable HTTPS domain.
Add request logging, rate limiting, monitoring, and graceful shutdown handling.
Add authentication if the endpoint should not be public.
Keep dependencies updated and test tool discovery after upgrades.
For private deployments, OpenAI also documents Secure MCP Tunnel, which lets supported OpenAI products reach a private MCP server without opening inbound firewall ports.
Contributing
Issues and pull requests are welcome. Please keep changes small, document user-visible behavior, and verify the server through MCP Inspector or the curl examples before submitting.
License
Add a LICENSE file before publishing the repository and update this section with the selected open-source license. MIT and Apache-2.0 are common choices for small developer tools.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/michaelcarpenter2000/flip-a-coin-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server