402 Coffee
Non-custodial x402 tip jars for the agentic web, enabling USDC tips via a hosted MCP tool for agents.
README
☕ 402 Coffee
Non-custodial x402 tip jars for the agentic web. Claim a handle with your wallet, get a
live payment endpoint (/t/@you) and an embeddable button. Humans tip from a browser wallet
with a signature (no gas); agents tip over HTTP or MCP; every tip settles as USDC straight to
the creator's wallet. No custodian, no fee.
Live: https://402coffee.com · MIT · built on x402 v2, Base USDC.
Why non-custodial
payTo is the creator's own wallet. The service composes the payment challenge and asks a
facilitator to verify + settle; it never holds keys or funds. Structurally cannot rug anyone,
and stays out of money-transmitter territory.
Two front doors, one rail
- Humans — an embeddable widget runs the full x402 flow in-browser: the payer signs an
EIP-3009
transferWithAuthorizationwith MetaMask/Coinbase/Rabby and pays zero gas. - Agents — every jar is a real x402 endpoint and an MCP tool:
tip("@handle", 1.00, "great post").
Embed (any site)
<script src="https://402coffee.com/widget.js" data-handle="tim" async></script>
README badge: [](https://402coffee.com/tim)
Routes
| Path | What |
|---|---|
GET/POST /t/:handle |
The x402 tip endpoint (dynamic payTo, ?amount= / ?tier=) |
GET /:handle |
Warm creator page (SSR, wall, tiers, embed, OG image) |
GET /:handle/dashboard |
SIWE-gated dashboard: ledger, per-post analytics, CSV, moderation |
GET /:handle/badge.svg |
README tip badge |
POST /api/creators |
SIWE signup / update |
GET /api/creators/:handle |
Public profile JSON |
GET /api/creators/:handle/tips |
SIWE-gated ledger (?format=csv) + POST to hide a tip |
GET /api/wall/:handle |
Public supporter wall |
GET /api/search?q= · GET /api/leaderboard |
Discovery |
GET /api/nonce |
SIWE nonce |
POST /mcp |
Hosted MCP server (get_creator, search_creators, tip) |
GET /.well-known/x402 · GET /llms.txt |
Machine-readable discovery |
GET /api/cron/reconcile |
Nightly ledger↔onchain reconciliation (cron) |
Protocol (verified onchain, x402 v2)
Built on @x402/core@2.18.0 (protocol v2). All facts re-verified against the live SDK /
facilitator / chain — never from memory:
| Item | Value |
|---|---|
| Headers | PAYMENT-REQUIRED / PAYMENT-SIGNATURE / PAYMENT-RESPONSE |
| Networks | CAIP-2 eip155:8453 (Base) · eip155:84532 (Base Sepolia) |
| USDC (Base) | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, 6 decimals |
| Scheme | exact (EIP-3009 TransferWithAuthorization, payer pays no gas) |
| Amount / tx | PaymentRequirements.amount (atomic) · SettleResponse.transaction |
Architecture
lib/x402.mjs— thin x402 v2 core: build a challenge; verify + settle (the churn-exposed part)lib/tipflow.mjs— the shared settle-and-record core used by both/t/:handleand MCPlib/creators.mjs·lib/tips.mjs— Postgres store (creators, idempotent tip ledger)lib/siwe.mjs— stateless-nonce Sign-In-With-Ethereumlib/notify.mjs— HMAC-signed webhook + optional emaillib/reconcile.mjs— data-quality gate: ledger vs onchain USDC transfersapp/— Next.js App Router (routes above);public/widget.js— the zero-dep widget
Develop
npm install
# local Postgres (Docker):
docker run -d --name pg402 -e POSTGRES_PASSWORD=dev -e POSTGRES_USER=dev -e POSTGRES_DB=coffee402 -p 5433:5432 postgres:16-alpine
cp .env.example .env.local # set SIWE_SECRET + DATABASE_URL (see below)
npm run migrate # create schema
npm run dev # http://localhost:3000
npm test # x402 v2 protocol/codec tests (vs real SDK + live facilitator)
npm run test:db # DB + SIWE + notify + moderation integration tests
node scripts/e2e-local.mjs # live HTTP: signup, challenge, ledger
node scripts/e2e-widget.mjs # simulate the browser widget tip flow
node scripts/e2e-mcp.mjs # drive the MCP server end to end
Environment
See .env.example. Production (Vercel) needs: DATABASE_URL (Neon), SIWE_SECRET,
CDP_API_KEY_ID / CDP_API_KEY_SECRET (mainnet facilitator), X402_NETWORK=mainnet.
Optional: CRON_SECRET, RESEND_API_KEY, BASE_RPC_URL.
License
MIT.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.