4.fun Agent Launch Protocol
Install & integrate
Tell your AI agent what you want to launch. 4.fun prepares everything. You review and sign. Launch, discover and integrate 4.fun markets from Claude Code, Cursor and any MCP-compatible agent.
Connect to Claude
Ordinary Claude users (web / Desktop) can add 4.fun as a custom connector — no GitHub clone and no Claude Code required.
- Open Claude → Customize → Connectors
- Choose Add custom connector
- Name:
4.fun - URL:
https://api.4.fun/api/mcp - Leave OAuth fields blank (public authless connector)
- Save, then connect and enable 4.fun in the conversation
The remote endpoint speaks Streamable HTTP MCP. Launch and trade tools only create unsigned quotes/drafts and return a browser review URL on 4.fun — you always sign in your own wallet.
Installation (Claude Code / Cursor)
Package status: Public npm package (@fourdottfun/mcp). Prefer the local stdio package for Claude Code:
claude mcp add 4fun -- npx -y @fourdottfun/mcp
Or add manually to your MCP config:
{
"mcpServers": {
"4fun": {
"command": "npx",
"args": ["-y", "@fourdottfun/mcp"],
"env": {
"AGENT_API_BASE_URL": "https://api.4.fun"
}
}
}
}Restart your agent after saving. Default API base is https://4.fun; for production agents prefer https://api.4.fun. Remote HTTP alternative: https://api.4.fun/api/mcp.
Natural-language examples
- “Launch a meme token called Rocket Frog with ticker $RFROG.”
- “Draft a 4.fun launch for Pixel Otter with website https://example.com and open the review link.”
- “List the newest 4.fun tokens and quote a 0.01 ETH buy on the top one.”
- “Show creator rewards for my wallet on 4.fun.”
The agent prepares an unsigned draft for any valid token idea. You open the review URL, edit metadata, upload a JPG/PNG/WebP image, connect with Privy, and confirm in your wallet. Nothing launches until you sign.
Available tools
| Tool | Description |
|---|---|
| get_platform_info | Get 4.fun Agent Launch Protocol platform info, contracts, and canonical fees. Call this first. |
| list_tokens | List recently launched 4.fun tokens. |
| get_token | Get a token by contract address. |
| get_token_market | Get market data for a token address. |
| parse_launch_intent | Parse a natural-language request for any supported token idea into draft fields (offline, no wallet). Works for memes, brands, utilities, etc. — not limited to AI-agent tokens. Returns missing fields, optional socials/imageUrl if present as https URLs, and nextSteps. Never accepts base64 images. |
| quote_launch | Validate a launch configuration against live Factory costs and return quoteId + canonical fees. Required before create_launch_draft. Accepts optional website/twitter/telegram/imageUrl (https only). Fail closed on RPC errors — never proceed without a cost quote. |
| create_launch_draft | Create an unsigned launch draft for any valid token from a successful unexpired quoteId and return a browser review URL. Optional https imageUrl/website/twitter/telegram are stored for the review page (users can still edit/upload there). Ask before calling. Never signs or broadcasts — nothing launches until the user reviews and signs. |
| get_launch_draft | Fetch an existing launch/trade draft by id. |
| quote_trade | Quote a buy/sell on a 4.fun token (review only). |
| create_trade_draft | Create a trade review draft with a wallet handoff URL. Never signs or broadcasts. |
| get_creator_rewards | Get indexed creator rewards for a wallet address. |
How it works
- Your agent calls the public 4.fun API / MCP tools.
- 4.fun builds an unsigned launch or trade draft using the same Factory / Pancake paths as the website.
- You receive a review URL on 4.fun, connect your wallet, and sign.
- No private keys are created or stored on 4.fun servers. Agents cannot bypass wallet confirmation.
Fees & rewards (from live contracts)
- Pool swap fee tier: 10000 (1%).
- Creator share of collected quote fees: 20% (on-chain).
- Creator share is 20% of collected quote fees on-chain (Factory / StockFactory). Remaining fees are split to platform recipients defined by the deployed contracts.
- Hardcoded in Token/StockToken: no buys in launch block; next 5 blocks enforce max wallet 2% and per-origin buy limits.
Full product docs remain at /docs.
Public developer API
Base path /api/v1 (feature flagged). Example:
curl https://4.fun/api/v1/platform
# 1) Validate costs via quote_launch (required)
curl -X POST https://4.fun/api/v1/launch/quote \
-H 'content-type: application/json' \
-d '{
"name": "Rocket Frog",
"symbol": "RFROG",
"description": "A frog with a jetpack on Robinhood Chain",
"initialBuy": "0.01"
}'
# 2) Create draft with the returned quoteId (fail closed without it)
curl -X POST https://4.fun/api/v1/launch/drafts \
-H 'content-type: application/json' \
-d '{
"quoteId": "apq_...",
"name": "Rocket Frog",
"symbol": "RFROG",
"description": "A frog with a jetpack on Robinhood Chain",
"initialBuy": "0.01"
}'Write endpoints require AGENT_PROTOCOL_WRITE_ENABLED=true. Try the browser playground at /agents/playground.
