x402 Protocol — Episode 3: MCP Server, awesome-x402, and the $0 Bet

The API was live. Payments worked. But here's the problem I hadn't thought about: how does a buyer agent even find my API?

Nobody's googling "Korean crypto data x402 endpoint." AI agents discover services through tool registries and curated lists. If my API isn't in those places, it doesn't exist. So this episode is about distribution — making KR Crypto Intelligence visible to the agents that might actually use it.

What This Post Covers

Building an MCP server so AI platforms like Claude and ChatGPT can call my API as a tool, adding a stablecoin premium endpoint that came from a random market research session, getting listed on awesome-x402 and MCP directories, and confronting the actual numbers behind the x402 ecosystem. This is where optimism meets arithmetic.

Building the MCP Server

MCP (Model Context Protocol) lets AI platforms call external APIs as tools. If my API is the product, the MCP server is the storefront. Glama alone indexes over 20,000 MCP servers — that's 20,000 potential storefronts that AI agents browse when they need a capability.

The setup with fastmcp was straightforward. Six tools registered — get_kimchi_premium, get_kr_prices, get_fx_rate, get_stablecoin_premium, get_available_symbols, check_health. Each tool calls the FastAPI server on localhost (127.0.0.1:80), so there's zero network latency between the MCP layer and the actual API.

from fastmcp import FastMCP mcp = FastMCP("KR Crypto Intelligence") @mcp.tool() async def get_kimchi_premium(symbol: str = "BTC") -> dict: async with httpx.AsyncClient(timeout=15) as client: r = await client.get( f"http://127.0.0.1:80/api/v1/kimchi-premium", params={"symbol": symbol} ) return r.json()
What this does in plain English: When Claude or ChatGPT needs Korean crypto data, it calls this tool. The tool hits my API locally and returns the result. The AI never needs to know about x402 payments — the MCP layer handles everything behind the scenes.

The MCP server runs on port 8443 via SSE. But here's where I burned 30 minutes: Cloudflare's Flexible SSL forwards everything to port 80 by default. So when someone hit mcp.printmoneylab.com, Cloudflare sent it to port 80 where FastAPI lives, and FastAPI returned a 404 because it doesn't know anything about MCP routes.

Fix: Cloudflare Origin Rules. One rule that says "if the hostname is mcp.printmoneylab.com, rewrite the destination port to 8443." Five clicks in the Cloudflare dashboard. Worked immediately.

One more gotcha: fastmcp recently removed the description parameter from its constructor. FastMCP("name", description="...") throws a TypeError now. Just pass the name. Cost me a confused 10 minutes staring at a stack trace for what turned out to be a one-word fix.

The Stablecoin Premium Idea

This one came out of nowhere. I was reviewing a list of market data ideas — about ten of them — trying to figure out what else I could offer beyond kimchi premium. Most were either too complex or already available elsewhere.

Then I noticed something: kimchi premium and stablecoin premium are two different things, and people mix them up constantly.

Kimchi premium measures the BTC price gap between Korean and global exchanges. Stablecoin premium measures something else entirely: what USDT and USDC themselves trade for on Korean exchanges versus the official USD/KRW exchange rate. When stablecoins trade at a premium in Korea, it's a direct signal that capital is flowing into the Korean crypto market. When they trade at a discount, money's flowing out.

I checked: nobody was offering this as an API. Zero services.

The beautiful part: I already had all the data. Upbit prices for USDT and USDC were already being fetched by my existing code. The exchange rate endpoint was already built. All I needed was ten lines of math to combine them into a new endpoint.

# Actual response data (April 3, 2026): { "official_fx_rate": 1512.55, "stablecoins": { "usdt": { "price_krw": 1517.0, "premium_percent": 0.29, "premium_direction": "positive" }, "usdc": { "price_krw": 1519.0, "premium_percent": 0.43, "premium_direction": "positive" } } }

USDT at 0.29% premium, USDC at 0.43%. Both positive — capital flowing into Korea at that moment. Ten new lines of code, no new data source, $0 additional cost. Added it to the x402 routes, registered the MCP tool, pushed to GitHub. Done in about 30 minutes.

Getting Listed

Remember CrossFin from Episode 1? The ghost competitor with 15 Korean data APIs and zero proof any of them worked? It was listed on awesome-x402 — the exact same curated list I was about to submit to.

I submitted PR #179 to awesome-x402. About a week later, it got merged. The maintainer's message:

"Thanks for contributing! Your project is now listed in awesome-x402."

There was something satisfying about seeing my actual, working service listed right there in the same ecosystem where a ghost had squatted. CrossFin claimed "first financial data APIs in x402." Mine actually work.

The maintainer also suggested listing on xpay.tools for additional visibility. Haven't done that yet — it's on the list.

Glama (MCP directory, 20,000+ servers indexed) approved my submission within a few hours. Straightforward process — sign in with GitHub, submit the server URL, wait.

Smithery (another MCP registry, 10,000+ users) didn't go as smoothly. Authentication stage returned a 405 error — probably a compatibility issue between fastmcp's SSE transport and Smithery's client, or Cloudflare's proxy interfering. I spent about 15 minutes looking at it, decided it wasn't worth debugging right now, and moved on. Not every platform needs to work on day one.

PulseMCP picked it up automatically from the official registry. No action needed.

I also added an x402 manifest at /.well-known/x402 — think of it as robots.txt for payment APIs. Buyer agents can check what services are available, what they cost, and how to pay, all without making a paid request first.

The $0 Bet

Time to be honest about the numbers.

The x402 ecosystem processes roughly $28,000 in daily volume. Artemis estimates about half of that is gamified (promotional, not organic). So maybe $14,000 in real transactions spread across 251+ services.

At $0.001 per call, I'd need 1,000 paid requests per day to make $1. That's not happening anytime soon.

So why did I build this?

Because it costs me nothing to run. Oracle server: $0. Cloudflare: $0. APIs: $0. Gas fees: $0 (xpay covers them). If zero customers show up tomorrow, I lose nothing. If the ecosystem grows — and Galaxy Research projects agentic commerce at $3-5 trillion by 2030 — I'm already positioned with a working service, on-chain history, and directory listings.

There's also the Base ecosystem angle. Every on-chain transaction builds activity on my wallet. When Base eventually does an airdrop or rewards program, active wallets with real transaction history tend to qualify. It's not the reason I built this, but it's a nice side effect.

If this cost $100/month to run, I wouldn't have built it. The economics wouldn't make sense at current volume. But at $0/month, it's a free option on the future of agentic commerce. Worst case: I learned a new protocol and got blog content out of it. Best case: the ecosystem grows 100x and I'm already there.

I can live with those odds.

What's Next

The Base version is live and listed. But x402 isn't just Base — there's a whole Solana side of the ecosystem I haven't touched yet. Next episode covers expanding to a second chain, new experiments, and whatever happens when real traffic starts showing up. I'll share the numbers when there are numbers to share.

← Previous: Episode 2: From Zero to First On-Chain Payment       Next: Episode 4: A Bot Rejected My PR, So I Added Solana Support


More updates on the way. If you're working on something similar or found a smarter way to do it, drop it in the comments — the more we share, the faster we all move.

Disclaimer: This blog documents my personal learning journey. Nothing here is financial advice.

Comments