Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

docs+test: Coin Communities article, AWS Builder Center drafts, SNS test

overstepping7cf8d91d3088
diff --git a/blog/three-ws-play-coin-communities.html b/blog/three-ws-play-coin-communities.html
new file mode 100644
index 000000000..5a2ff969c
--- /dev/null
+++ b/blog/three-ws-play-coin-communities.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>We turned every memecoin into a live 3D world you can walk into</title>
+<meta name="description" content="How we built /play: isolated multiplayer worlds keyed to a token's mint, driven by live on-chain trades, with proximity voice chat, an in-world buy flow, and worlds generated deterministically from the mint address.">
+<meta name="keywords" content="three.ws, /play, Coin Communities, pump.fun, 3D worlds, multiplayer, Colyseus, WebRTC, spatial voice, Three.js, Solana, memecoin">
+<link rel="canonical" href="https://three.ws/blog/three-ws-play-coin-communities.html">
+<meta property="og:title" content="We turned every memecoin into a live 3D world you can walk into">
+<meta property="og:description" content="How we built /play: every coin becomes a shared 3D world that reacts to its own on-chain trades, with proximity voice and an in-world buy flow.">
+<meta property="og:type" content="article">
+<meta property="og:url" content="https://three.ws/blog/three-ws-play-coin-communities.html">
+<meta property="og:image" content="https://three.ws/play-og.png">
+<meta name="twitter:card" content="summary_large_image">
+<meta name="twitter:title" content="We turned every memecoin into a live 3D world you can walk into">
+<meta name="twitter:description" content="Every coin becomes a shared 3D world that reacts to its own on-chain trades. Live at three.ws/play.">
+<meta name="twitter:image" content="https://three.ws/play-og.png">
+<style>
+*{margin:0;padding:0;box-sizing:border-box}
+body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;line-height:1.7;color:#1a1a1a;background:#fff;-webkit-font-smoothing:antialiased}
+.container{max-width:720px;margin:0 auto;padding:64px 24px}
+header{margin-bottom:48px;padding-bottom:32px;border-bottom:1px solid #eaeaea}
+.eyebrow{font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#ff9900;margin-bottom:16px}
+h1{font-size:40px;font-weight:700;letter-spacing:-0.02em;line-height:1.15;margin-bottom:20px}
+h2{font-size:24px;font-weight:700;letter-spacing:-0.01em;margin:40px 0 16px}
+p{margin-bottom:20px;font-size:17px;color:#333}
+a{color:#0066cc;text-decoration:none}
+a:hover{text-decoration:underline}
+code{font-family:"SF Mono",Monaco,Menlo,monospace;font-size:14px;background:#f5f5f5;padding:2px 6px;border-radius:4px;color:#d63384}
+ul{margin:0 0 20px 24px}
+li{margin-bottom:8px;font-size:17px;color:#333}
+.cta{margin:40px 0;padding:24px;background:#fafafa;border:1px solid #eaeaea;border-radius:12px}
+.cta p{margin-bottom:16px;font-weight:600}
+.cta a{display:inline-block;background:#000;color:#fff;padding:12px 24px;border-radius:8px;font-weight:600}
+.cta a:hover{background:#1a1a1a}
+footer{margin-top:56px;padding-top:32px;border-top:1px solid #eaeaea;font-size:14px;color:#888}
+footer a{color:#888}
+</style>
+</head>
+<body>
+<div class="container">
+<header>
+<p class="eyebrow">Coin Communities &middot; /play</p>
+<h1>We turned every memecoin into a live 3D world you can walk into</h1>
+<p style="font-size:15px;color:#888;margin-top:8px"><time datetime="2026-05-30">May 30, 2026</time> &middot; three.ws</p>
+</header>
+
+<p style="font-size:20px;line-height:1.6;color:#444;margin-bottom:32px">A memecoin's real asset is its crowd, not its chart. Yet that crowd lives in two flat tabs: a group chat and a candlestick. We wanted to give a community an actual place. So we built /play: every coin becomes a shared, walk-around 3D world where holders show up as avatars, talk by voice, and watch the coin's on-chain activity move the environment around them in real time.</p>
+
+<p>It is live in the browser at <a href="https://three.ws/play">three.ws/play</a>. No install. Pick a coin, you are standing in it. This is a walk through what we built and how it works.</p>
+
+<h2>The model: one coin, one room</h2>
+<p>Every coin is a room, keyed to its mint address. Open the lobby, pick a trending token or search any pump.fun token, and you drop in as a 3D avatar on a plaza with a slowly turning coin totem stamped in that token's art and a jumbotron showing live market cap and the live headcount.</p>
+<p>The isolation is enforced server-side. Our authoritative multiplayer server matches players into the same room instance only when their mint matches, so two communities never bleed into each other. A community becomes a shareable URL (<code>three.ws/play?coin=&lt;mint&gt;</code>): send it, and someone lands directly in that coin's world.</p>
+
+<h2>The world reacts to the chain</h2>
+<p>This is the part people stop and stare at. Each world streams that coin's real on-chain swap tape and pipes it straight into the environment:</p>
+<ul>
+<li>Every buy ripples green across the plaza, every sell ripples red.</li>
+<li>Sustained volume spins the totem faster: the room visibly speeds up when the tape heats up.</li>
+<li>The rolling percent change becomes the weather. Green opens the fog and flares the sun, red closes it in and dims the light. It drifts like a tide, so it reads as atmosphere, not a strobe.</li>
+<li>A whale trade detonates: a column of light fires over the totem, a shockwave rolls out, and a toast names the trade.</li>
+</ul>
+<p>Nobody narrates the action in chat. The world is the action. A quiet coin is a calm world; a coin getting aped is a thunderstorm of green light.</p>
+
+<h2>A trading terminal you can walk up to</h2>
+<p>Past the totem stands a live in-world terminal for the coin. It polls the same swap feed and paints, in real time: the price with sub-decimal memecoin notation, a live session chart, market cap, volume, trade count, buy/sell pressure, and a scrolling ticker of the latest real trades.</p>
+<p>It is not a redirect dressed up as a feature. /play ships a native buy flow: click Buy, our server builds the unsigned pump.fun transaction (handling both the bonding curve and the post-graduation AMM), your wallet signs it, it broadcasts. You can ape the coin while standing inside its world, next to the people who already did.</p>
+
+<h2>Spatial voice, the way your ears work</h2>
+<p>A crowd you cannot talk to is wallpaper. /play has proximity voice chat: walk up to someone and you hear them, drift away and they fade, and their voice comes from their direction. It is peer-to-peer WebRTC with HRTF spatial panning and distance falloff. The server only brokers the connection handshake and never touches the audio, and connections open only to the people near enough to hear, so the voice layer stays light no matter how busy the plaza gets. Voice is opt-in, and a speaker's nameplate pulses so you can pick them out of a crowd.</p>
+
+<h2>A thousand coins, a thousand worlds</h2>
+<p>Each world is generated deterministically from the mint address. We hash the mint into a seed, the seed picks a biome (Verdant Meadow, Dune Sea, Frostfields, Ashen Caldera, Neon Expanse, Lagoon Shore), then nudges that biome's palette and scatters its flora from the same seed. A given coin always renders the same world, and a thousand coins render a thousand recognizably different ones. The world becomes a fingerprint of the mint.</p>
+
+<h2>Build it together, and it stays</h2>
+<p>The world is not read-only. /play includes collaborative voxel building on a shared grid in the plaza. It is server-authoritative, so every block is validated and synced through the room everyone is in, and builds persist: a world's creation is saved per coin and rehydrated when the room spins back up. Come back tomorrow and what your community built is still standing. That is the difference between a chat log and a place: a chat scrolls away, a place accumulates.</p>
+
+<h2>How it actually works</h2>
+<p>For the builders reading: the load-bearing pieces are all real, nothing mocked.</p>
+<ul>
+<li><strong>Authoritative multiplayer.</strong> Worlds run on a Colyseus server. Clients send movement about 15 times a second; the server validates every update (anti-teleport step clamp, world bounds, name and message rate limits), holds authoritative state, and broadcasts only deltas via a binary protocol.</li>
+<li><strong>Live on-chain data.</strong> Chart, ticker, market cap, and the green/red reactor are all driven by live pump.fun trending, search, coin, and swap-tape feeds. An empty coin honestly says "no recent trades yet."</li>
+<li><strong>Avatars.</strong> Players load real GLB/VRM models: a preset, your own upload, a URL, or the 3D agent you built on three.ws. Draco-compressed exports work out of the box.</li>
+<li><strong>Voice.</strong> P2P WebRTC with spatial HRTF audio, proximity-gated.</li>
+<li><strong>Buys.</strong> A native pump.fun transaction built server-side and signed by the user's own wallet.</li>
+</ul>
+<p>The whole platform is open source under Apache 2.0.</p>
+
+<div class="cta">
+<p>Pick a coin and walk into it.</p>
+<a href="https://three.ws/play">Open /play</a>
+</div>
+
+<p>Or open the front door: the pinned <strong>$THREE town</strong> at the top of the lobby, our own coin's world.</p>
+
+<footer>
+<p>three.ws is an open-source platform for 3D AI agents and on-chain communities, an AWS Partner and available on <a href="https://three.ws/blog/three-ws-on-aws-marketplace.html">AWS Marketplace</a>. &middot; <a href="https://three.ws">three.ws</a> &middot; <a href="https://github.com/nirholas/three.ws">github.com/nirholas/three.ws</a></p>
+</footer>
+</div>
+</body>
+</html>
diff --git a/docs/aws-builder-center-marketplace-x402.md b/docs/aws-builder-center-marketplace-x402.md
new file mode 100644
index 000000000..e61aae7e0
--- /dev/null
+++ b/docs/aws-builder-center-marketplace-x402.md
@@ -0,0 +1,252 @@
+---
+title: "One paywall, two economies: putting AWS Marketplace metering in front of an x402 API"
+venue: AWS Builder Center
+account: three.ws (official)
+description: "How we metered a SaaS product through AWS Marketplace with the AWS SDK for JavaScript v3 — ResolveCustomer, MeterUsage, entitlements, and verified SNS lifecycle webhooks — and bridged it to an on-chain x402 paywall so one access check bills two ways. Real code, and the five things that bit us."
+tags: [aws, marketplace, saas, serverless, api]
+---
+
+# One paywall, two economies: putting AWS Marketplace metering in front of an x402 API
+
+We run [three.ws](https://three.ws), an open-source platform for 3D AI agents and on-chain communities. Our paid API already had a billing system: **x402**, the HTTP-native pay-per-call protocol where a request to a metered endpoint either carries a subscription key or gets a `402 Payment Required`. That works great for developers who pay in stablecoins.
+
+But a lot of teams don't want to touch crypto to pay an invoice. They want it on their AWS bill — drawn down from credits, counted toward their EDP commitment, one line item under *AWS Marketplace Software*. So we listed three.ws as a **SaaS usage-based product on AWS Marketplace** and wired AWS billing straight into the same access check that already powered x402.
+
+The result is one authorization path that meters two ways: an AWS-subscribed customer and a stablecoin-paying developer hit the exact same endpoint, and the platform bills whichever economy that caller belongs to. This post is how we built it with the AWS SDK for JavaScript v3, the parts of the SaaS integration that are easy to get subtly wrong, and the bridge that ties an AWS `CustomerIdentifier` to an x402 key.
+
+Everything here is real code from our open-source repo (Apache 2.0), not pseudocode — the serverless functions run on AWS in `us-east-1`.
+
+## The three integration points of a SaaS listing
+
+A SaaS usage-based listing on AWS Marketplace gives you exactly three seams to implement, and they all live in one helper module:
+
+1. **ResolveCustomer** — turn the short-lived token AWS hands you at signup into a stable customer ID.
+2. **MeterUsage** — report consumption back to AWS for billing.
+3. **SNS lifecycle webhooks** — get told, with a verified signature, when a customer subscribes, cancels, or changes entitlement.
+
+Here's the module that wraps all three. Two AWS SDK v3 clients, one region, plain credentials:
+
+```js
+import {
+ MarketplaceMeteringClient,
+ ResolveCustomerCommand,
+ MeterUsageCommand,
+} from '@aws-sdk/client-marketplace-metering';
+import {
+ MarketplaceEntitlementServiceClient,
+ GetEntitlementsCommand,
+} from '@aws-sdk/client-marketplace-entitlement-service';
+
+function meteringClient() {
+ return new MarketplaceMeteringClient({
+ region: env.AWS_MP_REGION,
+ credentials: {
+ accessKeyId: env.AWS_MP_ACCESS_KEY_ID,
+ secretAccessKey: env.AWS_MP_SECRET_ACCESS_KEY,
+ },
+ });
+}
+```
+
+## 1. Registration: the token → customer handshake
+
+When a customer clicks **Subscribe** in AWS Marketplace, AWS redirects their browser to your *registration URL* with an HTTP `POST` — `application/x-www-form-urlencoded`, carrying `x-amzn-marketplace-token` and an offer type that tells you whether it's a free trial. That token is short-lived and useless on its own; you exchange it for a stable identity with `ResolveCustomer`:
+
+```js
+export async function resolveCustomer(registrationToken) {
+ const client = meteringClient();
+ const result = await client.send(
+ new ResolveCustomerCommand({ RegistrationToken: registrationToken }),
+ );
+ return {
+ customerIdentifier: result.CustomerIdentifier,
+ productCode: result.ProductCode,
+ customerAWSAccountId: result.CustomerAWSAccountId,
+ };
+}
+```
+
+The handler reads the form post, resolves the customer, upserts a row, links it to a three.ws account if the visitor is already signed in, and redirects to our onboarding page:
+
+```js
+const body = await readForm(req);
+const token = body['x-amzn-marketplace-token'];
+const isFreeTrial = body['x-amzn-marketplace-offer-type'] === 'free-trial';
+
+const { customerIdentifier, productCode, customerAWSAccountId } =
+ await resolveCustomer(token);
+
+await sql`
+ INSERT INTO aws_marketplace_customers
+ (customer_identifier, product_code, customer_aws_account_id,
+ subscription_status, is_free_trial, subscribed_at)
+ VALUES
+ (${customerIdentifier}, ${productCode}, ${customerAWSAccountId ?? null},
+ ${isFreeTrial ? 'trial' : 'active'}, ${isFreeTrial}, now())
+ ON CONFLICT (customer_identifier) DO UPDATE SET ...
+`;
+
+res.statusCode = 302;
+res.setHeader('location',
+ `${env.APP_ORIGIN}/aws-marketplace/welcome?customer=${customerIdentifier}`);
+```
+
+**Gotcha #1:** the registration call is a *browser redirect with a form body*, not a JSON API call. If your framework only parses JSON bodies, the token is silently empty and `ResolveCustomer` throws "token expired" for reasons that have nothing to do with expiry. Read it as a form.
+
+## 2. SNS lifecycle — and actually verifying the signature
+
+AWS Marketplace tells you about the *rest* of the customer's life — cancellations, trial conversions, entitlement changes — over an Amazon SNS topic that POSTs to a webhook. There are three message types, and the most important line of the whole integration is: **verify the signature before you trust a single field.** An unverified webhook is an open door to cancel anyone's subscription or, worse, fake a `subscribe-success`.
+
+AWS signs every SNS message and includes the URL of the signing certificate. Verification means: only trust a cert hosted on `*.amazonaws.com`, rebuild the canonical signing string from the documented fields *in order*, and check the RSA-SHA1 signature:
+
+```js
+const certCache = new Map();
+
+async function fetchCert(url) {
+ const parsed = new URL(url);
+ if (parsed.protocol !== 'https:' || !parsed.hostname.endsWith('.amazonaws.com')) {
+ throw new Error(`Untrusted SNS signing cert URL: ${url}`);
+ }
+ if (certCache.has(url)) return certCache.get(url);
+ const pem = await (await fetch(url)).text();
+ certCache.set(url, pem);
+ return pem;
+}
+
+// Field set differs by message type — and order matters.
+const NOTIFICATION_FIELDS = ['Message', 'MessageId', 'Subject', 'Timestamp', 'TopicArn', 'Type'];
+const SUBSCRIPTION_FIELDS = ['Message', 'MessageId', 'SubscribeURL', 'Timestamp', 'Token', 'TopicArn', 'Type'];
+
+export async function verifySnsMessage(msg) {
+ if (env.AWS_MP_SNS_TOPIC_ARN && msg.TopicArn !== env.AWS_MP_SNS_TOPIC_ARN) {
+ throw new Error(`SNS TopicArn mismatch: got ${msg.TopicArn}`);
+ }
+ const pem = await fetchCert(msg.SigningCertURL);
+ const fields = msg.Type === 'Notification' ? NOTIFICATION_FIELDS : SUBSCRIPTION_FIELDS;
+ const signingString = fields
+ .filter((k) => msg[k] !== undefined)
+ .map((k) => `${k}\n${msg[k]}\n`)
+ .join('');
+ const verifier = createVerify('SHA1');
+ verifier.update(signingString);
+ if (!verifier.verify(createPublicKey(pem), msg.Signature, 'base64')) {
+ throw new Error('SNS signature verification failed');
+ }
+}
+```
+
+**Gotcha #2:** the canonical string is `Key\nValue\n` for each field, and the field list is *different* for a `Notification` versus a `SubscriptionConfirmation`. Get the set or the order wrong and every signature fails verification with no hint as to why. Also pin the `TopicArn` — the signature proves AWS sent it, the ARN check proves it's *your* topic.
+
+The handler confirms the SNS subscription on the one-time handshake, then routes lifecycle actions:
+
+```js
+await verifySnsMessage(msg);
+
+if (msg.Type === 'SubscriptionConfirmation' || msg.Type === 'UnsubscribeConfirmation') {
+ await fetch(msg.SubscribeURL); // complete the handshake
+ return json(res, 200, { ok: true });
+}
+
+const payload = JSON.parse(msg.Message);
+const { action, 'customer-identifier': customerId } = payload;
+
+if (action === 'subscribe-success') { /* mark active / trial */ }
+if (action === 'unsubscribe-success') { await revokeSubscriptionForCustomer(customerId); /* then mark cancelled */ }
+```
+
+**Gotcha #3 (the one that matters for money):** on `unsubscribe-success` we **revoke the customer's API key *before* we flip their status to `cancelled`**, and if the revoke throws we return `500` and leave them `active`. Why backwards? Because the failure we refuse to ship is a *cancelled customer who still has a working key*. Better to retry a stuck revoke than to hand out free access. Order your side effects by which failure you can least afford.
+
+## 3. The bridge: one `CustomerIdentifier`, one x402 key
+
+Here's the part we're proud of. Our metered endpoints (`/api/x402/*`) already authenticate with an x402 subscription key. Rather than build a second, parallel auth path for AWS customers, we **mint an x402 subscription for the AWS customer and tag it** with where it came from:
+
+```js
+const subscription = await createSubscription({
+ name: `aws-marketplace:${customerId}`,
+ rateLimitPerMinute: rateLimitForCustomer(customer),
+ meta: {
+ source: 'aws-marketplace',
+ aws_customer_identifier: customerId,
+ aws_product_code: customer.product_code,
+ is_free_trial: Boolean(customer.is_free_trial),
+ },
+});
+```
+
+That `meta.source = 'aws-marketplace'` is the whole trick. From here on, an AWS customer is just an x402 caller with a provenance tag. Every existing protection — rate limiting, revocation, audit logging — applies to both economies for free, and the access check stays a single code path.
+
+The plaintext key is returned exactly once, on first issue, and never stored in clear. If the customer cancels and later re-subscribes, the old link is revoked and a fresh key is minted — so a cancelled key can never be reanimated.
+
+## 4. Metering: bill the call, once, idempotently
+
+Now the access check. When a request to a metered route is granted, we look at that provenance tag. AWS-sourced? Report a unit of usage to AWS:
+
+```js
+// inside the x402 access-control grant path:
+if (sub.meta?.source === 'aws-marketplace') {
+ meterAwsSubscriptionUsage({ subscriptionId: sub.id, route });
+}
+```
+
+`MeterUsage` is the AWS-facing call, idempotent per `usageAllocationId`:
+
+```js
+const recordId = await meterUsage({
+ customerIdentifier: row.customer_identifier,
+ dimension: env.AWS_MP_METERING_DIMENSION,
+ quantity: 1,
+ timestamp: new Date(bucket * 1000),
+ usageAllocationId: `${subscriptionId}-${bucket}`, // idempotency key
+});
+```
+
+Metering is fire-and-forget (it must never add latency to the customer's request) and **de-duplicated to one call per subscription per second** before it ever leaves the process, with a Postgres audit row as the canonical count:
+
+```js
+const bucket = Math.floor(Date.now() / 1000);
+const dedupeKey = `${subscriptionId}:${bucket}`;
+if (_inFlight.has(dedupeKey)) return; // already metering this second
+_inFlight.add(dedupeKey);
+
+queueMicrotask(async () => {
+ // ...resolve customer, MeterUsage(1), then:
+ await sql`
+ insert into aws_marketplace_metering
+ (customer_identifier, dimension, quantity, metering_record_id, usage_allocation_id)
+ values (...)
+ on conflict (metering_record_id) do nothing
+ `;
+});
+```
+
+**Gotcha #4:** AWS Marketplace bills idempotently per usage-allocation id, but issuing the network call ten times a second under load is just wasted I/O and noisy retries. A one-second in-process bucket plus a unique `usageAllocationId` plus `ON CONFLICT DO NOTHING` gives you three independent layers that all agree: bill once.
+
+**Gotcha #5 — SNS lag:** when a customer cancels, the `unsubscribe-success` notification can take minutes to arrive. For those minutes, the customer's key is still technically valid. So the access check has a defense-in-depth probe that reads the live AWS status and aborts a zombie key *before* the webhook catches up:
+
+```js
+if (await isAwsCustomerInactive(sub)) {
+ return { abort: true, status: 403, reason: 'AWS Marketplace subscription inactive' };
+}
+```
+
+## What the customer actually gets
+
+The product on the other side of all this plumbing is the platform: three.ws agents, the avatar and `/play` 3D-world APIs, and the rest of the metered surface. From the customer's seat the flow is boring in the best way — **Subscribe** in AWS Marketplace → land on our welcome page → copy one API key → call `/api/x402/*`. Their usage shows up on their AWS invoice. They never learn that the same endpoint also speaks an on-chain payment protocol, because they never have to.
+
+## Takeaways
+
+- A SaaS usage-based listing is **three calls** (`ResolveCustomer`, `MeterUsage`, entitlements) plus **one verified webhook**. The AWS SDK v3 marketplace clients make the calls a one-liner each; the webhook security is where the real work is.
+- **Verify SNS signatures** with the right field set and order, and pin your `TopicArn`. Treat an unverified webhook as hostile.
+- **Order side effects by worst-case failure.** Revoke access before you mark a customer inactive.
+- **Don't fork your auth.** Tagging an AWS customer as a first-class entry in our existing subscription model meant rate limiting, revocation, and audit came for free, and one access check bills two economies.
+
+## Resources
+
+- AWS Marketplace SaaS metering — [ResolveCustomer / MeterUsage docs](https://docs.aws.amazon.com/marketplace/latest/userguide/metering-service.html)
+- [AWS SDK for JavaScript v3](https://github.com/aws/aws-sdk-js-v3) — `@aws-sdk/client-marketplace-metering`, `@aws-sdk/client-marketplace-entitlement-service`
+- [x402 protocol](https://www.x402.org) — the HTTP-native pay-per-call standard we bridged to
+- three.ws on [AWS Marketplace](https://aws.amazon.com/marketplace) · source on [GitHub](https://github.com/nirholas/three.ws) (Apache 2.0)
+
+---
+
+*three.ws is a verified AWS Partner and an open-source platform for 3D AI agents and on-chain communities, running on AWS in `us-east-1`. Live at [three.ws](https://three.ws).*
diff --git a/docs/aws-builder-center-mcp-agents.md b/docs/aws-builder-center-mcp-agents.md
new file mode 100644
index 000000000..a60ebeed7
--- /dev/null
+++ b/docs/aws-builder-center-mcp-agents.md
@@ -0,0 +1,108 @@
+---
+venue: AWS Builder Center
+account: three.ws (official) or personal builder byline
+suggested_title: "I built an MCP server whose tools pay for themselves"
+suggested_description: "An open-source MCP server that lets any agent (Claude, Cursor, your own) work with 3D avatars and call paid tools that settle per-call in USDC over HTTP 402. No subscription, no API key for the paid tools. Runs on AWS."
+suggested_tags: [mcp, agents, agentic-ai, generative-ai, open-source]
+suggested_canonical: https://three.ws/docs/mcp.md
+---
+
+# I built an MCP server whose tools pay for themselves
+
+Most AI tooling assumes a human is standing by with a credit card and an API key. You sign up, you paste a key into a config, you get a monthly bill. That model breaks the moment the *agent* is the one that needs a tool mid-reasoning. It cannot sign up for anything. It cannot paste a key. It just stops.
+
+I wanted agents to call paid tools the way they call free ones: discover, call, get a result, with the payment handled inline and autonomously. The Model Context Protocol gave me the tool interface, and HTTP 402 gave me the payment rail. This is a walk through what I built, all of it open source under Apache 2.0.
+
+## Why MCP
+
+MCP is an open standard from Anthropic that gives AI assistants a uniform way to discover and call external tools over JSON-RPC. The practical win is that I expose one server, and Claude Desktop, Claude Code, Cursor, and any custom agent all speak to it the same way. I did not have to write a per-client integration. A tool is a tool, whether it loads a 3D model or returns a market snapshot.
+
+There are two surfaces, and they answer two different questions.
+
+## Surface one: the hosted server (your account, your avatars)
+
+The hosted server lives at `https://three.ws/api/mcp`. It is streamable HTTP, MCP protocol `2025-06-18`, and it is account-aware, so it authenticates with OAuth 2.1 or a server-to-server API key. Once an MCP client points at it, the agent can:
+
+- browse and search your avatar library without anyone copy-pasting URLs,
+- render any avatar inline as an interactive `<model-viewer>` artifact,
+- run the Khronos glTF-Validator against any public GLB or glTF URL,
+- inspect mesh, texture, and animation counts and geometry stats,
+- get concrete optimization suggestions (compression, LOD, texture transcoding).
+
+The OAuth flow is the textbook one: dynamic client registration (RFC 7591), PKCE, and `.well-known` discovery (RFC 8414 / 9728), so a client that has never seen the server can register, get consent, and start calling tools with zero manual setup. Scopes on the token gate which tools the agent is allowed to touch.
+
+```json
+{
+ "mcpServers": {
+ "3d-agent": {
+ "url": "https://three.ws/api/mcp",
+ "headers": { "Authorization": "Bearer 3da_live_xxxxx" }
+ }
+ }
+}
+```
+
+## Surface two: four tools that pay for themselves
+
+This is the part I am most proud of. The npm package `@3d-agent/mcp-server` exposes four tools that take **no subscription and no API key**. Each call settles per-use in USDC over the x402 protocol (the HTTP 402 Payment Required status code, finally put to work). You configure a wallet address, not a key.
+
+| Tool | Price | What it returns |
+|---|---|---|
+| `get_pose_seed` | $0.001 | A deterministic seed and full Euler-rotation pose map for the pose-studio mannequin, plus a preview URL. |
+| `pump_snapshot` | $0.005 | A live token snapshot: USD price (Jupiter), 24h volume and pair (Dexscreener), mint metadata and image, and on-chain top-holder distribution (Solana RPC). |
+| `agent_reputation` | $0.01 | ERC-8004 on-chain reputation for an agent: score, total stake, and the latest reputation events from the canonical registry (default Base). |
+| `vanity_grinder` | up to $0.50 | A Solana keypair whose address starts with a prefix you choose. Settled USDC scales with the work actually done, capped at $0.50. |
+
+Setup is a wallet, not an account:
+
+```json
+{
+ "mcpServers": {
+ "3d-agent": {
+ "command": "npx",
+ "args": ["-y", "@3d-agent/mcp-server"],
+ "env": {
+ "MCP_EVM_PAYMENT_ADDRESS": "0xYourBaseWallet",
+ "MCP_SVM_PAYMENT_ADDRESS": "YourSolanaWallet"
+ }
+ }
+ }
+}
+```
+
+## The payment flow, end to end
+
+Here is what happens when an agent calls a paid tool:
+
+1. The agent calls, say, `pump_snapshot`.
+2. The server replies with HTTP 402 and a challenge describing the price and where to pay.
+3. The package settles the micropayment from the configured wallet in USDC.
+4. It retries the call with proof of payment, and the result streams back.
+
+From the agent's point of view this is a single tool call that just works. Under the hood, a real on-chain micropayment happened, no human in the loop. That is the unlock: an agent can consume a paid data feed in the middle of its reasoning without anyone provisioning access first. And because it is a standard, the same machinery lets *you* charge other agents for tools you expose. Consumer and provider, one protocol.
+
+## The architecture is deliberately thin
+
+```
+MCP client (Claude, Cursor) -> @3d-agent/mcp-server (npm, stdio) -> HTTPS + x402 -> platform on AWS
+```
+
+The npm package is a stdio-to-HTTP bridge. It speaks MCP over stdio to the client, handles the OAuth or x402 settlement, and forwards each call to the platform API over HTTPS. All the real logic lives server-side behind a normal HTTP API. That keeps the bridge small enough to audit in one sitting, and it means every capability is reachable without MCP at all, which is exactly what you want from infrastructure.
+
+## Where AWS comes in
+
+The platform runs on AWS in `us-east-1`, with assets and storage on S3, and it is available to subscribe through AWS Marketplace so usage lands on your AWS bill and counts toward existing commitments. three.ws is an AWS Partner (APN Software Path, Technology Partner).
+
+The MCP server itself is intentionally cloud-agnostic: it is an npm bridge to an HTTP API, so it drops into a Bedrock agent, a Strands agent, a Claude Code session, or anything else that speaks MCP, without caring where the agent runs. If you are building agentic systems on AWS and want them to use paid external tools without a human managing keys, this is a working pattern you can copy.
+
+## Try it
+
+- MCP docs and the full tool reference: [three.ws/docs/mcp.md](https://three.ws/docs/mcp.md)
+- Paid tools: `npx -y @3d-agent/mcp-server`
+- Source (Apache 2.0): [github.com/nirholas/three.ws](https://github.com/nirholas/three.ws)
+
+If you wire it into something, or you want to list a paid tool of your own, the repo issues are open. I would like to see what people point this at.
+
+---
+
+*three.ws is an open-source platform for 3D AI agents and on-chain communities, an AWS Partner and available on AWS Marketplace. Live at [three.ws](https://three.ws).*
diff --git a/docs/coinmarketcap-article-play.md b/docs/coinmarketcap-article-play.md
index 4b0a945a9..1396621df 100644
--- a/docs/coinmarketcap-article-play.md
+++ b/docs/coinmarketcap-article-play.md
@@ -5,92 +5,105 @@ target: CoinMarketCap Community / Editorial
# Every Memecoin Is Now a 3D World You Can Walk Into
-## The community is the asset — so why does it live in a chat box?
+## The community is the asset, so why does it live in a chat box?
Strip a memecoin down to what actually moves it and you don't find a product. You find a crowd. The chart is downstream of the community: the holders, the believers, the people refreshing the chart at 3am, the ones aping the next candle and the ones diamond-handing through the dip. On a memecoin, the community *is* the asset.
-And yet that community lives in the two saddest tabs on the internet: a Telegram group on one side, a price chart on the other. The thing everyone agrees is the whole point — the people — has no place. You can't walk into a coin. You can't see who else is there. You can't feel the market move.
+And yet that crowd lives in the two loneliest tabs on the internet: a Telegram group on one side, a price chart on the other. The whole point of the thing, the people, has nowhere to actually be. You can't walk into a coin. You can't see who else showed up. You can't feel the market move through a room.
-[three.ws](https://three.ws) **/play** changes that. It turns every [pump.fun](https://pump.fun) coin into its own live 3D world — a shared, walk-around space where holders show up as real 3D avatars, talk to each other by voice, and watch the coin's on-chain activity ripple through the environment around them in real time. The coin's chart isn't on a screen somewhere else. The chart is the *weather*.
+[three.ws](https://three.ws) **/play** gives the crowd a body. It turns every [pump.fun](https://pump.fun) coin into a live 3D world you can walk into: a shared space where holders show up as real avatars, talk by voice, and watch the coin's on-chain activity ripple through the ground, the sky, and the light around them as it happens. The chart isn't on a screen across the room. The chart *is* the room. Buys roll green across the plaza, a whale lands like a thunderclap, and a coin getting aped looks like a storm of falling gold.
-It's live now at **[three.ws/play](https://three.ws/play)**, in the browser, no install, no extension. Pick a coin and you're standing in it.
+It's live now at **[three.ws/play](https://three.ws/play)**, in the browser, no install, no extension. Pick a coin and you're standing in it, next to everyone else who did.
## One coin, one world
The mental model is simple: **every coin is a room, keyed to its mint address.**
-You open the /play lobby and see the trending pump.fun coins, plus a search box that reaches every coin on pump.fun — not just what's hot, *any* token. Pick one. You drop in as a 3D avatar standing on a plaza, under a sky, with a giant slowly-turning gold coin in the middle stamped with that token's art. A stadium jumbotron towers over the plaza showing the coin's name, its live market cap, and a count of how many people are in this community *right now*.
+You open the /play lobby and see the trending pump.fun coins, plus a search box that reaches every coin on pump.fun, not just what's hot, *any* token. Pick one. You drop in as a 3D avatar standing on a plaza, under a sky, with a giant slowly-turning gold coin in the middle stamped with that token's art. A stadium jumbotron towers over the plaza showing the coin's name, its live market cap, and a count of how many people are in this community *right now*.
-Other people are there too — real avatars, moving, with names floating over their heads and chat bubbles when they talk. You move with WASD and the mouse on desktop, or a touch joystick on mobile; sprint, jump, orbit the camera, wave an emote. Everyone in that space entered the same coin. Walk into a different coin and you're with a different crowd, in a different world.
+Other people are there too: real avatars, moving, with names floating over their heads and chat bubbles when they talk. You move with WASD and the mouse on desktop, or a touch joystick on mobile; sprint, jump, orbit the camera, wave an emote. Everyone in that space entered the same coin. Walk into a different coin and you're with a different crowd, in a different world.
-Under the hood this is enforced by the multiplayer server: players are matched into the same room instance **only when their coin matches**. Each token is an isolated world. There's no bleed between communities — the people in $DOGE's world and the people in some fresh launch's world never see each other, because they're literally in different rooms anchored to different mints. A community becomes a shareable URL (`three.ws/play?coin=<mint>`); send it and someone lands directly in your coin's world.
+Under the hood this is enforced by the multiplayer server: players are matched into the same room instance **only when their coin matches**. Each token is an isolated world. There's no bleed between communities: the people in $DOGE's world and the people in some fresh launch's world never see each other, because they're literally in different rooms anchored to different mints. A community becomes a shareable URL (`three.ws/play?coin=<mint>`); send it and someone lands directly in your coin's world.
+
+## Anyone can walk in. Holders get a room of their own.
+
+Not every crowd is the same crowd. There's the passer-by who clicked a link to see what a coin's world even looks like, and there's the holder with real skin in the game. /play gives a coin both, as two connected worlds.
+
+The **open world** is the front door. Anyone can drop into any coin, no wallet required: walk the plaza, watch the market move the sky, read the live terminal, and ape in if the world wins you over. Think of it as the trailer for the community.
+
+The **holders' world** is the community itself, and it's gated. To step through and actually take part, to talk, to build, to post into the coin's living feed, you have to hold at least **$8 worth of the coin**. That bar isn't a velvet rope three.ws invented. It's enforced through [Coin Communities](https://coin-communities.xyz), the protocol that powers each coin's social layer, which only lets verified holders participate in a token's community. Being in the room is itself proof that everyone around you has a stake in the same coin you do.
+
+It's the oldest idea in crypto finally given a place: holders together, in a space only holders can enter. The market the world reacts to is the market everyone in that room is exposed to. When the totem spins and golden coins rain down, nobody in the holders' world is a tourist; the green ripping across the plaza is *their* green.
+
+Send someone the open world and they can look around. Send them the holders' world and, if they're holding, they're home.
## The world reacts to the chain
This is the part that makes people stop and stare.
-Every /play world is streaming that coin's **real on-chain trades** — the actual pump.fun swap tape — and piping them straight into the environment. The market doesn't sit politely on a panel. It physically moves the world around you:
+Every /play world is streaming that coin's **real on-chain trades** (the actual pump.fun swap tape) and piping them straight into the environment. The market doesn't sit politely on a panel. It physically moves the world around you:
- **Every buy ripples green** across the plaza and kicks the glowing boundary ring.
- **Every sell ripples red.**
-- **Sustained volume spins the coin totem faster** — the room visibly speeds up when the tape heats up.
-- **The rolling percentage change becomes the weather.** Green and the fog opens out, the sun flares — euphoria. Red and the fog closes in and the light dims — a storm rolls over the world. The mood drifts like a tide, not a strobe, so it reads as atmosphere rather than noise.
-- **A whale trade detonates.** When a single trade crosses the whale threshold, a column of light fires up over the totem, a shockwave rolls out across the plaza, and on a big buy a fountain of golden coins rains off the top — with a toast naming what just happened ("🐋 Whale bought $X of $TICKER").
+- **Sustained volume spins the coin totem faster:** the room visibly speeds up when the tape heats up.
+- **The rolling percentage change becomes the weather.** Green and the fog opens out, the sun flares: euphoria. Red and the fog closes in and the light dims: a storm rolls over the world. The mood drifts like a tide, not a strobe, so it reads as atmosphere rather than noise.
+- **A whale trade detonates.** When a single trade crosses the whale threshold, a column of light fires up over the totem, a shockwave rolls out across the plaza, and on a big buy a fountain of golden coins rains off the top, with a toast naming what just happened ("🐋 Whale bought $X of $TICKER").
-The coin's price becomes the room's pulse. You don't read the market — you stand inside it and feel it flinch. A quiet coin is a calm, still world. A coin getting aped into orbit is a thunderstorm of green light and falling coins. Nobody has to narrate the action in chat; the world *is* the action.
+The coin's price becomes the room's pulse. You don't read the market; you stand inside it and feel it flinch. A quiet coin is a calm, still world. A coin getting aped into orbit is a thunderstorm of green light and falling coins. Nobody has to narrate the action in chat; the world *is* the action.
## A trading terminal you can walk up to
-Atmosphere is one half. The other half is a real, legible terminal — because people in a coin's world want the numbers, not just the vibe.
+Atmosphere is one half. The other half is a real, legible terminal, because people in a coin's world want the numbers, not just the vibe.
Past the totem stands a second giant screen: a live in-world **trading terminal** for the coin. It's not a decoration and it's not a screenshot. It polls the same on-chain swap feed the rest of the platform uses and paints, in real time:
-- the **price** (with the leading-zero sub-decimal notation memecoins need — $0.0₇123 and the like),
+- the **price** (with the leading-zero sub-decimal notation memecoins need: $0.0₇123 and the like),
- the session **price chart** with a live, glowing line,
- **market cap**, **live volume**, **trade count**, and **buy/sell flow** as a pressure bar,
-- and a **scrolling ticker of the latest real trades** — side, size in SOL and USD, the trader's short address, and how long ago.
+- and a **scrolling ticker of the latest real trades**: side, size in SOL and USD, the trader's short address, and how long ago.
-Tap the terminal and it opens the coin straight on pump.fun. And you don't even have to leave: /play ships a native in-world **buy flow**. Click Buy and the three.ws server builds the unsigned pump.fun transaction — handling both the bonding curve and the post-graduation AMM — your Solana wallet signs it, and it broadcasts. You can ape the coin while standing inside its world, surrounded by the people who already did.
+Tap the terminal and it opens the coin straight on pump.fun. And you don't even have to leave: /play ships a native in-world **buy flow**. Click Buy and the three.ws server builds the unsigned pump.fun transaction (handling both the bonding curve and the post-graduation AMM), your Solana wallet signs it, and it broadcasts. You can ape the coin while standing inside its world, surrounded by the people who already did.
That's the loop a memecoin has never had in one place: *see the crowd → feel the market → read the tape → buy the coin*, without ever switching tabs.
## Walk up to someone and talk
-A crowd you can't talk to is just wallpaper. /play has **spatial voice chat**, and it's the thing that makes a coin's world feel like a real gathering instead of a chat box with 3D models.
+A crowd you can't talk to is just wallpaper. Inside the holders' world, /play has **spatial voice chat**, and it's the thing that makes a coin's community feel like a real gathering instead of a chat box with 3D models.
-It works the way your ears do. Walk up to someone and you hear them. Drift away and they fade out. Their voice comes from *their direction* — someone on your left sounds like they're on your left. Get far enough and they're gone. The audio is genuine peer-to-peer WebRTC with HRTF spatial panning and distance falloff; the server only passes the connection handshake between two people and never touches the audio itself. Connections open only to the people near enough to hear, so the voice layer stays light no matter how busy the plaza gets — which is also exactly what spatial audio *should* do.
+It works the way your ears do. Walk up to someone and you hear them. Drift away and they fade out. Their voice comes from *their direction*: someone on your left sounds like they're on your left. Get far enough and they're gone. The audio is genuine peer-to-peer WebRTC with HRTF spatial panning and distance falloff; the server only passes the connection handshake between two people and never touches the audio itself. Connections open only to the people near enough to hear, so the voice layer stays light no matter how busy the plaza gets, which is also exactly what spatial audio *should* do.
-Voice is opt-in (the mic stays off until you tap it), and when someone's talking, their nameplate pulses so you can pick the speaker out of a crowd. Alongside it there's text chat with floating bubbles and a set of emotes. The result is that a coin's world feels less like a Discord and more like actually being *somewhere* with other holders — clusters of people talking near the totem, someone shouting across the plaza when a whale lands.
+Voice is opt-in (the mic stays off until you tap it), and when someone's talking, their nameplate pulses so you can pick the speaker out of a crowd. Alongside it there's text chat with floating bubbles and a set of emotes. The result is that a coin's world feels less like a Discord and more like actually being *somewhere* with other holders: clusters of people talking near the totem, someone shouting across the plaza when a whale lands.
## A thousand coins, a thousand worlds
If every coin shared one generic world, the whole thing would feel like a template. It doesn't.
-Each coin's world is generated **deterministically from its mint address**. The mint is hashed into a seed, the seed picks one of several biome archetypes — Verdant Meadow, Dune Sea, Frostfields, Ashen Caldera, Neon Expanse, Lagoon Shore — and then nudges that biome's palette and scatters its flora from the same seed. So a given coin **always** renders the same world (your coin's place is *its* place, every time you return), and a thousand different coins render a thousand recognizably different ones. Two tokens that happen to land in the same biome still get their own color and layout.
+Each coin's world is generated **deterministically from its mint address**. The mint is hashed into a seed, the seed picks one of several biome archetypes (Verdant Meadow, Dune Sea, Frostfields, Ashen Caldera, Neon Expanse, Lagoon Shore) and then nudges that biome's palette and scatters its flora from the same seed. So a given coin **always** renders the same world (your coin's place is *its* place, every time you return), and a thousand different coins render a thousand recognizably different ones. Two tokens that happen to land in the same biome still get their own color and layout.
-Walking into a new coin and seeing what world it "is" becomes its own small ritual — a frozen tundra, a neon alien expanse, an ashen volcanic caldera. The world is a fingerprint of the mint.
+Walking into a new coin and seeing what world it "is" becomes its own small ritual: a frozen tundra, a neon alien expanse, an ashen volcanic caldera. The world is a fingerprint of the mint.
-## Build it together — and it stays
+## Build it together, and it stays
-A community's world isn't read-only. /play includes **collaborative voxel building**: a block palette and a build mode where anyone in the world can place and break blocks together, in real time, on a shared grid in the middle of the plaza.
+A community's world isn't read-only. /play includes **collaborative voxel building**: a block palette and a build mode where anyone in the holders' world can place and break blocks together, in real time, on a shared grid in the middle of the plaza.
-It's server-authoritative — every block is validated and synced through the same room everyone's in, so what you build is what everyone sees. And critically, **builds persist**. The world's creation is saved per coin and rehydrated when the room spins back up, so a community's monument to their token survives even after the last person logs off and the room is torn down. Come back tomorrow and the thing your community built is still standing.
+It's server-authoritative: every block is validated and synced through the same room everyone's in, so what you build is what everyone sees. And critically, **builds persist**. The world's creation is saved per coin and rehydrated when the room spins back up, so a community's monument to their token survives even after the last person logs off and the room is torn down. Come back tomorrow and the thing your community built is still standing.
That's the difference between a chat log and a place. A chat scrolls away. A place accumulates.
## The flagship: the $THREE town
-There's one world that's always pinned to the top of the lobby, badged official, dressed in a fixed signature biome instead of the seeded lottery: the **$THREE town**, three.ws's own coin community. It's the front door — the world a first-time visitor lands in — and its identity (name, art, market cap) refreshes live from pump.fun so the pinned card is never stale. It's also the proof that this isn't a tech demo bolted onto a homepage: the platform runs its own community in its own product.
+There's one world that's always pinned to the top of the lobby, badged official, dressed in a fixed signature biome instead of the seeded lottery: the **$THREE town**, three.ws's own coin community. It's the front door (the world a first-time visitor lands in), and its identity (name, art, market cap) refreshes live from pump.fun so the pinned card is never stale. It's also the proof that this isn't a tech demo bolted onto a homepage: the platform runs its own community in its own product.
## It's all real
For a CoinMarketCap reader, the load-bearing question is always: *is any of this actually real, or is it a render?* Here's what's under the hood, plainly:
- **Real multiplayer.** The worlds run on an authoritative [Colyseus](https://colyseus.io) server deployed on Google Cloud Run. Clients send movement ~15 times a second; the server validates every update (anti-teleport step clamp, world bounds, name and message rate limits), keeps the authoritative state, and broadcasts only what changed via a binary delta protocol. It's the same proven engine behind the platform's `/walk` scene.
-- **Real on-chain data.** The chart, the ticker, the market cap, the reactor's green-and-red — all of it is driven by live pump.fun trending, search, coin, and swap-tape feeds. Nothing is mocked or canned. An empty coin honestly says "no recent trades yet — be the first to ape in."
-- **Real avatars.** Players load actual GLB/VRM 3D models — pick a preset, browse your own avatars and the public gallery, paste a URL, drop in your own `.glb`, or bring the 3D agent you built on three.ws. Draco-compressed models (most pump.fun and Sketchfab exports) just work.
+- **Real on-chain data.** The chart, the ticker, the market cap, the reactor's green-and-red: all of it is driven by live pump.fun trending, search, coin, and swap-tape feeds. Nothing is mocked or canned. An empty coin honestly says "no recent trades yet. Be the first to ape in."
+- **Real holder gating.** The holders' world is gated by genuine ownership, enforced through the Coin Communities protocol: only wallets holding at least $8 of the coin can enter the community and post to it. It's proof of stake in the literal sense, not an honor system or a club of screenshots.
+- **Real avatars.** Players load actual GLB/VRM 3D models: pick a preset, browse your own avatars and the public gallery, paste a URL, drop in your own `.glb`, or bring the 3D agent you built on three.ws. Draco-compressed models (most pump.fun and Sketchfab exports) just work.
- **Real voice.** Peer-to-peer WebRTC with spatial HRTF audio, proximity-gated so it scales and so it sounds right.
-- **Real buys.** A native pump.fun transaction built server-side and signed by your own wallet — not a redirect dressed up as a feature.
+- **Real buys.** A native pump.fun transaction built server-side and signed by your own wallet, not a redirect dressed up as a feature.
And it's **open source** under Apache 2.0, like the rest of the platform.
@@ -100,11 +113,12 @@ Memecoins have spent two years proving that attention and community are the actu
/play makes the community tab a *place*. It gives a token:
-- **A spatial home** — a room of its own, anchored to its mint, that holders can walk into and that you can link anyone directly into.
-- **An embodied crowd** — real avatars and spatial voice, so being "in" a coin means being somewhere with other people, not staring at a member count.
-- **A living chart** — the on-chain tape rendered as environment, so the market is something you experience, not just read.
-- **A persistent artifact** — a world the community can build in, that survives and accumulates instead of scrolling away.
-- **A path to action** — read the tape and buy the coin from inside its own world.
+- **A spatial home:** a room of its own, anchored to its mint, that holders can walk into and that you can link anyone directly into.
+- **An embodied crowd:** real avatars and spatial voice, so being "in" a coin means being somewhere with other people, not staring at a member count.
+- **A members' room:** a holders-only world, gated to wallets with at least $8 in the coin, so the people you're talking to are the people holding the bag with you, not a follower count.
+- **A living chart:** the on-chain tape rendered as environment, so the market is something you experience, not just read.
+- **A persistent artifact:** a world the community can build in, that survives and accumulates instead of scrolling away.
+- **A path to action:** read the tape and buy the coin from inside its own world.
For projects, that's a reason to send your holders somewhere that isn't a chat app. For traders, it's a way to *feel* a coin's momentum and meet the people behind it before you ape. For the space as a whole, it's a glimpse of what a memecoin community looks like when it finally gets a body.
@@ -112,8 +126,9 @@ For projects, that's a reason to send your holders somewhere that isn't a chat a
1. Go to **[three.ws/play](https://three.ws/play)**.
2. Pick a trending coin, or search any pump.fun token by name or ticker.
-3. Choose an avatar — a preset, your own upload, or your three.ws agent.
-4. Drop in. Walk around. Tap the mic to talk to whoever's there. Watch the world react as the trades land. Build something. Buy the coin.
+3. Choose an avatar: a preset, your own upload, or your three.ws agent.
+4. Drop into the open world. Walk around, watch the world react as the trades land, and buy the coin from inside it.
+5. Holding at least $8 of the coin? Step into the holders' world: tap the mic to talk to the people with a stake, and build something together that stays.
Or just open the front door: the pinned **$THREE town** at the top of the lobby.
diff --git a/tests/api/aws-marketplace-sns.test.js b/tests/api/aws-marketplace-sns.test.js
new file mode 100644
index 000000000..e41195221
--- /dev/null
+++ b/tests/api/aws-marketplace-sns.test.js
@@ -0,0 +1,124 @@
+// Unit tests for the security-critical half of the AWS Marketplace integration:
+// SNS webhook signature verification (api/_lib/aws-marketplace.js → verifySnsMessage).
+//
+// An unverified SNS webhook is the soft underbelly of a Marketplace listing — a
+// forged Notification could fake a subscribe-success or cancel a paying
+// customer. These tests prove the verifier:
+// • accepts a message genuinely signed by the (mocked) AWS key,
+// • rejects a tampered message body,
+// • refuses to fetch a signing cert from a non-amazonaws.com host,
+// • rejects a TopicArn that isn't ours.
+//
+// The canonical signing string built here mirrors the AWS SNS spec
+// (`Key\nValue\n` per field, fixed field set/order per message type), so a green
+// test also confirms the implementation reflects that spec, not just itself.
+
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+import { generateKeyPairSync, createSign } from 'node:crypto';
+
+// One RSA keypair for the suite. The "cert" we serve is the SPKI public-key PEM;
+// node's createPublicKey (used by verifySnsMessage) extracts the key from it.
+const { privateKey, publicKey } = generateKeyPairSync('rsa', { modulusLength: 2048 });
+const PUBLIC_PEM = publicKey.export({ type: 'spki', format: 'pem' });
+
+const CERT_URL = 'https://sns.us-east-1.amazonaws.com/SimpleNotificationService-test.pem';
+
+// Field sets/order per AWS SNS spec — must match the module under test.
+const NOTIFICATION_FIELDS = ['Message', 'MessageId', 'Subject', 'Timestamp', 'TopicArn', 'Type'];
+const SUBSCRIPTION_FIELDS = ['Message', 'MessageId', 'SubscribeURL', 'Timestamp', 'Token', 'TopicArn', 'Type'];
+
+function signingString(msg) {
+ const fields = msg.Type === 'Notification' ? NOTIFICATION_FIELDS : SUBSCRIPTION_FIELDS;
+ return fields
+ .filter((k) => msg[k] !== undefined)
+ .map((k) => `${k}\n${msg[k]}\n`)
+ .join('');
+}
+
+/** Build a message and attach a valid AWS-style RSA-SHA1 signature over it. */
+function signed(msg) {
+ const m = { ...msg, SigningCertURL: msg.SigningCertURL ?? CERT_URL, SignatureVersion: '1' };
+ const sig = createSign('RSA-SHA1').update(signingString(m)).sign(privateKey, 'base64');
+ return { ...m, Signature: sig };
+}
+
+function validNotification(overrides = {}) {
+ return signed({
+ Type: 'Notification',
+ MessageId: 'id-123',
+ Subject: 'AWS Marketplace',
+ Message: JSON.stringify({ action: 'subscribe-success', 'customer-identifier': 'CUST1' }),
+ Timestamp: '2026-05-30T00:00:00.000Z',
+ TopicArn: 'arn:aws:sns:us-east-1:155407237916:marketplace-topic',
+ ...overrides,
+ });
+}
+
+let verifySnsMessage;
+
+beforeEach(async () => {
+ delete process.env.AWS_MP_SNS_TOPIC_ARN; // default: no ARN pin unless a test sets it
+ // Serve our public PEM as the signing cert for the trusted URL; fail any other.
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async (url) => {
+ if (String(url) === CERT_URL) return { ok: true, text: async () => PUBLIC_PEM };
+ return { ok: false, status: 404, text: async () => 'not found' };
+ }),
+ );
+ // Import fresh each test so the module-level cert cache / env reads are clean.
+ vi.resetModules();
+ ({ verifySnsMessage } = await import('../../api/_lib/aws-marketplace.js'));
+});
+
+afterEach(() => {
+ vi.unstubAllGlobals();
+});
+
+describe('verifySnsMessage', () => {
+ it('accepts a genuinely signed Notification', async () => {
+ await expect(verifySnsMessage(validNotification())).resolves.toBeUndefined();
+ });
+
+ it('accepts a genuinely signed SubscriptionConfirmation (different field set)', async () => {
+ const msg = signed({
+ Type: 'SubscriptionConfirmation',
+ MessageId: 'id-sub',
+ Message: 'You have chosen to subscribe',
+ SubscribeURL: 'https://sns.us-east-1.amazonaws.com/?Action=ConfirmSubscription',
+ Timestamp: '2026-05-30T00:00:00.000Z',
+ Token: 'token-abc',
+ TopicArn: 'arn:aws:sns:us-east-1:155407237916:marketplace-topic',
+ });
+ await expect(verifySnsMessage(msg)).resolves.toBeUndefined();
+ });
+
+ it('rejects a tampered message body', async () => {
+ const msg = validNotification();
+ msg.Message = JSON.stringify({ action: 'subscribe-success', 'customer-identifier': 'ATTACKER' });
+ await expect(verifySnsMessage(msg)).rejects.toThrow(/signature verification failed/i);
+ });
+
+ it('refuses a signing cert URL not on *.amazonaws.com', async () => {
+ const msg = validNotification({ SigningCertURL: 'https://evil.example.com/cert.pem' });
+ await expect(verifySnsMessage(msg)).rejects.toThrow(/untrusted sns signing cert url/i);
+ // And it must never even fetch the hostile URL.
+ expect(fetch).not.toHaveBeenCalledWith('https://evil.example.com/cert.pem');
+ });
+
+ it('refuses a non-HTTPS cert URL', async () => {
+ const msg = validNotification({ SigningCertURL: 'http://sns.us-east-1.amazonaws.com/cert.pem' });
+ await expect(verifySnsMessage(msg)).rejects.toThrow(/untrusted sns signing cert url/i);
+ });
+
+ it('rejects a message from a different TopicArn when the ARN is pinned', async () => {
+ process.env.AWS_MP_SNS_TOPIC_ARN = 'arn:aws:sns:us-east-1:155407237916:marketplace-topic';
+ const msg = validNotification({ TopicArn: 'arn:aws:sns:us-east-1:000000000000:other-topic' });
+ await expect(verifySnsMessage(msg)).rejects.toThrow(/topicarn mismatch/i);
+ });
+
+ it('accepts the matching TopicArn when pinned', async () => {
+ process.env.AWS_MP_SNS_TOPIC_ARN = 'arn:aws:sns:us-east-1:155407237916:marketplace-topic';
+ await expect(verifySnsMessage(validNotification())).resolves.toBeUndefined();
+ });
+});