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.

chore: MCP server publish tooling, tool annotation tests, SDK READMEs + changelog

nirholas0360095f8bf7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a994578b6..36ed04456 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Every “what now?” button now takes your new model with you** — Finishing a model in Forge, Parts Studio, or Scan pops a card of next steps — and now every one of those buttons carries your work over instead of dropping you on an empty page. Embed editor opens with your fresh GLB previewed and the copy-paste snippet already pointing at it, Deploy onchain pre-loads it as the launchpad avatar, Drop it in a world spawns you wearing it, and a finished Scan deep-links your rigged avatar into Studio, Walk, and the embed editor. The embed editor and embeds also accept a direct GLB link now, not just saved avatar ids. (`/forge`) `[improvement]`
- **Forge a 3D model right on the homepage** — The homepage now has a live slice of Forge. Type a description of an object — or tap an example — and the real text-to-3D pipeline reconstructs a textured mesh and drops an interactive 3D model into the page, usually in seconds, that you can orbit and download as GLB. Anything you forge there also shows up in the full Forge gallery on the same device. (`/forge`) `[feature]`
- **Forge engine picker now shows live engine health** — The engine buttons on Forge now reflect what's actually running, probed live against each provider — not just whether it's set up. An engine whose upstream is down or unreachable is disabled with the reason in its tooltip, a throttled one shows an amber busy dot, and bring-your-own-key engines (Meshy, Tripo) say so before you pick them. Behind it is a new public health check at /api/forge?health, and the self-hosted Hunyuan3D lane was rewired to its own worker so it no longer fails every prompt by routing to the avatar pipeline. (`/forge`) `[improvement, fix]`
+- **Forge gets a community showcase — and takes photos from anywhere** — The /forge page now ends with “Fresh from the Forge”: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you. (`/forge`) `[feature]`
- **Forge helps you write a better prompt before you spend a generation** — The Forge (/forge) text box now coaches you in real time: it flags when a prompt asks for a whole scene (which reconstructs poorly) and nudges you to name a material or finish for a sharper mesh, with a live character counter. A new "Surprise me" button drops in a vivid, ready-to-forge prompt, and "More ideas" reshuffles the example chips — so you always have a strong starting point. The keyboard shortcut to generate (⌘/Ctrl + Enter) is now shown right on the button. (`/forge`) `[feature, improvement]`
- **Forge is now one click away from every feed** — Text-to-3D was easy to miss unless you knew where to look. Now every browsing surface points you at it: the avatar gallery leads with “Create from a prompt”, the marketplace's featured carousel has a “Forge your own from text” link, the agent directory and launches feed both carry Forge shortcuts, and empty feeds suggest forging your first model instead of showing a dead end. The project README also gained a full Forge chapter — REST, MCP, and pay-per-call examples included. (`/forge`) `[improvement]`
- **Forge models now carry straight into Scene Studio** — The "what's next" card after a Forge or Parts Studio result used to send you to the studio empty-handed — the model stayed behind. The primary action is now "Open in Scene Studio" and it brings the exact model you just made with it: Scene Studio opens with the GLB already imported, named after your prompt, ready to compose, edit, and export. Your work carries over instead of starting from a blank scene. (`/forge`) `[improvement, fix]`
diff --git a/agent-payments-sdk/README.md b/agent-payments-sdk/README.md
index e1f2e30d5..9280a4b0e 100644
--- a/agent-payments-sdk/README.md
+++ b/agent-payments-sdk/README.md
@@ -1,171 +1,212 @@
-# @pump-fun/agent-payments-sdk
-
-TypeScript SDK for the **Pump Agent Payments** Solana program (`AgenTMiC2hvxGebTsgmsD4HHBa8WEcqGFf87iwRRxLo7`).
-
-Reverse-engineered from the published npm package. Original by [@pump-fun](https://github.com/pump-fun).
-
-## Architecture
-
-```
-src/
-├── idl/
-│ ├── pump_agent_payments.json # Anchor IDL (snake_case, runtime)
-│ └── pump_agent_payments.ts # Anchor IDL type (camelCase, compile-time)
-├── pdas.ts # PDA derivation helpers (seeds + constants)
-├── program.ts # Anchor Program creation / offline instance
-├── types.ts # All parameter interfaces & decoded account types
-├── PumpAgentOffline.ts # Instruction builder — no RPC required
-├── PumpAgent.ts # Online agent — extends Offline with RPC calls
-├── decoders.ts # Account data decoders (GlobalConfig, etc.)
-├── events.ts # Event parsing, types & WebSocket subscriptions
-├── x402/ # x402 HTTP 402 Payment Required protocol
-│ ├── types.ts # Protocol constants & type definitions
-│ ├── headers.ts # Header encoding/decoding helpers
-│ ├── facilitator.ts # Server-side verify & settle + resource server
-│ └── client.ts # Client-side fetch wrapper (auto 402 handling)
-└── index.ts # Barrel export
-```
+<h1 align="center">@three-ws/agent-payments</h1>
+
+<p align="center"><strong>Agent payments across Solana and EVM — agent-token invoices, USDC/token-2022 settlement, bonding-curve trades, x402 and a2a.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/agent-payments"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/agent-payments?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/agent-payments"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/agent-payments?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/agent-payments?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/agent-payments?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#entry-points">Entry points</a> ·
+ <a href="#solana-api">Solana</a> ·
+ <a href="#evm-api">EVM</a> ·
+ <a href="#x402--a2a">x402 / a2a</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> The on-chain payments engine behind three.ws **agent tokens**: a user launches a
+> token for their agent and then charges the people who pay that agent in its
+> token, with buyback and shareholder distribution. This package binds the
+> Solana agent-payments program (`AgenTMiC2hvxGebTsgmsD4HHBa8WEcqGFf87iwRRxLo7`),
+> adds EVM agent payments, bonding-curve trading, and the x402 / a2a settlement
+> layers — all fully typed, dual ESM/CJS.
+
+### A value-added fork
+
+This is a deliberate, value-added three.ws fork of **`@pump-fun/[email protected]`**
+(the upstream Solana agent-payments program bindings). It keeps the core
+binary-compatible with the deployed program — the same program ids and the same
+`PumpAgent(mint, environment?, connection?)` constructor — and extends it with:
+
+- **USDC + token-2022 quote assets** (upstream is SOL-only): `USDC_MINT`,
+ `decodeBondingCurveQuoteMint`, `resolveTokenProgramForMint`.
+- **A v2 bonding-curve trade client** — `PumpTradeClient` (`buy_v2`/`sell_v2`,
+ exact-quote-in buys).
+- **EVM agent payments** (`./evm`), **x402 on EVM** (`./x402`), **a2a payment
+ helpers** (`./a2a`), the **legacy program** bindings, and a `solana-agent-kit`
+ plugin.
+
+When pump.fun ships program changes we port them *into* this fork rather than
+replacing it. See [FORK_NOTES.md](./FORK_NOTES.md) for the full upstream
+comparison and sync procedure.
## Install
```bash
-npm install @pump-fun/agent-payments-sdk
-```
-
-## Build
-
-```bash
-npm install
-npm run build
+npm install @three-ws/agent-payments
```
-## Development
-
-```bash
-npm run dev # watch mode
-npm run typecheck # tsc --noEmit
-npm run lint # eslint
-npm run lint:fix # eslint --fix
-```
+Solana (`@solana/web3.js`, `@solana/spl-token`, `@coral-xyz/anchor`), EVM
+(`ethers`, `viem`), and the pump SDKs ship as direct dependencies. `zod` is an
+optional peer dependency.
-## Usage
+## Quick start
-```typescript
-import { PumpAgent, PumpAgentOffline, PROGRAM_ID } from "@pump-fun/agent-payments-sdk";
-import { Connection, PublicKey } from "@solana/web3.js";
+```ts
+import { PumpAgent, PumpAgentOffline, USDC_MINT } from '@three-ws/agent-payments';
+import { Connection, PublicKey } from '@solana/web3.js';
-// Offline — build instructions without an RPC connection
-const offline = new PumpAgentOffline(mintPubkey);
-const createIx = await offline.create({
- authority: walletPubkey,
- mint: mintPubkey,
- agentAuthority: agentPubkey,
- buybackBps: 500, // 5%
-});
+const mint = new PublicKey('<your agent token mint>');
-// Online — with RPC for balance queries and invoice validation
-const connection = new Connection("https://api.mainnet-beta.solana.com");
-const agent = new PumpAgent(mintPubkey, "mainnet", connection);
-const balances = await agent.getBalances(currencyMint);
-```
+// Offline — build instructions without an RPC connection.
+const offline = new PumpAgentOffline(mint);
-### Invoice Validation
+// Online — RPC-backed balance queries and invoice validation.
+const connection = new Connection('https://api.mainnet-beta.solana.com');
+const agent = new PumpAgent(mint, 'mainnet', connection);
-```typescript
+// Did this user pay the invoice (e.g. 1 USDC) within the window?
const paid = await agent.validateInvoicePayment({
- user: payerPubkey,
- currencyMint: usdcMint,
- amount: 1_000_000, // 1 USDC (6 decimals)
+ user: new PublicKey('<payer>'),
+ currencyMint: USDC_MINT,
+ amount: 1_000_000, // 1 USDC, 6 decimals
memo: 12345,
startTime: Math.floor(Date.now() / 1000),
endTime: Math.floor(Date.now() / 1000) + 300,
});
```
-### Event Parsing
-
-```typescript
-import { parseAgentEvents, subscribeToAgentEvents } from "@pump-fun/agent-payments-sdk";
+## Entry points
+
+Each subpath is dual ESM/CJS with type declarations. The root `.` re-exports the
+full Solana and EVM surfaces, plus namespaced `solana`, `evm`, `x402Evm`, and
+`a2a` objects.
+
+| Import | What it provides |
+| --- | --- |
+| `@three-ws/agent-payments` | everything below, flat + namespaced (`solana`, `evm`, `x402Evm`, `a2a`) |
+| `@three-ws/agent-payments/solana` | `PumpAgent`, `PumpAgentOffline`, `PumpTradeClient`, PDAs, decoders, events |
+| `@three-ws/agent-payments/evm` | `EvmAgent`, `EvmAgentOffline`, ABIs, chain registry, invoice utils |
+| `@three-ws/agent-payments/x402` | EVM x402 client + facilitator helpers |
+| `@three-ws/agent-payments/a2a` | a2a payment helpers (`payA2A`, signers, EVM exact payloads) |
+| `@three-ws/agent-payments/solana/legacy-agent-payments` | bindings for the legacy 1.0.7 program |
+| `@three-ws/agent-payments/solana/solana-agent-kit` | `PumpAgentPaymentsPlugin` for solana-agent-kit |
+
+## Solana API
+
+### Classes
+
+- **`PumpAgent(mint, environment?, connection?)`** — RPC-backed agent. Methods
+ include `getBalances`, `getAllCurrencyBalances`, `getCoinQuoteMint`,
+ `getCoinPaymentSummary`, `updateBuybackBps`, `getAgentConfig`, `getGlobalConfig`,
+ `getPaymentStats`, `getSupportedCurrencies`, `isInitialized`,
+ `getPaymentHistory`, `getEventHistory`, `validateInvoicePayment`.
+- **`PumpAgentOffline(mint)`** — pure instruction builder, no RPC required.
+- **`PumpTradeClient(connection)`** — v2 bonding-curve trades:
+ `resolveQuoteMint`, `quoteForBuy`, `quoteForSell`, `buildBuyInstructions`,
+ `buildSellInstructions`. Throws `CoinGraduatedError`, `CoinNotFoundError`,
+ `InsufficientLiquidityError`, `UnsupportedQuoteMintError`.
+
+### Constants & helpers
+
+- **Program ids:** `PROGRAM_ID`, `PUMP_PROGRAM_ID`, `PUMP_AGENT_PAYMENTS_PROGRAM_ID`,
+ `PUMP_FEES_PROGRAM_ID`. **`USDC_MINT`** for USDC-quoted payments.
+- **PDAs:** `getGlobalConfigPDA`, `getTokenAgentPaymentsPDA`,
+ `getPaymentInCurrencyPDA`, `getInvoiceIdPDA`, `getBuybackAuthorityPDA`,
+ `getWithdrawAuthorityPDA`, `getBondingCurvePDA`, `getSharingConfigPDA`.
+- **Decoders:** `decodeGlobalConfig`, `decodeTokenAgentPayments`,
+ `decodeTokenAgentPaymentInCurrency`, `decodeBondingCurveQuoteMint`,
+ `resolveTokenProgramForMint`.
+- **Program:** `getProgram`, `getPumpProgram`, `getPumpProgramWithFallback`,
+ `getOfflineProgram`, `OFFLINE_PUMP_PROGRAM`.
+- **Errors:** `CurrencyNotSupportedError`, `JupiterUnavailableError`.
+
+### Events
+
+```ts
+import { parseAgentEvents, subscribeToAgentEvents } from '@three-ws/agent-payments';
-// Parse events from transaction logs
const events = parseAgentEvents(tx.meta.logMessages);
-for (const event of events) {
- if (event.name === "agentAcceptPaymentEvent") {
- console.log("Payment amount:", event.data.amount.toString());
- }
+for (const e of events) {
+ if (e.name === 'agentAcceptPaymentEvent') console.log('paid:', e.data.amount.toString());
}
-// Subscribe to real-time events via WebSocket
const sub = subscribeToAgentEvents(connection, (event, slot) => {
console.log(`[slot ${slot}] ${event.name}`, event.data);
-}, { eventNames: ["agentAcceptPaymentEvent"] });
+}, { eventNames: ['agentAcceptPaymentEvent'] });
+// sub.unsubscribe();
+```
+
+`createEventParser` and all event type interfaces are exported too. The pump
+bonding-curve program (`6EF8rrec...`) has its own parser under the namespaced
+`pumpEvents` export.
+
+## EVM API
+
+```ts
+import { EvmAgent, EVM_CHAINS, getInvoiceId } from '@three-ws/agent-payments/evm';
-// Later: stop listening
-sub.unsubscribe();
+const agent = new EvmAgent(/* config */);
+const config = await agent.getAgentConfig();
+const balances = await agent.getBalances(currencyToken);
+const paid = await agent.isInvoicePaid(invoiceId);
```
-### x402 (HTTP 402 Payment Required)
+- **`EvmAgent`** — read agent config, balances, payment stats/history, and verify
+ invoices (`getAgentConfig`, `getBalances`, `getPaymentStats`, `isInvoicePaid`,
+ `validateInvoicePayment`, `getPaymentHistory`).
+- **`EvmAgentOffline`** — instruction/calldata builder without a provider.
+- **Chains:** `EVM_CHAINS`, `SUPPORTED_CHAIN_IDS`, `getEvmChain`,
+ `isEvmChainSupported` (Ethereum, Base, Arbitrum, Polygon, BNB, Avalanche, …),
+ plus `NATIVE_TOKEN_ADDRESS`.
+- **ABIs & invoices:** `AGENT_PAYMENTS_ABI`, `ERC20_ABI`, `getInvoiceId`,
+ `buildInvoiceWindow`, `generateMemo`, `parseEvmAgentEvents`.
-The SDK includes an x402 sub-package for pay-gating HTTP endpoints:
+## x402 / a2a
-```typescript
-import { x402 } from "@pump-fun/agent-payments-sdk";
+EVM x402 pay-gating:
-// Server: build payment requirements for a 402 response
-const requirements = x402.buildPumpAgentRequirements({
- agentMint: "YourAgentMintAddress...",
- payTo: "PaymentVaultAddress...",
- amount: "1000000", // 1 USDC in minor units
-});
+```ts
+import { createEvmX402Fetch } from '@three-ws/agent-payments/x402';
-// Client: auto-pay 402 responses
-const x402fetch = x402.createX402Fetch({
- payer: wallet.publicKey.toBase58(),
- connection,
- signTransaction: async (tx) => { /* sign */ },
- sendTransaction: async (tx) => { /* send */ },
-});
-const res = await x402fetch("https://api.agent.example/inference");
+const x402fetch = createEvmX402Fetch({ /* wallet client + options */ });
+const res = await x402fetch('https://api.agent.example/inference');
```
-## Program Instructions
-
-| Instruction | Description |
-|---|---|
-| `agentInitialize` | Register a new agent for a token mint |
-| `agentAcceptPayment` | Accept a payment in a supported currency |
-| `agentDistributePayments` | Split vault funds between buyback and withdraw |
-| `agentBuybackTrigger` | Execute buyback via CPI swap + burn |
-| `agentWithdraw` | Withdraw funds from the withdraw vault |
-| `agentUpdateBuybackBps` | Update the buyback basis points |
-| `agentUpdateAuthority` | Transfer agent authority |
-| `agentTransferExtraLamports` | Transfer excess lamports (native SOL) |
-| `extendAccount` | Extend account size |
-| `closeAccount` | Close an account |
-| `globalConfigInitialize` | Initialize the global config |
-| `globalAddNewCurrency` | Add a supported currency |
-| `globalRemoveCurrency` | Remove a supported currency |
-| `globalUpdateAuthorities` | Update protocol / buyback authorities |
-
-## On-Chain Accounts
-
-| Account | Description |
-|---|---|
-| `GlobalConfig` | Protocol-wide config: authorities, supported currencies |
-| `TokenAgentPayments` | Per-mint agent config: authority, buyback bps |
-| `TokenAgentPaymentInCurrency` | Per-mint per-currency accounting |
-| `BondingCurve` | Pump bonding curve state (read-only) |
-
-## Key Exports
-
-- **Classes**: `PumpAgent`, `PumpAgentOffline`
-- **Constants**: `PROGRAM_ID`, `PUMP_PROGRAM_ID`, `PUMP_AGENT_PAYMENTS_PROGRAM_ID`
-- **PDAs**: `getGlobalConfigPDA`, `getTokenAgentPaymentsPDA`, `getPaymentInCurrencyPDA`, `getInvoiceIdPDA`, `getBuybackAuthorityPDA`, `getWithdrawAuthorityPDA`, `getBondingCurvePDA`
-- **Decoders**: `decodeGlobalConfig`, `decodeTokenAgentPaymentInCurrency`, `decodeTokenAgentPayments`
-- **Events**: `createEventParser`, `parseAgentEvents`, `subscribeToAgentEvents` + all event type interfaces
-- **Program**: `getPumpProgram`, `getPumpProgramWithFallback`, `getOfflineProgram`, `getProgram`
-- **x402**: `x402.createX402Fetch`, `x402.PumpAgentFacilitator`, `x402.createResourceServer`, `x402.buildPumpAgentRequirements`, header helpers
-
-## License
-
-ISC
+Also exported from `./x402`: `decodePaymentHeader`, `buildPaymentRequiredHeader`,
+and the `EvmReplayStore` / verification types for the facilitator side.
+
+Agent-to-agent payments:
+
+```ts
+import { payA2A, createPrivateKeySigner } from '@three-ws/agent-payments/a2a';
+
+const signer = await createPrivateKeySigner(process.env.A2A_PRIVATE_KEY);
+const result = await payA2A({ /* endpoint, signer, … */ });
+```
+
+`./a2a` also exports `requestA2AQuote`, `submitA2APayment`, `buildEvmExactPayload`,
+the A2A extension URI/header constants, and the A2A request/response types.
+
+## Requirements
+
+- **Node** `>= 18`.
+- **Solana:** `@solana/web3.js@^1.98`, `@solana/spl-token`, `@coral-xyz/anchor` (bundled deps).
+- **EVM:** `ethers@^6`, `viem@^2` (bundled deps).
+- `zod` is an optional peer dependency.
+
+## Links
+
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Sibling SDK: [`@three-ws/solana-agent`](https://www.npmjs.com/package/@three-ws/solana-agent)
+- Issues: https://github.com/nirholas/three.ws/issues
+- Fork notes: [FORK_NOTES.md](./FORK_NOTES.md)
+- License: ISC
diff --git a/agent-payments-sdk/package.json b/agent-payments-sdk/package.json
index 2203c9388..5e6f2c68d 100644
--- a/agent-payments-sdk/package.json
+++ b/agent-payments-sdk/package.json
@@ -53,7 +53,7 @@
],
"scripts": {
"build": "tsup",
- "build:prod": "tsup --minify",
+ "build:prod": "TSUP_SOURCEMAP=false tsup --minify",
"dev": "tsup --watch",
"typecheck": "tsc --noEmit",
"lint": "eslint src/ --cache --quiet",
diff --git a/agent-payments-sdk/tsup.config.ts b/agent-payments-sdk/tsup.config.ts
index c7a2aab7e..8f6a43e27 100644
--- a/agent-payments-sdk/tsup.config.ts
+++ b/agent-payments-sdk/tsup.config.ts
@@ -16,7 +16,9 @@ export default defineConfig({
},
format: ["esm", "cjs"],
dts: true,
- sourcemap: true,
+ // Sourcemaps in dev builds; omitted from the published (prod) bundle to keep
+ // the npm tarball lean — set TSUP_SOURCEMAP=false (see the build:prod script).
+ sourcemap: process.env.TSUP_SOURCEMAP !== "false",
clean: true,
splitting: false,
treeshake: true,
diff --git a/agent-protocol-sdk/README.md b/agent-protocol-sdk/README.md
new file mode 100644
index 000000000..56e40203f
--- /dev/null
+++ b/agent-protocol-sdk/README.md
@@ -0,0 +1,136 @@
+<h1 align="center">@3d-agent/agent-protocol-sdk</h1>
+
+<p align="center"><strong>Record verifiable agent-to-agent skill invocations on Solana, via the <code>agent_invocation</code> Anchor program.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@3d-agent/agent-protocol-sdk"><img alt="npm" src="https://img.shields.io/npm/v/@3d-agent/agent-protocol-sdk?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@3d-agent/agent-protocol-sdk"><img alt="downloads" src="https://img.shields.io/npm/dm/@3d-agent/agent-protocol-sdk?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@3d-agent/agent-protocol-sdk?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@3d-agent/agent-protocol-sdk?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#api">API</a> ·
+ <a href="#requirements">Requirements</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> Thin, typed client for the `agent_invocation` Solana program. One agent calls a
+> skill on another agent; the call is validated client-side, built as an Anchor
+> instruction, and submitted on-chain, where it emits a `SkillInvoked` event that
+> anyone can verify. Built for three.ws agent-to-agent (A2A) coordination.
+
+> **Pending deployment.** The `agent_invocation` program is **not yet deployed to
+> mainnet**. The program id exported as `AGENT_INVOCATION_PROGRAM_ID`
+> (`Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS`) is the Anchor placeholder id,
+> not a live deployment. To use this SDK against a real cluster you **must deploy
+> the program yourself and pass your own `programId`** to `invokeSkill()` /
+> `deriveAgentPda()`. Until then, treat the defaults as devnet/local scaffolding.
+
+## Install
+
+```bash
+npm install @3d-agent/agent-protocol-sdk @solana/web3.js @coral-xyz/anchor
+```
+
+`@solana/web3.js` (`^1.98`) and `@coral-xyz/anchor` (`^0.32`) are direct
+dependencies and are installed alongside the package.
+
+## Quick start
+
+```ts
+import { Connection, Keypair, PublicKey } from '@solana/web3.js';
+import { invokeSkill } from '@3d-agent/agent-protocol-sdk';
+
+const connection = new Connection('https://api.devnet.solana.com', 'confirmed');
+const invokerAuthority = Keypair.fromSecretKey(/* your secret key bytes */);
+const targetAuthority = new PublicKey('<authority that owns the target agent>');
+
+const signature = await invokeSkill({
+ connection,
+ invokerAuthority, // signs + pays
+ targetAuthority, // target agent PDA is derived from this
+ skillName: 'summarize', // 1–64 bytes
+ parameters: JSON.stringify({ url: 'https://example.com' }), // ≤512 bytes
+ programId: new PublicKey('<your deployed program id>'), // required on a live cluster
+});
+
+console.log('invocation tx:', signature);
+```
+
+`invokeSkill` validates the inputs, derives both the invoker and target agent
+PDAs, builds the `invoke_skill` instruction, submits it, and returns the
+confirmed transaction signature.
+
+## API
+
+### `invokeSkill(params): Promise<string>`
+
+Records a skill invocation from one agent to another and returns the confirmed
+transaction signature.
+
+| Param | Type | Description |
+| --- | --- | --- |
+| `connection` | `Connection` | Live Solana connection used to build and send the tx. |
+| `invokerAuthority` | `Keypair` | Owns the invoking agent. Signs and pays. |
+| `targetAuthority` | `PublicKey` | Owns the target agent; its PDA is re-derived from this. |
+| `skillName` | `string` | Skill identifier, 1–64 bytes (UTF-8). |
+| `parameters` | `string` | Opaque parameter blob, ≤512 bytes (typically JSON). |
+| `programId` | `PublicKey` *(optional)* | Override the program id. Required on any live cluster. |
+
+Throws if `skillName` is empty, `skillName` exceeds `MAX_SKILL_NAME_LEN` bytes,
+or `parameters` exceeds `MAX_PARAMETERS_LEN` bytes — so you get a clear local
+error instead of a failed on-chain simulation.
+
+### `deriveAgentPda(authority, programId?): [PublicKey, number]`
+
+Derives an agent's program-derived address from the authority that owns it.
+Matches the program's `seeds = [b"agent", authority]`. Pass your deployed
+`programId` to derive against a live cluster; otherwise it uses
+`AGENT_INVOCATION_PROGRAM_ID`.
+
+```ts
+import { deriveAgentPda } from '@3d-agent/agent-protocol-sdk';
+
+const [agentPda, bump] = deriveAgentPda(authority, programId);
+```
+
+### Constants & types
+
+| Export | Type | Value / meaning |
+| --- | --- | --- |
+| `MAX_SKILL_NAME_LEN` | `number` | `64` — max `skillName` length in bytes. |
+| `MAX_PARAMETERS_LEN` | `number` | `512` — max `parameters` length in bytes. |
+| `AGENT_INVOCATION_PROGRAM_ID` | `string` | Declared program id (placeholder until deployed). |
+| `IDL` | Anchor `Idl` | The `agent_invocation` IDL (Anchor 0.30+ format). |
+| `AgentInvocation` | `type` | TypeScript type of `IDL` for `new Program<AgentInvocation>(...)`. |
+| `InvokeSkillParams` | `interface` | Parameter shape for `invokeSkill`. |
+
+### On-chain shape
+
+The program exposes one instruction, `invoke_skill(skill_name, parameters)`, over
+four accounts (`invoker_agent` PDA, `invoker_authority` signer, `target_authority`,
+`target_agent` PDA) plus the system program. A successful call emits a
+`SkillInvoked` event with `invoker_agent`, `target_agent`, `invoker_authority`,
+`skill_name`, `parameters`, and a `timestamp`. The program's error codes
+(`EmptySkillName`, `SkillNameTooLong`, `ParametersTooLong`) mirror the client-side
+validation above.
+
+## Requirements
+
+- **Node** `>= 18`.
+- **Peers / deps:** `@solana/web3.js@^1.98`, `@coral-xyz/anchor@^0.32`.
+- **A deployed program.** On any live cluster you must deploy `agent_invocation`
+ and pass its id as `programId`. The default `AGENT_INVOCATION_PROGRAM_ID` is a
+ placeholder.
+
+## Links
+
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: MIT — see [LICENSE](./LICENSE)
diff --git a/agent-ui-sdk/README.md b/agent-ui-sdk/README.md
index 4ae9877fe..42a9f042f 100644
--- a/agent-ui-sdk/README.md
+++ b/agent-ui-sdk/README.md
@@ -1,18 +1,48 @@
-# @three-ws/agent-ui
-
-Drop a 3D avatar into your UI and let it react to buttons, inputs, and navigation.
-
-A small Three.js overlay SDK that takes the avatar-stage runtime used by the [three.ws](https://three.ws) demos (`404`, `login`, `3d-home`) and packages it as a drop-in API. The avatar lives on a transparent fullscreen canvas above your DOM, anchored to real elements — it can stand on a card, fall onto a heading, walk over to focus an input, cover its eyes when you type a password, or run off-screen before navigating away.
+<h1 align="center">@three-ws/agent-ui</h1>
+
+<p align="center"><strong>Drop a 3D avatar onto a transparent overlay and let it react to your DOM — clicks, inputs, and navigation.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/agent-ui"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/agent-ui?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/agent-ui"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/agent-ui?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/agent-ui?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/agent-ui?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#imperative-api">Imperative API</a> ·
+ <a href="#declarative-attributes">Declarative</a> ·
+ <a href="#options">Options</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> `@three-ws/agent-ui` packages the avatar-overlay runtime from the [three.ws](https://three.ws)
+> demos into a small Three.js SDK. The avatar lives on a transparent, fullscreen
+> canvas above your DOM and is anchored to real elements: it can stand on a card,
+> fall onto a heading, walk over to focus an input, cover its eyes when you type a
+> password, or run off-screen before a navigation. One `createAgentUI()` call gets
+> you a handle with imperative methods; one `agent.scan()` call wires up declarative
+> `data-agent-*` attributes with no per-element JS.
+
+## Install
```bash
npm install @three-ws/agent-ui three
```
+`three` (`>=0.150.0`) is a peer dependency so your bundler de-dupes it. The package
+ships source ESM (`@three-ws/agent-ui`) plus a prebuilt bundle subpath
+(`@three-ws/agent-ui/bundle`).
+
## Quick start
```html
<canvas></canvas>
-<button id="go" data-agent-action="navigate-on-click">Take me home</button>
+<div id="hero">three.ws</div>
<script type="module">
import { createAgentUI } from '@three-ws/agent-ui';
@@ -23,10 +53,11 @@ npm install @three-ws/agent-ui three
clips: ['idle', 'walk', 'falling'],
});
- agent.fallOnto(document.getElementById('hero'), {
+ const hero = document.getElementById('hero');
+ agent.fallOnto(hero, {
onLand: () => {
- agent.fx.dust(document.getElementById('hero'));
- agent.fx.impactPulse(document.getElementById('hero'));
+ agent.fx.dust(hero);
+ agent.fx.impactPulse(hero);
},
});
@@ -34,59 +65,91 @@ npm install @three-ws/agent-ui three
</script>
```
+`createAgentUI(options)` resolves once the GLB and clip JSONs load and the avatar is
+in scene. The resolved handle exposes the Three.js objects (`renderer`, `scene`,
+`camera`, `canvas`, `avatar`), animation control, movement/posing behaviors, FX
+helpers, and lifecycle (`whenReady`, `destroy`).
+
## Imperative API
```js
+// Animation — clips are loaded from `clipsBase`
agent.play('idle', { loop: true });
-agent.play('covereyes', { loop: false, hold: true, onComplete: () => {} });
-
-agent.standOn(formCard, { anchor: 'top-center' });
-agent.walkTo(emailInput);
-agent.fallOnto(heading, { duration: 1.4 });
-agent.runOff('right');
+agent.play('covereyes', { loop: false, hold: true });
+agent.clip('walk'); // → clip duration in seconds (0 if not loaded)
+agent.currentClip; // → name of the clip currently playing
+
+// Movement & posing
+agent.standOn(formCard, { anchor: 'top-center' }); // park without traversal
+agent.walkTo(emailInput); // walk-cycle over to an element
+agent.fallOnto(heading, { duration: 1.4 }); // drop in from above
+agent.runOff('right'); // walk off-screen
agent.interceptNavigation(homeLink, { direction: 'right', delay: 1100 });
-
-agent.lookAt(450); // screen-X in pixels
+agent.lookAt(450); // turn yaw toward a screen-X (pixels)
agent.faceFront();
-const stopShadow = agent.fx.proximityShadow(heading);
+// FX
+const stopShadow = agent.fx.proximityShadow(heading); // returns a disposer
agent.fx.dust(buttonEl);
agent.fx.impactPulse(buttonEl);
+
+// Utilities
+agent.worldOfElement(el, { anchor: 'center' }); // DOM rect → world-space target
+const pick = agent.pickFrom(['nod', 'shrug', 'wave']); // non-repeating picker
+agent.whenReady((a) => { /* runs now or on ready */ });
+agent.destroy(); // cancels RAF, unlocks root motion, tears down the renderer
```
+Anchors accepted by `standOn` / `walkTo` / `worldOfElement`: `top-left`,
+`top-right`, `top-center` (default), `center`, `bottom-center`, `left-of`,
+`right-of`.
+
+The same behavior functions are exported standalone for advanced compositions:
+`createRenderer`, `loadAvatar`, `createAnimator`, `lockRootMotion`, `worldOfElement`,
+`moveTo`, `lookAtScreenX`, `faceFront`, `walkTo`, `standOn`, `fallOnto`, `runOff`,
+`interceptNavigation`, `createRandomPicker`, `caretScreenX`, `startCaretTracking`,
+`dust`, `impactPulse`, `proximityShadow`, `scan`.
+
## Declarative attributes
-Mark up the page and call `agent.scan()` once — no per-element JS needed.
+Mark up the page, call `agent.scan()` once. It returns a cleanup function that
+removes every listener it added.
```html
+<div class="card" data-agent-action="stand-on"></div>
+
<input data-agent-action="track-typing" />
<input data-agent-action="privacy-mode" type="password" />
<a href="/" data-agent-action="navigate-on-click" data-agent-direction="right">Home</a>
<button data-agent-action="react-on-click" data-agent-clip="celebrate">Subscribe</button>
-
-<div class="card" data-agent-action="stand-on"></div>
```
-| `data-agent-action` | Behavior |
-| -------------------- | ------------------------------------------------------------------------- |
-| `stand-on` | Park the avatar above this element on ready. |
-| `track-typing` | On focus, walk to the input, play `lookdown`, follow the caret with yaw. |
-| `privacy-mode` | On focus, walk to the input, play `covereyes` once and hold. |
-| `navigate-on-click` | Intercept click, run off-screen, then follow `href`. |
-| `react-on-click` | Play `data-agent-clip` once on click. |
+| `data-agent-action` | Behavior |
+|---|---|
+| `stand-on` | Park the avatar above this element on ready. |
+| `track-typing` | On focus, walk to the input, play `lookdown`, then follow the caret with yaw. |
+| `privacy-mode` | On focus, walk to the input, play `covereyes` once and hold; play `idle` on blur. |
+| `navigate-on-click` | Intercept the click, run off-screen, then follow `href`. |
+| `react-on-click` | Play `data-agent-clip` once on click. |
+
+Optional modifiers: `data-agent-direction` (`left`/`right`), `data-agent-clip`,
+`data-agent-anchor`, `data-agent-delay` (ms), `data-agent-loop` (`true`/`false`),
+`data-agent-hold` (`true`/`false`).
## Options
```ts
createAgentUI({
- avatar: '/avatars/cz.glb',
- clipsBase: '/animations/clips/',
+ avatar: '/avatars/cz.glb', // GLB URL (you host it)
+ clipsBase: '/animations/clips/', // base path for clip JSONs
clips: ['idle', 'walk', 'lookdown', 'covereyes', 'falling', 'celebrate'],
subclips: {
// Trim a long Mixamo clip down to just the settle frames
covereyes: { start: 0, end: 48, fps: 30 },
},
+ container: undefined, // defaults to document.body
+ canvas: undefined, // explicit canvas; otherwise one is created
pixelsPerUnit: 120,
zIndex: 999,
parallax: true,
@@ -97,11 +160,25 @@ createAgentUI({
## Notes
-- **Assets are yours.** The SDK does not bundle the avatar GLB or animation JSONs — point it at whatever you host. The three.ws CDN paths used in the demos are the defaults but every URL is configurable.
+- **Assets are yours.** The SDK does not bundle the avatar GLB or animation JSONs — point it at whatever you host. Every URL is configurable; the three.ws CDN paths are only the defaults.
- **Three.js is a peer dep** so your bundler de-dupes it. Works with Three r150+.
-- **No gsap dep.** All tweens use built-in `requestAnimationFrame` easings.
+- **No animation-library dependency.** All tweens use built-in `requestAnimationFrame` easings.
- **Root motion is locked** automatically so walk-cycle hip translation doesn't drift the avatar off-screen.
-## License
+## Requirements
+
+- Node `>=18`.
+- Peer dependency: `three` `>=0.150.0`.
+- A GLB avatar and clip JSONs you host (no bundled assets).
+
+## Related packages
+
+- [`@three-ws/avatar`](https://www.npmjs.com/package/@three-ws/avatar) — the full avatar SDK with `<agent-3d>`, lipsync, and an avatar creator.
+- [`@three-ws/viewer-presets`](https://www.npmjs.com/package/@three-ws/viewer-presets) — tuned light rig, floor reflection, and bloom configs.
+
+## Links
-Apache-2.0 © three.ws
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/api/_lib/forge-store.js b/api/_lib/forge-store.js
index eb437c784..6db03a018 100644
--- a/api/_lib/forge-store.js
+++ b/api/_lib/forge-store.js
@@ -316,13 +316,17 @@ export async function listShowcase({ limit = 12 } = {}) {
if (!forgeStoreEnabled()) return [];
const capped = Math.min(Math.max(Number(limit) || 12, 1), 24);
try {
+ // Visual-first: the showcase is a shop window, so rows that have a
+ // preview image lead; recency breaks ties. Geometry-first lanes paint
+ // no reference image — their cards still work (the GLB is the artifact)
+ // but they shouldn't bury the visual rows.
const rows = await sql`
select id, prompt, glb_url, preview_image_url,
views_used, multiview, backend, tier, path, created_at
from forge_creations
where status = 'done' and glb_url is not null
and (outcome is null or outcome != 'rejected')
- order by created_at desc
+ order by (preview_image_url is not null) desc, created_at desc
limit ${capped}
`;
return rows.map((r) => ({
diff --git a/avatar-sdk/README.md b/avatar-sdk/README.md
index 3cf8c76ae..cbebd9dcb 100644
--- a/avatar-sdk/README.md
+++ b/avatar-sdk/README.md
@@ -1,12 +1,31 @@
-# @three-ws/avatar
-
-3D avatar viewer, creator iframe, and emotion + lipsync runtime — a drop-in replacement for legacy hosted avatar SDKs that are winding down or no longer accepting new accounts.
-
-Includes:
-
-- **`<agent-3d>` web component** — declarative avatar viewer with built-in chat/voice loop, emotion morphs, audio-driven viseme lipsync, AR Quick Look (iOS) and WebXR (Android/Quest).
-- **`AvatarCreator`** — programmatic iframe modal that wraps the [Character Studio](https://studio.three.ws) builder and the [Avaturn](https://avaturn.me) photo-to-avatar pipeline. Resolves with a GLB Blob.
-- **`saveBlob()`** — uploads a freshly-created GLB to the hosted three.ws backend (R2 storage, auto-thumbnail, USDZ companion auto-generation).
+<h1 align="center">@three-ws/avatar</h1>
+
+<p align="center"><strong>3D avatar viewer, creator iframe, and emotion + lipsync runtime — a drop-in replacement for hosted avatar SDKs.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/avatar"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/avatar?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/avatar"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/avatar?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/avatar?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/avatar?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#entry-points">Entry points</a> ·
+ <a href="#react">React</a> ·
+ <a href="#api">API</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> `@three-ws/avatar` is the official three.ws avatar SDK. It ships a self-contained
+> `<agent-3d>` web component with a built-in chat/voice loop, emotion morphs, and
+> audio-driven viseme lipsync; a lightweight `<three-ws-viewer>` element for pure
+> 3D previews; a programmatic `AvatarCreator` iframe modal that resolves to a GLB
+> Blob; and first-class React bindings. It's for anyone replacing a winding-down
+> hosted avatar SDK with self-hostable, web-standard parts.
## Install
@@ -14,60 +33,170 @@ Includes:
npm install @three-ws/avatar three
```
-`three` is a peer dependency.
+`three` (`>=0.150.0`) is a required peer dependency. `react` (`>=18`) is an optional
+peer dependency, needed only for the [`./react`](#react) entry point.
-## Use the web component
+## Quick start
+
+Importing the package registers the `<agent-3d>` custom element as a side effect.
```html
<script type="module">
import '@three-ws/avatar';
</script>
-<agent-3d avatar-id="00000000-1111-2222-3333-444444444444"></agent-3d>
+<!-- Resolve a three.ws avatar by id… -->
+<agent-3d avatarid="00000000-1111-2222-3333-444444444444"></agent-3d>
+
+<!-- …or point at a GLB directly -->
+<agent-3d src="https://example.com/my-avatar.glb"></agent-3d>
```
-Or with a direct GLB URL:
+Need only a 3D preview — no chat, no voice, no 3 MB runtime? Use the light viewer:
```html
-<agent-3d src="https://example.com/my-avatar.glb"></agent-3d>
+<script type="module">
+ import '@three-ws/avatar/viewer';
+</script>
+
+<three-ws-viewer
+ src="https://example.com/my-avatar.glb"
+ alt="My avatar"
+ background="transparent"
+></three-ws-viewer>
```
+## Entry points
+
+The package exposes focused subpath exports so you only ship what you use.
+
+| Import | Provides |
+|---|---|
+| `@three-ws/avatar` | Registers `<agent-3d>` (the full runtime). |
+| `@three-ws/avatar/agent` | `ensureAgent3D()` — lazy-load + register `<agent-3d>` on demand. |
+| `@three-ws/avatar/viewer` | Registers `<three-ws-viewer>` (lightweight GLB preview element). |
+| `@three-ws/avatar/creator` | `AvatarCreator` class + `saveBlob()` upload helper. |
+| `@three-ws/avatar/react` | `<Avatar>`, `<AgentAvatar>`, `<AvatarCreator>`, `useAvatar()`. |
+| `@three-ws/avatar/style.css` | No-op stylesheet stub (the element injects its own styles). |
+
+### `<three-ws-viewer>`
+
+A minimal viewer element: loads a GLB at `src`, frames it, and renders with
+`OrbitControls` and a `RoomEnvironment` image-based light.
+
+| Attribute | Description |
+|---|---|
+| `src` | GLB URL to load. |
+| `alt` | Accessibility label; also rendered as an on-canvas caption. |
+| `background` | CSS color, or `transparent` (default) for an alpha canvas. |
+
+It dispatches a `load` event (`detail: { url }`) on success and an `error` event
+(`detail: { url, error }`) on failure.
+
+### `<agent-3d>`
+
+The full runtime element. Set `avatarid` to resolve a server-hosted avatar, or
+`src` for a direct GLB. Other attributes: `ios-src` (USDZ for iOS AR Quick Look)
+and `kiosk` (hide the debug GUI). Instance methods include `playGesture(name, opts?)`
+and `setMorph(name, weight)`.
+
## Open the avatar creator
+`AvatarCreator` opens a modal iframe pointing at the three.ws Avatar Studio (or an
+Avaturn edit session), listens for the `export` postMessage from the trusted
+origin, and resolves with a GLB `Blob`. `saveBlob()` then uploads it to a
+three.ws-compatible backend via presigned R2 upload.
+
```js
import { AvatarCreator, saveBlob } from '@three-ws/avatar/creator';
const creator = new AvatarCreator({
onExport: async (glbBlob) => {
const avatar = await saveBlob(glbBlob, {
- bearerToken: 'YOUR_THREE_WS_TOKEN',
+ bearerToken: process.env.THREE_WS_TOKEN, // scope: avatars:write
name: 'My Avatar',
visibility: 'public',
});
- console.log('Saved:', avatar.url);
+ console.log('Saved:', avatar.id, avatar.url, avatar.slug);
},
});
-creator.open();
+await creator.open();
```
-If you have a previously created avatar and want to re-open it for editing, first call your backend's `/api/avatars/:id/session` (which POSTs to Avaturn under the hood) and pass `avaturnSessionUrl` to the constructor.
+Pass `avaturnSessionUrl` to re-open an existing avatar in edit mode. Call
+`creator.close()` / `creator.dispose()` to tear the modal down.
+
+## React
+
+The `./react` entry is a client-only module (`'use client'`).
+
+```jsx
+import { Avatar, AgentAvatar, AvatarCreator, useAvatar } from '@three-ws/avatar/react';
+
+function Profile({ id }) {
+ const { avatar, loading, error } = useAvatar(id);
-## What this gives you that legacy avatar SDKs did
+ if (loading) return <p>Loading avatar…</p>;
+ if (error) return <p>Could not load avatar.</p>;
-| Legacy SDK feature | `@three-ws/avatar` equivalent |
+ return (
+ <>
+ {/* Pure-visual viewer */}
+ <Avatar src={avatar.model_url} alt={avatar.name} background="transparent" />
+
+ {/* Full runtime (lazy-loads the 3 MB monolith on mount) */}
+ <AgentAvatar avatarId={id} kiosk />
+ </>
+ );
+}
+```
+
+| Export | Signature |
|---|---|
-| Photo → 3D avatar | `AvatarCreator` → Avaturn pipeline |
-| In-browser avatar editor | `AvatarCreator` → [Character Studio](https://studio.three.ws) |
-| Hosted CDN | three.ws R2 + presigned uploads (free public tier) |
-| ARKit `viseme_*` morphs | Loaded automatically into the runtime |
-| Mixamo-compatible humanoid rig | Yes — same skeleton naming conventions |
-| Animation library | 50+ Mixamo clips bundled (idle, wave, nod, dance, …) |
-| iOS Quick Look USDZ | Auto-generated server-side on first upload |
-| Half-body variant | Auto-generated for VR seats |
-| Web component embed | `<agent-3d>` |
-| React component | `<agent-3d>` (works in React 18+ via the JSX intrinsic) |
-
-## License
-
-Apache-2.0. See `LICENSE` in the repo root.
+| `<Avatar>` | `{ src, alt?, background?, style?, className?, onLoad?, onError? }` — wraps `<three-ws-viewer>`. |
+| `<AgentAvatar>` | `{ avatarId?, src?, iosSrc?, kiosk?, style?, className? }` — wraps `<agent-3d>`, lazy-loaded. |
+| `<AvatarCreator>` | `{ open, onExport?, onClose?, studioUrl?, sessionUrl? }` — declarative wrapper around the class. |
+| `useAvatar(id, opts?)` | Returns `{ avatar, loading, error }`; fetches `/api/avatars/:id`, aborts on unmount. `opts.apiOrigin` overrides the host. |
+
+## API
+
+### `ensureAgent3D(): Promise<void>`
+
+From `@three-ws/avatar/agent`. Lazily imports and registers the `<agent-3d>`
+element, resolving once it's ready. Idempotent and cached. Importing the module
+also kicks off the load eagerly in the browser.
+
+### `saveBlob(blob, opts): Promise<{ id, url, slug }>`
+
+From `@three-ws/avatar/creator`. Uploads a GLB `Blob` to a three.ws-compatible
+backend: requests a presigned URL, PUTs the bytes to R2, then creates the avatar
+record. Computes a SHA-256 checksum client-side.
+
+| Option | Type | Notes |
+|---|---|---|
+| `bearerToken` | `string` | **Required.** Token with `avatars:write` scope. |
+| `apiOrigin` | `string` | Defaults to `https://three.ws`. |
+| `name` | `string` | Display name. |
+| `description` | `string` | Optional. |
+| `tags` | `string[]` | Optional. |
+| `visibility` | `'public' \| 'unlisted' \| 'private'` | Defaults to `public`. |
+
+## Requirements
+
+- Node `>=18` (for tooling; the runtime targets modern browsers).
+- Peer dependency: `three` `>=0.150.0` (required), `react` `>=18` (optional, for `./react`).
+- `saveBlob()` needs a bearer token with `avatars:write` scope and a three.ws-compatible API origin.
+
+## Related packages
+
+- [`@three-ws/avatar-schema`](https://www.npmjs.com/package/@three-ws/avatar-schema) — the on-chain manifest format these avatars resolve from.
+- [`@three-ws/viewer-presets`](https://www.npmjs.com/package/@three-ws/viewer-presets) — tuned light rig, floor reflection, and bloom configs for your own viewer.
+- [`@three-ws/avatar-cli`](https://www.npmjs.com/package/@three-ws/avatar-cli) — scaffold, validate, hash, and preview avatar manifests from your shell.
+
+## Links
+
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/data/changelog.json b/data/changelog.json
index cba197d20..1984fa25f 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1239,6 +1239,15 @@
"improvement"
],
"link": "/docs/mcp-3d-studio"
+ },
+ {
+ "date": "2026-06-12",
+ "title": "Forge gets a community showcase — and takes photos from anywhere",
+ "summary": "The /forge page now ends with “Fresh from the Forge”: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/forge"
}
]
}
diff --git a/mcp-bridge/README.md b/mcp-bridge/README.md
index cdd89b876..07c0f6cb8 100644
--- a/mcp-bridge/README.md
+++ b/mcp-bridge/README.md
@@ -7,12 +7,22 @@ The bridge handles 402 → sign → retry transparently using the [@x402](https:
On startup the bridge registers:
-| Tool | What it does |
-| --------------------- | --------------------------------------------------------------------------------------------------------- |
-| `call_paid_endpoint` | Fallback: hit any URL, auto-pay if it returns 402. Returns the resource response + parsed settlement. |
-| `list_bazaar_tools` | Returns the cached list of Bazaar-discovered tools (name, resource, accepted payment terms). |
-| `refresh_bazaar` | Re-queries the x402 Bazaar and re-registers dynamic tools without restarting. |
-| `paid_<derived>` … | One tool per discovered Bazaar resource (up to `MCP_BRIDGE_DISCOVER_LIMIT`), with that endpoint's schema. |
+| Tool | What it does |
+| -------------------- | --------------------------------------------------------------------------------------------------------- |
+| `call_paid_endpoint` | Fallback: hit any URL, auto-pay if it returns 402. Returns the resource response + parsed settlement. |
+| `list_bazaar_tools` | Returns the cached list of Bazaar-discovered tools (name, resource, accepted payment terms). |
+| `refresh_bazaar` | Re-queries the x402 Bazaar and re-registers dynamic tools without restarting. |
+| `paid_<derived>` … | One tool per discovered Bazaar resource (up to `MCP_BRIDGE_DISCOVER_LIMIT`), with that endpoint's schema. |
+
+### Tool annotations
+
+Every tool carries MCP `ToolAnnotations` so hosts can apply the right confirmation policy:
+
+- `call_paid_endpoint` and every dynamic `paid_*` tool: `readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`, `openWorldHint: true`. **These spend real USDC** — each call settles a payment (capped by `MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC`), and retrying is a new charge. They never delete or overwrite caller state, hence not destructive.
+- `list_bazaar_tools`: `readOnlyHint: true`, `idempotentHint: true`, `openWorldHint: false`. Pure in-process cache read; free, no network.
+- `refresh_bazaar`: `readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`, `openWorldHint: true`. Free (no payment), but it mutates the registered tool set from the live Bazaar feed, so repeat calls can differ.
+
+Tool results that are plain objects are returned as both a JSON `text` block (backward compatible) and `structuredContent` for typed clients.
Payment paths registered on the buyer client:
@@ -25,17 +35,17 @@ Claude Desktop restarts do not re-deposit on the next call.
## Environment
-| Variable | Required | Default | Notes |
-| ----------------------------------------- | ----------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
-| `MCP_BRIDGE_EVM_PRIVATE_KEY` | one of EVM/SVM required | — | 0x-prefixed 32-byte hex. Funds USDC payments on Base, Arbitrum, etc. |
-| `MCP_BRIDGE_SVM_PRIVATE_KEY` | one of EVM/SVM required | — | base58 64-byte secret key (Phantom/solana-keygen format) **or** 64-int JSON array. |
-| `MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC` | no | `100000` (= $0.10 USDC at 6 decimals) | Per-call spending cap. Payment aborts above this with a clear reason. |
-| `MCP_BRIDGE_DISCOVER_LIMIT` | no | `20` | Max number of Bazaar tools to register dynamically. Set `0` to disable discovery. |
-| `MCP_BRIDGE_BAZAAR_URL` | no | `https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources` | Override to point at a self-hosted or alternative bazaar. |
-| `MCP_BRIDGE_BATCH_DEPOSIT_MULTIPLIER` | no | `5` | How many request-amounts to deposit at once when opening a batch channel. |
-| `MCP_BRIDGE_MAX_DEPOSIT_ATOMIC` | no | `5000000` (= $5.00 USDC) | Hard cap on the deposit amount per channel open / top-up. |
-| `X402_MCP_BRIDGE_CHANNELS_DIR` | no | `~/.x402-mcp-bridge/channels` | Override the directory used by `FileClientChannelStorage`. |
-| `RPC_URL_<chainId>` | no | viem default public RPC | Per-chain RPC override. Example: `RPC_URL_8453=https://mainnet.base.org`. |
+| Variable | Required | Default | Notes |
+| -------------------------------------- | ----------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
+| `MCP_BRIDGE_EVM_PRIVATE_KEY` | one of EVM/SVM required | — | 0x-prefixed 32-byte hex. Funds USDC payments on Base, Arbitrum, etc. |
+| `MCP_BRIDGE_SVM_PRIVATE_KEY` | one of EVM/SVM required | — | base58 64-byte secret key (Phantom/solana-keygen format) **or** 64-int JSON array. |
+| `MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC` | no | `100000` (= $0.10 USDC at 6 decimals) | Per-call spending cap. Payment aborts above this with a clear reason. |
+| `MCP_BRIDGE_DISCOVER_LIMIT` | no | `20` | Max number of Bazaar tools to register dynamically. Set `0` to disable discovery. |
+| `MCP_BRIDGE_BAZAAR_URL` | no | `https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources` | Override to point at a self-hosted or alternative bazaar. |
+| `MCP_BRIDGE_BATCH_DEPOSIT_MULTIPLIER` | no | `5` | How many request-amounts to deposit at once when opening a batch channel. |
+| `MCP_BRIDGE_MAX_DEPOSIT_ATOMIC` | no | `5000000` (= $5.00 USDC) | Hard cap on the deposit amount per channel open / top-up. |
+| `X402_MCP_BRIDGE_CHANNELS_DIR` | no | `~/.x402-mcp-bridge/channels` | Override the directory used by `FileClientChannelStorage`. |
+| `RPC_URL_<chainId>` | no | viem default public RPC | Per-chain RPC override. Example: `RPC_URL_8453=https://mainnet.base.org`. |
`MCP_BRIDGE_*` env vars also fall back to `EVM_PRIVATE_KEY` / `SVM_PRIVATE_KEY` if you
already have those set for the rest of this repo.
diff --git a/mcp-bridge/src/index.js b/mcp-bridge/src/index.js
index aaf24001f..0f2e109ee 100755
--- a/mcp-bridge/src/index.js
+++ b/mcp-bridge/src/index.js
@@ -32,9 +32,27 @@ const log = (...args) => {
process.stderr.write(`[${BRIDGE_NAME}] ${args.map(String).join(' ')}\n`);
};
+// Annotation profiles (MCP ToolAnnotations). Payment tools spend real funds:
+// not read-only, not idempotent (every call settles a new payment), and
+// open-world (they reach arbitrary external endpoints) — but not destructive
+// (they never delete or overwrite caller state).
+const PAYMENT_TOOL_ANNOTATIONS = {
+ readOnlyHint: false,
+ destructiveHint: false,
+ idempotentHint: false,
+ openWorldHint: true,
+};
+
function asTextContent(value) {
const text = typeof value === 'string' ? value : JSON.stringify(value, null, 2);
- return { content: [{ type: 'text', text }] };
+ const result = { content: [{ type: 'text', text }] };
+ // Plain objects also go out as structuredContent so typed clients can skip
+ // re-parsing the text block (kept for backward compatibility). MCP requires
+ // structuredContent to be an object, so strings/arrays stay text-only.
+ if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
+ result.structuredContent = value;
+ }
+ return result;
}
function asErrorContent(message) {
@@ -85,8 +103,11 @@ function registerCallPaidEndpoint(server, deps) {
title: 'Call any x402-paid endpoint',
description:
'Calls any HTTP URL that returns 402 with x402 payment requirements, automatically signing and paying. ' +
+ 'SPENDS REAL MONEY: each call settles a USDC payment from the bridge wallet (capped by ' +
+ 'MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC), and retrying is a new charge. ' +
'Supports EVM exact, EVM batch-settlement, and Solana exact schemes. ' +
'Returns the resource response plus the parsed settlement receipt.',
+ annotations: PAYMENT_TOOL_ANNOTATIONS,
inputSchema: {
url: z.string().url().describe('Full URL of the x402-paid resource'),
method: z
@@ -124,7 +145,9 @@ function registerListBazaarTools(server, getCached) {
{
title: 'List Bazaar-discovered tools',
description:
- 'Returns the cached list of x402 Bazaar resources registered as MCP tools on this bridge.',
+ 'Returns the cached list of x402 Bazaar resources registered as MCP tools on this bridge. Free: reads the in-process cache only, no network and no payment.',
+ // Pure cache read: no side effects, no external interaction.
+ annotations: { readOnlyHint: true, openWorldHint: false, idempotentHint: true },
inputSchema: {},
},
async () => {
@@ -148,7 +171,15 @@ function registerRefreshBazaar(server, refresh) {
{
title: 'Refresh Bazaar discovery',
description:
- 'Re-queries the x402 Bazaar discovery endpoint and re-registers dynamic tools. Use when new paid services have been added since the bridge started.',
+ 'Re-queries the x402 Bazaar discovery endpoint and re-registers dynamic tools. Use when new paid services have been added since the bridge started. Free (no payment), but mutates the bridge tool list and results vary with the live Bazaar.',
+ // Mutates the registered tool set from a live external feed: not
+ // read-only, not idempotent, open-world — but never destructive.
+ annotations: {
+ readOnlyHint: false,
+ destructiveHint: false,
+ idempotentHint: false,
+ openWorldHint: true,
+ },
inputSchema: {},
},
async () => {
@@ -191,10 +222,7 @@ function buildDynamicInputSchema() {
.describe(
'Request body (object). Required when the bazaar input schema declares body fields. JSON-encoded automatically.',
),
- params: z
- .record(z.any())
- .optional()
- .describe('Query string parameters as an object.'),
+ params: z.record(z.any()).optional().describe('Query string parameters as an object.'),
pathParams: z
.record(z.union([z.string(), z.number()]))
.optional()
@@ -210,6 +238,9 @@ function registerDynamic(server, deps, spec) {
{
title: spec.name,
description: spec.description,
+ // Dynamic Bazaar tools route through call_paid_endpoint: every call
+ // spends USDC against an external service.
+ annotations: PAYMENT_TOOL_ANNOTATIONS,
inputSchema,
},
buildDynamicHandler(deps, spec),
@@ -268,7 +299,10 @@ async function main() {
try {
await refresh();
} catch (err) {
- log('bazaar discovery failed at startup (continuing without dynamic tools):', err?.message || err);
+ log(
+ 'bazaar discovery failed at startup (continuing without dynamic tools):',
+ err?.message || err,
+ );
}
const transport = new StdioServerTransport();
diff --git a/mcp-bridge/src/x402-axios-client.js b/mcp-bridge/src/x402-axios-client.js
index c769e0535..9527c3227 100644
--- a/mcp-bridge/src/x402-axios-client.js
+++ b/mcp-bridge/src/x402-axios-client.js
@@ -27,10 +27,10 @@ import axios from 'axios';
import { x402Client, x402HTTPClient } from '@x402/core/client';
import { wrapAxiosWithPayment } from '@x402/axios';
import { ExactEvmScheme } from '@x402/evm/exact/client';
-import {
- BatchSettlementEvmScheme,
- FileClientChannelStorage,
-} from '@x402/evm/batch-settlement/client';
+import { BatchSettlementEvmScheme } from '@x402/evm/batch-settlement/client';
+// @x402/evm >= 2.14 moved the Node file-backed storage to its own subpath so
+// the main client entry stays runtime-agnostic.
+import { FileClientChannelStorage } from '@x402/evm/batch-settlement/client/file-storage';
import { ExactSvmScheme } from '@x402/svm/exact/client';
import { getEvmSigner, getSvmSigner } from './signers.js';
diff --git a/mcp-server/README.md b/mcp-server/README.md
index 12a00b1b2..77cb57ef7 100644
--- a/mcp-server/README.md
+++ b/mcp-server/README.md
@@ -1,44 +1,96 @@
-# @3d-agent/mcp-server
+<h1 align="center">@3d-agent/mcp-server</h1>
+
+<p align="center"><strong>Paid x402 MCP tools from three.ws — text/image→3D, avatars, rigging, agent reputation, and more. Settled per call in USDC.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@3d-agent/mcp-server"><img alt="npm" src="https://img.shields.io/npm/v/@3d-agent/mcp-server?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@3d-agent/mcp-server"><img alt="downloads" src="https://img.shields.io/npm/dm/@3d-agent/mcp-server?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@3d-agent/mcp-server?color=3b82f6">
+ <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas-7c3aed"></a>
+ <img alt="node" src="https://img.shields.io/node/v/@3d-agent/mcp-server?color=339933&logo=node.js">
+ <a href="https://three.ws"><img alt="three.ws" src="https://img.shields.io/badge/built%20by-three.ws-000"></a>
+</p>
+
+<p align="center">
+ <a href="#quickstart-30-seconds">Quickstart</a> ·
+ <a href="#tools">Tools</a> ·
+ <a href="#environment-variables">Config</a> ·
+ <a href="#programmatic-client">Programmatic</a> ·
+ <a href="#payment-flow">Payments</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
-Four paid MCP tools from [three.ws](https://three.ws) — pose generation, pump.fun token snapshots, ERC-8004 agent reputation, and Solana vanity address mining. Each call is settled in USDC via the [x402](https://x402.org) payment protocol. No subscription, no API key — pay per call.
+---
+
+> Fifteen paid MCP tools from [three.ws](https://three.ws) — text/image→3D mesh generation, 3D avatars, GLB auto-rigging, pose seeds, pump.fun snapshots, ERC-8004 agent reputation, ENS/SNS resolution, agent-to-agent delegation, token sentiment, AgenC coordination reads, aixbt market intel, and a Solana vanity grinder. Each call is settled in USDC via the [x402](https://x402.org) payment protocol on Solana mainnet (`exact` scheme). No subscription, no API key — pay per call, and failed calls never bill the caller.
---
## Quickstart (30 seconds)
+### Claude Code
+
+```bash
+claude mcp add 3d-agent -- npx -y @3d-agent/mcp-server
+```
+
+To also receive payments (server operators), pass the payout address as env: `claude mcp add 3d-agent -e MCP_SVM_PAYMENT_ADDRESS=YourSolanaWallet -- npx -y @3d-agent/mcp-server`. Alternatively, run `/setup-mcp` in any project that includes this repo and Claude will detect your OS, collect your wallet addresses, and write the config for you.
+
+### Claude Desktop
+
Paste this into your **Claude Desktop** config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS, `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
```json
{
- "mcpServers": {
- "3d-agent": {
- "command": "npx",
- "args": ["-y", "@3d-agent/mcp-server"],
- "env": {
- "MCP_SVM_PAYMENT_ADDRESS": "YourSolanaWallet"
- }
- }
- }
+ "mcpServers": {
+ "3d-agent": {
+ "command": "npx",
+ "args": ["-y", "@3d-agent/mcp-server"],
+ "env": {
+ "MCP_SVM_PAYMENT_ADDRESS": "YourSolanaWallet"
+ }
+ }
+ }
}
```
Restart Claude Desktop. All tools appear immediately — no install step required.
-**Using Claude Code?** Run `/setup-mcp` in any project that includes this repo and Claude will detect your OS, collect your wallet addresses, and write the config for you.
-
---
## Tools
-| Tool | Price | What it returns |
-|------|-------|-----------------|
-| `mesh_forge` | $0.25 | Textured 3D GLB from a **text prompt or a reference image**. Text mode runs a chain of specialist models — an IBM Granite "prompt director" rewrites the prompt into an optimized single-subject 3D spec, FLUX renders a reference image, and Microsoft TRELLIS / Tencent Hunyuan3D reconstruct the mesh. Image mode (`image_url`) reconstructs directly. Returns the durable `glbUrl`, a three.ws viewer `preview`, the `directedPrompt`, and timing. |
-| `rig_mesh` | $0.20 | Auto-rig a static GLB into an animation-ready model — humanoid skeleton + per-vertex skin weights via VAST-AI UniRig. Takes a `glb_url` (e.g. `mesh_forge`'s output), returns the `riggedGlbUrl` and a three.ws pose-studio link. |
-| `text_to_avatar` | $0.15 | Textured 3D GLB avatar from a text prompt or reference image URLs, driving Replicate (Hunyuan-3D 3.1 by default). Returns the GLB URL, model version, prediction id, and timing. |
-| `get_pose_seed` | $0.001 | Deterministic seed + full Euler-rotation pose map (radians) for the three.ws pose-studio mannequin, matched from the in-repo preset library. Includes a `previewUrl` at `https://three.ws/pose?seed=…&preset=…`. |
-| `pump_snapshot` | $0.005 | Live token snapshot — USD price (Jupiter), 24h volume + pair (Dexscreener), mint metadata + image (pump.fun frontend-api-v3), and on-chain top-holder distribution (Solana RPC). Adds Helius DAS data when `HELIUS_API_KEY` is set. |
-| `agent_reputation` | $0.01 | ERC-8004 reputation: `getReputation`, `getTotalStake`, and the latest `ReputationSubmitted` / `ReputationStaked` events from the canonical ReputationRegistry on the requested chain (default Base). Resolves `agentId` from a wallet address automatically. |
-| `vanity_grinder` | $0.05 | Solana keypair whose base58 address starts with `prefix` (and optionally ends with `suffix`). Returns the full base58 secret key — treat as a secret. Flat `exact` price (override with `MCP_VANITY_PRICE_USD`); a difficulty guard rejects prefixes too long to mine within the iteration cap. |
+Every tool quotes a fixed USDC price and settles `exact` on Solana mainnet. Prices below come straight from each tool's source. Every tool also declares MCP tool annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) so clients can scope confirmation prompts correctly — none of these tools are destructive.
+
+### 3D generation
+
+| Tool | Price | What it returns |
+| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `mesh_forge` | $0.25 | Textured 3D GLB from a **text prompt or a reference image**. Text mode runs a chain of specialist models — an IBM Granite "prompt director" rewrites the prompt into an optimized single-subject 3D spec, FLUX renders a reference image, and Microsoft TRELLIS / Tencent Hunyuan3D reconstruct the mesh. Image mode (`image_url`) reconstructs directly. Returns the durable `glbUrl`, a three.ws viewer `preview`, the `directedPrompt`, and timing. |
+| `rig_mesh` | $0.20 | Auto-rig a static GLB into an animation-ready model — humanoid skeleton + per-vertex skin weights via VAST-AI UniRig. Takes a `glb_url` (e.g. `mesh_forge`'s output), returns the `riggedGlbUrl` and a three.ws pose-studio link. |
+| `text_to_avatar` | $0.15 | Textured 3D GLB avatar from a text prompt or reference image URLs, driving Replicate (Hunyuan-3D 3.1 by default). Returns the GLB URL, model version, prediction id, and timing. |
+| `get_pose_seed` | $0.001 | Deterministic seed + full Euler-rotation pose map (radians) for the three.ws pose-studio mannequin, matched from the in-repo preset library. Includes a `previewUrl` at `https://three.ws/pose?seed=…&preset=…`. |
+
+### Solana & markets
+
+| Tool | Price | What it returns |
+| ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `pump_snapshot` | $0.005 | Live token snapshot — USD price (Jupiter), 24h volume + pair (Dexscreener), mint metadata + image (pump.fun frontend-api-v3), and on-chain top-holder distribution (Solana RPC). Adds Helius DAS data when `HELIUS_API_KEY` is set. |
+| `sentiment_pulse` | $0.003 | Sentiment for a Solana token: scores recent pump.fun comments (plus optional caller-supplied snippets) with the three.ws deterministic lexicon. Returns overall + per-source breakdown with examples. Pairs with `pump_snapshot`. |
+| `vanity_grinder` | $0.05 | Solana keypair whose base58 address starts with `prefix` (and optionally ends with `suffix`). Returns the full base58 secret key — treat as a secret. Flat price (override with `MCP_VANITY_PRICE_USD`); a difficulty guard rejects prefixes too long to mine within the iteration cap. |
+| `aixbt_intel` | $0.01 | aixbt narrative intelligence feed — recent intel items across crypto with category, description, observation count, official-source flag, and the project/ticker concerned. Optional category/chain filter. Live aixbt REST API. |
+| `aixbt_projects` | $0.01 | aixbt momentum scan — projects ranked by spiking/climbing/active scores, with ticker, chain, market metrics (price, mcap, 24h volume + change), and recent intel. Filter by names or chain. Live aixbt REST API. |
+
+### Agents & identity
+
+| Tool | Price | What it returns |
+| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `agent_reputation` | $0.01 | ERC-8004 reputation: `getReputation`, `getTotalStake`, and the latest `ReputationSubmitted` / `ReputationStaked` events from the canonical ReputationRegistry on the requested chain (default Base). Resolves `agentId` from a wallet address automatically. |
+| `agent_delegate_action` | $0.01 | Send a message to a three.ws-registered agent and receive its response (it uses its configured Claude model + system prompt). Agents opted out of MCP delegation are refused. For agent-to-agent collaboration and tool composition. |
+| `ens_sns_resolve` | $0.0005 | Resolve a human-readable name across **ENS** (`.eth` → Ethereum address via ethers) and **SNS** (`.sol` → Solana owner wallet via Bonfida, plus the wallet's other owned `.sol` domains). Suffix-less names are tried against both. |
+| `agenc_list_tasks` | $0.001 | List every public AgenC task created by a Solana wallet — task PDA, state, reward, deadline, worker counts, reward mint. AgenC (agenc.tech, Tetsuo Corp) is a Solana task-coordination protocol. `cluster` defaults to mainnet. |
+| `agenc_get_task` | $0.001 | On-chain state + lifecycle timeline of a single AgenC task. Pass `taskPda` or `{creator, taskId}` (hex or any UTF-8 label). Returns state, reward, deadline, worker counts, lifecycle events, reward mint. |
+| `agenc_get_agent` | $0.001 | An AgenC agent's on-chain registration. Pass `agentPda` or `agentId` (hex or UTF-8 label). Returns authority wallet, capability bitmask, endpoint URL, status, reputation, stake, and active task count. |
---
@@ -60,26 +112,26 @@ Then replace `"command": "npx", "args": ["-y", "@3d-agent/mcp-server"]` with `"c
### Required
-| Var | Description |
-|-----|-------------|
+| Var | Description |
+| ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `MCP_SVM_PAYMENT_ADDRESS` | Solana USDC payout address (base58) where tools receive payment. Falls back to `X402_PAY_TO_SOLANA` / `X402_PAY_TO`. |
### Optional
-| Var | Default | Description |
-|-----|---------|-------------|
-| `HELIUS_API_KEY` | unset | Adds Helius DAS enrichment to `pump_snapshot` |
-| `SOLANA_RPC_URL` | `https://api.mainnet-beta.solana.com` | Primary Solana RPC for `pump_snapshot` / AgenC reads |
-| `SOLANA_RPC_URLS` | built-in public set | **Failover** — comma-separated Solana RPCs tried in order; first healthy one answers |
-| `MCP_EVM_RPC_<chainId>` | built-in public set | **Failover** — comma-separated EVM RPCs for that chain (`agent_reputation`, ENS uses chain 1) |
-| `X402_FACILITATOR_URL_SOLANA` | `https://facilitator.payai.network` | Primary PayAI Solana facilitator that verifies + settles payments |
-| `X402_FACILITATOR_URLS_SOLANA` | unset | **Failover** — comma-separated facilitators; earlier entries take precedence at init, a later one covers an outage |
-| `X402_FACILITATOR_TOKEN_SOLANA` | unset | Bearer token for the Solana facilitator, if required |
-| `X402_FEE_PAYER_SOLANA` | three.ws default | Fee payer for the settlement transaction |
-| `MCP_VANITY_PRICE_USD` | `$0.05` | Flat price for `vanity_grinder` |
-| `MCP_POSE_PREVIEW_BASE` | `https://three.ws/pose` | Base URL for `get_pose_seed` preview links |
-| `MCP_AGENT_REP_RPC_<chainId>` | public RPC | Per-chain RPC override for `agent_reputation` (tried before the failover set) |
-| `MCP_AGENT_REP_LOG_WINDOW` | `200000` | Block window for `agent_reputation` event scan |
+| Var | Default | Description |
+| ------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
+| `HELIUS_API_KEY` | unset | Adds Helius DAS enrichment to `pump_snapshot` |
+| `SOLANA_RPC_URL` | `https://api.mainnet-beta.solana.com` | Primary Solana RPC for `pump_snapshot` / AgenC reads |
+| `SOLANA_RPC_URLS` | built-in public set | **Failover** — comma-separated Solana RPCs tried in order; first healthy one answers |
+| `MCP_EVM_RPC_<chainId>` | built-in public set | **Failover** — comma-separated EVM RPCs for that chain (`agent_reputation`, ENS uses chain 1) |
+| `X402_FACILITATOR_URL_SOLANA` | `https://facilitator.payai.network` | Primary PayAI Solana facilitator that verifies + settles payments |
+| `X402_FACILITATOR_URLS_SOLANA` | unset | **Failover** — comma-separated facilitators; earlier entries take precedence at init, a later one covers an outage |
+| `X402_FACILITATOR_TOKEN_SOLANA` | unset | Bearer token for the Solana facilitator, if required |
+| `X402_FEE_PAYER_SOLANA` | three.ws default | Fee payer for the settlement transaction |
+| `MCP_VANITY_PRICE_USD` | `$0.05` | Flat price for `vanity_grinder` |
+| `MCP_POSE_PREVIEW_BASE` | `https://three.ws/pose` | Base URL for `get_pose_seed` preview links |
+| `MCP_AGENT_REP_RPC_<chainId>` | public RPC | Per-chain RPC override for `agent_reputation` (tried before the failover set) |
+| `MCP_AGENT_REP_LOG_WINDOW` | `200000` | Block window for `agent_reputation` event scan |
---
@@ -87,11 +139,11 @@ Then replace `"command": "npx", "args": ["-y", "@3d-agent/mcp-server"]` with `"c
This repo ships three slash commands in `.claude/commands/` that work in any project that references this repo:
-| Command | What it does |
-|---------|--------------|
-| `/setup-mcp` | Detects your OS, collects wallet addresses, and writes the MCP config to the right file |
-| `/scaffold-agent` | Scaffolds a new three.ws agent in the current project with MCP client wiring |
-| `/use-tools [tool_name]` | Produces a complete, runnable code example for a specific paid tool |
+| Command | What it does |
+| ------------------------ | --------------------------------------------------------------------------------------- |
+| `/setup-mcp` | Detects your OS, collects wallet addresses, and writes the MCP config to the right file |
+| `/scaffold-agent` | Scaffolds a new three.ws agent in the current project with MCP client wiring |
+| `/use-tools [tool_name]` | Produces a complete, runnable code example for a specific paid tool |
---
@@ -109,13 +161,13 @@ import { Keypair } from '@solana/web3.js';
import bs58 from 'bs58';
const transport = new StdioClientTransport({
- command: 'npx',
- args: ['-y', '@3d-agent/mcp-server'],
- env: {
- // Where the server receives USDC. Your client funds payments from the
- // Solana keypair below.
- MCP_SVM_PAYMENT_ADDRESS: process.env.MCP_SVM_PAYMENT_ADDRESS,
- },
+ command: 'npx',
+ args: ['-y', '@3d-agent/mcp-server'],
+ env: {
+ // Where the server receives USDC. Your client funds payments from the
+ // Solana keypair below.
+ MCP_SVM_PAYMENT_ADDRESS: process.env.MCP_SVM_PAYMENT_ADDRESS,
+ },
});
const mcp = new Client({ name: 'agent', version: '1.0.0' });
@@ -140,15 +192,15 @@ In Cursor's MCP settings (`Cursor > Settings > Features > MCP`):
```json
{
- "mcpServers": {
- "3d-agent": {
- "command": "npx",
- "args": ["-y", "@3d-agent/mcp-server"],
- "env": {
- "MCP_SVM_PAYMENT_ADDRESS": "YourSolanaWallet"
- }
- }
- }
+ "mcpServers": {
+ "3d-agent": {
+ "command": "npx",
+ "args": ["-y", "@3d-agent/mcp-server"],
+ "env": {
+ "MCP_SVM_PAYMENT_ADDRESS": "YourSolanaWallet"
+ }
+ }
+ }
}
```
@@ -221,6 +273,19 @@ Source: [`mcp-server/`](https://github.com/nirholas/three.ws/tree/main/mcp-serve
---
-## License
+## Requirements
+
+- Node.js **>= 20** (from `engines`).
+- A Solana USDC payout address in `MCP_SVM_PAYMENT_ADDRESS` (or `X402_PAY_TO_SOLANA` / `X402_PAY_TO`) to settle paid calls — see [Environment variables](#environment-variables). Tool registration (names/schemas) needs no env; only an actual paid invocation does.
+- A payment-aware MCP client (or `@x402/mcp`'s `wrapMCPClientWithPayment`) funding payments from a Solana keypair.
+
+## Related
+
+- [`@three-ws/pumpfun-mcp`](https://www.npmjs.com/package/@three-ws/pumpfun-mcp) — the free, read-only pump.fun + Solana MCP (token discovery, on-chain analysis, live 3D snapshots; no keys).
+
+## Links
-Apache-2.0 — see [LICENSE](LICENSE).
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/package.json b/package.json
index 124d156c3..cd8e4b94a 100644
--- a/package.json
+++ b/package.json
@@ -84,6 +84,8 @@
"build:lib:full": "TARGET=lib LIB_FORMATS=es,umd vite build",
"build:artifact": "vite build --config vite.config.artifact.js",
"publish:lib": "node scripts/publish-lib.mjs",
+ "publish:mcp": "node scripts/publish-mcp-servers.mjs",
+ "publish:mcp:dry": "node scripts/publish-mcp-servers.mjs --dry-run",
"build:chat": "cd chat && node scripts/ensure-deps.mjs && npm run build && cd .. && mkdir -p dist/chat && cp -rf public/chat/. dist/chat/",
"build:avatar-studio": "npm run build --prefix character-studio",
"build:fast": "npm run build",
diff --git a/packages/avatar-agent-mcp/README.md b/packages/avatar-agent-mcp/README.md
index 13c24bf80..bf333ad04 100644
--- a/packages/avatar-agent-mcp/README.md
+++ b/packages/avatar-agent-mcp/README.md
@@ -1,199 +1,191 @@
-# 3D AI Agent Avatar
+<h1 align="center">@three-ws/avatar-agent</h1>
+
+<p align="center"><strong>An MCP server that turns any GLB into a 3D AI agent — inspect/validate/optimize models, then give one a Solana wallet, a voice, and pump.fun powers.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/avatar-agent"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/avatar-agent?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/avatar-agent"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/avatar-agent?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/avatar-agent?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/avatar-agent?color=339933&logo=node.js">
+ <a href="https://modelcontextprotocol.io"><img alt="mcp" src="https://img.shields.io/badge/Model%20Context%20Protocol-✓-9945FF"></a>
+ <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas-0ea5e9"></a>
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#setup">Setup</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#tools">Tools</a> ·
+ <a href="#requirements">Requirements</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
-> **The MCP server for 3D + AI agents.** Inspect, validate, and optimize any GLB. Spawn a textured 3D avatar with a Solana wallet, a voice, and full pump.fun powers — including atomic Jito-bundled launches and creator-fee collection.
+---
-[![npm](https://img.shields.io/npm/v/%40three-ws%2Favatar-agent?style=flat-square&color=9945FF)](https://www.npmjs.com/package/@three-ws/avatar-agent)
-[![license](https://img.shields.io/badge/license-MIT-14F195?style=flat-square)](./LICENSE)
-[![node](https://img.shields.io/badge/node-%E2%89%A520-9945FF?style=flat-square)](https://nodejs.org)
-[![mcp](https://img.shields.io/badge/Model%20Context%20Protocol-✓-9945FF?style=flat-square)](https://modelcontextprotocol.io)
+> A single [Model Context Protocol](https://modelcontextprotocol.io) server that is two things at once. It is a general-purpose **3D toolkit** — `inspect_glb`, `validate_glb`, `optimize_glb`, `thumbnail_glb`, and `viewer_url` work on any GLB/glTF model, no avatar required, powered by `@gltf-transform/core` and Khronos's official `gltf-validator`. It is also a **3D AI agent in a box** — spawn a textured GLB avatar, give it a voice (OpenAI TTS), hand it a Solana wallet, and run pump.fun operations (Jupiter swaps, atomic Jito-bundled launches, creator-fee collection). Built and maintained by [three.ws](https://three.ws). Registry name: `io.github.nirholas/3D-AI-Agent-Avatar`.
-Registry name: **`io.github.nirholas/3D-AI-Agent-Avatar`** · npm: **`@three-ws/avatar-agent`**
+For a lightweight, read-only avatar viewer (no wallet, no signing), see the sibling package [`@three-ws/avatar-mcp`](https://www.npmjs.com/package/@three-ws/avatar-mcp), which renders a live, rotatable on-chain avatar inline in the chat.
-A single MCP server that's two things at once:
+## Install
-1. **A general-purpose 3D toolkit** — `inspect_glb`, `validate_glb`, `optimize_glb`, `viewer_url` work on **any** GLB/glTF model, no avatar required. Powered by `@gltf-transform/core` + Khronos's official `gltf-validator`.
-2. **A full 3D agent in a box** — spawn a textured GLB avatar, give it a voice (OpenAI TTS), a Solana wallet, and pump.fun trading powers (Jupiter swaps, atomic Jito-bundled launches, creator-fee collection).
+```bash
+npm install @three-ws/avatar-agent
+```
-Install it once. Your Claude / Cursor / Continue / Cline can now:
+Run it directly with `npx` (no install needed) or install globally for the CLI:
-- **Inspect any GLB** — meshes, materials, textures, animations, bounding box, vertex + triangle counts.
-- **Validate any GLB** against the Khronos glTF 2.0 spec (the same engine behind gltf.report).
-- **Optimize a GLB** — dedup, prune, weld, Draco-compress; get the smaller file back inline.
-- **Build a viewer URL** for any GLB so humans see it in WebGL with one click.
-- **Spawn a 3D avatar** from the curated defaults (`default`, `cz`) or any GLB URL.
-- **Dress it** — hats, glasses, earrings, poses.
-- **Generate a fresh avatar** from a text prompt via Replicate (Hunyuan-3D).
-- **Give it a voice** — OpenAI TTS, 11 voices.
-- **Hand it a Solana wallet** — vanity-grind a `three…` address in milliseconds.
-- **Read live pump.fun data** — Jupiter price, Dexscreener volume, pump.fun meta, holders.
-- **Buy any token** — Jupiter swap, optionally inside a sniper-resistant Jito bundle.
-- **Launch a coin atomically** — separate funder + creator wallets, both txs in the same block.
-- **Collect creator fees atomically** — collect + drain to a safe wallet in one tx.
-- **Resolve names** — ENS (`.eth`) and SNS (`.sol`).
+```bash
+npx -y @three-ws/avatar-agent # MCP stdio server
+npm install -g @three-ws/avatar-agent # exposes `three-avatar-agent`
+```
-Built and maintained by [three.ws](https://three.ws). Atomic pump.fun pieces are ported from [nirholas/atomic](https://github.com/nirholas/atomic).
+## Setup
----
+Add the server to your MCP client. **Claude Code**, one line:
-## Quick start (Claude Desktop / Cursor / Continue)
+```bash
+claude mcp add avatar-agent -- npx -y @three-ws/avatar-agent
+```
-Add this to your MCP config:
+**Claude Desktop / Cursor** (JSON config):
```json
{
"mcpServers": {
- "3d-ai-agent-avatar": {
+ "avatar-agent": {
"command": "npx",
"args": ["-y", "@three-ws/avatar-agent"],
"env": {
"SOLANA_RPC_URL": "https://api.mainnet-beta.solana.com",
"OPENAI_API_KEY": "sk-...",
- "THREE_MINT": "<the $three CA on pump.fun>"
+ "REPLICATE_API_TOKEN": "r8_..."
}
}
}
}
```
-Restart your client. Ask it: **"Inspect https://three.ws/avatars/cz.glb, then spawn CZ, give him shades, and read me the latest snapshot for $three."**
+The 3D tools (`inspect_glb`, `validate_glb`, `optimize_glb`, `thumbnail_glb`, `viewer_url`) and `pump_snapshot` work with **no environment variables**. Voice, generation, and signing tools need the keys in [Requirements](#requirements). Restart your client after editing the config.
----
+Inspect the full tool surface in a GUI:
-## Two 30-second demos
+```bash
+npx -y @modelcontextprotocol/inspector npx -y @three-ws/avatar-agent
+```
-### 3D toolkit demo (no avatar required)
+## Quick start
-```
-You ▸ Inspect this GLB: https://three.ws/avatars/cz.glb — how many triangles?
- Then validate it against the Khronos spec and optimize it with Draco.
-```
+Once connected, ask your client in plain language:
-Runs:
-1. `inspect_glb({ url })` → mesh/material/animation breakdown + triangle count + bbox
-2. `validate_glb({ url })` → official Khronos report
-3. `optimize_glb({ url, draco: true })` → dedup → prune → weld → Draco, returns the smaller GLB inline
+> Inspect `https://three.ws/avatars/cz.glb` — how many triangles? Then validate it against the Khronos spec and optimize it with Draco.
-### Avatar agent demo
+Runs `inspect_glb` → `validate_glb` → `optimize_glb({ draco: true })`, returning the smaller GLB inline.
-```
-You ▸ Spawn cz, give him shades, mint him a "three"-prefixed wallet,
- pull a snapshot of $three, and have him say "we're so back."
-```
+> Spawn the `cz` avatar, give him shades, mint him a `three`-prefixed Solana wallet, pull a snapshot of $THREE, and have him say "we're so back."
-Behind the scenes the MCP runs:
+Runs `spawn_avatar` → `dress_avatar` → `wallet_create({ vanityPrefix: "three" })` → `pump_snapshot` → `speak`.
-1. `spawn_avatar({ preset: "cz", voice: "onyx" })` → returns a `sessionId` + viewer URL
-2. `dress_avatar({ sessionId, accessoryIds: ["glasses-shades"] })`
-3. `wallet_create({ sessionId, vanityPrefix: "three" })` → base58 pubkey starting with `three…`
-4. `pump_snapshot({ token: "three" })` → live Jupiter price, Dexscreener volume, holders
-5. `speak({ sessionId, text: "we're so back" })` → mp3 base64 the client plays
+## Tools
----
+All 20 tools are free MCP tools — there is no per-call x402 charge. Tools marked **execution** sign and broadcast real Solana transactions that move real funds; configure your client's tool-approval flow for them.
-## Tool surface (20 tools)
+Every tool ships [MCP tool annotations](https://modelcontextprotocol.io/specification/2025-06-18/server/tools#tool-annotations): reads advertise `readOnlyHint: true`, and the four execution tools (`wallet_send`, `pump_buy`, `pump_launch`, `pump_collect_fees`) are flagged `destructiveHint: true`, so annotation-aware MCP clients prompt for confirmation before running them. The hints are advisory — the server-side `REQUIRE_CONFIRM` gate and spend caps (see [Safety](#safety)) apply regardless of client.
-### 3D toolkit (works on any GLB)
-| Tool | What it does |
-|---|---|
-| `inspect_glb` | Mesh / material / animation / skin breakdown + bounding box + vertex & triangle counts. `@gltf-transform/core`. |
-| `validate_glb` | Run Khronos's official `gltf-validator` on a GLB; errors, warnings, infos, hints with JSON pointers. |
-| `optimize_glb` | Dedup → prune → weld → optional Draco. Returns optimized bytes inline + before/after sizes. |
-| `thumbnail_glb` | **Render any GLB to a PNG** via three.ws's hosted three-light rig + auto-framing camera. Same pipeline as OG cards. Returns base64 PNG inline. |
-| `viewer_url` | Build a `three.ws/viewer?...` URL + ready-to-paste iframe snippet for any GLB or avatar session. Supports background, auto-rotate, camera preset OR explicit orbit, AR mode, dimensions. |
+### 3D toolkit — works on any GLB, no avatar required
-### Avatar
-| Tool | What it does |
-|---|---|
-| `list_avatars` | Catalog of default GLB avatars (`default`, `cz`), accessories, and pose presets. |
-| `list_animations` | Live fetch of three.ws's 24 pose presets (T-pose, wave, thinker, jump, dance, warrior2, …) grouped by category. |
-| `spawn_avatar` | Create an avatar session from a preset or custom GLB URL. Returns `sessionId`. |
-| `dress_avatar` | Apply accessories + pose to a session. |
-| `render_avatar` | **Render a posed avatar to a PNG** — pose preset + camera orbit (theta/phi/radius) + ARKit-52 facial expression. Same rig + lighting as the three.ws customizer's save-snapshot. |
-| `generate_avatar` | Text/image-to-3D via Replicate. New session preloaded with the generated GLB. |
+| Tool | What it does |
+| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `inspect_glb` | Mesh / material / texture / animation / skin breakdown, bounding box, vertex and triangle counts. `@gltf-transform/core`. |
+| `validate_glb` | Runs Khronos's official `gltf-validator`; returns errors, warnings, infos, hints with JSON pointers. |
+| `optimize_glb` | Dedup → prune → weld → optional Draco. Returns the optimized bytes inline with before/after sizes. |
+| `thumbnail_glb` | Renders any GLB to a PNG via three.ws's hosted three-light rig + auto-framing camera. Returns base64 PNG inline. |
+| `viewer_url` | Builds a `three.ws/viewer?...` URL + paste-ready iframe for any GLB or avatar session (background, auto-rotate, camera preset or explicit orbit, AR mode, dimensions). |
-### Voice
-| Tool | What it does |
-|---|---|
-| `speak` | OpenAI TTS — synthesize speech in the avatar's voice. Returns base64 audio. |
+### Avatar
-### Wallet
-| Tool | What it does |
-|---|---|
-| `wallet_create` | Generate a Solana keypair. Optional vanity grinder (`vanityPrefix: "three"`). |
-| `wallet_balance` | Read SOL + all SPL token balances (incl. Token-2022). |
-| `wallet_send` | Send SOL on mainnet. **Execution action.** |
+| Tool | What it does |
+| ----------------- | ------------------------------------------------------------------------------------------------------------- |
+| `list_avatars` | Catalog of default GLB avatars (`default`, `cz`), accessories, and pose presets. |
+| `list_animations` | Live fetch of three.ws's pose presets (T-pose, wave, thinker, jump, dance, warrior2, …) grouped by category. |
+| `spawn_avatar` | Creates an avatar session from a preset or custom GLB URL. Returns a `sessionId`. |
+| `dress_avatar` | Applies accessories + a pose to a session. |
+| `render_avatar` | Renders a posed avatar to a PNG — pose preset + camera orbit (theta/phi/radius) + ARKit-52 facial expression. |
+| `generate_avatar` | Text/image-to-3D via Replicate (Hunyuan-3D). New session preloaded with the generated GLB. |
-### pump.fun
-| Tool | What it does |
-|---|---|
-| `pump_snapshot` | Live market snapshot: price, volume, holders, meta. Pass `target: "three"` for $three. |
-| `pump_buy` | Jupiter swap, direct or **Jito-bundled** (funder→buyer transfer + swap atomic). **Execution action.** |
-| `pump_launch` | **Atomic launch** via Jito bundle: separate funder + creator wallets, both txs same block. Uploads metadata to pump.fun IPFS if no URI is supplied. **Execution action.** |
-| `pump_collect_fees` | **Atomic collect**: `collectCoinCreatorFee` + drain to safe wallet in one tx inside a Jito bundle — leaked-creator-key resistant. **Execution action.** |
+### Voice
-### Identity
-| Tool | What it does |
-|---|---|
-| `ens_sns_resolve` | Resolve `.eth` (ENS) and `.sol` (Bonfida SNS) names to addresses with reverse + favorite-domain lookups. |
+| Tool | What it does |
+| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `speak` | Synthesizes speech in the avatar's voice — free NVIDIA Magpie TTS lane first (`NVIDIA_API_KEY`), OpenAI TTS backstop (`OPENAI_API_KEY`). Returns base64 audio the client plays. |
----
+### Wallet
-## Environment variables
+| Tool | What it does |
+| ---------------- | ------------------------------------------------------------------------------------------------------- |
+| `wallet_create` | Generates a Solana keypair. Optional vanity grinder (`vanityPrefix: "three"`). Secret is returned once. |
+| `wallet_balance` | Reads SOL + all SPL token balances (incl. Token-2022). |
+| `wallet_send` | Sends SOL on mainnet. **Execution.** |
-| Variable | Required for | Notes |
-|---|---|---|
-| `SOLANA_RPC_URL` | All Solana ops | Defaults to `https://api.mainnet-beta.solana.com`. Bring your own (Helius/QuickNode/Triton) for production. |
-| `ETH_RPC_URL` | `ens_sns_resolve` | Optional — falls back to ethers' default public providers. |
-| `HELIUS_API_KEY` | `pump_snapshot` (enhanced) | Adds exact supply + DAS data. |
-| `OPENAI_API_KEY` | `speak` | Used directly against `api.openai.com/v1/audio/speech`. |
-| `REPLICATE_API_TOKEN` | `generate_avatar` | |
-| `REPLICATE_TEXT_TO_AVATAR_MODEL` | `generate_avatar` | Pin a commercial-OK version, e.g. latest `tencent/hunyuan-3d-3.1`. |
-| `SOLANA_SECRET_KEY` | `wallet_send` / `pump_buy` default signer | Per-call `secret` args override. Treat like cash. |
-| `THREE_MINT` | `pump_snapshot` / `pump_buy` shorthand | Set so tools accept `target: "three"`. |
+### pump.fun
----
+| Tool | What it does |
+| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `pump_snapshot` | Live market snapshot: USD price (Jupiter), 24h volume + DEX (Dexscreener), pump.fun metadata, top-holder distribution. Pass `target: "three"` for $THREE when `THREE_MINT` is set. Read-only, no signer. |
+| `pump_buy` | Jupiter swap, direct or **Jito-bundled** (funder→buyer transfer + swap atomic). Accepts any runtime mint. **Execution.** |
+| `pump_launch` | **Atomic launch** via Jito bundle: separate funder + creator wallets, both txs in the same block. Uploads metadata to pump.fun IPFS if no URI is supplied. **Execution.** |
+| `pump_collect_fees` | **Atomic collect**: `collectCoinCreatorFee` + drain to a safe wallet in one tx inside a Jito bundle — resistant to a leaked creator key. **Execution.** |
-## Atomic pump.fun, briefly
+### Identity
-The `pump_launch` and `pump_collect_fees` tools wrap the pattern from [nirholas/atomic](https://github.com/nirholas/atomic). Two things matter:
+| Tool | What it does |
+| ----------------- | ---------------------------------------------------------------------------------------------------------- |
+| `ens_sns_resolve` | Resolves `.eth` (ENS) and `.sol` (Bonfida SNS) names to addresses, with reverse + favorite-domain lookups. |
-**Launch:** the create tx's `payerKey` is the **creator** wallet, not the funder — so the on-chain `creator` field (which receives pump.fun creator fees forever) is the creator wallet. But the creator doesn't need to hold SOL: the funder transfers rent + tip in Tx1 of the same Jito bundle. Either both land or neither does.
+## How atomic pump.fun works
-**Collect:** even if a creator key is shared / leaked, the collect-and-drain runs as a single tx inside a Jito bundle. No competing collector can interleave a tx between `collectCoinCreatorFee` and the drain, even with the same key.
+The `pump_launch` and `pump_collect_fees` tools wrap two patterns:
-If you start hitting `Bundles must write lock at least one tip account`, the [Jito tip account list](https://docs.jito.wtf/) has rotated — refresh `src/lib/jito.js`.
+- **Launch** — the create tx's `payerKey` is the **creator** wallet, so the on-chain `creator` field (which receives pump.fun creator fees forever) is the creator wallet. The creator does not need to hold SOL: the funder transfers rent + tip in Tx1 of the same Jito bundle. Either both txs land or neither does.
+- **Collect** — even if a creator key is shared or leaked, collect-and-drain runs as a single tx inside a Jito bundle, so no competing collector can interleave a tx between `collectCoinCreatorFee` and the drain.
----
+If you start hitting `Bundles must write lock at least one tip account`, the [Jito tip-account list](https://docs.jito.wtf/) has rotated.
-## Running locally
+These tools accept an arbitrary mint supplied at runtime — generic plumbing for launching and managing your own coin. **$THREE** (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`) is the only coin three.ws promotes.
-```bash
-npm install @three-ws/avatar-agent
-npx three-avatar-agent # MCP stdio server
-npx @modelcontextprotocol/inspector npx three-avatar-agent # GUI
-```
+## Requirements
-Or clone this repo:
+- **Node** `>=20`.
-```bash
-git clone https://github.com/nirholas/three.ws.git
-cd three.ws/packages/avatar-agent-mcp
-npm install
-npm start
-```
+Per-tool environment variables (all optional — set only what you use):
----
+| Variable | Required for | Notes |
+| -------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
+| `SOLANA_RPC_URL` | All Solana ops | Defaults to `https://api.mainnet-beta.solana.com`. Bring your own (Helius / QuickNode / Triton) for production traffic. |
+| `ETH_RPC_URL` | `ens_sns_resolve` | Optional — falls back to ethers' default public providers. |
+| `HELIUS_API_KEY` | `pump_snapshot` (enhanced) | Adds exact supply + DAS data. |
+| `NVIDIA_API_KEY` | `speak` (free lane) | NVIDIA NIM key (`nvapi-…`) — leads the TTS provider chain with Magpie TTS. |
+| `OPENAI_API_KEY` | `speak` (paid backstop) | Used against `api.openai.com/v1/audio/speech` when the free lane is unavailable. |
+| `REPLICATE_API_TOKEN` | `generate_avatar` | Replicate text/image-to-3D. |
+| `REPLICATE_TEXT_TO_AVATAR_MODEL` | `generate_avatar` | Pin a commercial-OK version, e.g. latest `tencent/hunyuan-3d-3.1`. |
+| `SOLANA_SECRET_KEY` | `wallet_send` / `pump_buy` default signer | Per-call `secret` args override. Treat like cash. |
+| `THREE_MINT` | `pump_snapshot` / `pump_buy` shorthand | Set so tools accept `target: "three"`. |
+| `MAX_SOL_PER_TX` | execution tools | Per-transaction spend cap in SOL. Default `0.5`. |
+| `REQUIRE_CONFIRM` | execution tools | Default on: execution calls refuse until re-issued with `confirm: true`. Set `0`/`false` to disable. |
## Safety
-`pump_buy`, `pump_launch`, `pump_collect_fees`, and `wallet_send` all execute real on-chain transactions and move real funds. The MCP makes no judgment about the input — if your client tells it to send 100 SOL to a random address with a valid signer, it will. Configure your client's tool-approval flow accordingly.
+`wallet_send`, `pump_buy`, `pump_launch`, and `pump_collect_fees` execute real on-chain transactions. The server makes no judgment about inputs — with a valid signer it does exactly what it is told. Secrets are never logged or persisted; the secret from `wallet_create` is returned once.
-Secrets are never logged or persisted. Secrets returned by `wallet_create` are returned ONCE — store them yourself.
-
----
+Three layers keep that power in check:
-## License
+1. **Tool annotations** — the four execution tools are flagged `destructiveHint: true`, so annotation-aware MCP clients (Claude Code, Claude Desktop, Cursor) surface a confirmation prompt before running them. Read-only tools are flagged `readOnlyHint: true` and can be safely auto-approved.
+2. **Confirmation gate** — with `REQUIRE_CONFIRM` on (the default), every execution call returns `confirmation_required` until re-issued with `confirm: true`, independent of the client.
+3. **Spend caps** — `MAX_SOL_PER_TX` (default 0.5 SOL) bounds every send, buy, tip, and drain server-side.
-MIT © 2026 three.ws
+## Links
-Powered by the [Model Context Protocol](https://modelcontextprotocol.io), the [@nirholas/pump-sdk](https://www.npmjs.com/package/@nirholas/pump-sdk), and Jito's [Block Engine](https://docs.jito.wtf/).
+- Homepage: https://three.ws
+- Sibling package: [`@three-ws/avatar-mcp`](https://www.npmjs.com/package/@three-ws/avatar-mcp) — live, read-only avatar viewer for MCP
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: MIT — see [LICENSE](./LICENSE)
diff --git a/packages/avatar-agent-mcp/package-lock.json b/packages/avatar-agent-mcp/package-lock.json
index 2016b8bed..6abd38eae 100644
--- a/packages/avatar-agent-mcp/package-lock.json
+++ b/packages/avatar-agent-mcp/package-lock.json
@@ -1,17 +1,19 @@
{
"name": "@three-ws/avatar-agent",
- "version": "1.0.0",
+ "version": "1.2.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@three-ws/avatar-agent",
- "version": "1.0.0",
+ "version": "1.2.0",
"license": "MIT",
"dependencies": {
"@gltf-transform/core": "^4.3.0",
"@gltf-transform/extensions": "^4.3.0",
"@gltf-transform/functions": "^4.3.0",
+ "@grpc/grpc-js": "^1.14.4",
+ "@grpc/proto-loader": "^0.8.1",
"@modelcontextprotocol/sdk": "^1.29.0",
"@nirholas/pump-sdk": "^1.30.0",
"@solana/spl-token": "^0.4.14",
@@ -188,6 +190,37 @@
"url": "https://github.com/sponsors/donmccurdy"
}
},
+ "node_modules/@grpc/grpc-js": {
+ "version": "1.14.4",
+ "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.4.tgz",
+ "integrity": "sha512-k9Dj3DV/itK9D06Y8f190Qgop7/Ui+D0njFV3LHMPwPT75DpXLQohE9Wmz0QElrJnzsjB7KPWiKJbOl7IPDArQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@grpc/proto-loader": "^0.8.0",
+ "@js-sdsl/ordered-map": "^4.4.2"
+ },
+ "engines": {
+ "node": ">=12.10.0"
+ }
+ },
+ "node_modules/@grpc/proto-loader": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.8.1.tgz",
+ "integrity": "sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "lodash.camelcase": "^4.3.0",
+ "long": "^5.0.0",
+ "protobufjs": "^7.5.5",
+ "yargs": "^17.7.2"
+ },
+ "bin": {
+ "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/@hono/node-server": {
"version": "1.19.14",
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.14.tgz",
@@ -665,6 +698,16 @@
"url": "https://opencollective.com/libvips"
}
},
+ "node_modules/@js-sdsl/ordered-map": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz",
+ "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/js-sdsl"
+ }
+ },
"node_modules/@modelcontextprotocol/sdk": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.29.0.tgz",
@@ -752,6 +795,63 @@
"url": "https://paulmillr.com/funding/"
}
},
+ "node_modules/@protobufjs/aspromise": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
+ "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/base64": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
+ "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/codegen": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz",
+ "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/eventemitter": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz",
+ "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/fetch": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz",
+ "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.1"
+ }
+ },
+ "node_modules/@protobufjs/float": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
+ "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/path": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
+ "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/pool": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
+ "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/utf8": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.1.tgz",
+ "integrity": "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==",
+ "license": "BSD-3-Clause"
+ },
"node_modules/@pump-fun/pump-swap-sdk": {
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/@pump-fun/pump-swap-sdk/-/pump-swap-sdk-1.16.0.tgz",
@@ -3090,6 +3190,18 @@
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
"license": "MIT"
},
+ "node_modules/lodash.camelcase": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
+ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
+ "license": "MIT"
+ },
+ "node_modules/long": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
+ "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
+ "license": "Apache-2.0"
+ },
"node_modules/lru-cache": {
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
@@ -3518,6 +3630,29 @@
"integrity": "sha512-AvPcP7XECNWy4LGmFQ77k7un4lSKM4eS29PTvW4ck95uYeLxXPWJM7hLuBqK91FaHqCcgJvIUCuNJjjxKE7VKQ==",
"license": "MIT"
},
+ "node_modules/protobufjs": {
+ "version": "7.6.4",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.4.tgz",
+ "integrity": "sha512-RJJPTTpvFfHcWLkIa2JFWK4XvtSzS0yEWDmunqHXli1h3JlkbcQZXDZdcWxv+JK3Xsl5/UFDPZ0iGm7DAengYw==",
+ "hasInstallScript": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.2",
+ "@protobufjs/base64": "^1.1.2",
+ "@protobufjs/codegen": "^2.0.5",
+ "@protobufjs/eventemitter": "^1.1.1",
+ "@protobufjs/fetch": "^1.1.1",
+ "@protobufjs/float": "^1.0.2",
+ "@protobufjs/path": "^1.1.2",
+ "@protobufjs/pool": "^1.1.0",
+ "@protobufjs/utf8": "^1.1.1",
+ "@types/node": ">=13.7.0",
+ "long": "^5.3.2"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
diff --git a/packages/avatar-agent-mcp/server.json b/packages/avatar-agent-mcp/server.json
index 4a684d168..770767e5f 100644
--- a/packages/avatar-agent-mcp/server.json
+++ b/packages/avatar-agent-mcp/server.json
@@ -1,18 +1,27 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/3D-AI-Agent-Avatar",
+ "title": "3D AI Agent Avatar",
"description": "3D AI Agent Avatar — render any GLB, give it a Solana wallet, a voice, and pump.fun powers.",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
"repository": {
"url": "https://github.com/nirholas/three.ws",
"source": "github",
"subfolder": "packages/avatar-agent-mcp"
},
- "version": "1.0.3",
+ "version": "1.2.0",
"packages": [
{
"registryType": "npm",
"identifier": "@three-ws/avatar-agent",
- "version": "1.0.3",
+ "version": "1.2.0",
"transport": {
"type": "stdio"
},
@@ -37,9 +46,16 @@
"isRequired": false,
"isSecret": true
},
+ {
+ "name": "NVIDIA_API_KEY",
+ "description": "NVIDIA NIM key (nvapi-…) — leads the speak tool's TTS provider chain with the free Magpie TTS lane.",
+ "format": "string",
+ "isRequired": false,
+ "isSecret": true
+ },
{
"name": "OPENAI_API_KEY",
- "description": "Required for the speak tool (OpenAI TTS).",
+ "description": "OpenAI TTS — the speak tool's paid backstop when the free NVIDIA lane is unavailable.",
"format": "string",
"isRequired": false,
"isSecret": true
@@ -69,6 +85,20 @@
"description": "Optional pump.fun mint address for $three so tools accept target=\"three\" as shorthand.",
"format": "string",
"isRequired": false
+ },
+ {
+ "name": "MAX_SOL_PER_TX",
+ "description": "Per-transaction spend cap in SOL for the execution tools (wallet_send, pump_buy, pump_launch, pump_collect_fees).",
+ "format": "number",
+ "isRequired": false,
+ "default": "0.5"
+ },
+ {
+ "name": "REQUIRE_CONFIRM",
+ "description": "When on (default), execution tools refuse until re-issued with confirm:true. Set 0/false to disable the gate.",
+ "format": "boolean",
+ "isRequired": false,
+ "default": "true"
}
]
}
diff --git a/packages/avatar-agent-mcp/src/index.js b/packages/avatar-agent-mcp/src/index.js
index b559a72f2..553ef8fb5 100755
--- a/packages/avatar-agent-mcp/src/index.js
+++ b/packages/avatar-agent-mcp/src/index.js
@@ -11,6 +11,10 @@
//
// Or wire into Claude Desktop / Cursor — see README.md.
+import { realpathSync } from 'node:fs';
+import { createRequire } from 'node:module';
+import { pathToFileURL } from 'node:url';
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -35,7 +39,12 @@ import { def as pumpLaunch } from './tools/pump-launch.js';
import { def as pumpCollect } from './tools/pump-collect.js';
import { def as ensSnsResolve } from './tools/ens-sns-resolve.js';
-const TOOLS = [
+// Single source of truth for the advertised server identity — package.json.
+// The McpServer version can never drift from the published npm version again.
+const require = createRequire(import.meta.url);
+const { name: PKG_NAME, version: PKG_VERSION } = require('../package.json');
+
+export const TOOLS = [
// 3D toolkit — universal GLB / glTF tools
inspectGlb,
validateGlb,
@@ -63,16 +72,26 @@ const TOOLS = [
ensSnsResolve,
];
-async function main() {
+/**
+ * Construct a fully-registered McpServer WITHOUT connecting a transport and
+ * WITHOUT requiring any secrets. Tool registration (names, descriptions,
+ * schemas, annotations) is env-free; only invocations of tools that sign or
+ * call third-party APIs need credentials. Safe to import from tests.
+ *
+ * @returns {McpServer}
+ */
+export function buildServer() {
const server = new McpServer(
- { name: '3d-ai-agent-avatar', version: '1.0.0' },
+ // '@three-ws/avatar-agent' is an npm scope; MCP server names are plain
+ // identifiers, so keep the long-standing stdio identity.
+ { name: '3d-ai-agent-avatar', title: '3D AI Agent Avatar', version: PKG_VERSION },
{
capabilities: { tools: {} },
instructions:
'3D AI Agent Avatar — a complete 3D MCP toolkit plus a Solana-wallet-bearing, pump.fun-trading avatar agent. ' +
'3D tools (work on any GLB URL, no avatar required): inspect_glb returns mesh/material/animation/bbox stats; ' +
'validate_glb runs the official Khronos validator; optimize_glb runs dedup/prune/weld/Draco and returns the ' +
- 'smaller GLB inline; thumbnail_glb renders any GLB to a PNG via three.ws\'s hosted three-light rig (the same ' +
+ "smaller GLB inline; thumbnail_glb renders any GLB to a PNG via three.ws's hosted three-light rig (the same " +
'pipeline that generates OG cards); viewer_url builds a three.ws/viewer link + iframe embed. ' +
'Avatar flow: list_avatars → list_animations → spawn_avatar (preset "default"/"cz" or any GLB) → dress_avatar → ' +
'render_avatar (pose + camera orbit + ARKit-52 expression → real PNG) → speak. generate_avatar text/image-to-3D ' +
@@ -91,11 +110,17 @@ async function main() {
title: tool.title,
description: tool.description,
inputSchema: tool.inputSchema,
+ // MCP ToolAnnotations (readOnlyHint / destructiveHint /
+ // idempotentHint / openWorldHint) — lets clients gate
+ // confirmation prompts per tool instead of treating every
+ // call as a destructive write.
+ annotations: tool.annotations,
},
async (args, extra) => {
try {
const result = await tool.handler(args, extra);
- const text = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
+ const text =
+ typeof result === 'string' ? result : JSON.stringify(result, null, 2);
return { content: [{ type: 'text', text }] };
} catch (err) {
const payload = {
@@ -114,12 +139,32 @@ async function main() {
);
}
+ return server;
+}
+
+async function main() {
+ const server = buildServer();
const transport = new StdioServerTransport();
await server.connect(transport);
- console.error(`[3d-ai-agent-avatar] connected over stdio with ${TOOLS.length} tools`);
+ console.error(`[${PKG_NAME}@${PKG_VERSION}] connected over stdio with ${TOOLS.length} tools`);
}
-main().catch((err) => {
- console.error('[3d-ai-agent-avatar] fatal:', err);
- process.exit(1);
-});
+// Connect stdio ONLY when this file is the process entry point. Importing the
+// module (tests, embedding buildServer elsewhere) must not grab the transport.
+// realpath both sides: npm bin shims are symlinks, so argv[1] may point at
+// node_modules/.bin/... while import.meta.url is the resolved file.
+function isProcessEntryPoint() {
+ if (!process.argv[1]) return false;
+ try {
+ return import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href;
+ } catch {
+ return false;
+ }
+}
+
+if (isProcessEntryPoint()) {
+ main().catch((err) => {
+ console.error(`[${PKG_NAME}] fatal:`, err);
+ process.exit(1);
+ });
+}
diff --git a/packages/avatar-agent-mcp/test/annotations.test.mjs b/packages/avatar-agent-mcp/test/annotations.test.mjs
new file mode 100644
index 000000000..af7fc5171
--- /dev/null
+++ b/packages/avatar-agent-mcp/test/annotations.test.mjs
@@ -0,0 +1,151 @@
+// MCP ToolAnnotations invariants — this test pins the safety semantics of the
+// whole tool surface. MCP clients use these hints to decide which calls need a
+// human confirmation prompt, so an unannotated tool (or a mis-flagged
+// execution tool) is a safety regression, not a style nit.
+//
+// Importing src/index.js is side-effect-free: the stdio transport only
+// connects when the file is the process entry point, and buildServer()
+// requires no env secrets.
+//
+// Run: node --test packages/avatar-agent-mcp/test/annotations.test.mjs
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { TOOLS, buildServer } from '../src/index.js';
+
+// The ONLY tools allowed to carry destructiveHint: true — they sign and
+// broadcast irreversible Solana mainnet transactions. Adding an execution tool?
+// Add it here deliberately, in the same commit.
+const EXECUTION_TOOLS = new Set(['wallet_send', 'pump_buy', 'pump_launch', 'pump_collect_fees']);
+
+// Read-only surface: inspect/derive/fetch, never mutate.
+const READ_ONLY_TOOLS = new Set([
+ 'inspect_glb',
+ 'validate_glb',
+ 'optimize_glb',
+ 'thumbnail_glb',
+ 'viewer_url',
+ 'list_avatars',
+ 'list_animations',
+ 'render_avatar',
+ 'pump_snapshot',
+ 'wallet_balance',
+ 'ens_sns_resolve',
+]);
+
+// Deterministic reads — same inputs, same answer — may advertise idempotency.
+const IDEMPOTENT_TOOLS = new Set([
+ 'inspect_glb',
+ 'validate_glb',
+ 'optimize_glb',
+ 'thumbnail_glb',
+ 'viewer_url',
+ 'list_avatars',
+ 'render_avatar',
+]);
+
+test('exactly 20 tools are registered', () => {
+ assert.equal(TOOLS.length, 20);
+ assert.equal(new Set(TOOLS.map((t) => t.name)).size, 20, 'tool names must be unique');
+});
+
+test('every tool has a human title and a complete annotations object', () => {
+ for (const tool of TOOLS) {
+ assert.equal(typeof tool.title, 'string', `${tool.name} is missing a title`);
+ assert.ok(tool.title.length > 0, `${tool.name} has an empty title`);
+ assert.ok(tool.annotations, `${tool.name} is missing MCP ToolAnnotations`);
+ assert.equal(
+ typeof tool.annotations.readOnlyHint,
+ 'boolean',
+ `${tool.name} must set readOnlyHint explicitly`,
+ );
+ assert.equal(
+ typeof tool.annotations.idempotentHint,
+ 'boolean',
+ `${tool.name} must set idempotentHint explicitly`,
+ );
+ assert.equal(
+ typeof tool.annotations.openWorldHint,
+ 'boolean',
+ `${tool.name} must set openWorldHint explicitly`,
+ );
+ }
+});
+
+test('writes always set destructiveHint explicitly (spec default is TRUE when omitted)', () => {
+ for (const tool of TOOLS) {
+ if (tool.annotations.readOnlyHint === false) {
+ assert.equal(
+ typeof tool.annotations.destructiveHint,
+ 'boolean',
+ `${tool.name} is a write — destructiveHint must be explicit, never defaulted`,
+ );
+ }
+ }
+});
+
+test('the destructive set is EXACTLY the four on-chain execution tools', () => {
+ const destructive = TOOLS.filter((t) => t.annotations.destructiveHint === true).map(
+ (t) => t.name,
+ );
+ assert.deepEqual(new Set(destructive), EXECUTION_TOOLS);
+});
+
+test('read tools advertise readOnlyHint: true; writes do not', () => {
+ for (const tool of TOOLS) {
+ const expected = READ_ONLY_TOOLS.has(tool.name);
+ assert.equal(
+ tool.annotations.readOnlyHint,
+ expected,
+ `${tool.name} readOnlyHint should be ${expected}`,
+ );
+ }
+});
+
+test('idempotency is only claimed by deterministic reads', () => {
+ for (const tool of TOOLS) {
+ const expected = IDEMPOTENT_TOOLS.has(tool.name);
+ assert.equal(
+ tool.annotations.idempotentHint,
+ expected,
+ `${tool.name} idempotentHint should be ${expected}`,
+ );
+ }
+});
+
+test('wallet_create is the only closed-world tool (local keypair generation)', () => {
+ for (const tool of TOOLS) {
+ const expected = tool.name !== 'wallet_create';
+ assert.equal(
+ tool.annotations.openWorldHint,
+ expected,
+ `${tool.name} openWorldHint should be ${expected}`,
+ );
+ }
+});
+
+test('execution tools are never marked read-only or idempotent', () => {
+ for (const name of EXECUTION_TOOLS) {
+ const tool = TOOLS.find((t) => t.name === name);
+ assert.ok(tool, `${name} must exist in the tool registry`);
+ assert.equal(tool.annotations.readOnlyHint, false);
+ assert.equal(tool.annotations.idempotentHint, false);
+ }
+});
+
+test('buildServer registers every tool with its annotations, without env secrets', () => {
+ const server = buildServer();
+ // McpServer keeps its registry in _registeredTools (name → RegisteredTool).
+ const registered = server._registeredTools;
+ assert.ok(registered, 'McpServer should expose its tool registry');
+ for (const tool of TOOLS) {
+ const entry = registered[tool.name];
+ assert.ok(entry, `${tool.name} not registered on the server`);
+ assert.deepEqual(
+ entry.annotations,
+ tool.annotations,
+ `${tool.name} annotations must survive registration`,
+ );
+ }
+});
diff --git a/packages/avatar-cli/README.md b/packages/avatar-cli/README.md
index 3c49a6250..573b9b60d 100644
--- a/packages/avatar-cli/README.md
+++ b/packages/avatar-cli/README.md
@@ -1,45 +1,74 @@
-# @three-ws/avatar-cli
-
-Terminal-native tooling for on-chain avatars. Scaffold, validate, hash, and
-preview avatar manifests from your shell or CI.
-
-> **What RPM doesn't have.** Ready Player Me has a hosted creator and a
-> hosted SDK, but no CLI and no offline pipeline. three.ws's avatar workflow
-> is composable with build pipelines, content-addressed storage, and any
-> wallet — no service to sign up for.
+<h1 align="center">@three-ws/avatar-cli</h1>
+
+<p align="center"><strong>Terminal-native tooling for on-chain avatars: scaffold, validate, hash, and preview avatar manifests.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/avatar-cli"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/avatar-cli?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/avatar-cli"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/avatar-cli?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/avatar-cli?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/avatar-cli?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#commands">Commands</a> ·
+ <a href="#ci-usage">CI usage</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> `@three-ws/avatar-cli` brings the three.ws on-chain avatar workflow to your shell
+> and CI. It scaffolds spec-compliant manifests from a wallet and a mesh file,
+> validates existing manifests, computes content-addressing hashes, and prints
+> embeddable preview snippets. Every command runs offline against
+> [`@three-ws/avatar-schema`](https://www.npmjs.com/package/@three-ws/avatar-schema)
+> — no service to sign up for, no browser required.
## Install
```bash
-# one-shot
-npx @three-ws/avatar-cli init --owner 0xabc... --name "Nicholas" --mesh ./avatar.glb
+# run a single command without installing
+npx @three-ws/avatar-cli --help
-# or globally
-npm i -g @three-ws/avatar-cli
+# or install globally
+npm install -g @three-ws/avatar-cli
three-ws-avatar --help
```
-## Quickstart — claim an on-chain avatar in 30 seconds
+The binary is `three-ws-avatar`. `--version` prints the package version; `--help` /
+`-h` prints usage.
+
+## Quick start
```bash
-# 1. Generate a signed-ready manifest from your wallet + mesh
+# 1. Scaffold a manifest from your wallet + mesh (sha256 + size computed for you)
three-ws-avatar init \
- --owner 0x742d35Cc6634C0532925a3b844Bc454e4438f44e \
+ --owner eip155:1:0x742d35Cc6634C0532925a3b844Bc454e4438f44e \
--name "Nicholas" \
--mesh ./avatar.glb \
--out manifest.json
+# → wrote /…/manifest.json (validated against @three-ws/avatar-schema before writing)
# 2. Validate it
three-ws-avatar validate manifest.json
# → ok: manifest.json
-# 3. Preview the embed snippet
+# 3. Print embed snippets
three-ws-avatar preview manifest.json
-# → resolver URL, <three-ws-avatar> element, and iframe snippet
+# → resolver URL, <three-ws-avatar> element, and <iframe> snippet
```
## Commands
+| Command | What it does |
+|---|---|
+| `init` | Scaffold a new avatar manifest from a wallet and mesh file. |
+| `validate <path>` | Validate an existing manifest against the schema (exit 1 if invalid). |
+| `hash <path>` | Compute the SHA-256 of any file, lowercase hex. |
+| `preview <path>` | Print resolver URL + embeddable `<three-ws-avatar>` and `<iframe>` snippets. |
+
### `init` — scaffold a manifest
```bash
@@ -48,32 +77,33 @@ three-ws-avatar init \
--name <string> \
--mesh <path> \
[--skeleton avaturn|mixamo|rpm|vrm-humanoid|custom] \
- [--mesh-uri <https://... or ipfs://...>] \
+ [--mesh-uri <https://… or ipfs://…>] \
[--id <override>] \
[--out manifest.json]
```
-- `--owner` accepts either a full CAIP-10 (`eip155:1:0x...`) or a shorthand
- `0x...` address (assumed `eip155:1`).
-- `--mesh` is the path to a `.glb`, `.gltf`, or `.vrm` file. SHA-256 and byte
- size are computed automatically; format is inferred from the extension.
-- `--mesh-uri` lets you override the public URL the manifest references — if
- you're going to upload to IPFS or S3, pass that URI here so the manifest
- resolves correctly for everyone else.
-- `--id` defaults to the owner's CAIP-10, or to `--name` if it's an ENS-style
- name (`*.eth` / `*.ws` / `*.sol`).
-- The generated manifest is **validated against `@three-ws/avatar-schema`
- before output** — if you get JSON back, it's spec-compliant by definition.
+| Flag | Required | Notes |
+|---|---|---|
+| `--owner` | yes | Full CAIP-10 (`eip155:1:0x…`) or a shorthand `0x…` address (assumed `eip155:1`). |
+| `--name` | yes | Avatar display name. |
+| `--mesh` | yes | Path to a `.glb` / `.gltf` / `.vrm` file. SHA-256, byte size, and `format` are computed/inferred automatically. |
+| `--skeleton` | no | One of `avaturn` (default) / `mixamo` / `rpm` / `vrm-humanoid` / `custom`. |
+| `--mesh-uri` | no | Public URI to reference instead of the local `file://` path (use your IPFS/S3 URL). |
+| `--id` | no | Override the id; otherwise derived from the owner's CAIP-10, or from `--name` if it's an ENS-style `*.eth` / `*.ws` / `*.sol` name. |
+| `--out` | no | Write to a file (default: print JSON to stdout). |
-### `validate` — check an existing manifest
+The manifest is **validated against `@three-ws/avatar-schema` before output** — if
+you get JSON back, it's spec-compliant by definition.
+
+### `validate` — check a manifest
```bash
-three-ws-avatar validate manifest.json
-# or for machine output
-three-ws-avatar validate manifest.json --json
+three-ws-avatar validate manifest.json # → ok: manifest.json
+three-ws-avatar validate manifest.json --json # → {"valid":true,"path":"manifest.json"}
```
-Exit code 0 if valid, 1 otherwise. Use in CI.
+Exit code `0` if valid, `1` otherwise. On failure, each error prints its JSON
+instance path and message (or a structured `errors` array with `--json`).
### `hash` — SHA-256 a file
@@ -83,35 +113,50 @@ echo "$sha"
# 3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b
```
-`--json` emits `{ path, sha256, bytes }` instead.
+`--json` emits `{ "path", "sha256", "bytes" }` instead of the bare hex line.
-### `preview` — get embed snippets
+### `preview` — embed snippets
```bash
three-ws-avatar preview manifest.json
```
-Outputs three things:
+Prints three things:
+
+1. The resolver URL — `https://three.ws/a/{id}`
+2. A `<three-ws-avatar>` web-component snippet (requires [`@three-ws/avatar`](https://www.npmjs.com/package/@three-ws/avatar) on the page)
+3. A zero-install `<iframe>` embed snippet
-1. The three.ws viewer URL (`https://three.ws/a/{id}`)
-2. A `<three-ws-avatar>` web-component snippet
-3. A drop-in `<iframe>` embed snippet
+Use `--viewer http://localhost:3000` to target a local dev viewer, or `--json` for
+machine-readable output (`{ id, resolverUrl, element, iframe, schemaVersion }`).
-Use `--viewer https://localhost:3000` to point at a local dev viewer instead.
+## CI usage
+
+Avatars are content, and content belongs in a build pipeline:
+
+```bash
+# Fail the build if the mesh bytes drifted from what the manifest attests to.
+expected=$(node -p "require('./manifest.json').mesh.sha256")
+actual=$(three-ws-avatar hash ./avatar.glb)
+[ "$expected" = "$actual" ] || { echo "mesh hash mismatch"; exit 1; }
+
+# Gate every manifest change on schema validity.
+three-ws-avatar validate manifest.json
+```
-## Why a CLI
+## Requirements
-Avatars are content. Content belongs in a build pipeline:
+- Node `>=18`.
+- Bundled dependency: [`@three-ws/avatar-schema`](https://www.npmjs.com/package/@three-ws/avatar-schema) (used to validate every scaffolded and checked manifest).
-- Hash on commit, fail CI if the manifest's `mesh.sha256` doesn't match the
- bytes in the repo.
-- Validate every change to a manifest before it merges.
-- Generate per-environment manifests (dev viewer vs production viewer).
-- Scriptable bulk migration: `find . -name avatar.glb | while read f; do three-ws-avatar init ...; done`
+## Related packages
-RPM has none of this. Their workflow is "open browser, drag sliders, copy
-URL." Ours is "git commit, run CI, ship."
+- [`@three-ws/avatar-schema`](https://www.npmjs.com/package/@three-ws/avatar-schema) — the manifest format this CLI scaffolds and validates.
+- [`@three-ws/avatar`](https://www.npmjs.com/package/@three-ws/avatar) — the runtime SDK and `<three-ws-avatar>` / `<agent-3d>` elements the `preview` snippets embed.
-## License
+## Links
-Apache-2.0 — see [LICENSE](LICENSE).
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/packages/avatar-cli/src/cli.js b/packages/avatar-cli/src/cli.js
index 1a3f87d7b..ac38a3db9 100755
--- a/packages/avatar-cli/src/cli.js
+++ b/packages/avatar-cli/src/cli.js
@@ -3,36 +3,102 @@ import { init } from './commands/init.js';
import { validate } from './commands/validate.js';
import { hash } from './commands/hash.js';
import { preview } from './commands/preview.js';
+import { style, symbols, failure, hint } from './style.js';
-const COMMANDS = { init, validate, hash, preview };
+const COMMANDS = {
+ init: {
+ run: init,
+ summary: 'Scaffold a new avatar manifest from a wallet and mesh',
+ usage: `${style.bold('three-ws-avatar init')} ${style.dim('--owner <id> --name <name> --mesh <path> [options]')}
-const HELP = `three-ws-avatar — on-chain avatar tooling
+ Build a schema-valid avatar manifest. The mesh is hashed (SHA-256) and sized
+ automatically. Prints to stdout, or writes a file with ${style.cyan('--out')}.
-usage:
+ ${style.bold('required')}
+ --owner <caip10|0x…> Owner identity (eip155:1:0x…, or shorthand 0x…)
+ --name <string> Avatar display name
+ --mesh <path> Path to a .glb / .gltf / .vrm file
+
+ ${style.bold('optional')}
+ --skeleton <name> avaturn | mixamo | rpm | vrm-humanoid | custom (default: avaturn)
+ --mesh-uri <url> Public URI for the mesh (default: file:// path)
+ --id <string> Override id (default: derived from owner or name)
+ --out <path> Write manifest to a file instead of stdout
+
+ ${style.dim('example')}
+ three-ws-avatar init --owner 0x742d35… --name "Nicholas" --mesh ./avatar.glb --out manifest.json`,
+ },
+ validate: {
+ run: validate,
+ summary: 'Validate an existing avatar manifest against the schema',
+ usage: `${style.bold('three-ws-avatar validate')} ${style.dim('<path> [--json]')}
+
+ Validate a manifest file against @three-ws/avatar-schema. Exits 0 when valid,
+ 1 otherwise, with each schema error printed in place.
+
+ ${style.dim('example')}
+ three-ws-avatar validate manifest.json`,
+ },
+ hash: {
+ run: hash,
+ summary: 'Compute SHA-256 of a mesh or accessory file (lowercase hex)',
+ usage: `${style.bold('three-ws-avatar hash')} ${style.dim('<path> [--json]')}
+
+ Print the lowercase hex SHA-256 of a file's bytes — pipe-friendly:
+ sha=$(three-ws-avatar hash ./avatar.glb)
+
+ ${style.dim('example')}
+ three-ws-avatar hash ./avatar.glb --json`,
+ },
+ preview: {
+ run: preview,
+ summary: 'Print an embeddable <three-ws-avatar> snippet for a manifest',
+ usage: `${style.bold('three-ws-avatar preview')} ${style.dim('<path> [--viewer <origin>] [--json]')}
+
+ Validate a manifest and print a resolver URL, a <three-ws-avatar> web-component
+ snippet, and a zero-install iframe. Snippets are emitted uncolored so they
+ paste cleanly.
+
+ ${style.dim('example')}
+ three-ws-avatar preview manifest.json --viewer https://three.ws`,
+ },
+};
+
+function topHelp() {
+ const rows = Object.entries(COMMANDS)
+ .map(([name, { summary }]) => ` ${style.cyan(name.padEnd(10))} ${summary}`)
+ .join('\n');
+ return `${style.bold('three-ws-avatar')} ${style.dim('— on-chain avatar tooling')}
+
+${style.bold('usage')}
three-ws-avatar <command> [options]
-commands:
- init Scaffold a new avatar manifest from a wallet and mesh
- validate Validate an existing avatar manifest against the schema
- hash Compute SHA-256 of a mesh or accessory file (returns lowercase hex)
- preview Print an embeddable <three-ws-avatar> snippet for a manifest
+${style.bold('commands')}
+${rows}
-global options:
- --help, -h Show help for a command
+${style.bold('global options')}
+ --help, -h Show help (use ${style.cyan('<command> --help')} for command details)
--version Print version
+ --json Machine-readable output (validate, hash, preview)
+ --no-color Disable colored output
+
+${style.bold('examples')}
+ ${style.dim('three-ws-avatar init --owner 0xabc… --name "Nicholas" --mesh ./avatar.glb --out manifest.json')}
+ ${style.dim('three-ws-avatar validate manifest.json')}
+ ${style.dim('three-ws-avatar hash ./avatar.glb')}
+ ${style.dim('three-ws-avatar preview manifest.json')}
-examples:
- three-ws-avatar init --owner eip155:1:0xabc... --name "Nicholas" --mesh ./avatar.glb --out manifest.json
- three-ws-avatar validate manifest.json
- three-ws-avatar hash ./avatar.glb
- three-ws-avatar preview manifest.json
+${style.dim(`${symbols.arrow} docs: https://three.ws ${symbols.bullet} issues: https://github.com/nirholas/three.ws/issues`)}
`;
+}
-function parseArgs(argv) {
+export function parseArgs(argv) {
const args = { _: [], flags: {} };
for (let i = 0; i < argv.length; i++) {
const tok = argv[i];
- if (tok.startsWith('--')) {
+ if (tok === '--no-color') {
+ args.flags['no-color'] = true;
+ } else if (tok.startsWith('--')) {
const key = tok.slice(2);
const next = argv[i + 1];
if (next === undefined || next.startsWith('-')) {
@@ -50,28 +116,94 @@ function parseArgs(argv) {
return args;
}
-async function main(argv) {
+/** Closest command name within edit distance 2, for "did you mean" hints. */
+function suggestCommand(input) {
+ const names = Object.keys(COMMANDS);
+ let best = null;
+ let bestDist = Infinity;
+ for (const name of names) {
+ const d = levenshtein(input, name);
+ if (d < bestDist) {
+ bestDist = d;
+ best = name;
+ }
+ }
+ return bestDist <= 2 ? best : null;
+}
+
+function levenshtein(a, b) {
+ const m = a.length;
+ const n = b.length;
+ const row = Array.from({ length: n + 1 }, (_, i) => i);
+ for (let i = 1; i <= m; i++) {
+ let prev = row[0];
+ row[0] = i;
+ for (let j = 1; j <= n; j++) {
+ const tmp = row[j];
+ row[j] = Math.min(
+ row[j] + 1,
+ row[j - 1] + 1,
+ prev + (a[i - 1] === b[j - 1] ? 0 : 1),
+ );
+ prev = tmp;
+ }
+ }
+ return row[n];
+}
+
+async function readVersion() {
+ const { readFileSync } = await import('node:fs');
+ const { fileURLToPath } = await import('node:url');
+ const { dirname, resolve } = await import('node:path');
+ const here = dirname(fileURLToPath(import.meta.url));
+ return JSON.parse(readFileSync(resolve(here, '../package.json'), 'utf8')).version;
+}
+
+export async function main(argv) {
const args = parseArgs(argv);
- if (args.flags.version) {
- const { readFileSync } = await import('node:fs');
- const { fileURLToPath } = await import('node:url');
- const { dirname, resolve } = await import('node:path');
- const here = dirname(fileURLToPath(import.meta.url));
- const pkg = JSON.parse(readFileSync(resolve(here, '../package.json'), 'utf8'));
- console.log(pkg.version);
+
+ if (args.flags.version || args.flags.V) {
+ console.log(await readVersion());
return 0;
}
+
const [command, ...rest] = args._;
- if (!command || args.flags.help || args.flags.h) {
- process.stdout.write(HELP);
- return command ? 0 : 1;
+ const wantsHelp = args.flags.help || args.flags.h;
+
+ if (!command) {
+ process.stdout.write(topHelp());
+ return wantsHelp ? 0 : 1;
}
- const fn = COMMANDS[command];
- if (!fn) {
- process.stderr.write(`unknown command: ${command}\n\n${HELP}`);
+
+ const entry = COMMANDS[command];
+ if (!entry) {
+ failure(`unknown command: ${style.bold(command)}`);
+ const guess = suggestCommand(command);
+ if (guess) hint(`did you mean "${guess}"?`);
+ hint(`run "three-ws-avatar --help" to see all commands`);
return 1;
}
- return await fn({ positional: rest, flags: args.flags });
+
+ if (wantsHelp) {
+ process.stdout.write(entry.usage + '\n');
+ return 0;
+ }
+
+ return entry.run({ positional: rest, flags: args.flags });
+}
+
+/** Turn low-level Node errors into a one-line, human message. */
+function describeError(err) {
+ switch (err?.code) {
+ case 'ENOENT':
+ return `file not found: ${err.path ?? err.message}`;
+ case 'EACCES':
+ return `permission denied: ${err.path ?? err.message}`;
+ case 'EISDIR':
+ return `expected a file but got a directory: ${err.path ?? err.message}`;
+ default:
+ return err?.message ?? String(err);
+ }
}
const isDirectInvocation = (() => {
@@ -84,9 +216,7 @@ if (isDirectInvocation) {
main(process.argv.slice(2))
.then((code) => process.exit(code ?? 0))
.catch((err) => {
- process.stderr.write(`error: ${err.message}\n`);
+ failure(describeError(err));
process.exit(1);
});
}
-
-export { main, parseArgs };
diff --git a/packages/avatar-cli/src/commands/hash.js b/packages/avatar-cli/src/commands/hash.js
index 4e9672a18..45d65f5d4 100644
--- a/packages/avatar-cli/src/commands/hash.js
+++ b/packages/avatar-cli/src/commands/hash.js
@@ -1,23 +1,31 @@
import { createHash } from 'node:crypto';
import { readFileSync, statSync } from 'node:fs';
import { resolve } from 'node:path';
+import { failure } from '../style.js';
/**
* `three-ws-avatar hash <path>` — SHA-256 of file bytes, lowercase hex.
*
- * Returns the hash as a single line on stdout so it can be piped:
+ * Prints the hash as a single line on stdout so it can be piped:
* sha=$(three-ws-avatar hash ./avatar.glb)
+ * Stdout stays the raw hex (or JSON with --json) — never decorated.
*/
export async function hash({ positional, flags }) {
const [filePath] = positional;
if (!filePath) {
- process.stderr.write('hash: missing <path> argument\n');
+ failure('hash: missing <path> argument');
return 1;
}
const full = resolve(process.cwd(), filePath);
- const stat = statSync(full);
+ let stat;
+ try {
+ stat = statSync(full);
+ } catch {
+ failure(`file not found: ${filePath}`);
+ return 1;
+ }
if (!stat.isFile()) {
- process.stderr.write(`hash: not a file: ${filePath}\n`);
+ failure(`not a file: ${filePath}`);
return 1;
}
const hex = createHash('sha256').update(readFileSync(full)).digest('hex');
diff --git a/packages/avatar-cli/src/commands/init.js b/packages/avatar-cli/src/commands/init.js
index da77cb12a..6caf4ee7f 100644
--- a/packages/avatar-cli/src/commands/init.js
+++ b/packages/avatar-cli/src/commands/init.js
@@ -2,6 +2,7 @@ import { createHash } from 'node:crypto';
import { readFileSync, writeFileSync, statSync } from 'node:fs';
import { resolve, extname } from 'node:path';
import { assertValid } from '@three-ws/avatar-schema';
+import { style, symbols, success, failure, hint } from '../style.js';
const FORMAT_BY_EXT = {
'.glb': 'glb',
@@ -57,25 +58,36 @@ export async function init({ flags }) {
const meshPath = flags.mesh;
if (!ownerSpec || !name || !meshPath) {
- process.stderr.write(
- 'init: requires --owner, --name, and --mesh.\n' +
- ' e.g. three-ws-avatar init --owner 0x742d35... --name "Nicholas" --mesh ./avatar.glb\n',
- );
+ const missing = [
+ !ownerSpec && '--owner',
+ !name && '--name',
+ !meshPath && '--mesh',
+ ].filter(Boolean);
+ failure(`init: missing required ${missing.length === 1 ? 'flag' : 'flags'} ${style.bold(missing.join(', '))}`);
+ hint('three-ws-avatar init --owner 0x742d35… --name "Nicholas" --mesh ./avatar.glb');
return 1;
}
const owner = inferOwner(ownerSpec);
if (!owner) {
- process.stderr.write(`init: could not parse --owner ${JSON.stringify(ownerSpec)}\n`);
+ failure(`could not parse --owner ${JSON.stringify(ownerSpec)}`);
+ hint('expected CAIP-10 (eip155:1:0x…) or shorthand 0x…');
return 1;
}
const meshFull = resolve(process.cwd(), meshPath);
- const meshStat = statSync(meshFull);
+ let meshStat;
+ try {
+ meshStat = statSync(meshFull);
+ } catch {
+ failure(`mesh file not found: ${meshPath}`);
+ return 1;
+ }
const ext = extname(meshFull).toLowerCase();
const format = FORMAT_BY_EXT[ext];
if (!format) {
- process.stderr.write(`init: unsupported mesh extension ${ext} (expected .glb/.gltf/.vrm)\n`);
+ failure(`unsupported mesh extension ${style.bold(ext || '(none)')}`);
+ hint('expected .glb, .gltf, or .vrm');
return 1;
}
@@ -100,7 +112,13 @@ export async function init({ flags }) {
if (flags.out) {
const outPath = resolve(process.cwd(), flags.out);
writeFileSync(outPath, json);
- process.stderr.write(`wrote ${outPath}\n`);
+ success(`wrote ${style.bold(outPath)}`);
+ process.stderr.write(
+ ` ${style.dim(`${symbols.bullet} id ${manifest.id}`)}\n` +
+ ` ${style.dim(`${symbols.bullet} skeleton ${manifest.skeleton}`)}\n` +
+ ` ${style.dim(`${symbols.bullet} mesh ${format} · ${manifest.mesh.kBytes} kB · sha256:${manifest.mesh.sha256.slice(0, 12)}…`)}\n`,
+ );
+ process.stderr.write(` ${style.dim(`${symbols.arrow} next: three-ws-avatar preview ${flags.out}`)}\n`);
} else {
process.stdout.write(json);
}
diff --git a/packages/avatar-cli/src/commands/preview.js b/packages/avatar-cli/src/commands/preview.js
index 82f2521a5..af9f8402e 100644
--- a/packages/avatar-cli/src/commands/preview.js
+++ b/packages/avatar-cli/src/commands/preview.js
@@ -1,6 +1,7 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { assertValid } from '@three-ws/avatar-schema';
+import { style, heading, failure } from '../style.js';
const DEFAULT_VIEWER = 'https://three.ws';
@@ -17,11 +18,18 @@ const DEFAULT_VIEWER = 'https://three.ws';
export async function preview({ positional, flags }) {
const [filePath] = positional;
if (!filePath) {
- process.stderr.write('preview: missing <path> argument\n');
+ failure('preview: missing <path> argument');
return 1;
}
const full = resolve(process.cwd(), filePath);
- const manifest = JSON.parse(readFileSync(full, 'utf8'));
+ let manifest;
+ try {
+ manifest = JSON.parse(readFileSync(full, 'utf8'));
+ } catch (err) {
+ failure(`could not read manifest at ${filePath}`);
+ process.stderr.write(` ${style.dim(err.message)}\n`);
+ return 1;
+ }
assertValid(manifest);
const viewer = (flags.viewer || DEFAULT_VIEWER).replace(/\/$/, '');
@@ -43,15 +51,15 @@ export async function preview({ positional, flags }) {
return 0;
}
- console.log(`# ${manifest.name} (${manifest.id})`);
+ console.log(`${style.bold(manifest.name)} ${style.dim(`(${manifest.id})`)}`);
console.log('');
- console.log('# resolver url');
+ console.log(heading('resolver url'));
console.log(resolverUrl);
console.log('');
- console.log('# web component (requires @three-ws/avatar on the page)');
+ console.log(heading('web component — requires @three-ws/avatar on the page'));
console.log(element);
console.log('');
- console.log('# iframe (zero-install)');
+ console.log(heading('iframe — zero-install'));
console.log(iframe);
return 0;
}
diff --git a/packages/avatar-cli/src/commands/validate.js b/packages/avatar-cli/src/commands/validate.js
index 464416cba..dcd052b47 100644
--- a/packages/avatar-cli/src/commands/validate.js
+++ b/packages/avatar-cli/src/commands/validate.js
@@ -1,6 +1,7 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { validate as schemaValidate } from '@three-ws/avatar-schema';
+import { style, symbols, success, failure } from '../style.js';
/**
* `three-ws-avatar validate <path>` — validate a manifest file against the schema.
@@ -10,7 +11,7 @@ import { validate as schemaValidate } from '@three-ws/avatar-schema';
export async function validate({ positional, flags }) {
const [filePath] = positional;
if (!filePath) {
- process.stderr.write('validate: missing <path> argument\n');
+ failure('validate: missing <path> argument');
return 1;
}
const full = resolve(process.cwd(), filePath);
@@ -18,7 +19,8 @@ export async function validate({ positional, flags }) {
try {
manifest = JSON.parse(readFileSync(full, 'utf8'));
} catch (err) {
- process.stderr.write(`validate: could not parse JSON at ${filePath}: ${err.message}\n`);
+ failure(`could not parse JSON at ${filePath}`);
+ process.stderr.write(` ${style.dim(err.message)}\n`);
return 1;
}
@@ -27,7 +29,7 @@ export async function validate({ positional, flags }) {
if (flags.json) {
console.log(JSON.stringify({ valid: true, path: filePath }));
} else {
- console.log(`ok: ${filePath}`);
+ success(`${style.bold(filePath)} is valid`);
}
return 0;
}
@@ -35,9 +37,11 @@ export async function validate({ positional, flags }) {
if (flags.json) {
console.log(JSON.stringify({ valid: false, path: filePath, errors: result.errors }));
} else {
- process.stderr.write(`invalid: ${filePath}\n`);
+ const count = result.errors.length;
+ failure(`${style.bold(filePath)} is invalid ${style.dim(`(${count} ${count === 1 ? 'error' : 'errors'})`)}`);
for (const err of result.errors) {
- process.stderr.write(` ${err.instancePath || '/'} ${err.message}\n`);
+ const where = style.cyan(err.instancePath || '/');
+ process.stderr.write(` ${style.red(symbols.bullet)} ${where} ${err.message}\n`);
}
}
return 1;
diff --git a/packages/avatar-cli/src/style.js b/packages/avatar-cli/src/style.js
new file mode 100644
index 000000000..aa6917e18
--- /dev/null
+++ b/packages/avatar-cli/src/style.js
@@ -0,0 +1,81 @@
+// Zero-dependency terminal styling for the three-ws-avatar CLI.
+//
+// Decoration is applied only to human-facing framing (messages, headers, help).
+// Machine payloads — the hash hex, `--json` output, and copy-paste embed
+// snippets — are always emitted uncolored so they stay pipe- and paste-safe.
+//
+// Color is honored unless disabled by the NO_COLOR convention
+// (https://no-color.org), a `--no-color` flag, or a non-TTY stdout — and is
+// forced on by FORCE_COLOR.
+
+const noColorEnv = process.env.NO_COLOR != null && process.env.NO_COLOR !== '';
+const noColorFlag = process.argv.includes('--no-color');
+const forceColor = ['1', '2', '3', 'true'].includes(process.env.FORCE_COLOR ?? '');
+
+export const colorEnabled =
+ !noColorFlag && !noColorEnv && (forceColor || Boolean(process.stdout.isTTY) || Boolean(process.stderr.isTTY));
+
+const CODES = {
+ reset: 0,
+ bold: 1,
+ dim: 2,
+ red: 31,
+ green: 32,
+ yellow: 33,
+ blue: 34,
+ magenta: 35,
+ cyan: 36,
+ gray: 90,
+};
+
+function paint(code, text) {
+ if (!colorEnabled) return text;
+ return `\x1b[${code}m${text}\x1b[0m`;
+}
+
+export const style = {
+ bold: (t) => paint(CODES.bold, t),
+ dim: (t) => paint(CODES.dim, t),
+ red: (t) => paint(CODES.red, t),
+ green: (t) => paint(CODES.green, t),
+ yellow: (t) => paint(CODES.yellow, t),
+ blue: (t) => paint(CODES.blue, t),
+ magenta: (t) => paint(CODES.magenta, t),
+ cyan: (t) => paint(CODES.cyan, t),
+ gray: (t) => paint(CODES.gray, t),
+};
+
+// Glyphs degrade to ASCII when stdout is not a TTY (e.g. CI logs, pipes).
+const unicode = Boolean(process.stdout.isTTY) || forceColor;
+export const symbols = {
+ tick: unicode ? '✔' : 'ok',
+ cross: unicode ? '✖' : 'x',
+ warn: unicode ? '⚠' : '!',
+ arrow: unicode ? '›' : '>',
+ bullet: unicode ? '•' : '-',
+};
+
+/** Success line → stdout (human framing only). */
+export function success(message) {
+ process.stdout.write(`${style.green(symbols.tick)} ${message}\n`);
+}
+
+/** Failure line → stderr. */
+export function failure(message) {
+ process.stderr.write(`${style.red(symbols.cross)} ${message}\n`);
+}
+
+/** Warning line → stderr. */
+export function warn(message) {
+ process.stderr.write(`${style.yellow(symbols.warn)} ${message}\n`);
+}
+
+/** Dim hint line → stderr, indented under a preceding message. */
+export function hint(message) {
+ process.stderr.write(` ${style.dim(message)}\n`);
+}
+
+/** Section header for human-readable stdout blocks. */
+export function heading(text) {
+ return style.dim(`${symbols.arrow} ${text}`);
+}
diff --git a/packages/avatar-cli/test/cli.test.js b/packages/avatar-cli/test/cli.test.js
index 69793e172..567db3181 100644
--- a/packages/avatar-cli/test/cli.test.js
+++ b/packages/avatar-cli/test/cli.test.js
@@ -5,6 +5,9 @@ import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { main } from '../src/cli.js';
+// Strip ANSI color codes so assertions are independent of TTY/FORCE_COLOR state.
+const stripAnsi = (s) => s.replace(/\x1b\[[0-9;]*m/g, '');
+
function captured(fn) {
const out = [];
const err = [];
@@ -23,7 +26,7 @@ function captured(fn) {
out.push(args.map(String).join(' ') + '\n');
};
return fn()
- .then((code) => ({ code, stdout: out.join(''), stderr: err.join('') }))
+ .then((code) => ({ code, stdout: stripAnsi(out.join('')), stderr: stripAnsi(err.join('')) }))
.finally(() => {
process.stdout.write = origOut;
process.stderr.write = origErr;
@@ -52,16 +55,30 @@ test('help is shown when no command given', async () => {
assert.ok(stdout.includes('init'));
});
-test('help is shown for --help', async () => {
+test('explicit --help exits 0', async () => {
const { code, stdout } = await captured(() => main(['--help']));
- assert.equal(code, 1);
- assert.ok(stdout.includes('commands:'));
+ assert.equal(code, 0);
+ assert.ok(stdout.includes('commands'));
});
-test('unknown command returns 1', async () => {
- const { code, stderr } = await captured(() => main(['nope']));
+test('per-command --help prints command usage and exits 0', async () => {
+ const { code, stdout } = await captured(() => main(['init', '--help']));
+ assert.equal(code, 0);
+ assert.ok(stdout.includes('three-ws-avatar init'));
+ assert.ok(stdout.includes('--owner'));
+});
+
+test('unknown command returns 1 and suggests a close match', async () => {
+ const { code, stderr } = await captured(() => main(['vlaidate']));
assert.equal(code, 1);
assert.ok(stderr.includes('unknown command'));
+ assert.ok(stderr.includes('did you mean "validate"?'));
+});
+
+test('--version prints the package version', async () => {
+ const { code, stdout } = await captured(() => main(['--version']));
+ assert.equal(code, 0);
+ assert.match(stdout.trim(), /^\d+\.\d+\.\d+/);
});
test('hash command returns sha256 of file', async () => {
@@ -161,7 +178,7 @@ test('validate passes for a freshly generated manifest', async () => {
);
const { code, stdout } = await captured(() => main(['validate', outPath]));
assert.equal(code, 0);
- assert.ok(stdout.includes('ok'));
+ assert.ok(stdout.includes('valid'));
});
test('validate fails for malformed manifest', async () => {
diff --git a/packages/avatar-schema/README.md b/packages/avatar-schema/README.md
index 32dd4a433..9da03ee51 100644
--- a/packages/avatar-schema/README.md
+++ b/packages/avatar-schema/README.md
@@ -1,22 +1,37 @@
-# @three-ws/avatar-schema
+<h1 align="center">@three-ws/avatar-schema</h1>
-JSON Schema and validator for **three.ws on-chain avatar manifests** — the
-canonical, hash-anchored format any cross-chain client can use to resolve and
-verify an avatar.
+<p align="center"><strong>JSON Schema and validator for three.ws on-chain avatar manifests — the canonical, hash-anchored avatar format.</strong></p>
-This is the on-chain equivalent of Ready Player Me's
-[content-validation-schemas](https://github.com/readyplayerme/content-validation-schemas):
-a tiny, dependency-light spec package that lets any third-party viewer,
-indexer, or marketplace integrate with three.ws avatars without pulling in the
-full runtime.
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/avatar-schema"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/avatar-schema?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/avatar-schema"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/avatar-schema?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/avatar-schema?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/avatar-schema?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#usage">Usage</a> ·
+ <a href="#manifest-fields">Manifest fields</a> ·
+ <a href="#api">API</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> `@three-ws/avatar-schema` is the canonical, hash-anchored format any cross-chain
+> client can use to resolve and verify a three.ws avatar. It's a tiny,
+> dependency-light spec package — bundled JSON Schema (`avatar.v1.json`) plus an
+> Ajv-backed validator — so any third-party viewer, indexer, or marketplace can
+> integrate with three.ws avatars without pulling in the full runtime.
## Install
```bash
-npm i @three-ws/avatar-schema
+npm install @three-ws/avatar-schema
```
-## Use
+## Usage
```js
import { validate, assertValid } from '@three-ws/avatar-schema';
@@ -25,77 +40,83 @@ const manifest = await (await fetch('https://three.ws/avatars/nicholas.eth.json'
const result = validate(manifest);
if (!result.valid) {
- console.error(result.errors);
+ console.error(result.errors); // Ajv ErrorObject[]
}
-// Or throw on first failure:
+// Or throw on the first failure (useful in pipelines):
assertValid(manifest);
```
-The raw JSON Schema is exported separately so you can bind it to any other
-validator (Python `jsonschema`, Go `gojsonschema`, etc.):
+The raw JSON Schema is exported separately so you can bind it to any validator
+(Python `jsonschema`, Go `gojsonschema`, etc.):
```js
-import schema from '@three-ws/avatar-schema/schema';
+import schema from '@three-ws/avatar-schema/schema'; // ./schema/avatar.v1.json
+// or the version-pinned subpath:
+import schemaV1 from '@three-ws/avatar-schema/schema/v1';
```
-Or by absolute URL: <https://three.ws/schema/avatar.v1.json>.
+It's also resolvable by absolute URL: <https://three.ws/schema/avatar.v1.json>.
-## What's in a manifest
+## Manifest fields
An on-chain avatar manifest binds a 3D mesh (and optional animations and
accessories) to an owner identity on a specific chain. Every binary asset is
-referenced by content-addressed URI plus SHA-256, so clients can verify they
-fetched the exact bytes the manifest signer attested to.
+referenced by URI plus SHA-256, so clients can verify they fetched the exact bytes
+the manifest signer attested to.
| Field | Required | Purpose |
|---|---|---|
-| `schemaVersion` | yes | Always `1` for this version of the schema |
-| `id` | yes | CAIP-10 account id or `*.eth` / `*.ws` / `*.sol` name |
-| `name` | yes | Human-readable name |
-| `mesh` | yes | URI + SHA-256 + format (`glb`/`gltf`/`vrm`) |
-| `skeleton` | yes | One of `avaturn`/`mixamo`/`rpm`/`vrm-humanoid`/`custom` |
-| `animations` | no | Pointer to an animation-manifest URI + SHA-256 |
-| `accessories` | no | Array of slotted accessories (hat, glasses, etc.) |
-| `traits` | no | NFT-style flat key/value attributes |
-| `owner` | yes | `{ chain, address }` — current on-chain holder |
-| `creator` | no | Original creator (omit if same as owner) |
-| `createdAt` | yes | ISO 8601 UTC timestamp |
-| `signature` | no | EIP-712 / ed25519 / secp256k1 signature over the manifest |
-
-See [examples/basic.json](examples/basic.json) for a fully-populated example.
-
-## Why this exists
-
-Ready Player Me operates a single avatar service. There is no need for an
-open, verifiable manifest format because RPM is the source of truth.
-
-three.ws is decentralized: avatars are owned by wallets on multiple chains and
-rendered by viewers the avatar owner doesn't control. A common schema lets:
-
-- **Viewers** validate an avatar before rendering it, instead of trusting any
- URL they're handed.
-- **Indexers** rebuild a global view of all three.ws avatars by scanning
- on-chain registrations and pulling manifests.
-- **Marketplaces** verify ownership and accessory composition without
- bespoke per-vendor logic.
-- **Cross-chain bridges** carry the same identity across EVM, Solana, and
- beyond using CAIP-2 / CAIP-10 ids.
+| `schemaVersion` | yes | Always `1` for this version of the schema. |
+| `id` | yes | CAIP-10 account id, or an ENS-style `*.eth` / `*.ws` / `*.sol` name. |
+| `name` | yes | Human-readable name. |
+| `mesh` | yes | `{ uri, sha256, format, kBytes? }` — `format` is `glb`/`gltf`/`vrm`. |
+| `skeleton` | yes | One of `avaturn`/`mixamo`/`rpm`/`vrm-humanoid`/`custom`. |
+| `animations` | no | `{ uri, sha256 }` pointer to an animation manifest. |
+| `accessories` | no | Array of `{ slot, uri, sha256 }` (slots: `head`, `eyes`, `ears`, `neck`, `torso`, `back`, `hands`, `waist`, `feet`). |
+| `traits` | no | Flat key/value attributes (`string` / `number` / `boolean`). |
+| `owner` | yes | `{ chain, address }` — current on-chain holder; `chain` is a CAIP-2 id. |
+| `creator` | no | `{ chain, address }` original creator (omit if same as owner). |
+| `createdAt` | yes | ISO 8601 UTC timestamp. |
+| `signature` | no | `{ algorithm, value, signer }` — `eip-712` / `ed25519` / `secp256k1`. |
+
+See [examples/basic.json](examples/basic.json) for a fully-populated manifest.
+TypeScript consumers get an `AvatarManifestV1` interface and the supporting types
+(`MeshRef`, `AccessoryRef`, `ChainAccount`, `Signature`, …) from the package types.
+
+## API
+
+| Export | Signature | Notes |
+|---|---|---|
+| `validate(manifest)` | `(unknown) => { valid: true } \| { valid: false, errors }` | Non-throwing. `errors` is Ajv's `ErrorObject[]`. |
+| `assertValid(manifest)` | `(unknown) => void` | Throws `Error` with a joined message on the first invalid manifest; narrows to `AvatarManifestV1`. |
+| `schema` | `object` | The parsed `avatar.v1.json` JSON Schema. |
+| `SCHEMA_VERSION` | `1` | Integer schema version. |
+| `SCHEMA_ID` | `string` | `https://three.ws/schema/avatar.v1.json`. |
+
+Validation is backed by [Ajv](https://ajv.js.org) (2020 dialect) with `ajv-formats`,
+compiled once at module load.
## Versioning
The schema uses an integer `schemaVersion`. Breaking changes get a new file
-(`avatar.v2.json`), a new const, and a new published major version of this
-package. Old versions remain valid forever.
+(`avatar.v2.json`), a new `SCHEMA_VERSION` const, and a new published major version
+of this package. Old versions remain valid forever.
-## Test
+## Requirements
-```bash
-npm test
-```
+- Node `>=18`.
+- Bundled dependencies: `ajv`, `ajv-formats` (no peer deps).
+- Run the test suite with `npm test` (Node's built-in `node:test`, no extra runner).
+
+## Related packages
-Tests use Node's built-in `node:test`. No extra runner required.
+- [`@three-ws/avatar-cli`](https://www.npmjs.com/package/@three-ws/avatar-cli) — scaffold, validate, hash, and preview manifests in this format from your shell or CI.
+- [`@three-ws/avatar`](https://www.npmjs.com/package/@three-ws/avatar) — the runtime SDK that renders avatars resolved from these manifests.
-## License
+## Links
-Apache-2.0 — see [LICENSE](LICENSE).
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/packages/ibm-watsonx-mcp/README.md b/packages/ibm-watsonx-mcp/README.md
index 6031078b1..6f37961f6 100644
--- a/packages/ibm-watsonx-mcp/README.md
+++ b/packages/ibm-watsonx-mcp/README.md
@@ -1,72 +1,107 @@
-# @three-ws/ibm-watsonx-mcp
+<h1 align="center">@three-ws/ibm-watsonx-mcp</h1>
-An [MCP](https://modelcontextprotocol.io) server for **IBM watsonx.ai**. It exposes IBM Granite (and any model in your watsonx.ai account) to MCP clients — Claude Desktop, Claude Code, Cursor, and any other MCP host — as five tools: chat, text generation, embeddings, tokenization, and model discovery.
+<p align="center"><strong>MCP server for IBM watsonx.ai — chat, generation, embeddings, tokenization, forecasting, and model discovery, on your own IBM Cloud account.</strong></p>
-The server talks **directly** to the watsonx.ai as-a-Service REST API using **your own IBM Cloud credentials**. It mints an IAM bearer token from your API key, caches it until just before expiry, and scopes every call to your project. No intermediary backend, no telemetry, no mock data.
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/ibm-watsonx-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/ibm-watsonx-mcp?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/ibm-watsonx-mcp"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/ibm-watsonx-mcp?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/ibm-watsonx-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/ibm-watsonx-mcp?color=339933&logo=node.js">
+ <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas%2Fibm--watsonx-6e56cf"></a>
+ <a href="https://three.ws"><img alt="three.ws" src="https://img.shields.io/badge/built%20by-three.ws-000"></a>
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#tools">Tools</a> ·
+ <a href="#requirements">Requirements</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes IBM watsonx.ai — IBM Granite foundation models and anything else in your account — to MCP clients such as Claude Desktop, Claude Code, and Cursor. It talks **directly** to the watsonx.ai as-a-Service REST API with **your own IBM Cloud credentials**: it mints an IAM bearer token from your API key, caches it until just before expiry, and scopes every call to your project. No intermediary backend, no telemetry, no mock data.
> Community-built and not affiliated with IBM. Registry name: `io.github.nirholas/ibm-watsonx`.
-## Tools
+## Install
-| Tool | What it does |
-| --- | --- |
-| `watsonx_chat` | Chat completion from a list of role/content messages. Returns reply + token usage. |
-| `watsonx_generate` | Raw prompt completion with decoding control (greedy/sample, stop sequences). |
-| `watsonx_embed` | Embedding vectors for one or more texts. Returns one vector per input. |
-| `watsonx_tokenize` | Token count (and optionally the tokens) for a text against a model tokenizer. |
-| `watsonx_list_models` | List foundation models available to your account/region, optionally filtered. |
+```bash
+npm install @three-ws/ibm-watsonx-mcp
+```
-## Prerequisites
+Run it directly with `npx` (no install needed):
-1. An IBM Cloud account with watsonx.ai provisioned — [sign up](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx) (free tier available).
-2. An **IBM Cloud API key** — create one at <https://cloud.ibm.com/iam/apikeys>.
-3. Your **watsonx.ai project id** — open the project → **Manage** → **General** → **Project ID**.
+```bash
+WATSONX_API_KEY=... WATSONX_PROJECT_ID=... npx @three-ws/ibm-watsonx-mcp
+```
-## Configuration
+Or install globally to get the `ibm-watsonx-mcp` binary on your `PATH`:
-| Env var | Required | Default |
-| --- | --- | --- |
-| `WATSONX_API_KEY` | ✅ | — |
-| `WATSONX_PROJECT_ID` | ✅ (or `WATSONX_SPACE_ID`) | — |
-| `WATSONX_URL` | | `https://us-south.ml.cloud.ibm.com` |
-| `WATSONX_MODEL_ID` | | `ibm/granite-3-8b-instruct` |
-| `WATSONX_EMBED_MODEL_ID` | | `ibm/granite-embedding-278m-multilingual` |
-| `WATSONX_API_VERSION` | | `2024-05-31` |
+```bash
+npm install -g @three-ws/ibm-watsonx-mcp
+```
-Regional hosts: `us-south`, `eu-de`, `eu-gb`, `jp-tok`, `au-syd`, `ca-tor` — e.g. `https://eu-de.ml.cloud.ibm.com`.
+## Quick start
+
+With Claude Code, one command:
-## Use with Claude Desktop / Claude Code / Cursor
+```bash
+claude mcp add ibm-watsonx -e WATSONX_API_KEY=... -e WATSONX_PROJECT_ID=... -- npx -y @three-ws/ibm-watsonx-mcp
+```
-Add to your MCP config (`claude_desktop_config.json`, or via `claude mcp add`):
+Or add the server to your MCP client config (`claude_desktop_config.json`, Cursor's `mcp.json`):
```json
{
- "mcpServers": {
- "ibm-watsonx": {
- "command": "npx",
- "args": ["-y", "@three-ws/ibm-watsonx-mcp"],
- "env": {
- "WATSONX_API_KEY": "your-ibm-cloud-api-key",
- "WATSONX_PROJECT_ID": "your-watsonx-project-id"
- }
- }
- }
+ "mcpServers": {
+ "ibm-watsonx": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/ibm-watsonx-mcp"],
+ "env": {
+ "WATSONX_API_KEY": "your-ibm-cloud-api-key",
+ "WATSONX_PROJECT_ID": "your-watsonx-project-id"
+ }
+ }
+ }
}
```
-## Run standalone
+Restart the client and the six tools below appear. Inspect the surface manually with the MCP Inspector:
```bash
-WATSONX_API_KEY=... WATSONX_PROJECT_ID=... npx @three-ws/ibm-watsonx-mcp
+npx -y @modelcontextprotocol/inspector npx @three-ws/ibm-watsonx-mcp
```
-Inspect the tool surface with the MCP Inspector:
+## Tools
-```bash
-npx -y @modelcontextprotocol/inspector npx @three-ws/ibm-watsonx-mcp
-```
+| Tool | What it does |
+| --------------------- | ----------------------------------------------------------------------------------------------- |
+| `watsonx_chat` | Chat completion from a list of role/content messages. Returns the reply plus token usage. |
+| `watsonx_generate` | Raw prompt completion with decoding control (greedy/sample, stop sequences). |
+| `watsonx_embed` | Embedding vectors for one or more texts (up to 1000). One vector per input plus dimensionality. |
+| `watsonx_tokenize` | Token count (and optionally the tokens) for a text against a model tokenizer. |
+| `watsonx_forecast` | Zero-shot time-series forecasting with an IBM Granite TimeSeries (TinyTimeMixer) model. |
+| `watsonx_list_models` | List the foundation models available to your account and region, optionally filtered. |
+
+Every tool is a read-only model-inference call — nothing in your environment or IBM account is modified — and declares MCP tool annotations (`readOnlyHint`, `openWorldHint`, `idempotentHint`) so clients can reason about side effects.
+
+### Input parameters
+
+**`watsonx_chat`** — `messages` (required: array of `{ role, content }`, roles `system`/`user`/`assistant`), `model`, `max_tokens` (1–4096), `temperature` (0–2), `top_p` (0–1).
+
+**`watsonx_generate`** — `input` (required), `model`, `max_new_tokens` (1–4096), `temperature` (0–2), `decoding_method` (`greedy`/`sample`), `stop_sequences`.
+
+**`watsonx_embed`** — `inputs` (required: 1–1000 texts), `model`.
+
+**`watsonx_tokenize`** — `input` (required), `model`, `return_tokens` (boolean).
+
+**`watsonx_forecast`** — `timestamps` (required: ISO-8601, uniform cadence, oldest first), `values` (required: numeric, same length), `freq` (required: pandas cadence, e.g. `1h`, `15min`, `1D`), `model`, `target_column`, `prediction_length` (1–96).
+
+**`watsonx_list_models`** — `filter` (e.g. `function_text_generation`, `function_embedding`), `limit` (1–200, default 100).
-## Example calls
+### Example calls
```jsonc
// watsonx_chat
@@ -78,17 +113,45 @@ npx -y @modelcontextprotocol/inspector npx @three-ws/ibm-watsonx-mcp
// watsonx_embed
{ "inputs": ["lakehouse", "data warehouse"] }
+// watsonx_forecast
+{ "timestamps": ["2025-01-01T00:00:00Z", "2025-01-01T01:00:00Z"], "values": [1200, 1180], "freq": "1h", "prediction_length": 24 }
+
// watsonx_list_models
{ "filter": "function_embedding" }
```
## How auth works
-`WATSONX_API_KEY` is exchanged for a short-lived IAM bearer token at
-`https://iam.cloud.ibm.com/identity/token` (`grant_type=urn:ibm:params:oauth:grant-type:apikey`).
-The token is cached in-process and refreshed ~5 minutes before it expires. Your API
-key never leaves your machine except in that single IAM exchange.
+`WATSONX_API_KEY` is exchanged for a short-lived IAM bearer token at `https://iam.cloud.ibm.com/identity/token` (`grant_type=urn:ibm:params:oauth:grant-type:apikey`). The token is cached in-process and refreshed about five minutes before it expires. Your API key never leaves your machine except in that single IAM exchange.
+
+## Requirements
+
+- **Node.js >= 20.**
+- An IBM Cloud account with watsonx.ai provisioned — [sign up](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx) (free tier available).
+- An **IBM Cloud API key** — create one at <https://cloud.ibm.com/iam/apikeys>.
+- Your **watsonx.ai project id** — open the project → **Manage** → **General** → **Project ID** (or a deployment space id).
+
+### Environment variables
+
+| Variable | Required | Default |
+| ------------------------ | ----------------------------------- | ----------------------------------------- |
+| `WATSONX_API_KEY` | yes | — |
+| `WATSONX_PROJECT_ID` | yes (or `WATSONX_SPACE_ID`) | — |
+| `WATSONX_SPACE_ID` | alternative to `WATSONX_PROJECT_ID` | — |
+| `WATSONX_URL` | no | `https://us-south.ml.cloud.ibm.com` |
+| `WATSONX_MODEL_ID` | no | `ibm/granite-3-8b-instruct` |
+| `WATSONX_EMBED_MODEL_ID` | no | `ibm/granite-embedding-278m-multilingual` |
+| `WATSONX_API_VERSION` | no | `2024-05-31` |
+
+Regional hosts: `us-south`, `eu-de`, `eu-gb`, `jp-tok`, `au-syd`, `ca-tor` — e.g. `https://eu-de.ml.cloud.ibm.com`.
+
+## Related
+
+- [`@three-ws/ibm-x402-mcp`](https://www.npmjs.com/package/@three-ws/ibm-x402-mcp) — the same IBM Granite tools as pay-per-use x402 endpoints (USDC on Solana), so callers need no IBM account of their own.
-## License
+## Links
-Apache-2.0
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/packages/ibm-watsonx-mcp/package.json b/packages/ibm-watsonx-mcp/package.json
index 8c90fa924..e61587120 100644
--- a/packages/ibm-watsonx-mcp/package.json
+++ b/packages/ibm-watsonx-mcp/package.json
@@ -50,6 +50,7 @@
},
"scripts": {
"start": "node src/index.js",
+ "test": "node --test \"test/**/*.test.mjs\"",
"inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
},
"dependencies": {
diff --git a/packages/ibm-watsonx-mcp/test/tools.test.mjs b/packages/ibm-watsonx-mcp/test/tools.test.mjs
new file mode 100644
index 000000000..994ed47f7
--- /dev/null
+++ b/packages/ibm-watsonx-mcp/test/tools.test.mjs
@@ -0,0 +1,74 @@
+// Smoke tests for the watsonx tool surface. Tool enumeration is secret-free:
+// buildTools(client) only closes over the client for handler execution, so the
+// definitions can be inspected without any WATSONX_* credentials.
+//
+// Run: node --test packages/ibm-watsonx-mcp/test/tools.test.mjs
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { buildTools } from '../src/tools.js';
+
+// Guarantee enumeration works with no credentials in the environment.
+delete process.env.WATSONX_API_KEY;
+delete process.env.WATSONX_PROJECT_ID;
+delete process.env.WATSONX_SPACE_ID;
+
+const tools = buildTools(null);
+const definitions = tools.map((t) => t.definition);
+
+// Generative tools may return different output for identical input; the
+// deterministic ones always return the same result for the same arguments.
+const GENERATIVE = ['watsonx_chat', 'watsonx_generate', 'watsonx_forecast'];
+const DETERMINISTIC = ['watsonx_embed', 'watsonx_tokenize', 'watsonx_list_models'];
+
+test('exposes exactly the six documented tools', () => {
+ const names = definitions.map((d) => d.name).sort();
+ assert.deepEqual(names, [...GENERATIVE, ...DETERMINISTIC].sort());
+});
+
+test('tool names are unique', () => {
+ const names = definitions.map((d) => d.name);
+ assert.equal(new Set(names).size, names.length);
+});
+
+test('every tool has a non-empty description and human title', () => {
+ for (const d of definitions) {
+ assert.ok(
+ typeof d.description === 'string' && d.description.trim().length > 0,
+ `${d.name} description`,
+ );
+ assert.ok(typeof d.title === 'string' && d.title.trim().length > 0, `${d.name} title`);
+ }
+});
+
+test('every tool has an object input schema', () => {
+ for (const d of definitions) {
+ assert.ok(d.inputSchema, `${d.name} inputSchema missing`);
+ assert.equal(d.inputSchema.type, 'object', `${d.name} inputSchema.type`);
+ }
+});
+
+test('every tool is annotated read-only and open-world (pure inference calls)', () => {
+ for (const d of definitions) {
+ assert.ok(d.annotations, `${d.name} annotations missing`);
+ assert.equal(d.annotations.readOnlyHint, true, `${d.name} readOnlyHint`);
+ assert.equal(d.annotations.openWorldHint, true, `${d.name} openWorldHint`);
+ }
+});
+
+test('generative tools are marked non-idempotent; deterministic tools idempotent', () => {
+ const byName = new Map(definitions.map((d) => [d.name, d]));
+ for (const name of GENERATIVE) {
+ assert.equal(byName.get(name).annotations.idempotentHint, false, `${name} idempotentHint`);
+ }
+ for (const name of DETERMINISTIC) {
+ assert.equal(byName.get(name).annotations.idempotentHint, true, `${name} idempotentHint`);
+ }
+});
+
+test('every tool pairs its definition with a handler function', () => {
+ for (const t of tools) {
+ assert.equal(typeof t.handler, 'function', `${t.definition.name} handler`);
+ }
+});
diff --git a/packages/ibm-x402-mcp/README.md b/packages/ibm-x402-mcp/README.md
index a793d67fe..232f4660b 100644
--- a/packages/ibm-x402-mcp/README.md
+++ b/packages/ibm-x402-mcp/README.md
@@ -1,40 +1,48 @@
-# @three-ws/ibm-x402-mcp
+<h1 align="center">@three-ws/ibm-x402-mcp</h1>
+
+<p align="center"><strong>Pay-per-use IBM Granite AI over MCP — chat, code, embeddings, analysis, and forecasting, billed in USDC on Solana. No IBM account required.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/ibm-x402-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/ibm-x402-mcp?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/ibm-x402-mcp"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/ibm-x402-mcp?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/ibm-x402-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/ibm-x402-mcp?color=339933&logo=node.js">
+ <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas%2Fibm--x402--mcp-6e56cf"></a>
+ <a href="https://three.ws"><img alt="three.ws" src="https://img.shields.io/badge/built%20by-three.ws-000"></a>
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#tools">Tools</a> ·
+ <a href="#payment-flow">Payment flow</a> ·
+ <a href="#requirements">Requirements</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
-**The world's first x402-enabled MCP server on IBM Cloud.**
-
-An [MCP](https://modelcontextprotocol.io) server that exposes IBM Granite foundation models as pay-per-use tools via the [x402](https://x402.org) payment protocol. End users pay **USDC on Solana** per call — no IBM Cloud account required.
+---
-> Built by [three.ws](https://three.ws). Listed on IBM Cloud Partner Center.
-> Full developer guide: **[docs/ibm-x402-mcp.md](https://github.com/nirholas/three.ws/blob/main/docs/ibm-x402-mcp.md)**.
+> A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes IBM Granite foundation models as pay-per-use tools via the [x402](https://x402.org) payment protocol. End users pay **USDC on Solana** per call — no IBM Cloud account of their own. The server operator supplies IBM credentials (`WATSONX_*`) and a receiving Solana wallet (`MCP_SVM_PAYMENT_ADDRESS`); callers supply only USDC. One free tool (`ibm_granite_getting_started`) explains prices and the flow before any payment.
----
+> Built by [three.ws](https://three.ws). Community-built and not affiliated with IBM.
## How it works
-1. An MCP client (Claude Desktop, Claude Code, Cursor, etc.) connects to this server.
+1. An MCP client (Claude Desktop, Claude Code, Cursor, or an agent) connects to this server.
2. The client calls a tool — e.g. `ibm_granite_chat`.
-3. The server responds with an x402 `PaymentRequired` envelope quoting the USDC price.
-4. The client pays (signs a Solana USDC transaction via its x402-capable wallet).
-5. The server verifies + settles the payment, calls IBM watsonx.ai, and returns the result.
-
-The server operator supplies IBM credentials (`WATSONX_*`) and a receiving Solana wallet (`MCP_SVM_PAYMENT_ADDRESS`). End users supply only USDC.
+3. Without an x402 payment payload, the server returns a `402 PaymentRequired` envelope quoting the USDC price and the Solana receiving address.
+4. The client signs a Solana USDC transfer and retries with the payment in `_meta["x402/payment"]`.
+5. The server verifies and settles the payment via the facilitator, calls IBM watsonx.ai, and returns the result with a settlement receipt in `_meta["x402/payment-response"]`.
----
-
-## Tools
+x402-capable MCP clients handle this loop automatically.
-| Tool | What it does | Price |
-|---|---|---|
-| `ibm_granite_getting_started` | **Start here** — overview, prices, and the x402 payment flow. No payment or IBM account required. | **Free** |
-| `ibm_granite_chat` | Conversational AI via IBM Granite 3 8B Instruct | $0.02 USDC |
-| `ibm_granite_code` | Code generation, review, refactoring, testing, and documentation | $0.025 USDC |
-| `ibm_granite_embed` | Batch text embeddings for RAG, semantic search, and clustering (up to 64 texts) | $0.005 USDC |
-| `ibm_granite_analyze` | Structured document analysis: entities, sentiment, risk flags, summary, next steps | $0.04 USDC |
-| `ibm_granite_forecast` | Zero-shot time-series forecasting via IBM Granite TTM | $0.05 USDC |
+## Install
----
+```bash
+npm install @three-ws/ibm-x402-mcp
+```
-## Quickstart (server operator)
+Run it directly with `npx` (no install needed):
```bash
MCP_SVM_PAYMENT_ADDRESS=<your-solana-wallet> \
@@ -43,60 +51,75 @@ WATSONX_PROJECT_ID=<watsonx-project-id> \
npx @three-ws/ibm-x402-mcp
```
----
-
-## Configuration
+Or install globally for the `ibm-x402-mcp` binary on your `PATH`:
-### Required
-
-| Env var | Description |
-|---|---|
-| `MCP_SVM_PAYMENT_ADDRESS` | Solana wallet that receives USDC payments from callers |
-| `WATSONX_API_KEY` | IBM Cloud API key — [create one](https://cloud.ibm.com/iam/apikeys) |
-| `WATSONX_PROJECT_ID` | watsonx.ai project id (Project → Manage → General → Project ID) |
+```bash
+npm install -g @three-ws/ibm-x402-mcp
+```
-### Optional
+## Quick start
-| Env var | Default | Description |
-|---|---|---|
-| `WATSONX_SPACE_ID` | — | Deployment space id (alternative to `WATSONX_PROJECT_ID`) |
-| `WATSONX_URL` | `https://us-south.ml.cloud.ibm.com` | Regional inference host |
-| `WATSONX_MODEL_ID` | `ibm/granite-3-8b-instruct` | Default chat/generation model |
-| `WATSONX_EMBED_MODEL_ID` | `ibm/granite-embedding-278m-multilingual` | Default embedding model |
-| `X402_FEE_PAYER_SOLANA` | three.ws fee payer | Solana account sponsoring tx fees |
-| `X402_FACILITATOR_URL` | `https://facilitator.payai.network` | x402 payment facilitator |
-| `X402_FACILITATOR_TOKEN` | — | Bearer token for the facilitator |
-| `X402_ASSET_MINT_SOLANA` | USDC mainnet mint | USDC mint override |
+With Claude Code, one command (as an end user paying per call, no env vars needed):
-Regional hosts: `us-south`, `eu-de`, `eu-gb`, `jp-tok`, `au-syd`, `ca-tor`
-→ e.g. `https://eu-de.ml.cloud.ibm.com`
+```bash
+claude mcp add ibm-granite-x402 -- npx -y @three-ws/ibm-x402-mcp
+```
----
+Server operators add `-e MCP_SVM_PAYMENT_ADDRESS=... -e WATSONX_API_KEY=... -e WATSONX_PROJECT_ID=...` before the `--`.
-## Wire into Claude Desktop / Claude Code / Cursor
+Or wire the server into your MCP client config (`claude_desktop_config.json`, Cursor's `mcp.json`):
```json
{
- "mcpServers": {
- "ibm-x402": {
- "command": "npx",
- "args": ["-y", "@three-ws/ibm-x402-mcp"],
- "env": {
- "MCP_SVM_PAYMENT_ADDRESS": "your-solana-wallet-address",
- "WATSONX_API_KEY": "your-ibm-cloud-api-key",
- "WATSONX_PROJECT_ID": "your-watsonx-project-id"
- }
- }
- }
+ "mcpServers": {
+ "ibm-x402": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/ibm-x402-mcp"],
+ "env": {
+ "MCP_SVM_PAYMENT_ADDRESS": "your-solana-wallet-address",
+ "WATSONX_API_KEY": "your-ibm-cloud-api-key",
+ "WATSONX_PROJECT_ID": "your-watsonx-project-id"
+ }
+ }
+ }
}
```
----
+Inspect the tool surface with the MCP Inspector:
+
+```bash
+npx -y @modelcontextprotocol/inspector npx @three-ws/ibm-x402-mcp
+```
+
+## Tools
+
+| Tool | What it does | Price |
+| ----------------------------- | ----------------------------------------------------------------------------------- | ----------- |
+| `ibm_granite_getting_started` | Overview, prices, and the x402 payment flow. No payment or IBM account required. | Free |
+| `ibm_granite_chat` | Conversational AI via IBM Granite (default `ibm/granite-3-8b-instruct`). | $0.02 USDC |
+| `ibm_granite_code` | Code generate, review, refactor, explain, test, document. | $0.025 USDC |
+| `ibm_granite_embed` | Batch text embeddings for RAG, search, and clustering (1–64 texts). | $0.005 USDC |
+| `ibm_granite_analyze` | Structured document analysis: entities, sentiment, risk flags, summary, next steps. | $0.04 USDC |
+| `ibm_granite_forecast` | Zero-shot time-series forecasting via IBM Granite TTM (Tiny Time Mixer). | $0.05 USDC |
+
+Every tool is a read-only model-inference call — nothing on your machine or in any account is modified — and declares MCP tool annotations (`readOnlyHint`, `openWorldHint`, `idempotentHint`) so clients can reason about side effects before paying.
+
+### Input parameters
+
+**`ibm_granite_chat`** — `messages` (required: 1–50 `{ role, content }` pairs), `model`, `max_new_tokens` (1–4096, default 1024), `temperature` (0–2, default 0.7).
+
+**`ibm_granite_code`** — `task` (required: `generate`/`review`/`refactor`/`explain`/`test`/`document`), `prompt` (required), `language`, `context`.
+
+**`ibm_granite_embed`** — `inputs` (required: 1–64 texts, ≤8000 chars each), `model`.
+
+**`ibm_granite_analyze`** — `document` (required), `analysis_type` (`general`/`contract`/`financial`/`technical`/`medical`/`sentiment`, default `general`), `language`.
-## Tool examples
+**`ibm_granite_forecast`** — `timestamps` (required: 64–1024 ISO-8601, uniform cadence, oldest first), `values` (required: 64–1024 numbers, same length), `freq` (required: pandas cadence, e.g. `1h`, `1D`), `prediction_length` (1–96), `label`.
+
+### Example calls
-### `ibm_granite_chat`
```jsonc
+// ibm_granite_chat
{
"messages": [
{ "role": "system", "content": "You are an expert data engineer." },
@@ -105,65 +128,29 @@ Regional hosts: `us-south`, `eu-de`, `eu-gb`, `jp-tok`, `au-syd`, `ca-tor`
"max_new_tokens": 1024,
"temperature": 0.7
}
-```
-### `ibm_granite_code`
-```jsonc
-{
- "task": "review",
- "prompt": "def calculate_roi(revenue, cost): return revenue / cost",
- "language": "Python"
-}
-```
+// ibm_granite_code
+{ "task": "review", "prompt": "def calculate_roi(revenue, cost): return revenue / cost", "language": "Python" }
-### `ibm_granite_embed`
-```jsonc
-{
- "inputs": [
- "enterprise data governance",
- "cloud-native AI pipeline",
- "real-time analytics"
- ]
-}
-```
+// ibm_granite_embed
+{ "inputs": ["enterprise data governance", "cloud-native AI pipeline", "real-time analytics"] }
-### `ibm_granite_analyze`
-```jsonc
-{
- "document": "This Software License Agreement is entered into between...",
- "analysis_type": "contract"
-}
-```
+// ibm_granite_analyze
+{ "document": "This Software License Agreement is entered into between...", "analysis_type": "contract" }
-### `ibm_granite_forecast`
-```jsonc
-{
- "timestamps": ["2025-01-01T00:00:00Z", "2025-01-02T00:00:00Z"],
- "values": [12500, 13200],
- "freq": "1D",
- "prediction_length": 14,
- "label": "daily_revenue_usd"
-}
+// ibm_granite_forecast (timestamps/values must be 64–1024 points; abbreviated here)
+{ "timestamps": ["2025-01-01T00:00:00Z", "...", "2025-03-05T00:00:00Z"], "values": [12500, "...", 13200], "freq": "1D", "prediction_length": 14, "label": "daily_revenue_usd" }
```
----
-
## Payment flow
This server uses the [x402 protocol](https://x402.org) for micropayments:
-1. Client calls a tool without payment → receives `402 PaymentRequired` with USDC amount + Solana address.
-2. Client builds a signed Solana USDC transfer transaction.
+1. Client calls a tool without payment → `402 PaymentRequired` with the USDC amount and Solana address.
+2. Client builds and signs a Solana USDC transfer transaction.
3. Client retries with the signed tx in `_meta["x402/payment"]`.
-4. Server verifies via the [PayAI facilitator](https://facilitator.payai.network).
-5. Server calls IBM watsonx.ai and settles the payment.
-6. Response includes `_meta["x402/payment-response"]` with the settlement receipt.
-
-x402-capable MCP clients handle this flow automatically.
-
----
-
-## Architecture
+4. Server verifies and settles via the configured facilitator (default PayAI).
+5. Server calls IBM watsonx.ai and returns the result with `_meta["x402/payment-response"]` (settlement receipt).
```
MCP Client (Claude Desktop / Cursor / agent)
@@ -171,15 +158,42 @@ MCP Client (Claude Desktop / Cursor / agent)
▼
ibm-x402-mcp (stdio MCP server)
│ verify + settle USDC on Solana
- ├──► PayAI Facilitator (https://facilitator.payai.network)
+ ├──► x402 facilitator (default https://facilitator.payai.network)
│
- │ inference call with Bearer token
+ │ inference call with IAM Bearer token
└──► IBM watsonx.ai (us-south.ml.cloud.ibm.com)
└── IBM Granite 3 8B Instruct / Embedding / TTM
```
----
+## Requirements
+
+- **Node.js >= 20.**
+- A Solana wallet address to receive USDC (`MCP_SVM_PAYMENT_ADDRESS`).
+- IBM Cloud credentials: an API key ([create one](https://cloud.ibm.com/iam/apikeys)) and a watsonx.ai project id (Project → Manage → General → Project ID), or a deployment space id.
+
+### Environment variables
+
+| Variable | Required | Default |
+| ------------------------- | ----------------------------------- | ----------------------------------------- |
+| `MCP_SVM_PAYMENT_ADDRESS` | yes | — |
+| `WATSONX_API_KEY` | yes | — |
+| `WATSONX_PROJECT_ID` | yes (or `WATSONX_SPACE_ID`) | — |
+| `WATSONX_SPACE_ID` | alternative to `WATSONX_PROJECT_ID` | — |
+| `WATSONX_URL` | no | `https://us-south.ml.cloud.ibm.com` |
+| `WATSONX_MODEL_ID` | no | `ibm/granite-3-8b-instruct` |
+| `WATSONX_EMBED_MODEL_ID` | no | `ibm/granite-embedding-278m-multilingual` |
+| `X402_FEE_PAYER_SOLANA` | no | three.ws fee payer |
+| `X402_FACILITATOR_URL` | no | `https://facilitator.payai.network` |
+
+Regional hosts: `us-south`, `eu-de`, `eu-gb`, `jp-tok`, `au-syd`, `ca-tor` — e.g. `https://eu-de.ml.cloud.ibm.com`.
+
+## Related
+
+- [`@three-ws/ibm-watsonx-mcp`](https://www.npmjs.com/package/@three-ws/ibm-watsonx-mcp) — the same IBM Granite tools driven by your own IBM Cloud credentials (no x402, no per-call payment).
-## License
+## Links
-Apache-2.0 · Built by [three.ws](https://three.ws)
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/packages/ibm-x402-mcp/package.json b/packages/ibm-x402-mcp/package.json
index 32713ef1b..4c2511c06 100644
--- a/packages/ibm-x402-mcp/package.json
+++ b/packages/ibm-x402-mcp/package.json
@@ -53,6 +53,7 @@
},
"scripts": {
"start": "node src/index.js",
+ "test": "node --test \"test/**/*.test.mjs\"",
"inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
},
"dependencies": {
diff --git a/packages/ibm-x402-mcp/server.json b/packages/ibm-x402-mcp/server.json
index e11eaaca6..cc2b96aa7 100644
--- a/packages/ibm-x402-mcp/server.json
+++ b/packages/ibm-x402-mcp/server.json
@@ -1,18 +1,27 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/ibm-x402-mcp",
- "description": "x402 pay-per-use IBM Granite AI — chat, code, embeddings, document analysis, and time-series forecasting. Pay USDC on Solana per call. No IBM Cloud account required.",
+ "title": "IBM Granite via x402",
+ "description": "x402 pay-per-use IBM Granite AI: chat, code, embeddings, analysis, forecasting. Pay USDC per call.",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
"repository": {
"url": "https://github.com/nirholas/three.ws",
"source": "github",
"subfolder": "packages/ibm-x402-mcp"
},
- "version": "1.0.0",
+ "version": "1.1.0",
"packages": [
{
"registryType": "npm",
"identifier": "@three-ws/ibm-x402-mcp",
- "version": "1.0.0",
+ "version": "1.1.0",
"transport": {
"type": "stdio"
},
diff --git a/packages/ibm-x402-mcp/src/index.js b/packages/ibm-x402-mcp/src/index.js
index 5210d212a..b36d724b2 100644
--- a/packages/ibm-x402-mcp/src/index.js
+++ b/packages/ibm-x402-mcp/src/index.js
@@ -86,14 +86,12 @@ export async function buildServer(client) {
}
async function main() {
- // Fail fast on missing payment address — a running server that can't receive
- // USDC payments is useless.
- assertPaymentEnv();
-
- // Load IBM credentials once at startup. Throws with an actionable message on
- // any missing required env var so the operator sees the problem immediately.
+ // Fail fast and clearly on any missing required env var: the payment address
+ // first (a server that can't receive USDC is useless), then IBM credentials.
+ // Each check throws an actionable single-line message naming the env var.
let config;
try {
+ assertPaymentEnv();
config = loadConfig();
} catch (err) {
console.error(`[ibm-x402-mcp] configuration error: ${err.message}`);
diff --git a/packages/ibm-x402-mcp/src/payments.js b/packages/ibm-x402-mcp/src/payments.js
index 1d3e0c0bc..3a2c7e818 100644
--- a/packages/ibm-x402-mcp/src/payments.js
+++ b/packages/ibm-x402-mcp/src/payments.js
@@ -33,7 +33,7 @@ function requireSvmPayTo() {
const addr = env('MCP_SVM_PAYMENT_ADDRESS') || env('X402_PAY_TO_SOLANA') || env('X402_PAY_TO');
if (!addr) {
throw new Error(
- 'ibm-x402-mcp: set MCP_SVM_PAYMENT_ADDRESS to your Solana wallet address to receive USDC payments.',
+ 'set MCP_SVM_PAYMENT_ADDRESS to your Solana wallet address to receive USDC payments.',
);
}
return addr;
diff --git a/packages/ibm-x402-mcp/test/tools.test.mjs b/packages/ibm-x402-mcp/test/tools.test.mjs
new file mode 100644
index 000000000..0529346ec
--- /dev/null
+++ b/packages/ibm-x402-mcp/test/tools.test.mjs
@@ -0,0 +1,106 @@
+// Smoke tests for the x402 tool surface. Tool building is secret-free by
+// design (payment wiring is lazy, see src/payments.js), so the whole catalog
+// can be enumerated with no MCP_SVM_PAYMENT_ADDRESS and no WATSONX_* env.
+//
+// Run: node --test packages/ibm-x402-mcp/test/tools.test.mjs
+
+import { test, before } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { buildGettingStartedTool } from '../src/tools/getting-started.js';
+import { buildGraniteChatTool } from '../src/tools/granite-chat.js';
+import { buildGraniteCodeTool } from '../src/tools/granite-code.js';
+import { buildGraniteEmbedTool } from '../src/tools/granite-embed.js';
+import { buildGraniteAnalyzeTool } from '../src/tools/granite-analyze.js';
+import { buildGraniteForecastTool } from '../src/tools/granite-forecast.js';
+
+// Guarantee enumeration works with neither payment nor IBM credentials set.
+delete process.env.MCP_SVM_PAYMENT_ADDRESS;
+delete process.env.X402_PAY_TO_SOLANA;
+delete process.env.X402_PAY_TO;
+delete process.env.WATSONX_API_KEY;
+delete process.env.WATSONX_PROJECT_ID;
+delete process.env.WATSONX_SPACE_ID;
+
+// Published per-call USDC prices. Kept in sync with README.md and CATALOG.md.
+const PAID_PRICES = {
+ ibm_granite_chat: '$0.02',
+ ibm_granite_code: '$0.025',
+ ibm_granite_embed: '$0.005',
+ ibm_granite_analyze: '$0.04',
+ ibm_granite_forecast: '$0.05',
+};
+
+let tools;
+
+before(async () => {
+ tools = await Promise.all([
+ buildGettingStartedTool(),
+ buildGraniteChatTool(null),
+ buildGraniteCodeTool(null),
+ buildGraniteEmbedTool(null),
+ buildGraniteAnalyzeTool(null),
+ buildGraniteForecastTool(null),
+ ]);
+});
+
+test('exposes one free tool plus the five documented paid tools', () => {
+ const names = tools.map((t) => t.name).sort();
+ assert.deepEqual(names, ['ibm_granite_getting_started', ...Object.keys(PAID_PRICES)].sort());
+});
+
+test('tool names are unique', () => {
+ const names = tools.map((t) => t.name);
+ assert.equal(new Set(names).size, names.length);
+});
+
+test('every tool has a non-empty description and human title', () => {
+ for (const t of tools) {
+ assert.ok(
+ typeof t.description === 'string' && t.description.trim().length > 0,
+ `${t.name} description`,
+ );
+ assert.ok(typeof t.title === 'string' && t.title.trim().length > 0, `${t.name} title`);
+ }
+});
+
+test('every tool ships an input schema (zod raw shape) and a handler', () => {
+ for (const t of tools) {
+ assert.ok(t.inputSchema && typeof t.inputSchema === 'object', `${t.name} inputSchema`);
+ assert.ok(Object.keys(t.inputSchema).length > 0, `${t.name} inputSchema has no fields`);
+ assert.equal(typeof t.handler, 'function', `${t.name} handler`);
+ }
+});
+
+test('every tool is annotated read-only (model inference modifies nothing)', () => {
+ for (const t of tools) {
+ assert.ok(t.annotations, `${t.name} annotations missing`);
+ assert.equal(t.annotations.readOnlyHint, true, `${t.name} readOnlyHint`);
+ }
+});
+
+test('paid tools are open-world; only embeddings are idempotent', () => {
+ for (const t of tools) {
+ if (t.name === 'ibm_granite_getting_started') continue;
+ assert.equal(t.annotations.openWorldHint, true, `${t.name} openWorldHint`);
+ const expectedIdempotent = t.name === 'ibm_granite_embed';
+ assert.equal(t.annotations.idempotentHint, expectedIdempotent, `${t.name} idempotentHint`);
+ }
+});
+
+test('getting_started is the static closed-world entry point and is free', () => {
+ const t = tools.find((x) => x.name === 'ibm_granite_getting_started');
+ assert.equal(t.annotations.openWorldHint, false);
+ assert.equal(t.annotations.idempotentHint, true);
+ assert.match(t.description, /FREE/i);
+ assert.match(t.description, /no payment/i);
+});
+
+test('every paid tool description states its exact USDC price', () => {
+ for (const [name, price] of Object.entries(PAID_PRICES)) {
+ const t = tools.find((x) => x.name === name);
+ assert.ok(t, `${name} not built`);
+ assert.ok(t.description.includes(price), `${name} description must mention ${price}`);
+ assert.ok(t.title.includes(price), `${name} title must mention ${price}`);
+ }
+});
diff --git a/packages/pumpfun-mcp/README.md b/packages/pumpfun-mcp/README.md
index 8438f959b..56bb2d5b6 100644
--- a/packages/pumpfun-mcp/README.md
+++ b/packages/pumpfun-mcp/README.md
@@ -1,14 +1,39 @@
-# @three-ws/pumpfun-mcp
+<h1 align="center">@three-ws/pumpfun-mcp</h1>
-A **free, read-only** [Model Context Protocol](https://modelcontextprotocol.io) server for **pump.fun** and **Solana**. Give Claude — or any MCP client — live token discovery, on-chain bonding-curve and holder analysis, creator fee-claim tracking, Solana Name Service resolution, KOL signals, and read-only swap quotes.
+<p align="center"><strong>Free, read-only pump.fun + Solana MCP server — token discovery, on-chain analysis, and live 3D snapshots. No API keys.</strong></p>
-**No API keys. No RPC URL. No wallet.** Every Solana RPC and pump.fun API call runs server-side on the canonical [three.ws](https://three.ws) backend, so the data is live and on-chain and the client stays zero-config.
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/pumpfun-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/pumpfun-mcp?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/pumpfun-mcp"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/pumpfun-mcp?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/pumpfun-mcp?color=3b82f6">
+ <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas-7c3aed"></a>
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/pumpfun-mcp?color=339933&logo=node.js">
+ <a href="https://three.ws"><img alt="three.ws" src="https://img.shields.io/badge/built%20by-three.ws-000"></a>
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#tools">Tools</a> ·
+ <a href="#configuration">Configuration</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> A free, read-only [Model Context Protocol](https://modelcontextprotocol.io) server for **pump.fun** and **Solana**. It gives Claude — or any MCP client — live token discovery, on-chain bonding-curve and holder analysis, creator fee-claim tracking, Solana Name Service resolution, KOL signals, read-only swap quotes, and shareable live 3D token snapshots. Every Solana RPC and pump.fun API call runs server-side on the canonical [three.ws](https://three.ws) backend, so the data is live and on-chain while the client stays zero-config: **no API keys, no RPC URL, no wallet.**
## Install
-### Claude Desktop / Claude Code / Cursor
+### Claude Code (one-liner)
+
+```bash
+claude mcp add pumpfun -- npx -y @three-ws/pumpfun-mcp
+```
+
+### Claude Desktop / Cursor / any MCP client
-Add to your MCP config (`claude_desktop_config.json`, `.mcp.json`, etc.):
+Add to your MCP config (`claude_desktop_config.json`, `.cursor/mcp.json`, `.mcp.json`, etc.):
```json
{
@@ -21,24 +46,32 @@ Add to your MCP config (`claude_desktop_config.json`, `.mcp.json`, etc.):
}
```
-That's it — restart the client and the pump.fun tools appear.
+Restart the client and the pump.fun tools appear. No install step required.
### Run directly
```bash
-npx @three-ws/pumpfun-mcp
-# or
+npx -y @three-ws/pumpfun-mcp
+# or install globally and run the bin
npm i -g @three-ws/pumpfun-mcp && pumpfun-mcp
```
-### Inspect the tools
+## Quick start
-```bash
-npx -y @modelcontextprotocol/inspector npx @three-ws/pumpfun-mcp
+The server speaks stdio JSON-RPC — your MCP client spawns it via the `npx` command above. Once configured, ask your client natural-language questions and it picks the right tool:
+
+```text
+"What's trending on pump.fun right now?" → getTrendingTokens
+"Show the bonding curve for <mint>" → getBondingCurve
+"Who are the top holders of <mint>?" → getTokenHolders
+"Resolve bonfida.sol" → sns_resolve
+"Build a 3D snapshot for <mint>" → pumpfun_token_3d
```
## Tools
+All tools are **read-only** — nothing signs or sends a transaction. `pumpfun_quote_swap` only quotes; `pumpfun_vanity_mint` returns a keypair for you to use yourself.
+
| Tool | What it does |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `searchTokens` | Search pump.fun tokens by name, symbol, or mint. |
@@ -58,27 +91,47 @@ npx -y @modelcontextprotocol/inspector npx @three-ws/pumpfun-mcp
| `pumpfun_first_claims` | First-ever creator claims — a cash-out signal. |
| `pumpfun_quote_swap` | Read-only pump.fun AMM swap quote (no signing). |
| `pumpfun_watch_whales` | Collect large trades on a token over a short window. |
-| `pumpfun_vanity_mint` | Grind a vanity Solana keypair (returns secret to caller; never stored). |
+| `pumpfun_vanity_mint` | Grind a vanity Solana keypair (secret returned to caller, never stored). |
| `sns_resolve` | Resolve a `.sol` domain to its owner wallet. |
| `sns_reverseLookup` | Reverse-lookup a wallet to its primary `.sol` domain. |
| `social_cashtag_sentiment` | Deterministic lexicon sentiment over supplied posts. |
| `social_x_post_impact` | Correlate an X post to bonding-curve price impact. |
| `pumpfun_token_3d` | **Live 3D snapshot** of a token — composes metadata, holders, and graduation into a shareable [three.ws/coin3d](https://three.ws/coin3d) viewer (spinning coin medallion + holder galaxy + graduation ring) and returns the deep-link, an embeddable iframe, and the underlying data. |
-Read-only by design: no tool signs or sends a transaction. `pumpfun_quote_swap` only quotes; `pumpfun_vanity_mint` returns a keypair for you to use yourself.
+The live tool list is fetched from the backend at startup; a bundled copy ships as an offline fallback so a fresh install always advertises a correct surface.
+
+### Inspect the tools
+
+```bash
+npx -y @modelcontextprotocol/inspector npx @three-ws/pumpfun-mcp
+```
## Configuration
+No configuration is required. One optional override exists:
+
| Env var | Default | Purpose |
| ----------------- | ----------------------------------- | --------------------------------------------------------- |
| `PUMPFUN_MCP_URL` | `https://three.ws/api/pump-fun-mcp` | Backend endpoint. Override only to self-host the handler. |
## How it works
-This package is a small stdio ↔ HTTP bridge. It forwards MCP `tools/call` requests to the canonical three.ws pump.fun JSON-RPC backend, which performs the actual Solana RPC reads and pump.fun API queries. That keeps one authoritative implementation, ships no secrets to clients, and means the tool surface stays current automatically (the live `tools/list` is fetched at startup, with a bundled fallback for offline use).
+This package is a small stdio ↔ HTTP bridge. It forwards MCP `tools/call` requests to the canonical three.ws pump.fun JSON-RPC backend, which performs the actual Solana RPC reads and pump.fun API queries. That keeps one authoritative implementation, ships no secrets to clients, and means the tool surface stays current automatically.
`pumpfun_token_3d` is a **native** tool: it runs in-process, orchestrating several backend reads (metadata + bonding curve + holders) and resolving the token logo from its on-chain metadata URI, then returns a deep-link into the three.ws 3D viewer. It needs no extra keys and adds no new backend dependency.
-## License
+## Requirements
+
+- Node.js **>= 20** (from `engines`).
+- No API keys, RPC URL, or wallet. Outbound HTTPS to the three.ws backend (or your `PUMPFUN_MCP_URL`).
+
+## Related
+
+- [`@3d-agent/mcp-server`](https://www.npmjs.com/package/@3d-agent/mcp-server) — the paid, x402-settled three.ws MCP (text→3D mesh, avatars, pose seeds, ERC-8004 reputation, and a paid `pump_snapshot`).
+
+## Links
-Apache-2.0 — see [LICENSE](./LICENSE).
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/packages/pumpfun-mcp/package.json b/packages/pumpfun-mcp/package.json
index 5d5cad39f..42eaad2b2 100644
--- a/packages/pumpfun-mcp/package.json
+++ b/packages/pumpfun-mcp/package.json
@@ -49,6 +49,7 @@
},
"scripts": {
"start": "node src/index.js",
+ "test": "node --test \"test/**/*.test.mjs\"",
"inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
},
"dependencies": {
diff --git a/packages/pumpfun-mcp/server.json b/packages/pumpfun-mcp/server.json
index e73da7aff..7db357017 100644
--- a/packages/pumpfun-mcp/server.json
+++ b/packages/pumpfun-mcp/server.json
@@ -2,7 +2,7 @@
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/pumpfun-solana-mcp",
"title": "pump.fun Solana Data",
- "description": "Free, read-only pump.fun + Solana MCP server: token discovery, on-chain bonding-curve & holder analysis, creator fee-claim tracking, SNS name resolution, KOL radar/leaderboard signals, read-only swap quotes, and live 3D token snapshots (coin medallion + holder galaxy + graduation ring via three.ws/coin3d). No API keys required.",
+ "description": "Free, read-only pump.fun + Solana MCP: token discovery, on-chain analysis, SNS, 3D snapshots.",
"websiteUrl": "https://three.ws",
"icons": [
{
diff --git a/packages/pumpfun-mcp/test/tools.test.mjs b/packages/pumpfun-mcp/test/tools.test.mjs
new file mode 100644
index 000000000..de665876f
--- /dev/null
+++ b/packages/pumpfun-mcp/test/tools.test.mjs
@@ -0,0 +1,84 @@
+// Tool-surface invariants for the vendored fallback catalog and the local
+// annotations overlay. Every tool this bridge advertises must be a complete,
+// explicitly read-only MCP tool definition — a new entry without annotations
+// (or one marked destructive) fails here before it can ship.
+//
+// Run: node --test packages/pumpfun-mcp/test/tools.test.mjs
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { FALLBACK_TOOLS, TOOL_ANNOTATIONS } from '../src/tools.js';
+import { NATIVE_TOOLS } from '../src/native.js';
+
+test('FALLBACK_TOOLS is a non-empty array', () => {
+ assert.ok(Array.isArray(FALLBACK_TOOLS));
+ assert.ok(FALLBACK_TOOLS.length > 0);
+});
+
+test('every fallback tool has name, description, inputSchema, title', () => {
+ for (const tool of FALLBACK_TOOLS) {
+ assert.equal(typeof tool.name, 'string', 'name must be a string');
+ assert.ok(tool.name.length > 0, 'name must be non-empty');
+ assert.equal(typeof tool.description, 'string', `${tool.name}: description`);
+ assert.ok(tool.description.length > 0, `${tool.name}: description non-empty`);
+ assert.ok(tool.inputSchema, `${tool.name}: inputSchema`);
+ assert.equal(tool.inputSchema.type, 'object', `${tool.name}: inputSchema.type`);
+ assert.equal(typeof tool.title, 'string', `${tool.name}: title`);
+ assert.ok(tool.title.length > 0, `${tool.name}: title non-empty`);
+ }
+});
+
+test('every fallback tool carries read-only MCP annotations', () => {
+ for (const tool of FALLBACK_TOOLS) {
+ const a = tool.annotations;
+ assert.ok(a && typeof a === 'object', `${tool.name}: annotations object`);
+ assert.equal(typeof a.readOnlyHint, 'boolean', `${tool.name}: readOnlyHint boolean`);
+ assert.equal(a.readOnlyHint, true, `${tool.name}: must be read-only`);
+ // destructiveHint defaults to true in the MCP spec when omitted — this
+ // surface must set it explicitly false, never true.
+ assert.equal(a.destructiveHint, false, `${tool.name}: destructiveHint must be false`);
+ assert.equal(typeof a.idempotentHint, 'boolean', `${tool.name}: idempotentHint boolean`);
+ assert.equal(typeof a.openWorldHint, 'boolean', `${tool.name}: openWorldHint boolean`);
+ }
+});
+
+test('fallback tool names are unique', () => {
+ const names = FALLBACK_TOOLS.map((t) => t.name);
+ assert.equal(new Set(names).size, names.length);
+});
+
+test('TOOL_ANNOTATIONS covers every fallback tool name', () => {
+ for (const tool of FALLBACK_TOOLS) {
+ assert.ok(
+ Object.hasOwn(TOOL_ANNOTATIONS, tool.name),
+ `${tool.name}: missing from TOOL_ANNOTATIONS overlay map`,
+ );
+ }
+});
+
+test('semantic spot checks: deterministic and local-compute tools', () => {
+ assert.equal(TOOL_ANNOTATIONS.sns_resolve.idempotentHint, true);
+ assert.equal(TOOL_ANNOTATIONS.sns_reverseLookup.idempotentHint, true);
+ // Pure lexicon scorer: deterministic and closed-world.
+ assert.equal(TOOL_ANNOTATIONS.social_cashtag_sentiment.idempotentHint, true);
+ assert.equal(TOOL_ANNOTATIONS.social_cashtag_sentiment.openWorldHint, false);
+ // Vanity grind: local compute, fresh keypair every call.
+ assert.equal(TOOL_ANNOTATIONS.pumpfun_vanity_mint.idempotentHint, false);
+ assert.equal(TOOL_ANNOTATIONS.pumpfun_vanity_mint.openWorldHint, false);
+});
+
+test('native composed tools carry the same annotation contract', () => {
+ assert.ok(NATIVE_TOOLS.length > 0);
+ const fallbackNames = new Set(FALLBACK_TOOLS.map((t) => t.name));
+ for (const { def } of NATIVE_TOOLS) {
+ assert.ok(!fallbackNames.has(def.name), `${def.name}: collides with a fallback tool`);
+ assert.equal(typeof def.title, 'string', `${def.name}: title`);
+ const a = def.annotations;
+ assert.ok(a && typeof a === 'object', `${def.name}: annotations object`);
+ assert.equal(a.readOnlyHint, true, `${def.name}: must be read-only`);
+ assert.equal(a.destructiveHint, false, `${def.name}: destructiveHint must be false`);
+ assert.equal(typeof a.idempotentHint, 'boolean', `${def.name}: idempotentHint boolean`);
+ assert.equal(typeof a.openWorldHint, 'boolean', `${def.name}: openWorldHint boolean`);
+ }
+});
diff --git a/packages/three-token-mcp/README.md b/packages/three-token-mcp/README.md
index 46be850fc..8b12a5944 100644
--- a/packages/three-token-mcp/README.md
+++ b/packages/three-token-mcp/README.md
@@ -1,74 +1,114 @@
-# @three-ws/three-token-mcp
+<h1 align="center">@three-ws/three-token-mcp</h1>
-**The first MCP server whose actions burn a token.** Give any AI agent three
-$THREE primitives over the Model Context Protocol: read the live price, read a
-wallet's balance, and **burn $THREE on-chain** — split between the incinerator
-and the three.ws treasury, priced live via Jupiter.
+<p align="center"><strong>The first MCP server whose actions burn a token — let any AI agent price, hold, and burn $THREE on Solana.</strong></p>
-Deflation as an agent primitive: every `three_burn` call is a real, verifiable
-Solana transaction that permanently removes $THREE from supply and funds the
-treasury.
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/three-token-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/three-token-mcp?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/three-token-mcp"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/three-token-mcp?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/three-token-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/three-token-mcp?color=339933&logo=node.js">
+ <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas-0ea5e9"></a>
+ <a href="https://three.ws"><img alt="three.ws" src="https://img.shields.io/badge/built%20by-three.ws-000"></a>
+</p>
-```
-io.github.nirholas/three-token-mcp → @three-ws/three-token-mcp
-```
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#tools">Tools</a> ·
+ <a href="#requirements">Requirements</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
-## Why this is different
+---
-Most paid MCP servers settle in USDC. This one moves the project's own token,
-and the destinations are not hardcoded — they're read at runtime from the
-**public** three.ws token surface (`/api/token/config`, `/api/token/price`), so
-the mint, decimals, burn address, treasury, and split always track the canonical
-on-chain config the rest of three.ws uses.
+> A [Model Context Protocol](https://modelcontextprotocol.io) server that gives any AI assistant three $THREE primitives over stdio: read the live USD price, read a wallet's balance, and **burn $THREE on-chain** — split between the incinerator and the three.ws treasury, priced live via Jupiter. Deflation as an agent primitive: every `three_burn` call is a real, verifiable Solana transaction that permanently removes $THREE from supply and funds the treasury.
-## Tools
+$THREE is the only coin this server touches. Contract address (mainnet SPL): `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`.
-| Tool | Type | What it does |
-| :--- | :--- | :----------- |
-| `three_price` | read-only | Live USD price of $THREE (Jupiter → Birdeye fallback). Pass `usd` to also get the token-amount quote. |
-| `three_balance` | read-only | $THREE + SOL balance for any pubkey (defaults to the configured signer). |
-| `three_burn` | **execution** | Burn a USD-denominated amount of $THREE in one Solana tx, split incinerator/treasury. Returns the signature + breakdown + Solscan link. |
+## Why this is different
-`three_burn` burns $THREE the wallet **already holds**. To acquire $THREE first,
-swap SOL→$THREE on any Solana DEX, then burn.
+Most paid MCP servers settle in USDC. This one moves the project's own token, and the destinations are not hardcoded — they're read at runtime from the **public** three.ws token surface (`/api/token/config`, `/api/token/price`), so the mint, decimals, burn address, treasury, and split always track the canonical on-chain config the rest of three.ws uses. Before signing, the resolved mint is asserted to equal the canonical $THREE address above — a misconfigured or compromised endpoint cannot redirect a burn to any other token.
## Install
-Add to your MCP client (Claude Desktop / Cursor / Claude Code):
+```bash
+npm install @three-ws/three-token-mcp
+```
+
+Run it directly with `npx` (no install needed):
+
+```bash
+SOLANA_SECRET_KEY=<base58> npx @three-ws/three-token-mcp
+```
+
+Or install globally for the `three-token-mcp` binary on your `PATH`:
+
+```bash
+npm install -g @three-ws/three-token-mcp
+```
+
+## Quick start
+
+**Claude Code**, one line:
+
+```bash
+claude mcp add three-token -- npx -y @three-ws/three-token-mcp
+```
+
+**Claude Desktop / Cursor** (`claude_desktop_config.json` or `mcp.json`):
```json
{
- "mcpServers": {
- "three-token": {
- "command": "npx",
- "args": ["-y", "@three-ws/three-token-mcp"],
- "env": {
- "SOLANA_SECRET_KEY": "<base58 secret of the wallet that holds $THREE>",
- "SOLANA_RPC_URL": "https://your-rpc-provider"
- }
- }
- }
+ "mcpServers": {
+ "three-token": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/three-token-mcp"],
+ "env": {
+ "SOLANA_SECRET_KEY": "<base58 secret of the wallet that holds $THREE>",
+ "SOLANA_RPC_URL": "https://your-rpc-provider"
+ }
+ }
+ }
}
```
-`SOLANA_SECRET_KEY` is only required for `three_burn`. The read-only tools work
-without it.
+`SOLANA_SECRET_KEY` is only required for `three_burn`. The read-only tools (`three_price`, `three_balance`) work without it. Inspect the surface with the MCP Inspector:
-## Configuration
+```bash
+npx -y @modelcontextprotocol/inspector npx @three-ws/three-token-mcp
+```
+
+## Tools
+
+| Tool | Type | What it does |
+| --------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
+| `three_price` | read-only | Live USD price of $THREE (Jupiter primary, Birdeye fallback). Pass `usd` to also get the token-amount quote. |
+| `three_balance` | read-only | $THREE + SOL balance for any pubkey (defaults to the configured signer). |
+| `three_burn` | **execution** | Burn a USD-denominated amount of $THREE in one Solana tx, split incinerator/treasury. Returns the signature, breakdown, and a Solscan link. |
+
+`three_burn` burns $THREE the wallet **already holds**. To acquire $THREE first, swap SOL → $THREE on any Solana DEX, then burn.
+
+### Safety
+
+All three tools ship [MCP tool annotations](https://modelcontextprotocol.io/specification/2025-06-18/server/tools#tool-annotations): `three_price` and `three_balance` advertise `readOnlyHint: true` and can be safely auto-approved; `three_burn` is flagged `destructiveHint: true`, so annotation-aware MCP clients (Claude Code, Claude Desktop, Cursor) prompt for confirmation before running it. The hints are advisory — server-side, every burn is still bounded by `MAX_BURN_USD` (default $100), gated by `REQUIRE_CONFIRM` (default on: the call refuses until re-issued with `confirm: true`), and the resolved mint is asserted to be canonical $THREE before signing, independent of the client.
+
+### Input parameters
-| Variable | Required | Purpose |
-| :------- | :------- | :------ |
-| `SOLANA_SECRET_KEY` | for burns | Base58 secret of the signing wallet. **Treat like cash.** |
-| `SOLANA_RPC_URL` | no | Solana mainnet RPC (defaults to the public cluster). |
-| `THREE_WS_BASE` | no | three.ws API base (defaults to `https://three.ws`). |
+**`three_price`** — `usd` (optional positive number: USD amount to quote into $THREE).
+
+**`three_balance`** — `pubkey` (optional base58, 32–64 chars; defaults to the configured signer's address).
+
+**`three_burn`** — `usd` (required positive number: USD value of $THREE to burn), `burnBps` (0–10000, default 5000 = 50% burn / 50% treasury; 10000 = burn everything), `memo` (optional, ≤120 chars; appended to the on-chain memo), `secret` (optional base58 signer override; defaults to `SOLANA_SECRET_KEY`), `confirm` (must be `true` to execute the irreversible burn when `REQUIRE_CONFIRM` is on).
## Example
-```
-> three_price { "usd": 5 }
+```jsonc
+// three_price
+> { "usd": 5 }
{ "price_usd": 0.0042, "quote": { "usd": 5, "token_amount": 1190.47, "atomics": "1190476190" } }
-> three_burn { "usd": 5, "burnBps": 5000 }
+// three_burn — irreversible; confirm:true required by default
+> { "usd": 5, "burnBps": 5000, "confirm": true }
{
"ok": true,
"signature": "5x...",
@@ -82,23 +122,37 @@ without it.
}
```
-`burnBps` controls the split: `5000` (default) = 50% burn / 50% treasury;
-`10000` = burn everything.
-
## How a burn is built
`three_burn` mirrors the proven three.ws browser payment flow:
1. `GET /api/token/config` → mint, decimals, burn address, treasury.
-2. `GET /api/token/price?usd=<n>` → live Jupiter price + the exact $THREE atomics.
-3. Build **one** transaction: an idempotent ATA-create + SPL transfer per leg
- (burn + treasury), plus a memo tagging the burn on-chain.
-4. Sign with your wallet, send, and confirm. The result reports the on-chain
- signature and per-leg amounts.
+2. `GET /api/token/price?usd=<n>` → live Jupiter price and the exact $THREE atomics.
+3. Build **one** transaction: an idempotent ATA-create + SPL transfer per leg (burn + treasury), plus a memo tagging the burn on-chain.
+4. Sign with your wallet, send, and confirm. The result reports the on-chain signature and per-leg amounts.
+
+The server pre-checks your $THREE balance and fails fast with a clear error if it can't cover the burn — no opaque on-chain failures. Burns are bounded by `MAX_BURN_USD` (default $100) and gated by `REQUIRE_CONFIRM` (default on).
+
+## Requirements
+
+- **Node.js >= 20.**
+- A Solana mainnet RPC endpoint (the public cluster works for read-only; bring your own — Helius / QuickNode / Triton — for burn traffic). The endpoint must be `https` (only `http://localhost` is accepted, for local dev validators).
+- For burns: a wallet holding $THREE, provided as a base58 `SOLANA_SECRET_KEY` (or a per-call `secret`).
+
+### Environment variables
-The server pre-checks your $THREE balance and fails fast with a clear error if
-it can't cover the burn — no opaque on-chain failures.
+| Variable | Required | Default |
+| -------------------- | -------------- | ------------------------------------------------- |
+| `SOLANA_SECRET_KEY` | for burns only | — |
+| `SOLANA_RPC_URL` | no | `https://api.mainnet-beta.solana.com` |
+| `THREE_WS_BASE` | no | `https://three.ws` |
+| `MAX_BURN_USD` | no | `100` |
+| `REQUIRE_CONFIRM` | no | `true` (set `0`/`false` to skip the confirm gate) |
+| `THREE_BURN_ADDRESS` | no | the Solana incinerator |
-## License
+## Links
-Apache-2.0 · [three.ws](https://three.ws)
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/packages/three-token-mcp/server.json b/packages/three-token-mcp/server.json
index 253044087..4527b7324 100644
--- a/packages/three-token-mcp/server.json
+++ b/packages/three-token-mcp/server.json
@@ -1,18 +1,27 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/three-token-mcp",
- "description": "The first MCP server whose actions burn a token. Price, hold, and burn $THREE on Solana — every burn splits to the incinerator + treasury via the live three.ws token rail, with Jupiter USD pricing. Deflation as an agent primitive.",
+ "title": "$THREE Token",
+ "description": "Price, hold, and burn $THREE on Solana — the first MCP server whose actions burn a token.",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
"repository": {
"url": "https://github.com/nirholas/three.ws",
"source": "github",
"subfolder": "packages/three-token-mcp"
},
- "version": "1.0.0",
+ "version": "1.1.0",
"packages": [
{
"registryType": "npm",
"identifier": "@three-ws/three-token-mcp",
- "version": "1.0.0",
+ "version": "1.1.0",
"transport": {
"type": "stdio"
},
@@ -37,6 +46,20 @@
"format": "string",
"isRequired": false,
"default": "https://three.ws"
+ },
+ {
+ "name": "MAX_BURN_USD",
+ "description": "Max USD value of $THREE a single three_burn call may destroy.",
+ "format": "number",
+ "isRequired": false,
+ "default": "100"
+ },
+ {
+ "name": "REQUIRE_CONFIRM",
+ "description": "When on (default), three_burn refuses until re-issued with confirm:true. Set 0/false to disable the gate.",
+ "format": "boolean",
+ "isRequired": false,
+ "default": "true"
}
]
}
diff --git a/packages/three-token-mcp/src/index.js b/packages/three-token-mcp/src/index.js
index ed15a8611..9e99bf74b 100644
--- a/packages/three-token-mcp/src/index.js
+++ b/packages/three-token-mcp/src/index.js
@@ -15,6 +15,10 @@
//
// Or wire into Claude Desktop / Cursor — see README.md.
+import { realpathSync } from 'node:fs';
+import { createRequire } from 'node:module';
+import { pathToFileURL } from 'node:url';
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -22,17 +26,30 @@ import { def as threePrice } from './tools/three-price.js';
import { def as threeBalance } from './tools/three-balance.js';
import { def as threeBurn } from './tools/three-burn.js';
-const TOOLS = [threePrice, threeBalance, threeBurn];
+// Single source of truth for the advertised server identity — package.json.
+// The McpServer version can never drift from the published npm version again.
+const require = createRequire(import.meta.url);
+const { version: PKG_VERSION } = require('../package.json');
-async function main() {
+export const TOOLS = [threePrice, threeBalance, threeBurn];
+
+/**
+ * Construct a fully-registered McpServer WITHOUT connecting a transport and
+ * WITHOUT requiring a signer. Tool registration (names, descriptions, schemas,
+ * annotations) is env-free; only an actual three_burn invocation needs
+ * SOLANA_SECRET_KEY. Safe to import from tests.
+ *
+ * @returns {McpServer}
+ */
+export function buildServer() {
const server = new McpServer(
- { name: 'three-token-mcp', version: '1.0.0' },
+ { name: 'three-token-mcp', title: '$THREE Token', version: PKG_VERSION },
{
capabilities: { tools: {} },
instructions:
'$THREE token MCP — price, hold, and BURN the three.ws token ($THREE) on Solana. ' +
'three_price returns the live USD price (Jupiter primary, Birdeye fallback) and, given `usd`, ' +
- 'how much $THREE that buys. three_balance reads any wallet\'s $THREE + SOL (defaults to the ' +
+ "how much $THREE that buys. three_balance reads any wallet's $THREE + SOL (defaults to the " +
'configured signer). three_burn is an EXECUTION ACTION: it quotes a USD amount to $THREE and ' +
'sends one Solana transaction splitting it between the incinerator and the three.ws treasury ' +
'(default 50/50, override with burnBps; 10000 = burn everything). Burning requires a signer ' +
@@ -48,11 +65,17 @@ async function main() {
title: tool.title,
description: tool.description,
inputSchema: tool.inputSchema,
+ // MCP ToolAnnotations (readOnlyHint / destructiveHint /
+ // idempotentHint / openWorldHint) — lets clients gate
+ // confirmation prompts per tool instead of treating every
+ // call as a destructive write.
+ annotations: tool.annotations,
},
async (args, extra) => {
try {
const result = await tool.handler(args, extra);
- const text = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
+ const text =
+ typeof result === 'string' ? result : JSON.stringify(result, null, 2);
return { content: [{ type: 'text', text }] };
} catch (err) {
const payload = {
@@ -71,12 +94,34 @@ async function main() {
);
}
+ return server;
+}
+
+async function main() {
+ const server = buildServer();
const transport = new StdioServerTransport();
await server.connect(transport);
- console.error(`[three-token-mcp] connected over stdio with ${TOOLS.length} tools`);
+ console.error(
+ `[three-token-mcp@${PKG_VERSION}] connected over stdio with ${TOOLS.length} tools`,
+ );
}
-main().catch((err) => {
- console.error('[three-token-mcp] fatal:', err);
- process.exit(1);
-});
+// Connect stdio ONLY when this file is the process entry point. Importing the
+// module (tests, embedding buildServer elsewhere) must not grab the transport.
+// realpath both sides: npm bin shims are symlinks, so argv[1] may point at
+// node_modules/.bin/... while import.meta.url is the resolved file.
+function isProcessEntryPoint() {
+ if (!process.argv[1]) return false;
+ try {
+ return import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href;
+ } catch {
+ return false;
+ }
+}
+
+if (isProcessEntryPoint()) {
+ main().catch((err) => {
+ console.error('[three-token-mcp] fatal:', err);
+ process.exit(1);
+ });
+}
diff --git a/packages/three-token-mcp/test/annotations.test.mjs b/packages/three-token-mcp/test/annotations.test.mjs
new file mode 100644
index 000000000..d2decd6fa
--- /dev/null
+++ b/packages/three-token-mcp/test/annotations.test.mjs
@@ -0,0 +1,104 @@
+// MCP ToolAnnotations invariants — pins the safety semantics of the tool
+// surface. MCP clients use these hints to decide which calls need a human
+// confirmation prompt, so an unannotated tool (or a mis-flagged burn) is a
+// safety regression, not a style nit.
+//
+// Importing src/index.js is side-effect-free: the stdio transport only
+// connects when the file is the process entry point, and buildServer()
+// requires no signer.
+//
+// Run: node --test packages/three-token-mcp/test/annotations.test.mjs
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { TOOLS, buildServer } from '../src/index.js';
+
+// The ONLY tool allowed to carry destructiveHint: true — it signs and
+// broadcasts an irreversible Solana mainnet burn. Adding an execution tool?
+// Add it here deliberately, in the same commit.
+const EXECUTION_TOOLS = new Set(['three_burn']);
+const READ_ONLY_TOOLS = new Set(['three_price', 'three_balance']);
+
+test('exactly 3 tools are registered', () => {
+ assert.equal(TOOLS.length, 3);
+ assert.deepEqual(
+ new Set(TOOLS.map((t) => t.name)),
+ new Set(['three_price', 'three_balance', 'three_burn']),
+ );
+});
+
+test('every tool has a human title and a complete annotations object', () => {
+ for (const tool of TOOLS) {
+ assert.equal(typeof tool.title, 'string', `${tool.name} is missing a title`);
+ assert.ok(tool.title.length > 0, `${tool.name} has an empty title`);
+ assert.ok(tool.annotations, `${tool.name} is missing MCP ToolAnnotations`);
+ assert.equal(
+ typeof tool.annotations.readOnlyHint,
+ 'boolean',
+ `${tool.name} must set readOnlyHint explicitly`,
+ );
+ assert.equal(
+ typeof tool.annotations.idempotentHint,
+ 'boolean',
+ `${tool.name} must set idempotentHint explicitly`,
+ );
+ assert.equal(
+ typeof tool.annotations.openWorldHint,
+ 'boolean',
+ `${tool.name} must set openWorldHint explicitly`,
+ );
+ }
+});
+
+test('writes always set destructiveHint explicitly (spec default is TRUE when omitted)', () => {
+ for (const tool of TOOLS) {
+ if (tool.annotations.readOnlyHint === false) {
+ assert.equal(
+ typeof tool.annotations.destructiveHint,
+ 'boolean',
+ `${tool.name} is a write — destructiveHint must be explicit, never defaulted`,
+ );
+ }
+ }
+});
+
+test('the destructive set is EXACTLY three_burn', () => {
+ const destructive = TOOLS.filter((t) => t.annotations.destructiveHint === true).map(
+ (t) => t.name,
+ );
+ assert.deepEqual(new Set(destructive), EXECUTION_TOOLS);
+});
+
+test('three_price and three_balance are read-only, live-data (non-idempotent), open-world', () => {
+ for (const name of READ_ONLY_TOOLS) {
+ const tool = TOOLS.find((t) => t.name === name);
+ assert.ok(tool, `${name} must exist in the tool registry`);
+ assert.equal(tool.annotations.readOnlyHint, true, `${name} should be read-only`);
+ assert.equal(tool.annotations.idempotentHint, false, `${name} reads live data`);
+ assert.equal(tool.annotations.openWorldHint, true, `${name} talks to external services`);
+ }
+});
+
+test('three_burn is never marked read-only or idempotent', () => {
+ const burn = TOOLS.find((t) => t.name === 'three_burn');
+ assert.equal(burn.annotations.readOnlyHint, false);
+ assert.equal(burn.annotations.idempotentHint, false);
+ assert.equal(burn.annotations.openWorldHint, true);
+});
+
+test('buildServer registers every tool with its annotations, without a signer', () => {
+ const server = buildServer();
+ // McpServer keeps its registry in _registeredTools (name → RegisteredTool).
+ const registered = server._registeredTools;
+ assert.ok(registered, 'McpServer should expose its tool registry');
+ for (const tool of TOOLS) {
+ const entry = registered[tool.name];
+ assert.ok(entry, `${tool.name} not registered on the server`);
+ assert.deepEqual(
+ entry.annotations,
+ tool.annotations,
+ `${tool.name} annotations must survive registration`,
+ );
+ }
+});
diff --git a/packages/threews-avatar-mcp/README.md b/packages/threews-avatar-mcp/README.md
index b311159d4..3f1656c3d 100644
--- a/packages/threews-avatar-mcp/README.md
+++ b/packages/threews-avatar-mcp/README.md
@@ -1,63 +1,100 @@
-# @three-ws/avatar-mcp
+<h1 align="center">@three-ws/avatar-mcp</h1>
-[![npm version](https://img.shields.io/npm/v/%40three-ws%2Favatar-mcp)](https://www.npmjs.com/package/@three-ws/avatar-mcp)
-[![license](https://img.shields.io/npm/l/%40three-ws%2Favatar-mcp)](./LICENSE)
-[![MCP Registry](https://img.shields.io/badge/MCP%20Registry-io.github.nirholas%2Fthreews--avatar-blue)](https://registry.modelcontextprotocol.io/?q=io.github.nirholas)
+<p align="center"><strong>An MCP server that drops a live, rotatable 3D avatar into any chat — interactive in the conversation, embeddable anywhere. Free, no API key.</strong></p>
-An [MCP](https://modelcontextprotocol.io) server that drops a **live three.ws 3D avatar** into any MCP client — Claude Desktop, Claude Code, Cursor, or any other host. Render a rotatable avatar inline, get a paste-anywhere embed iframe, or fetch avatar metadata.
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/avatar-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/avatar-mcp?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/avatar-mcp"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/avatar-mcp?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/avatar-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/avatar-mcp?color=339933&logo=node.js">
+ <a href="https://modelcontextprotocol.io"><img alt="mcp" src="https://img.shields.io/badge/Model%20Context%20Protocol-✓-9945FF"></a>
+ <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas%2Fthreews--avatar-blue"></a>
+</p>
-It's a thin, **zero-config, read-only** bridge to the real three.ws endpoints. Public and unlisted avatars need **no API key**. No mock data — every tool reads live from three.ws.
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#setup">Setup</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#tools">Tools</a> ·
+ <a href="#requirements">Requirements</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
-> Registry name: `io.github.nirholas/threews-avatar`. Built by [three.ws](https://three.ws).
+---
-## Tools
+> A thin, zero-config, **read-only** [Model Context Protocol](https://modelcontextprotocol.io) server that brings three.ws 3D avatars into any MCP client — Claude Desktop, Claude Code, Cursor, or any other host. Render a live, rotatable avatar inline, get a paste-anywhere embed iframe, or fetch avatar metadata. Every tool reads live from the real three.ws endpoints — no mock data. Public and unlisted avatars need **no API key**. Registry name: `io.github.nirholas/threews-avatar`. Built by [three.ws](https://three.ws).
-| Tool | What it does |
-| --- | --- |
-| `render_avatar` | Renders an avatar inline. On [MCP Apps](https://modelcontextprotocol.io/extensions/apps/overview)-capable hosts (Claude, VS Code Copilot, Goose…) it shows a **live, rotatable 3D model right in the chat**; on other clients it falls back to a preview image + embed URL. |
-| `avatar_embed_code` | A ready-to-paste `<iframe>` that embeds the live avatar anywhere — as easy as a YouTube embed. |
-| `get_avatar` | Avatar metadata: name, GLB model url, owner, visibility. |
+Need wallets, voice, generation, or pump.fun powers? See the sibling package [`@three-ws/avatar-agent`](https://www.npmjs.com/package/@three-ws/avatar-agent), a full 3D AI agent in a box.
-All three tools are read-only and annotated as such (`readOnlyHint`, `idempotentHint`, `openWorldHint`) so hosts can run them without confirmation prompts.
+## Install
-### Interactive 3D in the chat (MCP Apps) — the differentiator
+```bash
+npm install @three-ws/avatar-mcp
+```
-`render_avatar` is an [MCP App](https://modelcontextprotocol.io/extensions/apps/overview) (SEP-1865): it declares a `ui://` resource that supporting hosts render in a sandboxed iframe — a real, orbit-and-zoom `<model-viewer>`, not a static image. The avatar is **live in the conversation**: rotate it, zoom it, watch it idle, all without leaving the chat. Hosts without MCP Apps support still get a rendered preview image and a one-tap live embed, so the tool degrades gracefully everywhere.
+Run it directly with `npx` (no install needed) or install globally for the `avatar-mcp` CLI:
-Identify an avatar three ways: by **`id`** (UUID), by **`@handle`** (username), or by a raw **`model`** GLB url.
+```bash
+npx -y @three-ws/avatar-mcp # MCP stdio server
+npm install -g @three-ws/avatar-mcp # exposes `avatar-mcp`
+```
-## Use with Claude Desktop / Claude Code / Cursor
+## Setup
-Claude Code, one line:
+**Claude Code**, one line:
```bash
claude mcp add threews-avatar -- npx -y @three-ws/avatar-mcp
```
-Claude Desktop / Cursor (JSON config):
+**Claude Desktop / Cursor** (JSON config):
```json
{
- "mcpServers": {
- "threews-avatar": {
- "command": "npx",
- "args": ["-y", "@three-ws/avatar-mcp"]
- }
- }
+ "mcpServers": {
+ "threews-avatar": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/avatar-mcp"]
+ }
+ }
}
```
-No environment variables required. To point at a different host, set `THREEWS_BASE_URL`.
+No environment variables are required. To read avatars from a different host (e.g. a preview deployment), set `THREEWS_BASE_URL`. Restart your client after editing the config.
-## Run standalone
+Inspect the tool surface in a GUI:
```bash
-npx @three-ws/avatar-mcp
-# inspect the tool surface:
-npx -y @modelcontextprotocol/inspector npx @three-ws/avatar-mcp
+npx -y @modelcontextprotocol/inspector npx -y @three-ws/avatar-mcp
```
-## Example calls
+## Quick start
+
+Once connected, ask your client in plain language:
+
+> Render the avatar for @nirholas in the chat, dark background, auto-rotating.
+
+`render_avatar` returns three things so it looks great in every client:
+
+1. a **preview image** that renders inline everywhere,
+2. an **interactive `text/html` resource** — a real `<model-viewer>` you can orbit and zoom, for hosts that render HTML resources, and
+3. the **embed URL + iframe** to drop the live avatar into any page.
+
+## Tools
+
+All three tools are free, read-only, and annotated (`readOnlyHint`, `idempotentHint`, `openWorldHint`) so hosts can run them without confirmation prompts. There is no x402 charge. Identify an avatar by **`id`** (UUID), **`handle`** (`nirholas` or `@nirholas`), or a raw **`model`** GLB URL.
+
+| Tool | Selectors | What it does |
+| ------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `render_avatar` | `id` · `handle` · `model` | Renders the avatar inline. On [MCP Apps](https://modelcontextprotocol.io/extensions/apps/overview)-capable hosts it shows a **live, rotatable 3D model right in the chat**; other clients get a preview image + embed URL. Params: `background` (`transparent`/`dark`/`light`), `scene` (`portrait`/`headshot`/`upper-body`/`full-body`), `auto_rotate`, `height` (160–1080). |
+| `avatar_embed_code` | `id` · `handle` · `model` | Returns a ready-to-paste `<iframe>` that embeds the live avatar anywhere — as easy as a YouTube embed. Params: `background`, `width` (CSS), `height` (160–1080), `idle` (loop the idle animation), `overlay` (chrome-free mode for OBS/overlays). |
+| `get_avatar` | `id` · `handle` | Fetches avatar metadata: `name`, GLB `model_url`, owner, visibility. |
+
+### Interactive 3D in the chat — the differentiator
+
+`render_avatar` is an [MCP App](https://modelcontextprotocol.io/extensions/apps/overview) (SEP-1865): it declares a `ui://` resource that supporting hosts render in a sandboxed iframe — a real, orbit-and-zoom `<model-viewer>`, not a static image. The avatar is live in the conversation: rotate it, zoom it, watch it idle, without leaving the chat. Hosts without MCP Apps support still get a rendered preview image and a one-tap live embed, so the tool degrades gracefully everywhere.
+
+### Example calls
```jsonc
// render_avatar — live, rotatable avatar in chat
@@ -70,21 +107,32 @@ npx -y @modelcontextprotocol/inspector npx @three-ws/avatar-mcp
{ "handle": "@nirholas" }
```
-`render_avatar` returns three things so it looks great in every client:
-1. a **preview image** (renders inline everywhere),
-2. an **interactive `text/html` resource** (a `<model-viewer>` you can orbit — for clients that render HTML resources), and
-3. the **embed URL + iframe** so you can drop the live avatar into any page.
-
## How it works
-| Selector | Endpoint |
-| --- | --- |
-| `id` | `GET https://three.ws/api/avatars/:id` |
-| `handle` | `GET https://three.ws/api/users/:handle/avatar` |
-| preview image | `GET https://three.ws/api/avatar/render?avatar=:id` |
-| live embed | `https://three.ws/avatar-embed.html?...` |
-| viewer | `https://three.ws/viewer?src=:glb` |
+Each selector maps to a real three.ws endpoint. Raw `model` URLs must be `https://` (or `http://localhost` for dev); other schemes are rejected.
+
+| Selector / asset | Endpoint |
+| ---------------- | --------------------------------------------------- |
+| `id` | `GET https://three.ws/api/avatars/:id` |
+| `handle` | `GET https://three.ws/api/users/:handle/avatar` |
+| preview image | `GET https://three.ws/api/avatar/render?avatar=:id` |
+| live embed | `https://three.ws/avatar-embed.html?...` |
+| viewer | `https://three.ws/viewer?src=:glb` |
+
+## Requirements
+
+- **Node** `>=20`.
+- **No credentials.** Public and unlisted avatars need no API key.
+
+| Variable | Required | Notes |
+| -------------------- | -------- | ----------------------------------------------------------- |
+| `THREEWS_BASE_URL` | Optional | three.ws host to read from. Defaults to `https://three.ws`. |
+| `THREEWS_TIMEOUT_MS` | Optional | Per-request network timeout. Defaults to `30000`. |
-## License
+## Links
-Apache-2.0
+- Homepage: https://three.ws
+- Sibling package: [`@three-ws/avatar-agent`](https://www.npmjs.com/package/@three-ws/avatar-agent) — full 3D AI agent (wallet, voice, pump.fun)
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/packages/viewer-presets/README.md b/packages/viewer-presets/README.md
new file mode 100644
index 000000000..bcdf6c9aa
--- /dev/null
+++ b/packages/viewer-presets/README.md
@@ -0,0 +1,125 @@
+<h1 align="center">@three-ws/viewer-presets</h1>
+
+<p align="center"><strong>Tuned light rig, floor reflection, and bloom presets for three.ws avatar viewers — visage-derived, framework-agnostic.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/viewer-presets"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/viewer-presets?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/viewer-presets"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/viewer-presets?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/viewer-presets?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/viewer-presets?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#usage">Usage</a> ·
+ <a href="#presets">Presets</a> ·
+ <a href="#api">API</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> `@three-ws/viewer-presets` is a small, data-first package of visual presets for
+> 3D avatar viewers: a five-light rig, floor-reflection parameters, and a bloom
+> configuration. The tuning values are derived from Ready Player Me's open-source
+> [`visage`](https://github.com/readyplayerme/visage) viewer (MIT) and re-tuned for
+> three.ws, so avatars render color-accurate to that reference setup. It's
+> framework-agnostic: presets are plain frozen objects, and the one factory
+> (`buildLightRig`) takes your `THREE` namespace as an argument instead of importing
+> Three.js itself.
+
+## Install
+
+```bash
+npm install @three-ws/viewer-presets
+```
+
+`three` (`>=0.150.0`) is an **optional** peer dependency — only `buildLightRig()`
+touches it, and you pass your own `THREE` namespace in. The preset constants and the
+`floorReflectionConfig` / `bloomConfig` helpers are pure data and need nothing.
+
+## Usage
+
+```js
+import * as THREE from 'three';
+import { buildLightRig, floorReflectionConfig, bloomConfig } from '@three-ws/viewer-presets';
+
+// 1. Build the five-light avatar rig as a THREE.Group and add it to your scene.
+const { group, headTarget, shoeTarget } = buildLightRig(THREE);
+scene.add(group);
+
+// 2. Floor reflection config — `color` must match your canvas background.
+const floor = floorReflectionConfig({ color: '#0b0b12' });
+// feed `floor` into MeshReflectorMaterial (or your own reflector)
+
+// 3. Bloom config — feed into the `postprocessing` Bloom effect (or equivalent).
+const bloom = bloomConfig({ intensity: 0.15 });
+```
+
+You can also import each preset from its own subpath:
+
+```js
+import { LIGHT_CONFIG, buildLightRig } from '@three-ws/viewer-presets/lights';
+import { FLOOR_REFLECTION_DEFAULTS, floorReflectionConfig } from '@three-ws/viewer-presets/floor';
+import { BLOOM_DEFAULTS, bloomConfig } from '@three-ws/viewer-presets/bloom';
+```
+
+## Presets
+
+### Light rig (`./lights`)
+
+`buildLightRig(THREE, overrides?)` returns a `THREE.Group` containing five spotlights
+— fill (blue rim), back (warm rim), key (soft face fill), lift (body/shoe wash), and
+silhouette (arms/legs) — plus a head target and shoe target the lights aim at.
+Positions, angles, intensities, and colors come from `LIGHT_CONFIG`; `overrides`
+patches the `defaults` block (e.g. `keyLightIntensity`, `fillLightColor`,
+`backLightPosition`, `lightTarget`).
+
+### Floor reflection (`./floor`)
+
+`FLOOR_REFLECTION_DEFAULTS` holds reflector parameters (`resolution`, `mixBlur`,
+`mixStrength`, `blur`, `mirror`, depth thresholds, `planeSize`, fog range, …) using
+the same names as visage's `FloorReflection` component. `floorReflectionConfig(props)`
+merges your overrides; `color` is **required** and should match the canvas background
+so the plane fades in seamlessly.
+
+### Bloom (`./bloom`)
+
+`BLOOM_DEFAULTS` is a verbatim-tuned bloom config (`luminanceThreshold`,
+`luminanceSmoothing`, `mipmapBlur`, `intensity`, `kernelSize`).
+`bloomConfig(overrides?)` merges your changes over it.
+
+## API
+
+| Export | Signature |
+|---|---|
+| `buildLightRig(THREE, overrides?)` | `(THREE, Partial<LightingOverrides>) => { group, headTarget, shoeTarget }` |
+| `LIGHT_CONFIG` | Frozen `LightConfig` (angles, positions, and a `defaults` overrides block). |
+| `floorReflectionConfig(props)` | `(Partial<FloorReflectionProps> & { color }) => FloorReflectionProps`; throws if `color` is missing. |
+| `FLOOR_REFLECTION_DEFAULTS` | Frozen floor-reflection defaults (no `color`). |
+| `bloomConfig(overrides?)` | `(Partial<BloomProps>) => BloomProps` |
+| `BLOOM_DEFAULTS` | Frozen bloom defaults. |
+
+## Requirements
+
+- Node `>=18`.
+- Optional peer dependency: `three` `>=0.150.0` (only for `buildLightRig`; passed in, not imported).
+- Run the test suite with `npm test` (Node's built-in `node:test`).
+
+## Attribution
+
+Preset values are derived from Ready Player Me's `visage` viewer (MIT) and re-tuned
+for three.ws. See [NOTICE](./NOTICE) for details. This package is distributed under
+Apache-2.0.
+
+## Related packages
+
+- [`@three-ws/avatar`](https://www.npmjs.com/package/@three-ws/avatar) — the avatar SDK whose viewer these presets are tuned for.
+- [`@three-ws/agent-ui`](https://www.npmjs.com/package/@three-ws/agent-ui) — the avatar-overlay SDK.
+
+## Links
+
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: Apache-2.0 — see [LICENSE](./LICENSE)
diff --git a/pages/forge.html b/pages/forge.html
index f222c2756..17736b36c 100644
--- a/pages/forge.html
+++ b/pages/forge.html
@@ -1615,9 +1615,27 @@
outline: 2px solid var(--accent);
outline-offset: 2px;
}
+ /* Hover-to-spin: the card's real model, laid over the square thumb,
+ faded in only after its GLB finishes loading. */
+ .showcase-preview {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ aspect-ratio: 1 / 1;
+ width: 100%;
+ background: var(--surface-2);
+ opacity: 0;
+ pointer-events: none;
+ transition: opacity 0.25s ease;
+ }
+ .showcase-card.is-previewing .showcase-preview {
+ opacity: 1;
+ }
@media (prefers-reduced-motion: reduce) {
.showcase-refresh,
- .showcase-remix {
+ .showcase-remix,
+ .showcase-preview {
transition: none;
}
.showcase-refresh:hover {
diff --git a/public/changelog.json b/public/changelog.json
index 1e44b82cc..8155dfe0d 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-12T23:41:21.919Z",
+ "generated_at": "2026-06-12T23:45:02.011Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -118,6 +118,16 @@
"fix"
]
},
+ {
+ "date": "2026-06-12",
+ "type": "update",
+ "title": "Forge gets a community showcase — and takes photos from anywhere",
+ "summary": "The /forge page now ends with “Fresh from the Forge”: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.",
+ "link": "/forge",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-12",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 0781f133a..8178de453 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -94,6 +94,14 @@
<category>improvement</category>
<description>The engine buttons on Forge now reflect what's actually running, probed live against each provider — not just whether it's set up. An engine whose upstream is down or unreachable is disabled with the reason in its tooltip, a throttled one shows an amber busy dot, and bring-your-own-key engines (Meshy, Tripo) say so before you pick them. Behind it is a new public health check at /api/forge?health, and the self-hosted Hunyuan3D lane was rewired to its own worker so it no longer fails every prompt by routing to the avatar pipeline.</description>
</item>
+ <item>
+ <title>Forge gets a community showcase — and takes photos from anywhere</title>
+ <link>https://three.ws/forge</link>
+ <guid isPermaLink="false">2026-06-12:Forge gets a community showcase — and takes photos from anywhere</guid>
+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>The /forge page now ends with “Fresh from the Forge”: a live strip of the newest models other people generated. Hover a card and the actual model spins in place; open it in the full viewer with download, share, and stylize working; or hit Remix to copy its prompt into the composer and make your own version. Getting photos in is easier too — paste an image from the clipboard (⌘V) anywhere on the page, or drag files onto the page and Forge switches to photo mode and places them for you.</description>
+ </item>
<item>
<title>Forge helps you write a better prompt before you spend a generation</title>
<link>https://three.ws/forge</link>
diff --git a/public/features.json b/public/features.json
index 7df60668c..0d02224c1 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-12T23:41:21.900Z",
+ "generated_at": "2026-06-12T23:45:01.997Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/scripts/publish-mcp-servers.mjs b/scripts/publish-mcp-servers.mjs
new file mode 100644
index 000000000..caf36f478
--- /dev/null
+++ b/scripts/publish-mcp-servers.mjs
@@ -0,0 +1,232 @@
+#!/usr/bin/env node
+// Publish every three.ws MCP server to npm and the official MCP registry
+// (registry.modelcontextprotocol.io), idempotently.
+//
+// For each stdio package below it:
+// 1. checks the version in package.json against npm — publishes to npm if absent
+// (requires `npm whoami` to succeed or NPM_TOKEN in the environment);
+// 2. checks the version against the MCP registry — publishes server.json if absent.
+//
+// Remote-only manifests (root server*.json) skip the npm step.
+//
+// Registry auth (io.github.nirholas namespace), first match wins:
+// - MCP_REGISTRY_TOKEN env (a registry JWT)
+// - GITHUB_TOKEN env, exchanged via POST /v0/auth/github-at
+// - the GitHub PAT embedded in the `origin` remote URL, same exchange
+//
+// Usage:
+// node scripts/publish-mcp-servers.mjs --dry-run # validate + report only
+// node scripts/publish-mcp-servers.mjs # publish what's missing
+// node scripts/publish-mcp-servers.mjs --only pumpfun-mcp,three-token-mcp
+
+import { execFileSync } from 'node:child_process';
+import { readFileSync, existsSync } from 'node:fs';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const REGISTRY = 'https://registry.modelcontextprotocol.io';
+
+// Every publishable MCP server in this repo. `dir` packages publish to npm
+// first; `manifest`-only entries are remote Streamable HTTP servers.
+const SERVERS = [
+ { key: 'mcp-server', dir: 'mcp-server', manifest: 'mcp-server/server.json' },
+ {
+ key: 'pumpfun-mcp',
+ dir: 'packages/pumpfun-mcp',
+ manifest: 'packages/pumpfun-mcp/server.json',
+ },
+ {
+ key: 'ibm-watsonx-mcp',
+ dir: 'packages/ibm-watsonx-mcp',
+ manifest: 'packages/ibm-watsonx-mcp/server.json',
+ },
+ {
+ key: 'ibm-x402-mcp',
+ dir: 'packages/ibm-x402-mcp',
+ manifest: 'packages/ibm-x402-mcp/server.json',
+ },
+ {
+ key: 'avatar-agent-mcp',
+ dir: 'packages/avatar-agent-mcp',
+ manifest: 'packages/avatar-agent-mcp/server.json',
+ },
+ {
+ key: 'threews-avatar-mcp',
+ dir: 'packages/threews-avatar-mcp',
+ manifest: 'packages/threews-avatar-mcp/server.json',
+ },
+ {
+ key: 'three-token-mcp',
+ dir: 'packages/three-token-mcp',
+ manifest: 'packages/three-token-mcp/server.json',
+ },
+ { key: 'remote-main', manifest: 'server.json' },
+ { key: 'remote-3d', manifest: 'server-3d.json' },
+ { key: 'remote-agent', manifest: 'server-agent.json' },
+ { key: 'remote-ibm', manifest: 'server-ibm.json' },
+ { key: 'remote-bazaar', manifest: 'server-bazaar.json' },
+];
+
+const args = process.argv.slice(2);
+const dryRun = args.includes('--dry-run');
+const onlyArg = args.find((a) => a.startsWith('--only'));
+const only = onlyArg
+ ? (onlyArg.includes('=') ? onlyArg.split('=')[1] : args[args.indexOf(onlyArg) + 1] || '')
+ .split(',')
+ .filter(Boolean)
+ : null;
+
+const fail = (msg) => {
+ console.error(`✗ ${msg}`);
+ process.exitCode = 1;
+};
+
+function readJson(path) {
+ return JSON.parse(readFileSync(resolve(root, path), 'utf8'));
+}
+
+async function npmVersionExists(name, version) {
+ const res = await fetch(
+ `https://registry.npmjs.org/${encodeURIComponent(name).replace('%2F', '/')}`,
+ );
+ if (res.status === 404) return false;
+ if (!res.ok) throw new Error(`npm registry lookup for ${name} → HTTP ${res.status}`);
+ const meta = await res.json();
+ return Boolean(meta.versions && meta.versions[version]);
+}
+
+async function registryVersionExists(name, version) {
+ const res = await fetch(
+ `${REGISTRY}/v0/servers/${encodeURIComponent(name)}/versions/${encodeURIComponent(version)}`,
+ );
+ if (res.status === 404) return false;
+ if (!res.ok) throw new Error(`MCP registry lookup for ${name}@${version} → HTTP ${res.status}`);
+ return true;
+}
+
+function patFromOriginRemote() {
+ try {
+ const url = execFileSync('git', ['-C', root, 'remote', 'get-url', 'origin'], {
+ encoding: 'utf8',
+ }).trim();
+ const m = /https:\/\/[^:]+:([^@]+)@github\.com\//.exec(url);
+ return m ? m[1] : null;
+ } catch {
+ return null;
+ }
+}
+
+async function getRegistryToken() {
+ if (process.env.MCP_REGISTRY_TOKEN) return process.env.MCP_REGISTRY_TOKEN;
+ const ghToken = process.env.GITHUB_TOKEN || patFromOriginRemote();
+ if (!ghToken) {
+ throw new Error(
+ 'no registry auth: set MCP_REGISTRY_TOKEN or GITHUB_TOKEN, or keep the PAT on the origin remote',
+ );
+ }
+ const res = await fetch(`${REGISTRY}/v0/auth/github-at`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ github_token: ghToken }),
+ });
+ if (!res.ok) {
+ throw new Error(
+ `registry github-at exchange failed → HTTP ${res.status}: ${await res.text()}`,
+ );
+ }
+ const body = await res.json();
+ if (!body.registry_token)
+ throw new Error('registry github-at exchange returned no registry_token');
+ return body.registry_token;
+}
+
+async function publishToRegistry(manifest, token) {
+ const res = await fetch(`${REGISTRY}/v0/publish`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` },
+ body: JSON.stringify(manifest),
+ });
+ const text = await res.text();
+ if (!res.ok) throw new Error(`registry publish → HTTP ${res.status}: ${text}`);
+ return JSON.parse(text);
+}
+
+function npmPublish(dir) {
+ execFileSync('npm', ['publish', '--access', 'public'], {
+ cwd: resolve(root, dir),
+ stdio: 'inherit',
+ });
+}
+
+let registryToken = null;
+
+for (const server of SERVERS) {
+ if (only && !only.includes(server.key)) continue;
+ const manifestPath = resolve(root, server.manifest);
+ if (!existsSync(manifestPath)) {
+ fail(`${server.key}: manifest ${server.manifest} not found`);
+ continue;
+ }
+ const manifest = readJson(server.manifest);
+ const { name, version } = manifest;
+ console.log(`\n── ${server.key} → ${name}@${version}`);
+
+ // Consistency checks before anything irreversible.
+ if (server.dir) {
+ const pkg = readJson(`${server.dir}/package.json`);
+ if (pkg.version !== version) {
+ fail(`${server.key}: package.json ${pkg.version} ≠ server.json ${version}`);
+ continue;
+ }
+ const pkgEntry = manifest.packages?.[0];
+ if (!pkgEntry || pkgEntry.identifier !== pkg.name || pkgEntry.version !== version) {
+ fail(`${server.key}: server.json packages[0] does not match ${pkg.name}@${version}`);
+ continue;
+ }
+ if (pkg.mcpName !== name) {
+ fail(
+ `${server.key}: package.json mcpName "${pkg.mcpName}" ≠ server.json name "${name}"`,
+ );
+ continue;
+ }
+ }
+
+ // 1. npm
+ if (server.dir) {
+ const pkg = readJson(`${server.dir}/package.json`);
+ const onNpm = await npmVersionExists(pkg.name, version);
+ if (onNpm) {
+ console.log(` npm: ${pkg.name}@${version} already published`);
+ } else if (dryRun) {
+ console.log(` npm: would publish ${pkg.name}@${version}`);
+ } else {
+ console.log(` npm: publishing ${pkg.name}@${version}…`);
+ npmPublish(server.dir);
+ }
+ }
+
+ // 2. MCP registry
+ const onRegistry = await registryVersionExists(name, version);
+ if (onRegistry) {
+ console.log(` registry: ${name}@${version} already published`);
+ } else if (dryRun) {
+ console.log(` registry: would publish ${name}@${version}`);
+ } else {
+ if (server.dir) {
+ const pkg = readJson(`${server.dir}/package.json`);
+ if (!(await npmVersionExists(pkg.name, version))) {
+ fail(
+ `${server.key}: skipping registry publish — ${pkg.name}@${version} is not on npm yet`,
+ );
+ continue;
+ }
+ }
+ registryToken ??= await getRegistryToken();
+ console.log(` registry: publishing ${name}@${version}…`);
+ const out = await publishToRegistry(manifest, registryToken);
+ console.log(` registry: published (status ${out?.server?.status ?? 'ok'})`);
+ }
+}
+
+console.log(dryRun ? '\nDry run complete.' : '\nPublish run complete.');
diff --git a/scripts/verify-forge-showcase.mjs b/scripts/verify-forge-showcase.mjs
index 684b2f8e0..65842d85a 100644
--- a/scripts/verify-forge-showcase.mjs
+++ b/scripts/verify-forge-showcase.mjs
@@ -59,15 +59,33 @@ const livePass = await page.$eval('#showcase', (el) =>
console.log('live API pass:', livePass);
// ── Pass 2: stub the community endpoint with the real response shape ─────────
+// A duplicate-prompt row is included on purpose: the module must dedupe it.
await page.route('**/api/forge-gallery?scope=community*', (route) =>
- route.fulfill({ json: { enabled: true, creations: SHOWCASE_ROWS } }),
+ route.fulfill({
+ json: {
+ enabled: true,
+ creations: [...SHOWCASE_ROWS, { ...SHOWCASE_ROWS[0], id: 'c-dupe' }],
+ },
+ }),
);
await page.goto(`${BASE}/forge.html`, { waitUntil: 'load' });
await page.waitForSelector('#showcase:not(.is-hidden) .showcase-card', { timeout: 5000 });
const cards = await page.$$eval('#showcase-grid .showcase-card', (els) => els.length);
const count = await page.$eval('#showcase-count', (el) => el.textContent);
const whens = await page.$$eval('.showcase-when', (els) => els.map((e) => e.textContent));
-console.log('showcase rendered:', { cards, count, whens });
+const badge = await page.$eval('#showcase-grid .showcase-card .badge', (el) => el.textContent);
+console.log('showcase rendered (3 rows in, dupe dropped):', { cards, count, whens, badge });
+
+// Hover-to-spin: dwell on a card → a mini model-viewer with its GLB appears.
+await page.hover('#showcase-grid .showcase-card');
+await page.waitForSelector('#showcase-grid .showcase-card .showcase-preview', { timeout: 3000 });
+const previewSrc = await page.$eval('#showcase-grid .showcase-card .showcase-preview', (el) =>
+ el.getAttribute('src'),
+);
+await page.mouse.move(0, 0); // leave → teardown
+await page.waitForTimeout(150);
+const previewGone = await page.$('#showcase-grid .showcase-preview');
+console.log('hover preview:', { previewSrc, tornDown: previewGone === null });
// Remix: fills the composer prompt + focuses it.
await page.click('.showcase-card .showcase-remix');
diff --git a/sdk/README.md b/sdk/README.md
index cdf528539..41617203b 100644
--- a/sdk/README.md
+++ b/sdk/README.md
@@ -1,6 +1,31 @@
-# @three-ws/sdk
-
-Ship an **ERC-8004 agent** with on-chain identity, a chat panel, and discoverable `.well-known` endpoints — in minutes.
+<h1 align="center">@three-ws/sdk</h1>
+
+<p align="center"><strong>Ship a cross-chain 3D AI agent: ERC-8004 + Solana identity, a chat panel, an embeddable avatar, and <code>.well-known</code> manifests.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/sdk"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/sdk?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/sdk"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/sdk?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/sdk?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/sdk?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#embed-a-3d-avatar">Avatar</a> ·
+ <a href="#register-on-chain">Register</a> ·
+ <a href="#api">API</a> ·
+ <a href="#permissions">Permissions</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> A browser SDK for shipping a 3D AI agent that's discoverable on-chain. Mount a
+> floating chat panel with voice I/O, embed any three.ws agent's 3D avatar, register
+> the agent via ERC-8004 (EVM) or Metaplex (Solana), generate the standard
+> `.well-known` manifests, and run x402 paid agent-to-agent calls — all from one
+> package. Vanilla JS, no framework required.
## Install
@@ -8,7 +33,9 @@ Ship an **ERC-8004 agent** with on-chain identity, a chat panel, and discoverabl
npm install @three-ws/sdk ethers
```
-`ethers@^6` is a peer dependency (only needed if you call `register()`).
+`ethers@^6` and `@solana/web3.js@^1` are optional peer dependencies — install
+`ethers` only if you call `register()` (EVM), `@solana/web3.js` only for the
+Solana helpers.
## Quick start
@@ -194,6 +221,65 @@ import {
} from '@three-ws/sdk/permissions/advanced';
```
-## License
+## Solana identity & payments
+
+Sign in with Solana (SIWS), register an agent's identity via Metaplex, and run a
+Solana Pay checkout. Imported from `@three-ws/sdk/solana` (or the root). Needs an
+injected Solana wallet (`@solana/web3.js@^1` is an optional peer dependency).
+
+```js
+import {
+ detectSolanaProvider,
+ signInWithSolana,
+ registerSolanaAgent,
+ startSolanaCheckout,
+ confirmSolanaPayment,
+} from '@three-ws/sdk/solana';
+
+const provider = detectSolanaProvider();
+const { publicKey } = await signInWithSolana({ provider });
+
+const { intentId, reference } = await startSolanaCheckout({ plan: 'pro', network: 'mainnet' });
+const ok = await confirmSolanaPayment({ intentId, txSignature, network: 'mainnet' });
+```
+
+On-chain attestations and reputation (feedback, validation, tasks, disputes) are
+exported from `@three-ws/sdk/solana-attestations`: `attestFeedback`,
+`attestValidation`, `createTask`, `acceptTask`, `attestRevoke`, `attestDispute`,
+`listAttestations`, `fetchAttestations`, `fetchReputation`.
+
+## Paid agent-to-agent calls (x402)
+
+`AgentClient` calls another agent's paid skills, handling the x402 `402 Payment
+Required` flow for you.
+
+```js
+import { AgentClient, PaymentRequiredError } from '@three-ws/sdk';
+
+const client = new AgentClient({ baseUrl: 'https://three.ws/', apiKey: process.env.THREE_WS_KEY });
+
+const prices = await client.getSkillPrices(agentId);
+try {
+ const result = await client.invokeSkill(agentId, 'summarize', { url: 'https://example.com' });
+} catch (err) {
+ if (err instanceof PaymentRequiredError) {
+ // surface the payment requirements to the user / wallet
+ }
+}
+```
+
+## Requirements
+
+- **Node** `>= 18`; runs in modern browsers (the panel and avatar are browser-only).
+- **Optional peers:** `ethers@^6` (for `register()` and `PermissionsClient`),
+ `@solana/web3.js@^1` (for the Solana helpers).
+- **Credentials:** a [web3.storage](https://web3.storage) token for IPFS pinning on
+ `register()`; an injected EVM wallet (MetaMask) or Solana wallet for signing.
+
+## Links
-MIT
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Sibling SDK: [`@three-ws/solana-agent`](https://www.npmjs.com/package/@three-ws/solana-agent)
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: MIT — see [LICENSE](./LICENSE)
diff --git a/server-3d.json b/server-3d.json
index 105ba95fe..65d99ea82 100644
--- a/server-3d.json
+++ b/server-3d.json
@@ -1,7 +1,16 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/threews-3d-studio",
- "description": "Turn text or an image into an interactive, animation-ready 3D model (GLB): generate (text/image→3D, quality tiers + geometry backends), auto-rig, animate, pose, remesh, segment, retexture, save generated models as durable named avatars, and IBM Granite prompt-direction + material generation. By three.ws.",
+ "title": "three.ws 3D Studio",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
+ "description": "Turn text or an image into an animation-ready 3D model (GLB): generate, rig, animate, retexture.",
"repository": {
"url": "https://github.com/nirholas/three.ws",
"source": "github"
diff --git a/server-agent.json b/server-agent.json
index 8d9eb650f..8841332a6 100644
--- a/server-agent.json
+++ b/server-agent.json
@@ -1,7 +1,16 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/threews-agent",
- "description": "Give your AI agent a wallet on the x402 network: provision a custodial wallet, discover and pay for services in USDC, and monetize your own endpoint to earn USDC from other agents. By three.ws.",
+ "title": "three.ws Agent Wallet",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
+ "description": "Give your AI agent an x402 wallet: discover and pay for services in USDC, or earn from your own.",
"repository": {
"url": "https://github.com/nirholas/three.ws",
"source": "github"
diff --git a/server-bazaar.json b/server-bazaar.json
index 5280ea196..be208a67b 100644
--- a/server-bazaar.json
+++ b/server-bazaar.json
@@ -1,6 +1,15 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/threews-x402-bazaar",
+ "title": "three.ws x402 Bazaar",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
"description": "Discover and price paid agent services across the live x402 network, by three.ws.",
"repository": {
"url": "https://github.com/nirholas/three.ws",
diff --git a/server-ibm.json b/server-ibm.json
index ed5cbc6ea..8397a2916 100644
--- a/server-ibm.json
+++ b/server-ibm.json
@@ -1,7 +1,16 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/ibm-x402-mcp-remote",
- "description": "x402 pay-per-use IBM Granite AI over a hosted MCP endpoint — chat, code, embeddings, document analysis, and time-series forecasting. Pay USDC on Base or Solana per call. No IBM Cloud account required. By three.ws.",
+ "title": "IBM Granite x402 Remote",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
+ "description": "Pay-per-use IBM Granite AI via x402: chat, code, embeddings, forecasting. USDC on Base or Solana.",
"repository": {
"url": "https://github.com/nirholas/three.ws",
"source": "github",
diff --git a/server.json b/server.json
index 957ce64f8..d8e48fe0c 100644
--- a/server.json
+++ b/server.json
@@ -1,7 +1,16 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.nirholas/three.ws",
- "description": "Render 3D avatars from three.ws as interactive embeds or real PNG/JPEG/WebP images, get copy-paste <iframe> embed code for any avatar, on-chain agent, or Forge creation to drop into Notion/Webflow/a blog, persist and manage your avatar library, validate, inspect, and optimize glTF/GLB models, give agents persistent memory (remember, recall, forget), and mint an agent's on-chain identity — register_agent (server-custodial Metaplex Agent Registry on Solana, or a prepared ERC-8004 payload for Base) and identity_check (Granite impersonation + policy screening).",
+ "title": "three.ws Avatars & Agents",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
+ "description": "3D avatars, embeds, glTF tools, agent memory, and on-chain agent identity from three.ws.",
"repository": {
"url": "https://github.com/nirholas/three.ws",
"source": "github"
diff --git a/solana-agent-sdk/README.md b/solana-agent-sdk/README.md
index 3fbfdc361..cfdfde7b5 100644
--- a/solana-agent-sdk/README.md
+++ b/solana-agent-sdk/README.md
@@ -1,6 +1,29 @@
-# @three-ws/solana-agent
+<h1 align="center">@three-ws/solana-agent</h1>
-Solana agent SDK for three.ws — keypair and browser wallets, SOL/SPL transfers, Jupiter swaps, staking, and the x402 "exact" payment scheme. Dual ESM/CJS, fully typed.
+<p align="center"><strong>Solana agent SDK: keypair + browser wallets, SOL/SPL transfers, Jupiter swaps, staking, and the x402 exact payment scheme.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/solana-agent"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/solana-agent?logo=npm&color=cb3837"></a>
+ <a href="https://www.npmjs.com/package/@three-ws/solana-agent"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/solana-agent?color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/solana-agent?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/solana-agent?color=339933&logo=node.js">
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#entry-points">Entry points</a> ·
+ <a href="#wallet-providers">Wallets</a> ·
+ <a href="#x402-exact-payments">x402</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> A typed Solana SDK for AI agents. Give an agent a wallet — its own keypair for
+> autonomous signing, or a browser wallet that defers signing to the user — then
+> transfer SOL and SPL tokens, swap via Jupiter, stake, pay x402 invoices in USDC,
+> and plug into solana-agent-kit. Dual ESM/CJS, fully typed.
## Install
@@ -135,16 +158,45 @@ const result = await swapAction.handler(agent, { inputMint, outputMint, amount }
Exports here: `SolanaAgentPlugin`, `allActions`, the individual actions (`transferSolAction`, `transferSplAction`, `swapAction`, `getSwapQuoteAction`, `getBalanceAction`, `createAtaAction`, `stakeSolAction`, `unstakeSolAction`, `getStakeAccountsAction`), and the `Action` / `Plugin` / `SolanaAgentLike` types.
+## AgenC coordination
+
+The root export also bundles an adapter for the [AgenC](https://agenc.tech)
+on-chain agent-coordination protocol — register agents, create and claim tasks,
+and bridge identities from ERC-8004 / MPL-Core / three.ws handles into AgenC ids.
+
+```js
+import {
+ createAgenCClient,
+ registerAgenCAgent,
+ createAgenCTask,
+ claimAgenCTask,
+ completeAgenCTask,
+} from '@three-ws/solana-agent';
+```
+
+Also exported: `getAgenCAgent`, `deriveAgenCAgentPda`, the task lifecycle helpers
+(`getAgenCTask`, `getAgenCTaskLifecycle`, `listAgenCTasksByCreator`,
+`generateAgenCTaskId`, `formatTaskState`), the identity bridges
+(`bridgeErc8004ToAgenCId`, `bridgeMplCoreToAgenCId`, `bridgeThreewsHandleToAgenCId`,
+`getCanonicalThreewsAgenCId`), and the program-id constants
+(`AGENC_DEVNET_PROGRAM_ID`, `AGENC_MAINNET_PROGRAM_ID`).
+
## Errors
Typed error classes (exported from the root) for boundary handling: `SolanaAgentError`, `TransactionRejectedError`, `WalletNotConnectedError`, `WalletCapabilityError`, `MissingTokenAccountError`, `SwapError`, `SimulationError`, `ConfirmationTimeoutError`.
-## Build & test
+## Requirements
-```
-npm run build # tsup -> dist (ESM + CJS + d.ts)
-npm run typecheck # tsc --noEmit
-npm test # jest
-```
+- **Node** `>= 18`.
+- **Base dep:** `@solana/web3.js@^1.98`. `@solana/spl-token` and
+ `@coral-xyz/anchor` ship as direct dependencies; `zod` is an optional peer dep.
+- For browser signing, a `@solana/wallet-adapter` wallet or a user-supplied
+ `SignerFn`.
+
+## Links
-Source lives in `src/` (`agent.ts`, `wallet/`, `actions/`, `x402-exact/`, `solana-agent-kit/`, `tx/`, `utils/`, `errors.ts`).
+- Homepage: https://three.ws
+- Changelog: https://three.ws/changelog
+- Sibling SDK: [`@three-ws/agent-payments`](https://www.npmjs.com/package/@three-ws/agent-payments)
+- Issues: https://github.com/nirholas/three.ws/issues
+- License: MIT — see [LICENSE](./LICENSE)
diff --git a/solana-agent-sdk/package.json b/solana-agent-sdk/package.json
index 52dfa97f1..56250dfa2 100644
--- a/solana-agent-sdk/package.json
+++ b/solana-agent-sdk/package.json
@@ -33,7 +33,7 @@
],
"scripts": {
"build": "tsup",
- "build:prod": "tsup --minify",
+ "build:prod": "TSUP_SOURCEMAP=false tsup --minify",
"dev": "tsup --watch",
"typecheck": "tsc --noEmit",
"clean": "rm -rf dist",
diff --git a/solana-agent-sdk/tsup.config.ts b/solana-agent-sdk/tsup.config.ts
index 7931d3b2f..822d2dc27 100644
--- a/solana-agent-sdk/tsup.config.ts
+++ b/solana-agent-sdk/tsup.config.ts
@@ -11,6 +11,8 @@ export default defineConfig({
format: ["cjs", "esm"],
dts: { compilerOptions: { noUnusedLocals: false, noUnusedParameters: false } },
clean: true,
- sourcemap: true,
+ // Sourcemaps in dev builds; omitted from the published (prod) bundle to keep
+ // the npm tarball lean — set TSUP_SOURCEMAP=false (see the build:prod script).
+ sourcemap: process.env.TSUP_SOURCEMAP !== "false",
splitting: false,
});
diff --git a/src/forge-showcase.js b/src/forge-showcase.js
index 84fb7c5e9..112b45446 100644
--- a/src/forge-showcase.js
+++ b/src/forge-showcase.js
@@ -63,9 +63,11 @@ function buildCard(c) {
prov.className = 'badge';
prov.style.left = '6px';
prov.style.right = 'auto';
- prov.textContent = [ENGINE_LABELS[c.backend] || c.backend, c.tier].filter(Boolean).join(' ');
+ prov.textContent = [ENGINE_LABELS[c.backend] || c.backend, c.tier].filter(Boolean).join(' · ');
card.appendChild(prov);
}
+
+ attachHoverPreview(card, c);
if (Number(c.views_used) > 1) {
const mv = document.createElement('span');
mv.className = 'badge';
@@ -116,6 +118,54 @@ function buildCard(c) {
return card;
}
+// Hover a card for a beat → its actual model spins in the thumb. One live
+// mini-viewer at a time (GLBs are megabytes; a grid of twelve would jank the
+// page), created only on real intent (300ms dwell) and torn down on leave.
+// <model-viewer> is already registered on this page. Pointer-only by design:
+// on touch, tapping the card opens the full viewer anyway.
+let activePreview = null; // { card, viewer }
+let previewTimer = null;
+
+function teardownHoverPreview() {
+ clearTimeout(previewTimer);
+ previewTimer = null;
+ if (activePreview) {
+ activePreview.viewer.remove();
+ activePreview.card.classList.remove('is-previewing');
+ activePreview = null;
+ }
+}
+
+function attachHoverPreview(card, c) {
+ if (!c.glb_url || !window.customElements?.get('model-viewer')) return;
+ if (matchMedia('(hover: none)').matches) return;
+
+ card.addEventListener('mouseenter', () => {
+ teardownHoverPreview();
+ previewTimer = setTimeout(() => {
+ const thumb = card.querySelector('.thumb');
+ if (!thumb) return;
+ const viewer = document.createElement('model-viewer');
+ viewer.className = 'showcase-preview';
+ viewer.setAttribute('src', c.glb_url);
+ viewer.setAttribute('auto-rotate', '');
+ viewer.setAttribute('auto-rotate-delay', '0');
+ viewer.setAttribute('rotation-per-second', '24deg');
+ viewer.setAttribute('interaction-prompt', 'none');
+ viewer.setAttribute('disable-zoom', '');
+ viewer.setAttribute('shadow-intensity', '0');
+ viewer.setAttribute('exposure', '0.9');
+ viewer.setAttribute('environment-image', 'neutral');
+ viewer.setAttribute('aria-hidden', 'true');
+ // Fade in only once the GLB is actually ready — no pop, no void.
+ viewer.addEventListener('load', () => card.classList.add('is-previewing'), { once: true });
+ thumb.insertAdjacentElement('afterend', viewer);
+ activePreview = { card, viewer };
+ }, 300);
+ });
+ card.addEventListener('mouseleave', teardownHoverPreview);
+}
+
// Put the prompt in the composer, in text mode, ready to edit-and-Generate.
function remixPrompt(prompt) {
document.querySelector('#mode-switch [data-mode="text"]')?.click();
@@ -138,7 +188,9 @@ async function loadShowcase() {
let data;
try {
- const res = await fetch('/api/forge-gallery?scope=community&limit=12');
+ // Over-fetch, then dedupe near-identical prompts client-side — people
+ // re-roll the same prompt, and a feed of six teapots sells nothing.
+ const res = await fetch('/api/forge-gallery?scope=community&limit=24');
data = await res.json().catch(() => ({}));
} catch {
els.grid.removeAttribute('aria-busy');
@@ -151,13 +203,23 @@ async function loadShowcase() {
}
els.grid.removeAttribute('aria-busy');
- const creations = Array.isArray(data?.creations) ? data.creations : [];
+ const all = Array.isArray(data?.creations) ? data.creations : [];
+ const seen = new Set();
+ const creations = all
+ .filter((c) => {
+ const key = (c.prompt || c.id || '').toLowerCase().replace(/\s+/g, ' ').trim();
+ if (seen.has(key)) return false;
+ seen.add(key);
+ return true;
+ })
+ .slice(0, 12);
if (!data?.enabled || creations.length === 0) {
// No durable store, or nothing forged yet — no hollow strip.
els.section.classList.add('is-hidden');
return;
}
+ teardownHoverPreview();
els.grid.innerHTML = '';
for (const c of creations) els.grid.appendChild(buildCard(c));
if (els.count) els.count.textContent = `${creations.length} recent`;
diff --git a/tests/mcp-tool-result.test.js b/tests/mcp-tool-result.test.js
index 03f0ec4e9..30d58150c 100644
--- a/tests/mcp-tool-result.test.js
+++ b/tests/mcp-tool-result.test.js
@@ -94,4 +94,60 @@ describe('MCP tool surface', () => {
const server = await buildServer();
expect(server).toBeTruthy();
});
+
+ // MCP ToolAnnotations contract: every tool declares behavior hints so
+ // clients can scope confirmation prompts. Per spec, destructiveHint
+ // DEFAULTS TO TRUE when omitted on a non-read-only tool — so every
+ // non-read-only tool here must set it to false explicitly (nothing this
+ // server ships destroys state).
+ it('declares MCP ToolAnnotations on every tool, and none are destructive', async () => {
+ const tools = await buildTools();
+ for (const t of tools) {
+ expect(t.annotations, `${t.name} missing annotations`).toBeTypeOf('object');
+ expect(typeof t.annotations.readOnlyHint, `${t.name}.readOnlyHint`).toBe('boolean');
+ expect(typeof t.annotations.idempotentHint, `${t.name}.idempotentHint`).toBe('boolean');
+ expect(typeof t.annotations.openWorldHint, `${t.name}.openWorldHint`).toBe('boolean');
+ // No tool on this server is destructive.
+ expect(t.annotations.destructiveHint, `${t.name}.destructiveHint`).not.toBe(true);
+ if (t.annotations.readOnlyHint === false) {
+ // Non-read-only tools MUST opt out of the spec's destructive default.
+ expect(
+ t.annotations.destructiveHint,
+ `${t.name} must set destructiveHint:false`,
+ ).toBe(false);
+ }
+ }
+ });
+
+ it('marks only the local-compute tools as closed-world, and the deterministic one as idempotent', async () => {
+ const tools = await buildTools();
+ const byName = Object.fromEntries(tools.map((t) => [t.name, t.annotations]));
+
+ // Pure local compute — no external interaction.
+ expect(byName.get_pose_seed).toEqual({
+ readOnlyHint: true,
+ idempotentHint: true,
+ openWorldHint: false,
+ });
+ expect(byName.vanity_grinder).toEqual({
+ readOnlyHint: true,
+ idempotentHint: false, // random keypair every call
+ openWorldHint: false,
+ });
+
+ // Everything else talks to the outside world.
+ for (const [name, a] of Object.entries(byName)) {
+ if (name === 'get_pose_seed' || name === 'vanity_grinder') continue;
+ expect(a.openWorldHint, `${name}.openWorldHint`).toBe(true);
+ // Live feeds / fresh artifacts — never claim idempotence.
+ expect(a.idempotentHint, `${name}.idempotentHint`).toBe(false);
+ }
+
+ // Generation + delegation tools are writes (they create hosted artifacts
+ // or dispatch actions); everything else is a pure read.
+ const writes = ['text_to_avatar', 'mesh_forge', 'rig_mesh', 'agent_delegate_action'];
+ for (const [name, a] of Object.entries(byName)) {
+ expect(a.readOnlyHint, `${name}.readOnlyHint`).toBe(!writes.includes(name));
+ }
+ });
});
diff --git a/tests/pump-mcp-tools.test.js b/tests/pump-mcp-tools.test.js
index 48ecbd1ec..c87bbecd5 100644
--- a/tests/pump-mcp-tools.test.js
+++ b/tests/pump-mcp-tools.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { TOOLS, rpcError, rpcEnvelope } from '../src/pump/mcp-tools.js';
+import { TOOLS, TOOL_ANNOTATIONS, rpcError, rpcEnvelope } from '../src/pump/mcp-tools.js';
// Tool names that must be present in both the Vercel and Worker runtimes.
// Both import TOOLS from the same shared module, so parity is structural.
@@ -44,6 +44,31 @@ describe('src/pump/mcp-tools — shared tool registry', () => {
expect(new Set(names).size).toBe(names.length);
});
+ it('every tool carries a title and read-only MCP annotations', () => {
+ for (const tool of TOOLS.filter(Boolean)) {
+ expect(typeof tool.title, `${tool.name}: title`).toBe('string');
+ expect(tool.title.length).toBeGreaterThan(0);
+ const a = tool.annotations;
+ expect(a, `${tool.name}: annotations`).toBeTypeOf('object');
+ // Every tool on this surface is a read — nothing signs or sends a tx.
+ expect(a.readOnlyHint, `${tool.name}: readOnlyHint`).toBe(true);
+ // destructiveHint defaults to TRUE in the MCP spec when omitted — it
+ // must be explicitly false here, never true.
+ expect(a.destructiveHint, `${tool.name}: destructiveHint`).toBe(false);
+ expect(typeof a.idempotentHint, `${tool.name}: idempotentHint`).toBe('boolean');
+ expect(typeof a.openWorldHint, `${tool.name}: openWorldHint`).toBe('boolean');
+ }
+ });
+
+ it('TOOL_ANNOTATIONS map covers every tool name', () => {
+ for (const tool of TOOLS.filter(Boolean)) {
+ expect(
+ Object.hasOwn(TOOL_ANNOTATIONS, tool.name),
+ `${tool.name}: missing from TOOL_ANNOTATIONS`,
+ ).toBe(true);
+ }
+ });
+
it('rpcError attaches rpcCode to the error', () => {
const err = rpcError(-32602, 'invalid param');
expect(err).toBeInstanceOf(Error);
@@ -58,7 +83,11 @@ describe('src/pump/mcp-tools — shared tool registry', () => {
it('rpcEnvelope wraps an error object', () => {
const env = rpcEnvelope(2, null, { code: -32601, message: 'not found' });
- expect(env).toEqual({ jsonrpc: '2.0', id: 2, error: { code: -32601, message: 'not found' } });
+ expect(env).toEqual({
+ jsonrpc: '2.0',
+ id: 2,
+ error: { code: -32601, message: 'not found' },
+ });
});
it('rpcEnvelope uses null id when id is undefined', () => {