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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(mcp): expose the crypto data aggregator as crypto_data + token_snapshot tools
fudjia0d714c735c26
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6ddb10d51..8e19a5562 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -33,11 +33,14 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **New shared DeFi utility library: one source of truth for chain and token constants across EVM and Solana** — Added @three-ws/defi-utils, a zero-dependency internal package with chain IDs, native-token symbols, common token addresses (including SPA and USDs on Arbitrum), and minimal ERC-20 ABI fragments for nine EVM chains, plus a Solana extension (SOL/USDC/$THREE mint resolution and base58 address validation). Also ships address and amount validators and USD/percent/token-amount formatters. It replaces ad hoc constant duplication across the codebase's API handlers and frontend modules going forward. `[sdk]`- **New tool-authoring SDK: define an agent tool once — typed params, permissions, and rate limits included** — Internal SDK release for developers extending three.ws's 38 MCP servers: @three-ws/tool-sdk lets a tool be declared once with defineTool (Zod parameter schemas, auto-derived JSON Schema, a per-tool permission manifest for network access/rate limits/wallet use) and wired up with defineExecutor (typed handlers, automatic validation, uniform error wrapping) — then adapted into a live MCP server registration with a single toMcpTools() call. Proven by refactoring the naming MCP server's sns_resolve tool onto it with byte-identical behavior. `[sdk]`- **Paid API endpoints now stay up through a cache-provider outage** — Hardened the pay-per-call x402 API surface — every /api/x402/* and /api/okx/3d/* endpoint — so it degrades gracefully instead of failing when the shared Redis cache is unreachable. Previously a missing cache configuration could take these paid endpoints offline; they now serve normally on a safe per-instance fallback, with on-chain payment safety unchanged (each payment authorization is still single-use, so no double-charge is possible). `[fix, infra]`+- **Restyle Studio — re-skin any 3D model with PBR presets and seeded variants** — A new browser tool re-skins any GLB without regenerating it. Apply a physically-based material preset — chrome, gold, copper, glass, wood, neon and more — fan out reproducible colorway variants from a seed, fine-tune metalness/roughness/emissive live, then export a validated GLB. Your original is never touched; one click resets it. The preset library also ships in the @three-ws/viewer-presets SDK for anyone building their own viewer. (`/restyle`) `[feature, sdk]`- **Sentiment and narrative intel are now part of the free API** — POST /api/v1/sentiment (deterministic text classification), GET /api/v1/market/intel, and GET /api/v1/market/projects (aixbt-backed narrative + momentum intelligence) are now documented, publicly readable with no API key, and degrade honestly with a real 503 when the deployment's aixbt key isn't set — instead of a silent internal error. (`/docs/api-reference`) `[improvement, docs]`- **Spatial MCP: 3D models are now a native, interactive response type** — We published an open standard — Spatial MCP — for returning a live, interactive 3D scene as a first-class AI tool result instead of a link in text. Every three.ws 3D tool now emits a conformant artifact (camera, lighting, animation, AR handoff), a public validator checks conformance with actionable errors, and a framework-free reference renderer displays any conformant payload — including ones transformed from other tools. It carries no wallet or token surface, so it works everywhere. Try the reference renderer. (`/spatial-mcp`) `[feature, docs]`- **The free crypto API goes deeper: CoinGecko, DefiLlama, and two new DeFi price feeds** — The unified /api/v1/x crypto API grew from 4 to 12 endpoints across CoinGecko and DefiLlama, all free with zero setup. CoinGecko now answers a full per-coin snapshot (price, ATH/ATL, supply, multi-window change), trending coins and hot categories, token price by contract address, the global market snapshot, and OHLC candles — not just spot price and ranked markets. DefiLlama adds every chain ranked by TVL, one protocol's full profile with 30 days of TVL history, and 90 days of historical chain TVL. Two new providers ride DefiLlama's sibling APIs: llama-prices for any chain:address token (covers long-tail tokens CoinGecko and Jupiter don't index) and llama-stablecoins for every tracked stablecoin's peg, price, and circulating supply. (`/docs/api-reference`) `[feature]`+- **The free crypto API is now callable as an MCP tool** — Two new MCP tools on the three.ws server: crypto_data calls any endpoint of the free Crypto Data API (DEX pairs, CoinGecko/DefiLlama market data, Jupiter Solana prices and swap quotes, Solana RPC reads) directly from an MCP client, generated live from the same registry that powers GET /api/v1/x/*; token_snapshot fans out to whichever of those providers are registered to build a one-call market snapshot for any Solana token mint, degrading gracefully around any provider that's absent or down. (`/docs/mcp`) `[feature]`- **The three.ws crypto API now has a real free tier** — Any unauthenticated call to the unified /api/v1/x API (CoinGecko, DefiLlama, Jupiter Solana prices/quotes/search) now gets real data with zero setup, up to a per-endpoint quota — no wallet, no key, no signup. curl https://three.ws/api/v1/x/coingecko/price?ids=solana just works. Every response carries rate-limit headers so an agent can see exactly how much free budget is left; once it's used up, the same URL falls through to pay-per-call USDC (x402) or a three.ws API key instead of dead-ending. (`/docs/api-reference`) `[feature]`- **three.ws now speaks BNB Chain's payment protocol (MPP), both ways** — Our paid endpoints now accept payments over MPP — BNB Chain's Machine Payments Protocol — in addition to the x402 payments we already take on Solana and Base. Because MPP is x402 v2 under the hood, the same signed-stablecoin credential works; agents from the BNB ecosystem can now pay us on BNB Chain, settling through the Binance OnchainPay facilitator, while every existing Solana/Base payment path is untouched. The $THREE Town Oracle is the first endpoint to accept both. Our own agents can pay any MPP-protected endpoint too, with a hard per-call spending cap that refuses an over-quote before any money moves. `[feature, sdk]`+- **Token-gated 3D embeds — holder-only interactive scenes** — Turn an avatar or on-chain agent you own into a holder-only interactive 3D embed. Visitors must prove a real, server-verified on-chain balance — a signed wallet challenge plus a live Solana RPC read, never a number the browser reports — before the live scene renders; below the bar they see a designed locked teaser with a connect-wallet button. Defaults to gating on $THREE, but accepts any SPL token at runtime for other communities. New create_gated_embed MCP tool, plus a REST API and a paste-anywhere <three-d> embed snippet. (`/docs/token-gated-3d-embeds`) `[feature]`- **View any generated model in your room with AR** — Every 3D model you generate can now be placed in your space through your phone. A new device-aware AR link opens Apple Quick Look on iPhone/iPad, Google Scene Viewer on Android, and the interactive 3D viewer on desktop — one tap, no app, no wallet. The USDZ for iOS is generated from the model on the fly, so any GLB works. Agents get an export_ar tool that returns the AR link alongside the model. `[feature]`## 2026-07-07diff --git a/api/_mcp/catalog.js b/api/_mcp/catalog.jsindex 9d6ce5095..ce19cd9a1 100644--- a/api/_mcp/catalog.js+++ b/api/_mcp/catalog.js@@ -14,6 +14,7 @@ import { toolDefs as embedDefs } from './tools/embed.js';import { toolDefs as oracleDefs } from './tools/oracle.js';import { toolDefs as traderDefs } from './tools/trader.js';import { toolDefs as tokenizeDefs } from './tools/tokenize.js';+import { toolDefs as cryptoDataDefs } from './tools/crypto-data.js';const baseDefs = [...avatarDefs,@@ -27,6 +28,7 @@ const baseDefs = [...oracleDefs,...traderDefs,...tokenizeDefs,+ ...cryptoDataDefs,];// Free, public entry point — listed first so discovery clients see it up top.diff --git a/api/_mcp/tools/crypto-data.js b/api/_mcp/tools/crypto-data.jsnew file mode 100644index 000000000..f1f8217e1--- /dev/null+++ b/api/_mcp/tools/crypto-data.js@@ -0,0 +1,258 @@+// crypto_data + token_snapshot — MCP front door onto the /api/v1/x aggregator+// (api/v1/_providers.js). Generated from the live registry so the toolset+// grows automatically as provider prompts land — no hand-enumerated endpoint+// list to keep in sync.+//+// Design (owner-approved, prompts/x402-catalog/10-crypto-api-mcp-tools.md):+// one generic tool + one curated convenience tool, not one tool per endpoint+// (a 30-tool flood degrades agent tool selection).+//+// Both tools run calls through the SAME engine the REST aggregator uses+// (executeUpstream, with the platform's own upstream key) — never re-fetch an+// upstream directly. An endpoint marked `free` in the registry is served+// within the identical per-IP quota the REST free lane enforces+// (api/v1/x/[...slug].js `serveFreeLane`) so the two doors share one budget+// instead of doubling it. A caller who exhausts the quota, or calls an+// endpoint with no free tier, gets a -32402 JSON-RPC error naming the exact+// REST URL + USDC price to pay via x402 — the platform's one real payment+// rail, never a second payment flow invented for MCP.++import { ENDPOINT_INDEX, providerCatalog } from '../../v1/_providers.js';+import { executeUpstream, resolveUpstreamKey } from '../../_lib/aggregator.js';+import { limits, clientIp } from '../../_lib/rate-limit.js';++function rpcError(code, message, data) {+ const e = new Error(message);+ e.code = code;+ e.data = data;+ return e;+}++function toolResult(payload) {+ return {+ content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],+ structuredContent: payload,+ };+}++function errorResult(message, data) {+ return {+ content: [{ type: 'text', text: message }],+ isError: true,+ structuredContent: data,+ };+}++// Same per-IP identity the REST free lane keys its quota by. `req` is absent+// under some transports (unit tests, non-HTTP dispatch) — fall back to the+// caller's account id, then a shared anonymous bucket.+function callerKey(auth, req) {+ if (req) {+ try {+ return `ip:${clientIp(req)}`;+ } catch {+ /* fall through */+ }+ }+ return auth?.userId ? `user:${auth.userId}` : 'anon';+}++/** Every "provider/endpoint" pair currently registered, for error hints. */+function listPairs() {+ return [...ENDPOINT_INDEX.keys()].sort();+}++/** One line per endpoint, generated fresh from the live registry at call time. */+function describePairs() {+ return providerCatalog()+ .flatMap((p) => p.endpoints.map((e) => `${p.id}/${e.id} — ${e.summary}`))+ .join('\n');+}++/**+ * Run one aggregator call, honoring the endpoint's free-tier quota (if any).+ * Shared by both tools so token_snapshot's fan-out and crypto_data's direct+ * call enforce identically. Never throws — every outcome is a tagged result+ * so callers can degrade gracefully (token_snapshot) or surface a clean+ * payment-required error (crypto_data).+ */+async function runEndpoint({ providerId, endpointId, params, auth, req }) {+ const hit = ENDPOINT_INDEX.get(`${providerId}/${endpointId}`);+ if (!hit) return { ok: false, reason: 'unknown_pair' };+ const { provider, endpoint } = hit;++ if (endpoint.free) {+ const key = callerKey(auth, req);+ const bucket = `${provider.id}:${endpoint.id}:mcp:${key}`;+ const [minR, dayR] = await Promise.all([+ limits.apiV1FreeMin(bucket, endpoint.free.perMin),+ limits.apiV1FreeDay(bucket, endpoint.free.perDay),+ ]);+ if (!minR.success || !dayR.success) {+ const blocked = !minR.success ? minR : dayR;+ return {+ ok: false,+ reason: 'quota_exceeded',+ provider: provider.id,+ endpoint: endpoint.id,+ reset: new Date(blocked.reset).toISOString(),+ priceAtomics: endpoint.priceAtomics,+ restUrl: `/api/v1/x/${provider.id}/${endpoint.id}`,+ };+ }+ } else {+ return {+ ok: false,+ reason: 'payment_required',+ provider: provider.id,+ endpoint: endpoint.id,+ priceAtomics: endpoint.priceAtomics,+ restUrl: `/api/v1/x/${provider.id}/${endpoint.id}`,+ };+ }++ const { key: apiKey } = resolveUpstreamKey(provider, null);+ try {+ const data = await executeUpstream({ provider, endpoint, query: params || {}, apiKey });+ return { ok: true, provider: provider.id, endpoint: endpoint.id, data };+ } catch (err) {+ return {+ ok: false,+ reason: 'upstream_error',+ provider: provider.id,+ endpoint: endpoint.id,+ message: err?.message || 'upstream call failed',+ status: err?.status || 502,+ };+ }+}++const READ_ONLY_LIVE_FEED = {+ readOnlyHint: true,+ destructiveHint: false,+ idempotentHint: false,+ openWorldHint: true,+};++export const toolDefs = [+ {+ name: 'crypto_data',+ title: 'Crypto Data API',+ annotations: READ_ONLY_LIVE_FEED,+ get description() {+ return (+ 'Call any endpoint in the three.ws free crypto data API (the same aggregator behind ' ++ 'GET /api/v1/x/*): DEX pairs, CoinGecko/DefiLlama market data, Jupiter Solana prices ' ++ 'and swap quotes, and direct Solana RPC reads. Endpoints marked free run within a ' ++ 'per-IP quota, no wallet needed; an endpoint with no free tier (or an exhausted quota) ' ++ 'returns a payment-required error naming the exact REST URL and USDC price to pay via ' ++ 'x402.\n\nLive provider/endpoint pairs on this deployment:\n' + describePairs()+ );+ },+ inputSchema: {+ type: 'object',+ required: ['provider', 'endpoint'],+ properties: {+ provider: {+ type: 'string',+ description: 'Registered provider id, e.g. "coingecko", "dexscreener", "jupiter", "solana", "defillama".',+ },+ endpoint: {+ type: 'string',+ description: 'Endpoint id under that provider, e.g. "price", "token", "quote".',+ },+ params: {+ type: 'object',+ description: 'Endpoint-specific query params — see the endpoint summary in the tool description for required fields.',+ additionalProperties: true,+ default: {},+ },+ },+ additionalProperties: false,+ },+ async handler(args, auth, req) {+ const providerId = String(args?.provider || '').trim();+ const endpointId = String(args?.endpoint || '').trim();+ const pairKey = `${providerId}/${endpointId}`;+ if (!ENDPOINT_INDEX.has(pairKey)) {+ return errorResult(+ `unknown provider/endpoint "${pairKey}". Valid pairs:\n${listPairs().join('\n')}`,+ { error: 'unknown_pair', valid_pairs: listPairs() },+ );+ }++ const result = await runEndpoint({ providerId, endpointId, params: args?.params, auth, req });+ if (result.ok) {+ return toolResult({ provider: result.provider, endpoint: result.endpoint, data: result.data });+ }+ if (result.reason === 'quota_exceeded' || result.reason === 'payment_required') {+ throw rpcError(-32402, `payment required for ${pairKey}`, {+ scheme: 'x402',+ provider: result.provider,+ endpoint: result.endpoint,+ amount_usdc_atomics: result.priceAtomics,+ pay_via: `${result.restUrl} — send an X-PAYMENT header (see docs/x402.md) for pay-per-call USDC`,+ ...(result.reset ? { free_tier_reset: result.reset } : {}),+ });+ }+ return errorResult(`${pairKey} upstream error: ${result.message}`, result);+ },+ },+ {+ name: 'token_snapshot',+ title: 'Crypto token snapshot',+ annotations: READ_ONLY_LIVE_FEED,+ description:+ 'One-call snapshot for a Solana token mint, fanning out to whichever free crypto-data ' ++ 'providers are registered on this deployment (DexScreener pairs, Jupiter price, Solana RPC ' ++ 'supply) and merging what answers — degrades gracefully around any provider that is absent, ' ++ 'unconfigured, or fails, never throwing on a partial result. Example mint: the $THREE CA ' ++ '"FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump". For pump.fun-specific bonding-curve / ' ++ 'launch data use the pump_snapshot tool instead — this tool covers general market data.',+ inputSchema: {+ type: 'object',+ required: ['mint'],+ properties: {+ mint: { type: 'string', description: 'Base58 Solana token mint address.' },+ },+ additionalProperties: false,+ },+ async handler(args, auth, req) {+ const mint = String(args?.mint || '').trim();+ if (!mint) return errorResult('"mint" is required', { error: 'validation_error' });++ // Fixed, small candidate set (not every registered provider) — a+ // snapshot is meant to answer "what is this token" in one call, not+ // fan out to every provider that happens to accept a mint-shaped param.+ const CANDIDATES = [+ { provider: 'dexscreener', endpoint: 'token', params: { addresses: mint } },+ { provider: 'jupiter', endpoint: 'price', params: { ids: mint } },+ { provider: 'solana', endpoint: 'token-supply', params: { mint } },+ ];++ const snapshot = { mint, sources: [], skipped: [], failed: [] };+ for (const c of CANDIDATES) {+ if (!ENDPOINT_INDEX.has(`${c.provider}/${c.endpoint}`)) {+ snapshot.skipped.push({+ provider: c.provider,+ endpoint: c.endpoint,+ reason: 'not_registered_on_this_deployment',+ });+ continue;+ }+ const r = await runEndpoint({ providerId: c.provider, endpointId: c.endpoint, params: c.params, auth, req });+ if (r.ok) {+ snapshot[c.provider] = r.data;+ snapshot.sources.push(c.provider);+ } else {+ snapshot.failed.push({ provider: c.provider, endpoint: c.endpoint, reason: r.reason, message: r.message });+ }+ }++ if (snapshot.sources.length === 0) {+ return errorResult(`no registered provider could resolve ${mint}`, snapshot);+ }+ return toolResult(snapshot);+ },+ },+];diff --git a/data/changelog.json b/data/changelog.jsonindex 8aa61ea0a..f26d05f78 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,34 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-07-08",+ "title": "The free crypto API is now callable as an MCP tool",+ "summary": "Two new MCP tools on the three.ws server: crypto_data calls any endpoint of the free Crypto Data API (DEX pairs, CoinGecko/DefiLlama market data, Jupiter Solana prices and swap quotes, Solana RPC reads) directly from an MCP client, generated live from the same registry that powers GET /api/v1/x/*; token_snapshot fans out to whichever of those providers are registered to build a one-call market snapshot for any Solana token mint, degrading gracefully around any provider that's absent or down.",+ "tags": [+ "feature"+ ],+ "link": "/docs/mcp"+ },+ {+ "date": "2026-07-08",+ "title": "Token-gated 3D embeds — holder-only interactive scenes",+ "summary": "Turn an avatar or on-chain agent you own into a holder-only interactive 3D embed. Visitors must prove a real, server-verified on-chain balance — a signed wallet challenge plus a live Solana RPC read, never a number the browser reports — before the live scene renders; below the bar they see a designed locked teaser with a connect-wallet button. Defaults to gating on $THREE, but accepts any SPL token at runtime for other communities. New create_gated_embed MCP tool, plus a REST API and a paste-anywhere <three-d> embed snippet.",+ "tags": [+ "feature"+ ],+ "link": "/docs/token-gated-3d-embeds"+ },+ {+ "date": "2026-07-08",+ "title": "Restyle Studio — re-skin any 3D model with PBR presets and seeded variants",+ "summary": "A new browser tool re-skins any GLB without regenerating it. Apply a physically-based material preset — chrome, gold, copper, glass, wood, neon and more — fan out reproducible colorway variants from a seed, fine-tune metalness/roughness/emissive live, then export a validated GLB. Your original is never touched; one click resets it. The preset library also ships in the @three-ws/viewer-presets SDK for anyone building their own viewer.",+ "tags": [+ "feature",+ "sdk"+ ],+ "link": "/restyle"+ },{"date": "2026-07-08","title": "/create is now the front door for everything you can build",diff --git a/docs/mcp.md b/docs/mcp.mdindex c2f597d55..16acc5a61 100644--- a/docs/mcp.md+++ b/docs/mcp.md@@ -477,6 +477,85 @@ Returns `holder`, `media` (`glb_url`, `image_url`, `viewer_url`, `viewer_live`),---+### `create_gated_embed`++Turn an avatar or on-chain agent **you own** into a holder-only interactive 3D embed. Visitors must prove — with a real, server-verified Solana SPL token balance, never a client-reported number — they hold at least `min_amount` of `mint` before the live scene renders; below the bar they see a designed locked teaser with a connect-wallet CTA. `mint` defaults to `$THREE` but accepts any SPL mint at runtime (a community can gate with its own token). Requires `avatars:write` scope.++```json+{+ "type": "object",+ "properties": {+ "asset_id": { "type": "string", "description": "\"avatar:<uuid>\" or \"<chainId>:<agentId>\" — an asset you own." },+ "mint": { "type": "string", "description": "SPL mint holders must have a balance of. Defaults to $THREE." },+ "min_amount": { "type": "number", "exclusiveMinimum": 0, "description": "Minimum balance a visitor must hold to unlock." }+ },+ "required": ["asset_id", "min_amount"],+ "additionalProperties": false+}+```++The `structuredContent` returns `gate_id`, `asset_id`, `gate` (`mint`, `min_amount`, `chain`), and `embed_snippet` — a ready-to-paste `<script>` + `<three-d>` tag. See [Token-gated 3D embeds](./token-gated-3d-embeds.md) for the full verification flow, the anti-abuse token/rate-limit design, and how visitors unlock the embed.++---++### `crypto_data`++Call any endpoint in the free [Crypto Data API](./api-reference.md) (the same aggregator behind `GET /api/v1/x/*`: DEX pairs, CoinGecko/DefiLlama market data, Jupiter Solana prices and swap quotes, direct Solana RPC reads) as an MCP tool call. The tool description is generated from the live provider registry at call time, so it always lists exactly the provider/endpoint pairs registered on this deployment — nothing hand-enumerated to drift out of date.++```json+{+ "type": "object",+ "properties": {+ "provider": { "type": "string", "description": "Registered provider id, e.g. \"coingecko\", \"dexscreener\", \"jupiter\", \"solana\", \"defillama\"." },+ "endpoint": { "type": "string", "description": "Endpoint id under that provider, e.g. \"price\", \"token\", \"quote\"." },+ "params": { "type": "object", "description": "Endpoint-specific query params.", "additionalProperties": true }+ },+ "required": ["provider", "endpoint"],+ "additionalProperties": false+}+```++An unknown `provider`/`endpoint` pair returns an error result listing every valid pair. A registered endpoint marked free runs within the same per-IP quota the REST free lane enforces — no wallet needed. An endpoint with no free tier, or a free quota you've exhausted, returns a JSON-RPC `-32402` error naming the exact REST URL and USDC price to pay via [x402](./x402.md) — never a second, MCP-only payment flow.++```bash+# Equivalent to: GET /api/v1/x/dexscreener/token?addresses=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump+curl -s https://three.ws/api/mcp -H 'content-type: application/json' -d '{+ "jsonrpc": "2.0", "id": 1, "method": "tools/call",+ "params": { "name": "crypto_data", "arguments": {+ "provider": "dexscreener", "endpoint": "token",+ "params": { "addresses": "FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump" }+ } }+}'+```++---++### `token_snapshot`++One-call snapshot for a Solana token mint. Fans out to whichever free crypto-data providers are registered on this deployment (DexScreener pairs, Jupiter price, Solana RPC supply) and merges what answers into one object — a provider that's unregistered, unconfigured, or errors is recorded in `skipped`/`failed` rather than failing the whole call. For pump.fun-specific bonding-curve/launch data, use `pump_snapshot` instead; this tool covers general market data.++```json+{+ "type": "object",+ "properties": {+ "mint": { "type": "string", "description": "Base58 Solana token mint address." }+ },+ "required": ["mint"],+ "additionalProperties": false+}+```++```bash+curl -s https://three.ws/api/mcp -H 'content-type: application/json' -d '{+ "jsonrpc": "2.0", "id": 1, "method": "tools/call",+ "params": { "name": "token_snapshot", "arguments": { "mint": "FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump" } }+}'+```++Returns `{ mint, sources: [...], dexscreener?, jupiter?, solana?, skipped: [...], failed: [...] }` — `sources` lists which providers actually answered.++---+## Rate limits| Scope | Limit |diff --git a/public/changelog.json b/public/changelog.jsonindex 0598eb221..0d251c42f 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-08T01:05:42.970Z",+ "generated_at": "2026-07-08T01:15:13.613Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -279,6 +279,17 @@"infra"]},+ {+ "date": "2026-07-08",+ "type": "update",+ "title": "Restyle Studio — re-skin any 3D model with PBR presets and seeded variants",+ "summary": "A new browser tool re-skins any GLB without regenerating it. Apply a physically-based material preset — chrome, gold, copper, glass, wood, neon and more — fan out reproducible colorway variants from a seed, fine-tune metalness/roughness/emissive live, then export a validated GLB. Your original is never touched; one click resets it. The preset library also ships in the @three-ws/viewer-presets SDK for anyone building their own viewer.",+ "link": "/restyle",+ "tags": [+ "feature",+ "sdk"+ ]+ },{"date": "2026-07-08","type": "update",@@ -311,6 +322,16 @@"feature"]},+ {+ "date": "2026-07-08",+ "type": "update",+ "title": "The free crypto API is now callable as an MCP tool",+ "summary": "Two new MCP tools on the three.ws server: crypto_data calls any endpoint of the free Crypto Data API (DEX pairs, CoinGecko/DefiLlama market data, Jupiter Solana prices and swap quotes, Solana RPC reads) directly from an MCP client, generated live from the same registry that powers GET /api/v1/x/*; token_snapshot fans out to whichever of those providers are registered to build a one-call market snapshot for any Solana token mint, degrading gracefully around any provider that's absent or down.",+ "link": "/docs/mcp",+ "tags": [+ "feature"+ ]+ },{"date": "2026-07-08","type": "update",@@ -332,6 +353,16 @@"sdk"]},+ {+ "date": "2026-07-08",+ "type": "update",+ "title": "Token-gated 3D embeds — holder-only interactive scenes",+ "summary": "Turn an avatar or on-chain agent you own into a holder-only interactive 3D embed. Visitors must prove a real, server-verified on-chain balance — a signed wallet challenge plus a live Solana RPC read, never a number the browser reports — before the live scene renders; below the bar they see a designed locked teaser with a connect-wallet button. Defaults to gating on $THREE, but accepts any SPL token at runtime for other communities. New create_gated_embed MCP tool, plus a REST API and a paste-anywhere <three-d> embed snippet.",+ "link": "/docs/token-gated-3d-embeds",+ "tags": [+ "feature"+ ]+ },{"date": "2026-07-08","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex e55c35b1a..dd3d860bd 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -222,6 +222,14 @@<category>fix</category><description>Hardened the pay-per-call x402 API surface — every /api/x402/* and /api/okx/3d/* endpoint — so it degrades gracefully instead of failing when the shared Redis cache is unreachable. Previously a missing cache configuration could take these paid endpoints offline; they now serve normally on a safe per-instance fallback, with on-chain payment safety unchanged (each payment authorization is still single-use, so no double-charge is possible).</description></item>+ <item>+ <title>Restyle Studio — re-skin any 3D model with PBR presets and seeded variants</title>+ <link>https://three.ws/restyle</link>+ <guid isPermaLink="false">2026-07-08:Restyle Studio — re-skin any 3D model with PBR presets and seeded variants</guid>+ <pubDate>Wed, 08 Jul 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>A new browser tool re-skins any GLB without regenerating it. Apply a physically-based material preset — chrome, gold, copper, glass, wood, neon and more — fan out reproducible colorway variants from a seed, fine-tune metalness/roughness/emissive live, then export a validated GLB. Your original is never touched; one click resets it. The preset library also ships in the @three-ws/viewer-presets SDK for anyone building their own viewer.</description>+ </item><item><title>Sentiment and narrative intel are now part of the free API</title><link>https://three.ws/docs/api-reference</link>@@ -246,6 +254,14 @@<category>feature</category><description>The unified /api/v1/x crypto API grew from 4 to 12 endpoints across CoinGecko and DefiLlama, all free with zero setup. CoinGecko now answers a full per-coin snapshot (price, ATH/ATL, supply, multi-window change), trending coins and hot categories, token price by contract address, the global market snapshot, and OHLC candles — not just spot price and ranked markets. DefiLlama adds every chain ranked by TVL, one protocol's full profile with 30 days of TVL history, and 90 days of historical chain TVL. Two new providers ride DefiLlama's sibling APIs: llama-prices for any chain:address token (covers long-tail tokens CoinGecko and Jupiter don't index) and llama-stablecoins for every tracked stablecoin's peg, price, and circulating supply.</description></item>+ <item>+ <title>The free crypto API is now callable as an MCP tool</title>+ <link>https://three.ws/docs/mcp</link>+ <guid isPermaLink="false">2026-07-08:The free crypto API is now callable as an MCP tool</guid>+ <pubDate>Wed, 08 Jul 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>Two new MCP tools on the three.ws server: crypto_data calls any endpoint of the free Crypto Data API (DEX pairs, CoinGecko/DefiLlama market data, Jupiter Solana prices and swap quotes, Solana RPC reads) directly from an MCP client, generated live from the same registry that powers GET /api/v1/x/*; token_snapshot fans out to whichever of those providers are registered to build a one-call market snapshot for any Solana token mint, degrading gracefully around any provider that's absent or down.</description>+ </item><item><title>The three.ws crypto API now has a real free tier</title><link>https://three.ws/docs/api-reference</link>@@ -262,6 +278,14 @@<category>feature</category><description>Our paid endpoints now accept payments over MPP — BNB Chain's Machine Payments Protocol — in addition to the x402 payments we already take on Solana and Base. Because MPP is x402 v2 under the hood, the same signed-stablecoin credential works; agents from the BNB ecosystem can now pay us on BNB Chain, settling through the Binance OnchainPay facilitator, while every existing Solana/Base payment path is untouched. The $THREE Town Oracle is the first endpoint to accept both. Our own agents can pay any MPP-protected endpoint too, with a hard per-call spending cap that refuses an over-quote before any money moves.</description></item>+ <item>+ <title>Token-gated 3D embeds — holder-only interactive scenes</title>+ <link>https://three.ws/docs/token-gated-3d-embeds</link>+ <guid isPermaLink="false">2026-07-08:Token-gated 3D embeds — holder-only interactive scenes</guid>+ <pubDate>Wed, 08 Jul 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>Turn an avatar or on-chain agent you own into a holder-only interactive 3D embed. Visitors must prove a real, server-verified on-chain balance — a signed wallet challenge plus a live Solana RPC read, never a number the browser reports — before the live scene renders; below the bar they see a designed locked teaser with a connect-wallet button. Defaults to gating on $THREE, but accepts any SPL token at runtime for other communities. New create_gated_embed MCP tool, plus a REST API and a paste-anywhere <three-d> embed snippet.</description>+ </item><item><title>View any generated model in your room with AR</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex 194cb28a8..af6dbf980 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-08T01:05:42.945Z",+ "generated_at": "2026-07-08T01:15:13.587Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tests/api/mcp-crypto-data.test.js b/tests/api/mcp-crypto-data.test.jsnew file mode 100644index 000000000..dd01c6120--- /dev/null+++ b/tests/api/mcp-crypto-data.test.js@@ -0,0 +1,199 @@+// crypto_data + token_snapshot — MCP tools wrapping the /api/v1/x aggregator+// (api/_mcp/tools/crypto-data.js), registered in api/_mcp/catalog.js.+//+// Verifies: both tools are in the discovery catalog with real input schemas;+// crypto_data validates the provider/endpoint pair against the live registry+// and errors helpfully (listing valid pairs) on an unknown one; a free-tier+// endpoint runs through executeUpstream and returns structuredContent; a+// quota-exhausted or payment-only endpoint throws a -32402 JSON-RPC error+// naming the real REST URL + price (never a fake MCP-only payment flow);+// token_snapshot merges partial provider availability (skip/fail) without+// throwing. The rate limiter and aggregator engine are mocked at their module+// boundary — real registry lookups (ENDPOINT_INDEX) run unmocked.++import { describe, it, expect, vi, beforeEach } from 'vitest';++const executeUpstreamMock = vi.fn();+vi.mock('../../api/_lib/aggregator.js', () => ({+ executeUpstream: (...a) => executeUpstreamMock(...a),+ resolveUpstreamKey: () => ({ key: null, source: 'platform' }),+}));++let minOk = true;+let dayOk = true;+vi.mock('../../api/_lib/rate-limit.js', () => ({+ limits: {+ apiV1FreeMin: async (_key, limit) =>+ minOk+ ? { success: true, limit, remaining: limit - 1, reset: Date.now() + 60_000 }+ : { success: false, limit, remaining: 0, reset: Date.now() + 60_000 },+ apiV1FreeDay: async (_key, limit) =>+ dayOk+ ? { success: true, limit, remaining: limit - 1, reset: Date.now() + 86_400_000 }+ : { success: false, limit, remaining: 0, reset: Date.now() + 86_400_000 },+ },+ clientIp: () => '203.0.113.7',+}));++beforeEach(() => {+ executeUpstreamMock.mockReset();+ minOk = true;+ dayOk = true;+});++// ── Catalog discovery — both tools registered with real schemas ───────────────+describe('api/_mcp/catalog — crypto_data + token_snapshot', () => {+ it('lists both tools with input schemas and live-registry-generated descriptions', async () => {+ const { TOOL_CATALOG, TOOLS } = await import('../../api/_mcp/catalog.js');++ const cryptoData = TOOL_CATALOG.find((t) => t.name === 'crypto_data');+ expect(cryptoData).toBeTruthy();+ expect(cryptoData.inputSchema.required).toEqual(['provider', 'endpoint']);+ // Generated from the live registry, not hand-enumerated — must mention a+ // real registered provider/endpoint pair rather than a static string.+ expect(cryptoData.description).toMatch(/dexscreener\/token|coingecko\/price|jupiter\/price/);++ const tokenSnapshot = TOOL_CATALOG.find((t) => t.name === 'token_snapshot');+ expect(tokenSnapshot).toBeTruthy();+ expect(tokenSnapshot.inputSchema.required).toEqual(['mint']);++ expect(TOOLS.crypto_data).toBeTruthy();+ expect(TOOLS.token_snapshot).toBeTruthy();+ expect(typeof TOOLS.crypto_data.handler).toBe('function');+ expect(typeof TOOLS.token_snapshot.handler).toBe('function');+ });+});++// ── crypto_data ─────────────────────────────────────────────────────────────+describe('crypto_data tool', () => {+ it('errors helpfully on an unknown provider/endpoint pair, listing valid ones', async () => {+ const { toolDefs } = await import('../../api/_mcp/tools/crypto-data.js');+ const tool = toolDefs.find((t) => t.name === 'crypto_data');+ const result = await tool.handler({ provider: 'nope', endpoint: 'nothing' }, {}, null);+ expect(result.isError).toBe(true);+ expect(result.structuredContent.error).toBe('unknown_pair');+ expect(Array.isArray(result.structuredContent.valid_pairs)).toBe(true);+ expect(result.structuredContent.valid_pairs.length).toBeGreaterThan(0);+ expect(executeUpstreamMock).not.toHaveBeenCalled();+ });++ it('runs a free-tier endpoint through executeUpstream and returns structuredContent', async () => {+ const { ENDPOINT_INDEX } = await import('../../api/v1/_providers.js');+ const [pairKey] = [...ENDPOINT_INDEX.keys()].filter((k) => {+ const { endpoint } = ENDPOINT_INDEX.get(k);+ return Boolean(endpoint.free);+ });+ expect(pairKey).toBeTruthy(); // sanity: at least one free endpoint is registered+ const [providerId, endpointId] = pairKey.split('/');++ executeUpstreamMock.mockResolvedValue({ fixture: true, mint: 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump' });++ const { toolDefs } = await import('../../api/_mcp/tools/crypto-data.js');+ const tool = toolDefs.find((t) => t.name === 'crypto_data');+ const result = await tool.handler({ provider: providerId, endpoint: endpointId, params: { x: 1 } }, {}, null);++ expect(result.isError).toBeFalsy();+ expect(result.structuredContent.provider).toBe(providerId);+ expect(result.structuredContent.endpoint).toBe(endpointId);+ expect(result.structuredContent.data).toEqual({ fixture: true, mint: 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump' });+ expect(executeUpstreamMock).toHaveBeenCalledTimes(1);+ });++ it('throws a -32402 payment-required error naming the REST URL + price when the free quota is exhausted', async () => {+ const { ENDPOINT_INDEX } = await import('../../api/v1/_providers.js');+ const [pairKey] = [...ENDPOINT_INDEX.keys()].filter((k) => {+ const { endpoint } = ENDPOINT_INDEX.get(k);+ return Boolean(endpoint.free);+ });+ const [providerId, endpointId] = pairKey.split('/');+ minOk = false;++ const { toolDefs } = await import('../../api/_mcp/tools/crypto-data.js');+ const tool = toolDefs.find((t) => t.name === 'crypto_data');++ await expect(tool.handler({ provider: providerId, endpoint: endpointId }, {}, null)).rejects.toMatchObject({+ code: -32402,+ data: expect.objectContaining({+ scheme: 'x402',+ provider: providerId,+ endpoint: endpointId,+ pay_via: expect.stringContaining(`/api/v1/x/${providerId}/${endpointId}`),+ }),+ });+ expect(executeUpstreamMock).not.toHaveBeenCalled();+ });++ it('throws -32402 immediately for an endpoint with no free tier at all (no quota check needed)', async () => {+ const { ENDPOINT_INDEX } = await import('../../api/v1/_providers.js');+ const [pairKey] = [...ENDPOINT_INDEX.keys()].filter((k) => {+ const { endpoint } = ENDPOINT_INDEX.get(k);+ return !endpoint.free;+ });+ if (!pairKey) return; // every registered endpoint currently free-tiers — nothing to assert+ const [providerId, endpointId] = pairKey.split('/');++ const { toolDefs } = await import('../../api/_mcp/tools/crypto-data.js');+ const tool = toolDefs.find((t) => t.name === 'crypto_data');+ await expect(tool.handler({ provider: providerId, endpoint: endpointId }, {}, null)).rejects.toMatchObject({ code: -32402 });+ });+});++// ── token_snapshot ──────────────────────────────────────────────────────────+describe('token_snapshot tool', () => {+ const MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';++ it('rejects a missing mint', async () => {+ const { toolDefs } = await import('../../api/_mcp/tools/crypto-data.js');+ const tool = toolDefs.find((t) => t.name === 'token_snapshot');+ const result = await tool.handler({ mint: '' }, {}, null);+ expect(result.isError).toBe(true);+ });++ it('merges partial provider availability (one ok, one fails) without throwing', async () => {+ const { ENDPOINT_INDEX } = await import('../../api/v1/_providers.js');+ const hasDexscreener = ENDPOINT_INDEX.has('dexscreener/token');+ const hasJupiter = ENDPOINT_INDEX.has('jupiter/price');+ if (!hasDexscreener && !hasJupiter) return; // neither provider registered on this run — nothing to fan out to++ executeUpstreamMock.mockImplementation(async ({ provider }) => {+ if (provider.id === 'dexscreener') return { pairs: [{ priceUsd: '0.001' }] };+ throw Object.assign(new Error('jupiter down'), { status: 502 });+ });++ const { toolDefs } = await import('../../api/_mcp/tools/crypto-data.js');+ const tool = toolDefs.find((t) => t.name === 'token_snapshot');+ const result = await tool.handler({ mint: MINT }, {}, null);++ expect(result.isError).toBeFalsy();+ const snap = result.structuredContent;+ expect(snap.mint).toBe(MINT);+ if (hasDexscreener) {+ expect(snap.sources).toContain('dexscreener');+ expect(snap.dexscreener).toEqual({ pairs: [{ priceUsd: '0.001' }] });+ }+ if (hasJupiter) {+ expect(snap.failed.some((f) => f.provider === 'jupiter')).toBe(true);+ }+ });++ it('degrades to skipped (not an error) when a candidate provider is not registered on this deployment', async () => {+ vi.doMock('../../api/v1/_providers.js', async (importOriginal) => {+ const actual = await importOriginal();+ const index = new Map(actual.ENDPOINT_INDEX);+ index.delete('jupiter/price'); // simulate jupiter/price not yet registered+ return { ...actual, ENDPOINT_INDEX: index };+ });+ vi.resetModules();+ executeUpstreamMock.mockResolvedValue({ ok: true });++ const { toolDefs } = await import('../../api/_mcp/tools/crypto-data.js');+ const tool = toolDefs.find((t) => t.name === 'token_snapshot');+ const result = await tool.handler({ mint: MINT }, {}, null);++ expect(result.isError).toBeFalsy();+ expect(result.structuredContent.skipped.some((s) => s.provider === 'jupiter')).toBe(true);++ vi.doUnmock('../../api/v1/_providers.js');+ vi.resetModules();+ });+});diff --git a/tests/fixtures/mcp-golden-tools.json b/tests/fixtures/mcp-golden-tools.jsonindex ed3a314ac..1369fa8af 100644--- a/tests/fixtures/mcp-golden-tools.json+++ b/tests/fixtures/mcp-golden-tools.json@@ -191,7 +191,38 @@"schemaHash": "5d9b231c5a24"}],+ "api/_mcp/tools/crypto-data.js": [+ {+ "name": "crypto_data",+ "title": "Crypto Data API",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": "ref:READ_ONLY_LIVE_FEED",+ "schemaHash": "87529a9dd287"+ },+ {+ "name": "token_snapshot",+ "title": "Crypto token snapshot",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": "ref:READ_ONLY_LIVE_FEED",+ "schemaHash": "1ba25dd7ff2b"+ }+ ],"api/_mcp/tools/embed.js": [+ {+ "name": "create_gated_embed",+ "title": "Create a token-gated embed",+ "descHead": "Turn an avatar or on-chain agent you own into a holder-only interactive ",+ "descHash": "c75c31fa64bd",+ "annotations": {+ "readOnlyHint": false,+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true+ },+ "schemaHash": "a8039900c799"+ },{"name": "get_embed_code","title": "Get embed code",@@ -444,6 +475,90 @@"schemaHash": "4dc84b2cce04"}],+ "api/_mcp3d/tools/ar.js": [+ {+ "name": "export_ar",+ "title": "Export a model for AR (\"View in your space\")",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": {+ "readOnlyHint": true,+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": false+ },+ "schemaHash": "e5d96ef9555d"+ }+ ],+ "api/_mcp3d/tools/persona-identity.js": [+ {+ "name": "persona_identity",+ "title": "Read a persona's on-chain identity — wallet, reputation, holdings",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": "ref:READ_ANNOTATIONS",+ "schemaHash": "a9b240149140"+ },+ {+ "name": "persona_send",+ "title": "Send USDC from a persona's own wallet",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": "ref:VALUE_ANNOTATIONS",+ "schemaHash": "f4e3dc8d161c"+ },+ {+ "name": "persona_tip",+ "title": "Tip USDC from a persona's own wallet",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": "ref:VALUE_ANNOTATIONS",+ "schemaHash": "f4e3dc8d161c"+ }+ ],+ "api/_mcp3d/tools/provenance.js": [+ {+ "name": "anchor_provenance",+ "title": "Anchor a signed content credential for a 3D model",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": {+ "readOnlyHint": false,+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true+ },+ "schemaHash": "ab4040f2db3a"+ },+ {+ "name": "verify_provenance",+ "title": "Verify a 3D model authenticity (content credential)",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": {+ "readOnlyHint": true,+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true+ },+ "schemaHash": "892619deae7b"+ }+ ],+ "api/_mcp3d/tools/spatial.js": [+ {+ "name": "validate_spatial_response",+ "title": "Validate a Spatial MCP 3D artifact",+ "descHead": "dynamic",+ "descHash": "dynamic",+ "annotations": {+ "readOnlyHint": true,+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": false+ },+ "schemaHash": "ea35f61d6c1f"+ }+ ],"api/_mcp3d/tools/studio.js": [{"name": "auto_rig_model",@@ -2193,8 +2308,7 @@"readOnlyHint": true,"idempotentHint": false,"openWorldHint": true- },- "schemaHash": "665d28ca0f6a"+ }}],"packages/naming-mcp/src/tools/sns-reverse.js": [