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.

MCP server manifests, vanity tools, and strategy compiler/backtest tests

nirholas1d3c9fe820de
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 80f5abad8..2d7795ea5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Feature: Agent Studio is complete — Body, Money, and Skills tabs are now live** — Agent Studio used to mount a real Brain and Memory editor but left Body, Money, and Skills as 'mounts here' placeholders. All three are now fully built and wired beside the live 3D stage. Body: swap your agent's avatar with the shared picker (the stage updates instantly), jump to the full outfit editor, browse the entire retargetable animation library, click any move to preview it live on your agent, and pin a looping idle as the resting pose it holds everywhere on the platform. Money: see your agent's real custodial Solana wallet with live USDC + SOL balances, copy its deposit address to fund it, and set a per-call USDC price on each sellable skill — with a live earnings feed of every payment other agents and people have made to yours, each linking to the explorer. Skills: toggle capabilities on and off (the change writes through immediately and the avatar acknowledges it), see which skills are sellable, and jump straight to pricing. Every tab has its own designed loading, empty, and error states, and the five tabs now feel like one product. (`/agent-studio`) `[feature]`
- **Feature: carry your agent and set it down anywhere in the room in IRL AR** — On the IRL page your agent used to hover at a fixed distance in front of the camera — you couldn't choose where it stood. New 'Move here' control: turn on Camera AR, tap Move here, and a soft ring tracks the floor under your aim. Tap to set your agent down on that exact spot — the couch, a corner, the middle of the room — and it eases into place and turns to face you. The agent then stays anchored where you put it as you look around: pan away and it's gone, pan back and there it is. This is the first half of placing agents in the real world the way you'd expect; cross-device discovery (a friend finding it on their own phone) is coming next. (`/irl`) `[feature]`
- **Feature: one-tap manual sell on any live sniper position** — Your autonomous sniper already exits on take-profit, stop-loss, trailing stop, or max-hold, and the kill switch dumps every position at once — but until now there was no way to close just ONE open position on demand. The Sniper Strategies dashboard now puts a 'Sell now' button on each live position: tap it, confirm, and the agent market-sells its full holding of that coin from its own wallet at the current price, with a real signature and realized PnL. It runs the exact same exit path the bot uses automatically (fresh re-quote, graduated coins routed through the AMM, the protected execution engine, full custody-trail audit), so a manual exit is held to the same standard as an automatic one — and it's owner-only, with the position atomically claimed so a manual sell and the bot's own sweep can never both fire on the same bag. (`/dashboard/sniper`) `[feature]`
+- **Five new MCP servers — drop three.ws scenes, vanity, naming, intel & marketplace into any AI agent** — The same one-line install that gave any AI assistant our 3D avatars now opens up five more of the platform's capabilities. scene-mcp turns one sentence into a placed 3D diorama plan — the world to go with your avatar's character. vanity-mcp exposes the Solana vanity-address bounty market and rarity gallery — price a pattern's difficulty, browse open bounties, read the grinder leaderboard, appraise any address. naming-mcp resolves .sol names both ways and checks whether a *.threews.sol agent identity is free to claim. intel-mcp hands an agent the market-intelligence rails: smart-money scores for a coin, a wallet's realized track record, verified signal feeds, KOL trades, and ranked copy-trade wallets. marketplace-mcp browses the agent marketplace and skills catalog. Every tool is a thin wrapper over the live public three.ws API — no key, no signer, no mock data — and ships with MCP safety annotations so clients know which calls are read-only. Add any of them in one line: `claude mcp add scene -- npx -y @three-ws/scene-mcp` (swap in vanity, naming, intel, or marketplace). `[sdk, feature]`
- **Fix: avatars look right in iOS AR, not collapsed and distorted** — Viewing an avatar in AR on iPhone or iPad (the 'Place in your space' / Quick Look flow) could show a mangled figure — limbs balled up at the hips and accessories like glasses floating at giant scale — instead of the avatar you saw on the page. The cause: the AR file format Apple uses doesn't carry an animation skeleton, so the standard exporter shipped the avatar in its raw, un-posed rig. We now freeze each avatar into its proper standing pose before generating the AR file, so what you place in your room matches what you see in the viewer, accessories included. `[fix]`
- **Fix: prompt-to-avatar shows your finished avatar instead of jumping to the editor** — When you described an avatar in words at Create → From a prompt, the 'done' screen was meant to show a live, spinnable preview of the character you just made — the payoff moment. For private avatars (the default), that preview was being skipped and you were dropped straight into the editor with no look at the result. The preview now renders for private avatars too, using the same owner-only secure link the selfie flow already used, so every prompt-built avatar greets you with a real 3D preview you can rotate before opening the editor or making another. (`/create/prompt`) `[fix]`
- **Fix: the bounty board and live token feeds stay up when a third party is slow** — Swept the API for places where a slow or flaky upstream could hang a request until it was force-killed, or a database missing a recent table could error a whole page, and closed them. The /go bounty board now provisions its own database tables, so it loads everywhere instead of erroring where they were absent. The pump trending and search feeds fall back to the last good list (or an empty one) when pump.fun returns a malformed response, rather than failing the page. And a batch of backend lookups — the live SOL price, Jupiter/Birdeye/CoinGecko market data, portfolio price charts, token-gated scene access checks, IPFS pinning, voice synthesis, and the embedded-agent AI fallback chain — now bound every third-party call with a timeout, so a stalled service returns a clean result quickly instead of holding the request open until it's killed. `[fix]`
diff --git a/STRUCTURE.md b/STRUCTURE.md
index 0f9787b53..68e824f6e 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -54,6 +54,11 @@ packages/ibm-watsonx-mcp/ → @three-ws/ibm-watsonx-mcp (MCP server — IB
packages/ibm-x402-mcp/ → @three-ws/ibm-x402-mcp (MCP server — IBM x402 payments)
packages/three-token-mcp/ → @three-ws/three-token-mcp (MCP server — $THREE token tools)
packages/threews-avatar-mcp/ → @three-ws/threews-avatar-mcp (MCP server — three.ws avatar ops)
+packages/scene-mcp/ → @three-ws/scene-mcp (MCP server — text→3D diorama scenes)
+packages/vanity-mcp/ → @three-ws/vanity-mcp (MCP server — Solana vanity bounty market + rarity gallery)
+packages/naming-mcp/ → @three-ws/naming-mcp (MCP server — .sol resolve + *.threews.sol identity availability)
+packages/intel-mcp/ → @three-ws/intel-mcp (MCP server — smart-money, signals, KOL, copy-trade intel)
+packages/marketplace-mcp/ → @three-ws/marketplace-mcp (MCP server — agent marketplace + skills catalog browse)
walk-sdk/ → @three-ws/walk (page walking companion + playground + avatar picker)
```
diff --git a/api/_lib/strategy-backtest.js b/api/_lib/strategy-backtest.js
index a669762ed..eb49da839 100644
--- a/api/_lib/strategy-backtest.js
+++ b/api/_lib/strategy-backtest.js
@@ -104,7 +104,7 @@ function toIntelRecord(row) {
* deflated by slippage. Exits use the live decideExit priority at the peak (for
* take-profit) and at the terminal price (for stop / trailing / hold).
*/
-function simulateTrade(strategy, peakMult, terminalMult, impactPct) {
+export function simulateTrade(strategy, peakMult, terminalMult, impactPct) {
const slip = (n(strategy.slippage_bps) ?? 500) / 10_000;
const entryPenalty = (1 + slip) * (1 + impactPct / 100);
diff --git a/api/_lib/strategy-compiler.js b/api/_lib/strategy-compiler.js
index 721dd7b0a..53844ebd5 100644
--- a/api/_lib/strategy-compiler.js
+++ b/api/_lib/strategy-compiler.js
@@ -285,7 +285,13 @@ function describeStrategy(s) {
// Extracts the same fields from common phrasings so the feature always compiles
// even with no model configured.
function heuristicCompile(text) {
- const t = ` ${text.toLowerCase()} `;
+ // Normalize small number-words ("at least two") to digits so the numeric
+ // patterns below catch them. Bounded to one..ten — enough for graduation/
+ // launch/concurrency counts; larger figures are written as digits anyway.
+ const WORDS = { one: '1', two: '2', three: '3', four: '4', five: '5', six: '6', seven: '7', eight: '8', nine: '9', ten: '10' };
+ let lowered = text.toLowerCase();
+ for (const [w, d] of Object.entries(WORDS)) lowered = lowered.replace(new RegExp(`\\b${w}\\b`, 'g'), d);
+ const t = ` ${lowered} `;
const out = { assumptions: [], allowed_categories: null };
const moneyToNum = (m) => {
@@ -304,8 +310,9 @@ function heuristicCompile(text) {
const sl = t.match(/(?:stop[ -]?loss|sl|stop)\D{0,12}?(\d+(?:\.\d+)?)\s*%/);
if (sl) out.stop_loss_pct = parseFloat(sl[1]);
- const trail = t.match(/(?:trailing|trail)\D{0,14}?(\d+(?:\.\d+)?)\s*%/);
- if (trail) out.trailing_stop_pct = parseFloat(trail[1]);
+ // Match either order: "trailing 25%" or "30% trailing stop".
+ const trail = t.match(/(?:trailing|trail)(?:\s*stop)?\D{0,10}?(\d+(?:\.\d+)?)\s*%|(\d+(?:\.\d+)?)\s*%\s*trailing/);
+ if (trail) out.trailing_stop_pct = parseFloat(trail[1] || trail[2]);
const perTrade = t.match(/(\d+(?:\.\d+)?)\s*sol\s*(?:per|\/|each|a)\s*(?:trade|snipe|buy|position)/);
if (perTrade) out.per_trade_sol = parseFloat(perTrade[1]);
diff --git a/data/changelog.json b/data/changelog.json
index 590c203b7..b7a8bbe4b 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,24 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-23",
+ "title": "Describe a sniper strategy in plain English — and backtest it against real history before you risk a lamport",
+ "summary": "Sniper config used to be a wall of numeric fields most people can't reason about. Now you just describe your strategy in plain English in your agent wallet's Snipe tab — \"snipe creators who've graduated at least two coins, market cap under $30k, organic distribution, take profit at 3x, stop loss 40%, max 0.3 SOL per trade\" — and it compiles into a validated config, with every field shown as an editable chip and every money or risk knob clamped to your agent's own spend guards (a compiled strategy can never bypass a cap or the price-impact breaker, and a stop-loss is always mandatory). Then comes the part nobody else can do: we backtest it against three.ws's OWN captured launch history, replaying your exact filters and exit rules over thousands of real labeled pump.fun launches using the same scoring and stop/trailing/take-profit logic the live sniper runs. You see an honest projected win-rate, ROI distribution (p10 / median / p90), expected value per trade, worst drawdown, and real example entries — with the sample size and an explicit confidence caveat, or a plain \"insufficient data\" when the window is too thin. No synthetic launches, no inflated numbers. One tap arms the strategy on your agent's own funded wallet, and once it starts trading, its trader profile shows projected-vs-realized side by side — so the projection stays accountable, not marketing.",
+ "tags": [
+ "feature",
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-06-23",
+ "title": "Five new MCP servers — drop three.ws scenes, vanity, naming, intel & marketplace into any AI agent",
+ "summary": "The same one-line install that gave any AI assistant our 3D avatars now opens up five more of the platform's capabilities. scene-mcp turns one sentence into a placed 3D diorama plan — the world to go with your avatar's character. vanity-mcp exposes the Solana vanity-address bounty market and rarity gallery — price a pattern's difficulty, browse open bounties, read the grinder leaderboard, appraise any address. naming-mcp resolves .sol names both ways and checks whether a *.threews.sol agent identity is free to claim. intel-mcp hands an agent the market-intelligence rails: smart-money scores for a coin, a wallet's realized track record, verified signal feeds, KOL trades, and ranked copy-trade wallets. marketplace-mcp browses the agent marketplace and skills catalog. Every tool is a thin wrapper over the live public three.ws API — no key, no signer, no mock data — and ships with MCP safety annotations so clients know which calls are read-only. Add any of them in one line: `claude mcp add scene -- npx -y @three-ws/scene-mcp` (swap in vanity, naming, intel, or marketplace).",
+ "tags": [
+ "sdk",
+ "feature"
+ ]
+ },
{
"date": "2026-06-23",
"title": "Signal Marketplace — verified traders sell paid alpha feeds; your agent pays per signal and auto-mirrors",
diff --git a/package-lock.json b/package-lock.json
index fe96e600d..5b619e175 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -27,6 +27,11 @@
"packages/ibm-x402-mcp",
"packages/three-token-mcp",
"packages/threews-avatar-mcp",
+ "packages/scene-mcp",
+ "packages/vanity-mcp",
+ "packages/naming-mcp",
+ "packages/intel-mcp",
+ "packages/marketplace-mcp",
"walk-sdk",
"tour-sdk"
],
@@ -22955,6 +22960,14 @@
"resolved": "packages/ibm-x402-mcp",
"link": true
},
+ "node_modules/@three-ws/intel-mcp": {
+ "resolved": "packages/intel-mcp",
+ "link": true
+ },
+ "node_modules/@three-ws/marketplace-mcp": {
+ "resolved": "packages/marketplace-mcp",
+ "link": true
+ },
"node_modules/@three-ws/mcp-bridge": {
"resolved": "mcp-bridge",
"link": true
@@ -22967,6 +22980,10 @@
"resolved": "multiplayer",
"link": true
},
+ "node_modules/@three-ws/naming-mcp": {
+ "resolved": "packages/naming-mcp",
+ "link": true
+ },
"node_modules/@three-ws/page-agent": {
"resolved": "page-agent-sdk",
"link": true
@@ -22975,6 +22992,10 @@
"resolved": "packages/pumpfun-mcp",
"link": true
},
+ "node_modules/@three-ws/scene-mcp": {
+ "resolved": "packages/scene-mcp",
+ "link": true
+ },
"node_modules/@three-ws/solana-agent": {
"resolved": "solana-agent-sdk",
"link": true
@@ -22987,6 +23008,10 @@
"resolved": "tour-sdk",
"link": true
},
+ "node_modules/@three-ws/vanity-mcp": {
+ "resolved": "packages/vanity-mcp",
+ "link": true
+ },
"node_modules/@three-ws/viewer-presets": {
"resolved": "packages/viewer-presets",
"link": true
@@ -54102,6 +54127,51 @@
"node": ">=20"
}
},
+ "packages/intel-mcp": {
+ "name": "@three-ws/intel-mcp",
+ "version": "0.1.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ },
+ "bin": {
+ "intel-mcp": "src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "packages/marketplace-mcp": {
+ "name": "@three-ws/marketplace-mcp",
+ "version": "0.1.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ },
+ "bin": {
+ "marketplace-mcp": "src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "packages/naming-mcp": {
+ "name": "@three-ws/naming-mcp",
+ "version": "0.1.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ },
+ "bin": {
+ "naming-mcp": "src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
"packages/pumpfun-mcp": {
"name": "@three-ws/pumpfun-mcp",
"version": "0.2.1",
@@ -54116,6 +54186,21 @@
"node": ">=20"
}
},
+ "packages/scene-mcp": {
+ "name": "@three-ws/scene-mcp",
+ "version": "0.1.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ },
+ "bin": {
+ "scene-mcp": "src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
"packages/three-token-mcp": {
"name": "@three-ws/three-token-mcp",
"version": "1.1.0",
@@ -54636,6 +54721,21 @@
"@esbuild/win32-x64": "0.28.0"
}
},
+ "packages/vanity-mcp": {
+ "name": "@three-ws/vanity-mcp",
+ "version": "0.1.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ },
+ "bin": {
+ "vanity-mcp": "src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
"packages/viewer-presets": {
"name": "@three-ws/viewer-presets",
"version": "0.2.0",
diff --git a/package.json b/package.json
index 4e4e191bb..7cfe99b24 100644
--- a/package.json
+++ b/package.json
@@ -53,6 +53,11 @@
"packages/ibm-x402-mcp",
"packages/three-token-mcp",
"packages/threews-avatar-mcp",
+ "packages/scene-mcp",
+ "packages/vanity-mcp",
+ "packages/naming-mcp",
+ "packages/intel-mcp",
+ "packages/marketplace-mcp",
"walk-sdk",
"tour-sdk"
],
diff --git a/packages/intel-mcp/README.md b/packages/intel-mcp/README.md
new file mode 100644
index 000000000..d305fb58b
--- /dev/null
+++ b/packages/intel-mcp/README.md
@@ -0,0 +1,153 @@
+<p align="center">
+ <a href="https://three.ws"><img src="https://three.ws/three-ws-mcp-icon.svg" alt="three.ws" width="88" height="88"></a>
+</p>
+
+<h1 align="center">@three-ws/intel-mcp</h1>
+
+<p align="center"><strong>Read the market the way the smart money does — smart-money scoring, wallet intel, signal feeds, KOL trades, and the copy-trade directory, from any AI agent.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/intel-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/intel-mcp?logo=npm&color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/intel-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/intel-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>
+
+---
+
+> A [Model Context Protocol](https://modelcontextprotocol.io) server that gives any AI assistant the three.ws **market-intelligence** surface over stdio. Judge a coin by *who* is buying it, pull a wallet's realized reputation, read a signal feed's proven accuracy, rank KOL traders, and browse the copy-trade Smart Money directory — all live, read-only, no key required.
+
+Every score, signal, and ranking comes straight from the public three.ws API. No API key, no signer, no payment — point `THREE_WS_BASE` at a deployment and go.
+
+## Install
+
+```bash
+npm install @three-ws/intel-mcp
+```
+
+Or run with `npx` (no install):
+
+```bash
+npx @three-ws/intel-mcp
+```
+
+## Quick start
+
+**Claude Code**, one line:
+
+```bash
+claude mcp add intel -- npx -y @three-ws/intel-mcp
+```
+
+**Claude Desktop / Cursor** (`claude_desktop_config.json` or `mcp.json`):
+
+```json
+{
+ "mcpServers": {
+ "intel": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/intel-mcp"]
+ }
+ }
+}
+```
+
+Inspect the surface with the MCP Inspector:
+
+```bash
+npx -y @modelcontextprotocol/inspector npx @three-ws/intel-mcp
+```
+
+## Tools
+
+| Tool | Type | What it does |
+| -------------------- | --------- | ------------------------------------------------------------------------------------------------------------ |
+| `smart_money_coin` | read-only | Score a coin by WHO is net-buying it — 0–100 smart-money score, reputable buyers, funder clusters, sybil flag. |
+| `wallet_intel` | read-only | One wallet's realized reputation: score, win rate, behavioral labels, and its funder cluster. |
+| `signal_feed` | read-only | A signal feed's proven accuracy (hit-rate, realized/follower ROI) and recent emissions with on-chain proof. |
+| `kol_leaderboard` | read-only | Rank tracked KOL traders by realized P&L over a 7d / 30d window. |
+| `kol_trades` | read-only | Recent KOL trades on a specific mint, across the tracked KOL set. |
+| `copy_smart_wallets` | read-only | Browse the ranked copy-trade Smart Money directory — filter by chain, category, and sort. |
+
+All six tools read live data: scores, feeds, and rankings move between calls, so none are idempotent.
+
+### Input parameters
+
+**`smart_money_coin`** — `mint` (required), `network` (`mainnet` | `devnet`, default `mainnet`).
+
+**`wallet_intel`** — `wallet` (required), `network` (`mainnet` | `devnet`, default `mainnet`).
+
+**`signal_feed`** — `slug` (required), `network` (`mainnet` | `devnet`, default `mainnet`).
+
+**`kol_leaderboard`** — `window` (`7d` | `30d`, default `7d`), `limit` (1–100, default 25).
+
+**`kol_trades`** — `mint` (required), `limit` (1–100, default 20).
+
+**`copy_smart_wallets`** — `chain` (`sol` | `bsc`), `category` (`smart_money` | `launchpad` | `kol` | `sniper`), `sort` (`profit` | `pnl` | `winrate` | `followers` | `score`, default `score`), `q` (text), `limit` (1–100, default 30), `offset` (default 0).
+
+## Example
+
+```jsonc
+// copy_smart_wallets
+> { "chain": "sol", "sort": "winrate", "limit": 3 }
+{
+ "ok": true,
+ "count": 3,
+ "total": 412,
+ "offset": 0,
+ "limit": 3,
+ "has_more": true,
+ "facets": { "byChain": { "sol": 300, "bsc": 112 }, "byCategory": { "smart_money": 180, "kol": 90 } },
+ "wallets": [
+ { "address": "…", "chain": "sol", "categories": ["smart_money"], "score": 94, "win_rate_30d": 0.71, "realized_profit_30d_usd": 182000, "follow_count": 1240 }
+ ]
+}
+```
+
+```jsonc
+// smart_money_coin
+> { "mint": "FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump" }
+{
+ "ok": true,
+ "mint": "FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump",
+ "network": "mainnet",
+ "computed": true,
+ "smart_money_score": 78,
+ "reputable_buyers": 12,
+ "sybil_flag": false,
+ "sybil_share": 0.18,
+ "wallets": [ /* reputable buyers with realized_score, win_rate, labels */ ],
+ "clusters": [ /* funder clusters in the book */ ]
+}
+```
+
+`computed: false` on a coin or wallet means the smart-money graph has no on-chain history for it yet — that's an honest "not enough data", not a failure.
+
+## Requirements
+
+- **Node.js >= 20.**
+- Network access to `https://three.ws` (or your own `THREE_WS_BASE`).
+
+### Environment variables
+
+| Variable | Required | Default |
+| --------------------- | -------- | ------------------ |
+| `THREE_WS_BASE` | no | `https://three.ws` |
+| `THREE_WS_TIMEOUT_MS` | no | `20000` |
+
+## 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)
+
+---
+
+<p align="center">
+ <sub>
+ Part of the <a href="https://three.ws">three.ws</a> SDK suite — 3D AI agents, on-chain identity, and agent payments.<br/>
+ <a href="https://three.ws">Website</a> · <a href="https://three.ws/changelog">Changelog</a> · <a href="https://github.com/nirholas/three.ws">GitHub</a>
+ </sub>
+</p>
diff --git a/packages/intel-mcp/package.json b/packages/intel-mcp/package.json
new file mode 100644
index 000000000..7531eaa2a
--- /dev/null
+++ b/packages/intel-mcp/package.json
@@ -0,0 +1,56 @@
+{
+ "name": "@three-ws/intel-mcp",
+ "version": "0.1.0",
+ "mcpName": "io.github.nirholas/intel-mcp",
+ "description": "three.ws market intelligence from any AI agent — smart-money scoring, wallet intel, signal feeds, KOL leaderboards/trades, and the copy-trade Smart Money directory. Read-only over the live public API. No key, no signer, no payment.",
+ "type": "module",
+ "author": "nirholas <[email protected]>",
+ "license": "Apache-2.0",
+ "homepage": "https://three.ws",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/nirholas/three.ws.git",
+ "directory": "packages/intel-mcp"
+ },
+ "bugs": {
+ "url": "https://github.com/nirholas/three.ws/issues"
+ },
+ "keywords": [
+ "mcp",
+ "three.ws",
+ "solana",
+ "smart-money",
+ "signals",
+ "kol",
+ "copy-trading",
+ "intel"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "files": [
+ "src",
+ "server.json",
+ "README.md",
+ "LICENSE"
+ ],
+ "bin": {
+ "intel-mcp": "src/index.js"
+ },
+ "main": "./src/index.js",
+ "exports": {
+ ".": "./src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "scripts": {
+ "start": "node src/index.js",
+ "test": "node --test \"test/**/*.test.mjs\"",
+ "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
+ },
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ }
+}
diff --git a/packages/intel-mcp/server.json b/packages/intel-mcp/server.json
new file mode 100644
index 000000000..fa45fb3e5
--- /dev/null
+++ b/packages/intel-mcp/server.json
@@ -0,0 +1,49 @@
+{
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
+ "name": "io.github.nirholas/intel-mcp",
+ "title": "three.ws Intel",
+ "description": "Read the market the way the smart money does — coin smart-money scores, wallet reputation, signal feeds, KOL leaderboards/trades, and the copy-trade Smart Money directory.",
+ "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/intel-mcp"
+ },
+ "version": "0.1.0",
+ "packages": [
+ {
+ "registryType": "npm",
+ "identifier": "@three-ws/intel-mcp",
+ "version": "0.1.0",
+ "runtimeHint": "npx",
+ "transport": {
+ "type": "stdio"
+ },
+ "environmentVariables": [
+ {
+ "name": "THREE_WS_BASE",
+ "description": "Base URL of the three.ws API that serves the intel endpoints. Override only when self-hosting or targeting a preview deployment.",
+ "format": "string",
+ "isRequired": false,
+ "default": "https://three.ws"
+ },
+ {
+ "name": "THREE_WS_TIMEOUT_MS",
+ "description": "Per-request timeout in milliseconds for the live intel reads.",
+ "format": "number",
+ "isRequired": false,
+ "default": "20000"
+ }
+ ]
+ }
+ ]
+}
diff --git a/packages/intel-mcp/src/index.js b/packages/intel-mcp/src/index.js
new file mode 100755
index 000000000..51efea0e6
--- /dev/null
+++ b/packages/intel-mcp/src/index.js
@@ -0,0 +1,126 @@
+#!/usr/bin/env node
+// @three-ws/intel-mcp — MCP server entry point.
+//
+// Gives any AI assistant the three.ws market-intelligence surface over stdio:
+// • smart_money_coin — judge a coin by WHO is net-buying it (0–100 score)
+// • wallet_intel — one wallet's realized reputation card
+// • signal_feed — a feed's proven accuracy + recent emissions
+// • kol_leaderboard — ranked KOL traders by realized P&L
+// • kol_trades — recent KOL trades on a given mint
+// • copy_smart_wallets — the ranked copy-trade Smart Money directory
+//
+// A thin wrapper over the PUBLIC three.ws API. No keys, no signer, no payment —
+// point THREE_WS_BASE at a deployment and go.
+//
+// Run standalone:
+// node packages/intel-mcp/src/index.js
+//
+// Or wire into Claude Code / 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';
+
+import { def as smartMoneyCoin } from './tools/smart-money-coin.js';
+import { def as walletIntel } from './tools/wallet-intel.js';
+import { def as signalFeed } from './tools/signal-feed.js';
+import { def as kolLeaderboard } from './tools/kol-leaderboard.js';
+import { def as kolTrades } from './tools/kol-trades.js';
+import { def as copySmartWallets } from './tools/copy-smart-wallets.js';
+
+// Single source of truth for the advertised server version — package.json.
+const require = createRequire(import.meta.url);
+const { version: PKG_VERSION } = require('../package.json');
+
+export const TOOLS = [
+ smartMoneyCoin,
+ walletIntel,
+ signalFeed,
+ kolLeaderboard,
+ kolTrades,
+ copySmartWallets,
+];
+
+/**
+ * Construct a fully-registered McpServer without connecting a transport.
+ * Registration is env-free, so this is safe to import from tests.
+ * @returns {McpServer}
+ */
+export function buildServer() {
+ const server = new McpServer(
+ { name: 'intel-mcp', title: 'three.ws Intel', version: PKG_VERSION },
+ {
+ capabilities: { tools: {} },
+ instructions:
+ 'three.ws Intel MCP — read the market the way the smart money does. smart_money_coin ' +
+ 'scores a coin by WHO is net-buying it (a 0–100 reputation-weighted score, funder clusters, ' +
+ 'and a sybil flag). wallet_intel pulls one wallet\'s realized track record (score, win rate, ' +
+ 'labels, funder cluster). signal_feed reads a feed\'s proven accuracy and recent emissions ' +
+ 'with realized ROI. kol_leaderboard ranks tracked KOL traders by P&L; kol_trades shows their ' +
+ 'recent trades on a given mint. copy_smart_wallets browses the ranked copy-trade Smart Money ' +
+ 'directory. All data comes live from the public three.ws API — no API key, signer, or payment ' +
+ 'required. Every tool is read-only.',
+ },
+ );
+
+ for (const tool of TOOLS) {
+ server.registerTool(
+ tool.name,
+ {
+ title: tool.title,
+ description: tool.description,
+ inputSchema: tool.inputSchema,
+ 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);
+ return { content: [{ type: 'text', text }] };
+ } catch (err) {
+ const payload = {
+ ok: false,
+ error: err?.code || 'unhandled',
+ message: err?.message || String(err),
+ ...(err?.status ? { status: err.status } : {}),
+ };
+ return {
+ content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
+ isError: true,
+ };
+ }
+ },
+ );
+ }
+
+ return server;
+}
+
+async function main() {
+ const server = buildServer();
+ const transport = new StdioServerTransport();
+ await server.connect(transport);
+ console.error(`[intel-mcp@${PKG_VERSION}] connected over stdio with ${TOOLS.length} tools`);
+}
+
+// Connect stdio ONLY when this file is the process entry point. Importing the
+// module (tests, embedding) must not grab the transport. realpath both sides:
+// npm bin shims are symlinks, so argv[1] may differ from import.meta.url.
+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('[intel-mcp] fatal:', err);
+ process.exit(1);
+ });
+}
diff --git a/packages/intel-mcp/src/lib/api.js b/packages/intel-mcp/src/lib/api.js
new file mode 100644
index 000000000..4b01992d6
--- /dev/null
+++ b/packages/intel-mcp/src/lib/api.js
@@ -0,0 +1,66 @@
+// Real HTTP access to the three.ws API. No mocks, no fixtures — every call is
+// a live request to THREE_WS_BASE. Errors are normalized into a single shape so
+// tool handlers can surface a clean message + status to the MCP client.
+
+import { THREE_WS_BASE, HTTP_TIMEOUT_MS, USER_AGENT } from '../config.js';
+
+/**
+ * Call a three.ws HTTP endpoint and return its parsed JSON body.
+ *
+ * @param {string} path Endpoint path beginning with `/` (e.g. `/api/intel/smart-money`).
+ * @param {{ method?: string, query?: Record<string, unknown>, body?: unknown }} [opts]
+ * @returns {Promise<any>} Parsed JSON response.
+ * @throws {Error} with `.code` ('timeout' | 'network_error' | 'upstream_error'),
+ * and on upstream errors `.status` + `.body`.
+ */
+export async function apiRequest(path, { method = 'GET', query, body } = {}) {
+ const url = new URL(`${THREE_WS_BASE}${path}`);
+ if (query) {
+ for (const [key, value] of Object.entries(query)) {
+ if (value === undefined || value === null || value === '') continue;
+ url.searchParams.set(key, String(value));
+ }
+ }
+
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), HTTP_TIMEOUT_MS);
+
+ let res;
+ try {
+ res = await fetch(url, {
+ method,
+ headers: {
+ accept: 'application/json',
+ 'user-agent': USER_AGENT,
+ ...(body !== undefined ? { 'content-type': 'application/json' } : {}),
+ },
+ body: body !== undefined ? JSON.stringify(body) : undefined,
+ signal: controller.signal,
+ });
+ } catch (err) {
+ clearTimeout(timer);
+ if (err?.name === 'AbortError') {
+ throw Object.assign(new Error(`three.ws ${path} timed out after ${HTTP_TIMEOUT_MS}ms`), {
+ code: 'timeout',
+ });
+ }
+ throw Object.assign(new Error(`three.ws ${path} request failed: ${err?.message || err}`), {
+ code: 'network_error',
+ });
+ }
+ clearTimeout(timer);
+
+ const text = await res.text();
+ let data;
+ try {
+ data = text ? JSON.parse(text) : {};
+ } catch {
+ data = { raw: text };
+ }
+
+ if (!res.ok) {
+ const message = data?.message || data?.error || `three.ws ${path} returned HTTP ${res.status}`;
+ throw Object.assign(new Error(message), { code: 'upstream_error', status: res.status, body: data });
+ }
+ return data;
+}
diff --git a/packages/intel-mcp/src/tools/copy-smart-wallets.js b/packages/intel-mcp/src/tools/copy-smart-wallets.js
new file mode 100644
index 000000000..37740d52b
--- /dev/null
+++ b/packages/intel-mcp/src/tools/copy-smart-wallets.js
@@ -0,0 +1,71 @@
+// `copy_smart_wallets` — the ranked copy-trade Smart Money directory. Read-only.
+//
+// Wraps GET /api/copy/smart-wallets?chain=&category=&sort=&q=&limit=&offset=.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'copy_smart_wallets',
+ title: 'Copy-trade smart wallet directory',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Browse the curated Smart Money directory for copy-trading: deduplicated wallets ranked by 30-day performance. Filter by chain (sol/bsc) and category (smart_money, launchpad, kol, sniper), search by address/name/twitter, and sort by profit, pnl, winrate, followers, or score. Returns the ranked page (wallet identity + 30-day performance, never token mints), the total, pagination flags, and category/chain facets. Read-only live data.',
+ inputSchema: {
+ chain: z
+ .enum(['sol', 'bsc'])
+ .optional()
+ .describe('Filter by chain. Omit for all chains.'),
+ category: z
+ .enum(['smart_money', 'launchpad', 'kol', 'sniper'])
+ .optional()
+ .describe('Filter by gmgn smart-money category. Omit for all categories.'),
+ sort: z
+ .enum(['profit', 'pnl', 'winrate', 'followers', 'score'])
+ .default('score')
+ .describe('Ranking key (default score).'),
+ q: z
+ .string()
+ .optional()
+ .describe('Free-text match against wallet address, name, or twitter handle.'),
+ limit: z
+ .number()
+ .int()
+ .min(1)
+ .max(100)
+ .optional()
+ .describe('Page size (1–100, default 30).'),
+ offset: z
+ .number()
+ .int()
+ .min(0)
+ .optional()
+ .describe('Page offset (default 0).'),
+ },
+ async handler(args) {
+ const data = await apiRequest('/api/copy/smart-wallets', {
+ query: {
+ chain: args?.chain,
+ category: args?.category,
+ sort: args?.sort,
+ q: args?.q,
+ limit: args?.limit,
+ offset: args?.offset,
+ },
+ });
+ const wallets = Array.isArray(data?.wallets) ? data.wallets : [];
+ return {
+ ok: true,
+ count: wallets.length,
+ total: data?.total ?? wallets.length,
+ offset: data?.offset ?? 0,
+ limit: data?.limit ?? wallets.length,
+ has_more: data?.has_more ?? false,
+ facets: data?.facets ?? { byChain: {}, byCategory: {} },
+ source: data?.source ?? null,
+ generated_at: data?.generated_at ?? null,
+ wallets,
+ };
+ },
+};
diff --git a/packages/intel-mcp/src/tools/kol-leaderboard.js b/packages/intel-mcp/src/tools/kol-leaderboard.js
new file mode 100644
index 000000000..639b89e76
--- /dev/null
+++ b/packages/intel-mcp/src/tools/kol-leaderboard.js
@@ -0,0 +1,40 @@
+// `kol_leaderboard` — the ranked KOL trader leaderboard. Read-only.
+//
+// Wraps GET /api/kol/leaderboard?window=7d|30d&limit=<n>.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'kol_leaderboard',
+ title: 'KOL trader leaderboard',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Rank the tracked key-opinion-leader (KOL) traders by realized performance over a recent window. Returns the leaderboard rows — each tracked wallet with its P&L, win rate, and trade activity for the chosen window. Read-only live data.',
+ inputSchema: {
+ window: z
+ .enum(['7d', '30d'])
+ .default('7d')
+ .describe('Performance window to rank over (default 7d).'),
+ limit: z
+ .number()
+ .int()
+ .min(1)
+ .max(100)
+ .optional()
+ .describe('How many ranked traders to return (1–100, default 25).'),
+ },
+ async handler(args) {
+ const window = args?.window === '30d' ? '30d' : '7d';
+ const limit = args?.limit;
+ const data = await apiRequest('/api/kol/leaderboard', { query: { window, limit } });
+ const items = Array.isArray(data?.items) ? data.items : [];
+ return {
+ ok: true,
+ window,
+ count: items.length,
+ items,
+ };
+ },
+};
diff --git a/packages/intel-mcp/src/tools/kol-trades.js b/packages/intel-mcp/src/tools/kol-trades.js
new file mode 100644
index 000000000..011e86f47
--- /dev/null
+++ b/packages/intel-mcp/src/tools/kol-trades.js
@@ -0,0 +1,41 @@
+// `kol_trades` — recent KOL trades on a given mint. Read-only.
+//
+// Wraps GET /api/kol/trades?mint=<addr>&limit=<n>.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'kol_trades',
+ title: 'Recent KOL trades on a mint',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'See which tracked KOL wallets have recently traded a specific mint. Returns the recent trades (buys/sells with size and timing) observed across the tracked KOL set, plus the size of that tracked set. Read-only live data.',
+ inputSchema: {
+ mint: z
+ .string()
+ .min(1)
+ .describe('The token mint address to scan KOL activity for.'),
+ limit: z
+ .number()
+ .int()
+ .min(1)
+ .max(100)
+ .optional()
+ .describe('How many recent trades to return (1–100, default 20).'),
+ },
+ async handler(args) {
+ const mint = String(args?.mint ?? '').trim();
+ const limit = args?.limit;
+ const data = await apiRequest('/api/kol/trades', { query: { mint, limit } });
+ const trades = Array.isArray(data?.trades) ? data.trades : [];
+ return {
+ ok: true,
+ mint: data?.mint ?? mint,
+ tracked_wallets: data?.wallets ?? 0,
+ count: trades.length,
+ trades,
+ };
+ },
+};
diff --git a/packages/intel-mcp/src/tools/signal-feed.js b/packages/intel-mcp/src/tools/signal-feed.js
new file mode 100644
index 000000000..7d9073df2
--- /dev/null
+++ b/packages/intel-mcp/src/tools/signal-feed.js
@@ -0,0 +1,45 @@
+// `signal_feed` — one signal feed's track record + recent emissions. Read-only.
+//
+// Wraps GET /api/signals/feed?slug=<slug>&network=mainnet.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'signal_feed',
+ title: 'Signal feed track record + recent signals',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ "Read one signal feed's public detail: the publisher's verified track record, the feed's proven accuracy (hit-rate, average realized ROI, follower ROI, emit→fill latency), pricing, and the recent emission log — every signal with its realized outcome and the on-chain tx that proves it. Read-only live data.",
+ inputSchema: {
+ slug: z
+ .string()
+ .min(1)
+ .describe('The feed slug (its public identifier on three.ws).'),
+ network: z
+ .enum(['mainnet', 'devnet'])
+ .default('mainnet')
+ .describe('Solana network the feed publishes on (default mainnet).'),
+ },
+ async handler(args) {
+ const slug = String(args?.slug ?? '').trim();
+ const network = args?.network === 'devnet' ? 'devnet' : 'mainnet';
+ const data = await apiRequest('/api/signals/feed', { query: { slug, network } });
+ const feed = data?.feed;
+ if (!feed) {
+ throw Object.assign(new Error(`No signal feed found with slug "${slug}".`), {
+ code: 'not_found',
+ status: 404,
+ });
+ }
+ const recent = Array.isArray(feed.recent_signals) ? feed.recent_signals : [];
+ return {
+ ok: true,
+ slug,
+ network,
+ feed,
+ recent_signal_count: recent.length,
+ };
+ },
+};
diff --git a/packages/intel-mcp/src/tools/smart-money-coin.js b/packages/intel-mcp/src/tools/smart-money-coin.js
new file mode 100644
index 000000000..33c881b4c
--- /dev/null
+++ b/packages/intel-mcp/src/tools/smart-money-coin.js
@@ -0,0 +1,42 @@
+// `smart_money_coin` — judge a coin by WHO is net-buying it. Read-only.
+//
+// Wraps GET /api/intel/smart-money?mint=<addr>&network=mainnet.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'smart_money_coin',
+ title: 'Smart-money score for a coin',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Assess a coin by WHO is net-buying it right now. Returns a 0–100 smart_money_score computed from real observed buys joined to real outcomes, the reputable buyers in the book (with realized score, win rate, and labels), the funder clusters behind them, and a sybil_flag when one cluster dominates the order book. `computed:false` means the graph has no on-chain history for this mint yet. Read-only live data.',
+ inputSchema: {
+ mint: z
+ .string()
+ .min(1)
+ .describe('The token mint address to assess (any runtime mint).'),
+ network: z
+ .enum(['mainnet', 'devnet'])
+ .default('mainnet')
+ .describe('Solana network the mint lives on (default mainnet).'),
+ },
+ async handler(args) {
+ const mint = String(args?.mint ?? '').trim();
+ const network = args?.network === 'devnet' ? 'devnet' : 'mainnet';
+ const data = await apiRequest('/api/intel/smart-money', { query: { mint, network } });
+ return {
+ ok: true,
+ mint: data?.mint ?? mint,
+ network: data?.network ?? network,
+ computed: data?.computed ?? false,
+ smart_money_score: data?.smart_money_score ?? 0,
+ reputable_buyers: data?.count ?? 0,
+ sybil_flag: data?.sybil_flag ?? false,
+ sybil_share: data?.sybil_share ?? 0,
+ wallets: Array.isArray(data?.wallets) ? data.wallets : [],
+ clusters: Array.isArray(data?.clusters) ? data.clusters : [],
+ };
+ },
+};
diff --git a/packages/intel-mcp/src/tools/wallet-intel.js b/packages/intel-mcp/src/tools/wallet-intel.js
new file mode 100644
index 000000000..3683e8249
--- /dev/null
+++ b/packages/intel-mcp/src/tools/wallet-intel.js
@@ -0,0 +1,41 @@
+// `wallet_intel` — one wallet's realized reputation card. Read-only.
+//
+// Wraps GET /api/intel/smart-money?wallet=<addr>&network=mainnet.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'wallet_intel',
+ title: 'Wallet reputation + smart-money card',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ "Pull one wallet's realized reputation, computed from its observed buys joined to real outcomes (graduated / pumped / rugged + ATH). Returns the realized_score (0–100), win_rate, behavioral labels, and the funder cluster it belongs to (with funder root, size, and confidence). `computed:false` means the graph has no scored history for this wallet yet. Read-only live data.",
+ inputSchema: {
+ wallet: z
+ .string()
+ .min(1)
+ .describe('The wallet address to look up.'),
+ network: z
+ .enum(['mainnet', 'devnet'])
+ .default('mainnet')
+ .describe('Solana network the wallet trades on (default mainnet).'),
+ },
+ async handler(args) {
+ const wallet = String(args?.wallet ?? '').trim();
+ const network = args?.network === 'devnet' ? 'devnet' : 'mainnet';
+ const data = await apiRequest('/api/intel/smart-money', { query: { wallet, network } });
+ return {
+ ok: true,
+ address: data?.address ?? wallet,
+ network: data?.network ?? network,
+ computed: data?.computed ?? false,
+ realized_score: data?.realized_score ?? 0,
+ win_rate: data?.win_rate ?? 0,
+ labels: Array.isArray(data?.labels) ? data.labels : [],
+ funder_cluster: data?.cluster ?? null,
+ reputation: data,
+ };
+ },
+};
diff --git a/packages/intel-mcp/test/registration.test.mjs b/packages/intel-mcp/test/registration.test.mjs
new file mode 100644
index 000000000..4f3a217ae
--- /dev/null
+++ b/packages/intel-mcp/test/registration.test.mjs
@@ -0,0 +1,71 @@
+// Tool-surface invariants for @three-ws/intel-mcp.
+//
+// Importing src/index.js is side-effect-free: the stdio transport only
+// connects when the file is the process entry point, and buildServer() needs
+// no key or signer. These tests run offline — they never touch the network.
+//
+// Run: node --test packages/intel-mcp/test/registration.test.mjs
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { TOOLS, buildServer } from '../src/index.js';
+
+const EXPECTED_NAMES = [
+ 'smart_money_coin',
+ 'wallet_intel',
+ 'signal_feed',
+ 'kol_leaderboard',
+ 'kol_trades',
+ 'copy_smart_wallets',
+];
+
+test('exactly the expected tools are registered', () => {
+ assert.equal(TOOLS.length, 6);
+ assert.deepEqual(new Set(TOOLS.map((t) => t.name)), new Set(EXPECTED_NAMES));
+});
+
+test('every tool has a title, description, input schema and complete annotations', () => {
+ 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.equal(typeof tool.description, 'string', `${tool.name} is missing a description`);
+ assert.ok(tool.description.length > 0, `${tool.name} has an empty description`);
+ assert.ok(tool.inputSchema && typeof tool.inputSchema === 'object', `${tool.name} is missing inputSchema`);
+ assert.equal(typeof tool.handler, 'function', `${tool.name} is missing a handler`);
+ assert.ok(tool.annotations, `${tool.name} is missing MCP ToolAnnotations`);
+ assert.equal(typeof tool.annotations.readOnlyHint, 'boolean', `${tool.name} must set readOnlyHint`);
+ assert.equal(typeof tool.annotations.idempotentHint, 'boolean', `${tool.name} must set idempotentHint`);
+ assert.equal(typeof tool.annotations.openWorldHint, 'boolean', `${tool.name} must set openWorldHint`);
+ }
+});
+
+test('every tool is a read-only, live-data query', () => {
+ for (const tool of TOOLS) {
+ assert.equal(tool.annotations.readOnlyHint, true, `${tool.name} should be read-only`);
+ assert.equal(tool.annotations.openWorldHint, true, `${tool.name} talks to a live service`);
+ // Live market data is never idempotent — the score/feed/ranking moves between calls.
+ assert.equal(tool.annotations.idempotentHint, false, `${tool.name} reads live data, not idempotent`);
+ }
+});
+
+test('read-only tools do not set destructiveHint (spec ignores it when readOnlyHint is true)', () => {
+ for (const tool of TOOLS) {
+ assert.equal(
+ tool.annotations.destructiveHint,
+ undefined,
+ `${tool.name} is read-only — destructiveHint should be omitted`,
+ );
+ }
+});
+
+test('buildServer registers every tool with its annotations, without a signer', () => {
+ const server = buildServer();
+ 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/marketplace-mcp/LICENSE b/packages/marketplace-mcp/LICENSE
new file mode 100644
index 000000000..8e2251ab4
--- /dev/null
+++ b/packages/marketplace-mcp/LICENSE
@@ -0,0 +1,180 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship made available under
+ the License, as indicated by a copyright notice that is included in
+ or attached to the work (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other transformations
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
+ in the Work by the copyright owner or by an individual or Legal Entity
+ authorized to submit on behalf of the copyright owner. For the purposes
+ of this definition, "submitted" means any form of electronic, verbal,
+ or written communication sent to the Licensor or its representatives,
+ including but not limited to communication on electronic mailing lists,
+ source code control systems, and issue tracking systems that are managed
+ by, or on behalf of, the Licensor for the purpose of discussing and
+ improving the Work, but excluding communication that is conspicuously
+ marked or designated in writing by the copyright owner as "Not a
+ Contribution."
+
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
+ whom a Contribution has been received by the Licensor and included
+ within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by the combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a cross-claim
+ or counterclaim in a lawsuit) alleging that the Work or any
+ Contribution embodied within the Work constitutes direct or contributory
+ patent infringement, then any patent licenses granted to You under
+ this License for that Work shall terminate as of the date such
+ litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or Derivative
+ Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, You must include a readable copy of the
+ attribution notices contained within such NOTICE file, in
+ at least one of the following places: within a NOTICE text
+ file distributed as part of the Derivative Works; within
+ the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the
+ Derivative Works, if and wherever such third-party notices
+ normally appear. The contents of the NOTICE file are for
+ informational purposes only and do not modify the License.
+ You may add Your own attribution notices within Derivative
+ Works that You distribute, alongside or in addition to the
+ NOTICE text from the Work, provided that such additional
+ attribution notices cannot be construed as modifying the License.
+
+ You may add Your own license statement for Your modifications and
+ may provide additional grant of rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the
+ Derivative Works, and to permit persons to whom the Derivative Works
+ are furnished to do so.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or reproducing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or exemplary damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or all other
+ commercial damages or losses), even if such Contributor has been
+ advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may offer only
+ conditions consistent with this License.
+
+ END OF TERMS AND CONDITIONS
+
+ Copyright 2026 nirholas
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/marketplace-mcp/README.md b/packages/marketplace-mcp/README.md
new file mode 100644
index 000000000..301c12192
--- /dev/null
+++ b/packages/marketplace-mcp/README.md
@@ -0,0 +1,138 @@
+<p align="center">
+ <a href="https://three.ws"><img src="https://three.ws/three-ws-mcp-icon.svg" alt="three.ws" width="88" height="88"></a>
+</p>
+
+<h1 align="center">@three-ws/marketplace-mcp</h1>
+
+<p align="center"><strong>Browse the three.ws agent marketplace and skills catalog from any AI agent.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/marketplace-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/marketplace-mcp?logo=npm&color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/marketplace-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/marketplace-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>
+
+---
+
+> A [Model Context Protocol](https://modelcontextprotocol.io) server that gives any AI assistant **browse and discovery** of the three.ws marketplace over stdio. Search and page the published agents, drill into one by id, and explore the reusable skills catalog — all from the public three.ws API.
+
+No API key, no signer, no payment — every call hits the public `/api/marketplace` and `/api/skills` endpoints. Creating or publishing agents and skills is the *authenticated write path* on the HTTP API; this server exposes browse/discovery only.
+
+## Install
+
+```bash
+npm install @three-ws/marketplace-mcp
+```
+
+Or run with `npx` (no install):
+
+```bash
+npx @three-ws/marketplace-mcp
+```
+
+## Quick start
+
+**Claude Code**, one line:
+
+```bash
+claude mcp add marketplace -- npx -y @three-ws/marketplace-mcp
+```
+
+**Claude Desktop / Cursor** (`claude_desktop_config.json` or `mcp.json`):
+
+```json
+{
+ "mcpServers": {
+ "marketplace": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/marketplace-mcp"]
+ }
+ }
+}
+```
+
+Inspect the surface with the MCP Inspector:
+
+```bash
+npx -y @modelcontextprotocol/inspector npx @three-ws/marketplace-mcp
+```
+
+## Tools
+
+| Tool | Type | What it does |
+| ------------------- | --------- | ---------------------------------------------------------------------------------------------------- |
+| `browse_agents` | read-only | Search & page the agent marketplace — filter by category and query, sort, paginate by cursor. |
+| `agent_detail` | read-only | Fetch one published agent by id (system prompt, capabilities, author, ratings, skill prices, avatar). |
+| `agent_categories` | read-only | List agent categories with the count of published agents in each, plus the overall total. |
+| `browse_skills` | read-only | Search & page the skills catalog — filter by query and category, sort, paginate by cursor. |
+| `skill_categories` | read-only | List skill categories that have at least one public skill, each with a slug, label, and count. |
+
+### Input parameters
+
+**`browse_agents`** — `category` (optional slug), `q` (optional free text), `sort` (`recommended` | `recent` | `popular` | `top_rated`, default `recommended`), `limit` (1–48, default 24), `cursor` (optional pagination cursor).
+
+**`agent_detail`** — `id` (required: the agent's UUID, from a `browse_agents` card).
+
+**`agent_categories`** — no parameters.
+
+**`browse_skills`** — `q` (optional free text), `category` (optional slug), `sort` (`popular` | `new` | `az`, default `popular`), `limit` (1–50, default 20), `cursor` (optional pagination cursor).
+
+**`skill_categories`** — no parameters.
+
+## Example
+
+```jsonc
+// browse_agents
+> { "q": "code review", "sort": "top_rated", "limit": 3 }
+{
+ "ok": true,
+ "items": [
+ {
+ "id": "a1b2c3d4-…",
+ "name": "Code Reviewer",
+ "description": "Reviews diffs for bugs and style.",
+ "category": "programming",
+ "tags": ["code", "review"],
+ "rating_avg": 4.8,
+ "rating_count": 22,
+ "views_count": 1340,
+ "forks_count": 41,
+ "thumbnail_url": "https://…",
+ "avatar_glb_url": "https://…"
+ }
+ ],
+ "next_cursor": "3"
+}
+```
+
+Pass `next_cursor` back as `cursor` to fetch the following page.
+
+## Requirements
+
+- **Node.js >= 20.**
+- Network access to `https://three.ws` (or your own `THREE_WS_BASE`).
+
+### Environment variables
+
+| Variable | Required | Default |
+| --------------------- | -------- | ------------------ |
+| `THREE_WS_BASE` | no | `https://three.ws` |
+| `THREE_WS_TIMEOUT_MS` | no | `20000` |
+
+## 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)
+
+---
+
+<p align="center">
+ <sub>
+ Part of the <a href="https://three.ws">three.ws</a> SDK suite — 3D AI agents, on-chain identity, and agent payments.<br/>
+ <a href="https://three.ws">Website</a> · <a href="https://three.ws/changelog">Changelog</a> · <a href="https://github.com/nirholas/three.ws">GitHub</a>
+ </sub>
+</p>
diff --git a/packages/marketplace-mcp/package.json b/packages/marketplace-mcp/package.json
new file mode 100644
index 000000000..21f460f8a
--- /dev/null
+++ b/packages/marketplace-mcp/package.json
@@ -0,0 +1,54 @@
+{
+ "name": "@three-ws/marketplace-mcp",
+ "version": "0.1.0",
+ "mcpName": "io.github.nirholas/marketplace-mcp",
+ "description": "Browse the three.ws agent marketplace and skills catalog from any AI agent. browse_agents and browse_skills search & page the public listings; agent_detail and the category tools round out discovery. Read-only — no key, no signer, no payment.",
+ "type": "module",
+ "author": "nirholas <[email protected]>",
+ "license": "Apache-2.0",
+ "homepage": "https://three.ws",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/nirholas/three.ws.git",
+ "directory": "packages/marketplace-mcp"
+ },
+ "bugs": {
+ "url": "https://github.com/nirholas/three.ws/issues"
+ },
+ "keywords": [
+ "mcp",
+ "three.ws",
+ "marketplace",
+ "agents",
+ "skills",
+ "discovery"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "files": [
+ "src",
+ "server.json",
+ "README.md",
+ "LICENSE"
+ ],
+ "bin": {
+ "marketplace-mcp": "src/index.js"
+ },
+ "main": "./src/index.js",
+ "exports": {
+ ".": "./src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "scripts": {
+ "start": "node src/index.js",
+ "test": "node --test \"test/**/*.test.mjs\"",
+ "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
+ },
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ }
+}
diff --git a/packages/marketplace-mcp/server.json b/packages/marketplace-mcp/server.json
new file mode 100644
index 000000000..da9deb262
--- /dev/null
+++ b/packages/marketplace-mcp/server.json
@@ -0,0 +1,49 @@
+{
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
+ "name": "io.github.nirholas/marketplace-mcp",
+ "title": "three.ws Marketplace",
+ "description": "Browse and discover the public three.ws agent marketplace and skills catalog — search, page, and inspect agents and skills. Read-only.",
+ "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/marketplace-mcp"
+ },
+ "version": "0.1.0",
+ "packages": [
+ {
+ "registryType": "npm",
+ "identifier": "@three-ws/marketplace-mcp",
+ "version": "0.1.0",
+ "runtimeHint": "npx",
+ "transport": {
+ "type": "stdio"
+ },
+ "environmentVariables": [
+ {
+ "name": "THREE_WS_BASE",
+ "description": "Base URL of the three.ws API that serves /api/marketplace and /api/skills. Override only when self-hosting or targeting a preview deployment.",
+ "format": "string",
+ "isRequired": false,
+ "default": "https://three.ws"
+ },
+ {
+ "name": "THREE_WS_TIMEOUT_MS",
+ "description": "Per-request timeout in milliseconds. These are fast public read endpoints, so the default is modest.",
+ "format": "number",
+ "isRequired": false,
+ "default": "20000"
+ }
+ ]
+ }
+ ]
+}
diff --git a/packages/marketplace-mcp/src/index.js b/packages/marketplace-mcp/src/index.js
new file mode 100755
index 000000000..b868202a8
--- /dev/null
+++ b/packages/marketplace-mcp/src/index.js
@@ -0,0 +1,120 @@
+#!/usr/bin/env node
+// @three-ws/marketplace-mcp — MCP server entry point.
+//
+// Gives any AI assistant browse/discovery of the three.ws marketplace over
+// stdio:
+// • browse_agents — search & page the agent marketplace
+// • agent_detail — fetch one agent by id
+// • agent_categories — list agent categories with counts
+// • browse_skills — search & page the skills catalog
+// • skill_categories — list skill categories with counts
+//
+// A thin, read-only wrapper over the PUBLIC three.ws API (/api/marketplace and
+// /api/skills). No keys, no signer, no payment — point THREE_WS_BASE at a
+// deployment and go. Creating or publishing agents and skills is the
+// authenticated write path on the HTTP API; this MCP exposes browse only.
+//
+// Run standalone:
+// node packages/marketplace-mcp/src/index.js
+//
+// Or wire into Claude Code / 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';
+
+import { def as browseAgents } from './tools/browse-agents.js';
+import { def as agentDetail } from './tools/agent-detail.js';
+import { def as agentCategories } from './tools/agent-categories.js';
+import { def as browseSkills } from './tools/browse-skills.js';
+import { def as skillCategories } from './tools/skill-categories.js';
+
+// Single source of truth for the advertised server version — package.json.
+const require = createRequire(import.meta.url);
+const { version: PKG_VERSION } = require('../package.json');
+
+export const TOOLS = [browseAgents, agentDetail, agentCategories, browseSkills, skillCategories];
+
+/**
+ * Construct a fully-registered McpServer without connecting a transport.
+ * Registration is env-free, so this is safe to import from tests.
+ * @returns {McpServer}
+ */
+export function buildServer() {
+ const server = new McpServer(
+ { name: 'marketplace-mcp', title: 'three.ws Marketplace', version: PKG_VERSION },
+ {
+ capabilities: { tools: {} },
+ instructions:
+ 'three.ws Marketplace MCP — browse and discover the public three.ws agent marketplace and skills ' +
+ 'catalog. browse_agents searches and pages published agents (filter by category and query, sort by ' +
+ 'recommended/recent/popular/top_rated); agent_detail fetches one agent by id; agent_categories lists ' +
+ 'the agent categories with counts. browse_skills searches and pages the skills catalog (sort by ' +
+ 'popular/new/az); skill_categories lists the skill categories with counts. All data comes live from ' +
+ 'the public three.ws /api/marketplace and /api/skills endpoints — no API key, signer, or payment ' +
+ 'required. Creating or publishing agents and skills is the authenticated write path on the HTTP API; ' +
+ 'this server exposes browse/discovery only.',
+ },
+ );
+
+ for (const tool of TOOLS) {
+ server.registerTool(
+ tool.name,
+ {
+ title: tool.title,
+ description: tool.description,
+ inputSchema: tool.inputSchema,
+ 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);
+ return { content: [{ type: 'text', text }] };
+ } catch (err) {
+ const payload = {
+ ok: false,
+ error: err?.code || 'unhandled',
+ message: err?.message || String(err),
+ ...(err?.status ? { status: err.status } : {}),
+ };
+ return {
+ content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
+ isError: true,
+ };
+ }
+ },
+ );
+ }
+
+ return server;
+}
+
+async function main() {
+ const server = buildServer();
+ const transport = new StdioServerTransport();
+ await server.connect(transport);
+ console.error(`[marketplace-mcp@${PKG_VERSION}] connected over stdio with ${TOOLS.length} tools`);
+}
+
+// Connect stdio ONLY when this file is the process entry point. Importing the
+// module (tests, embedding) must not grab the transport. realpath both sides:
+// npm bin shims are symlinks, so argv[1] may differ from import.meta.url.
+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('[marketplace-mcp] fatal:', err);
+ process.exit(1);
+ });
+}
diff --git a/packages/marketplace-mcp/src/tools/agent-categories.js b/packages/marketplace-mcp/src/tools/agent-categories.js
new file mode 100644
index 000000000..f0cf79fbe
--- /dev/null
+++ b/packages/marketplace-mcp/src/tools/agent-categories.js
@@ -0,0 +1,24 @@
+// `agent_categories` — list marketplace categories with published counts.
+// Read-only.
+//
+// Wraps GET /api/marketplace/categories.
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'agent_categories',
+ title: 'List agent marketplace categories',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'List the agent marketplace categories with the count of published agents in each, plus the overall total. Use the returned category slugs to filter browse_agents. Read-only.',
+ inputSchema: {},
+ async handler() {
+ const data = await apiRequest('/api/marketplace/categories');
+ const categories = Array.isArray(data?.data?.categories) ? data.data.categories : [];
+ return {
+ ok: true,
+ total: data?.data?.total ?? 0,
+ categories,
+ };
+ },
+};
diff --git a/packages/marketplace-mcp/src/tools/agent-detail.js b/packages/marketplace-mcp/src/tools/agent-detail.js
new file mode 100644
index 000000000..6683afa30
--- /dev/null
+++ b/packages/marketplace-mcp/src/tools/agent-detail.js
@@ -0,0 +1,30 @@
+// `agent_detail` — fetch one published marketplace agent by id. Read-only.
+//
+// Wraps GET /api/marketplace/agents/<id>.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'agent_detail',
+ title: 'Fetch a marketplace agent by id',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Fetch one published marketplace agent by its id, including its full detail: name, description, category, tags, system prompt, greeting, capabilities, author, ratings, skill prices, subscription tiers, and avatar URLs. Read-only.',
+ inputSchema: {
+ id: z.string().min(1).describe('The marketplace agent id (a UUID from a browse_agents card).'),
+ },
+ async handler(args) {
+ const id = String(args?.id ?? '').trim();
+ const data = await apiRequest(`/api/marketplace/agents/${encodeURIComponent(id)}`);
+ const agent = data?.data?.agent;
+ if (!agent) {
+ throw Object.assign(new Error(`No marketplace agent found with id "${id}".`), {
+ code: 'not_found',
+ status: 404,
+ });
+ }
+ return { ok: true, agent };
+ },
+};
diff --git a/packages/marketplace-mcp/src/tools/browse-agents.js b/packages/marketplace-mcp/src/tools/browse-agents.js
new file mode 100644
index 000000000..232a8e506
--- /dev/null
+++ b/packages/marketplace-mcp/src/tools/browse-agents.js
@@ -0,0 +1,55 @@
+// `browse_agents` — search and page the public three.ws agent marketplace.
+// Read-only.
+//
+// Wraps GET /api/marketplace/agents?category=&q=&sort=&limit=&cursor=.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'browse_agents',
+ title: 'Browse the agent marketplace',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Search and page the public three.ws agent marketplace. Filter by category and free-text query, choose a sort order, and get back a list of agent cards (id, name, description, category, tags, ratings, view/fork counts, thumbnail and GLB avatar URLs) plus a cursor for the next page. Read-only.',
+ inputSchema: {
+ category: z
+ .string()
+ .optional()
+ .describe('Restrict to one category slug (e.g. "programming", "marketing", "education").'),
+ q: z.string().optional().describe('Free-text search across agent name, description, and tags.'),
+ sort: z
+ .enum(['recommended', 'recent', 'popular', 'top_rated'])
+ .default('recommended')
+ .describe('Sort order: "recommended" (default), "recent", "popular", or "top_rated".'),
+ limit: z
+ .number()
+ .int()
+ .min(1)
+ .max(48)
+ .optional()
+ .describe('How many agents to return (1–48, default 24).'),
+ cursor: z
+ .string()
+ .optional()
+ .describe('Opaque pagination cursor from a previous response\'s next_cursor.'),
+ },
+ async handler(args) {
+ const data = await apiRequest('/api/marketplace/agents', {
+ query: {
+ category: args?.category,
+ q: args?.q,
+ sort: args?.sort,
+ limit: args?.limit,
+ cursor: args?.cursor,
+ },
+ });
+ const items = Array.isArray(data?.data?.items) ? data.data.items : [];
+ return {
+ ok: true,
+ items,
+ next_cursor: data?.data?.next_cursor ?? null,
+ };
+ },
+};
diff --git a/packages/marketplace-mcp/src/tools/browse-skills.js b/packages/marketplace-mcp/src/tools/browse-skills.js
new file mode 100644
index 000000000..e38ea91b6
--- /dev/null
+++ b/packages/marketplace-mcp/src/tools/browse-skills.js
@@ -0,0 +1,52 @@
+// `browse_skills` — search and page the public three.ws skills catalog.
+// Read-only.
+//
+// Wraps GET /api/skills?q=&category=&sort=&limit=&cursor=.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'browse_skills',
+ title: 'Browse the skills catalog',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Search and page the public three.ws skills catalog — reusable tools and capabilities agents can install. Filter by free-text query and category, choose a sort order, and get back a list of skills (id, name, slug, description, category, tags, install count, rating, per-call price, author, content preview) plus a cursor for the next page. Read-only.',
+ inputSchema: {
+ q: z.string().optional().describe('Free-text search across skill name, description, and tags.'),
+ category: z.string().optional().describe('Restrict to one category slug (e.g. "general").'),
+ sort: z
+ .enum(['popular', 'new', 'az'])
+ .default('popular')
+ .describe('Sort order: "popular" (default, by install count), "new" (most recent), or "az" (A–Z).'),
+ limit: z
+ .number()
+ .int()
+ .min(1)
+ .max(50)
+ .optional()
+ .describe('How many skills to return (1–50, default 20).'),
+ cursor: z
+ .string()
+ .optional()
+ .describe('Opaque pagination cursor from a previous response\'s next_cursor.'),
+ },
+ async handler(args) {
+ const data = await apiRequest('/api/skills', {
+ query: {
+ q: args?.q,
+ category: args?.category,
+ sort: args?.sort,
+ limit: args?.limit,
+ cursor: args?.cursor,
+ },
+ });
+ const skills = Array.isArray(data?.skills) ? data.skills : [];
+ return {
+ ok: true,
+ skills,
+ next_cursor: data?.next_cursor ?? null,
+ };
+ },
+};
diff --git a/packages/marketplace-mcp/src/tools/skill-categories.js b/packages/marketplace-mcp/src/tools/skill-categories.js
new file mode 100644
index 000000000..31f6ecbee
--- /dev/null
+++ b/packages/marketplace-mcp/src/tools/skill-categories.js
@@ -0,0 +1,19 @@
+// `skill_categories` — list skills catalog categories with counts. Read-only.
+//
+// Wraps GET /api/skills/categories.
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'skill_categories',
+ title: 'List skills catalog categories',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'List the skills catalog categories that have at least one public skill, each with a slug, label, and the count of skills in it. Use the returned slugs to filter browse_skills. Read-only.',
+ inputSchema: {},
+ async handler() {
+ const data = await apiRequest('/api/skills/categories');
+ const categories = Array.isArray(data?.categories) ? data.categories : [];
+ return { ok: true, categories };
+ },
+};
diff --git a/packages/marketplace-mcp/test/registration.test.mjs b/packages/marketplace-mcp/test/registration.test.mjs
new file mode 100644
index 000000000..5b563facf
--- /dev/null
+++ b/packages/marketplace-mcp/test/registration.test.mjs
@@ -0,0 +1,59 @@
+// Tool-surface invariants for @three-ws/marketplace-mcp.
+//
+// Importing src/index.js is side-effect-free: the stdio transport only
+// connects when the file is the process entry point, and buildServer() needs
+// no key or signer. These tests run offline — they never touch the network.
+//
+// Run: node --test packages/marketplace-mcp/test/registration.test.mjs
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { TOOLS, buildServer } from '../src/index.js';
+
+const TOOL_NAMES = ['browse_agents', 'agent_detail', 'agent_categories', 'browse_skills', 'skill_categories'];
+
+test('exactly the expected tools are registered', () => {
+ assert.equal(TOOLS.length, 5);
+ assert.deepEqual(new Set(TOOLS.map((t) => t.name)), new Set(TOOL_NAMES));
+});
+
+test('every tool has a title, description, input schema and complete annotations', () => {
+ 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.equal(typeof tool.description, 'string', `${tool.name} is missing a description`);
+ assert.ok(tool.description.length > 0, `${tool.name} has an empty description`);
+ assert.ok(tool.inputSchema && typeof tool.inputSchema === 'object', `${tool.name} is missing inputSchema`);
+ assert.equal(typeof tool.handler, 'function', `${tool.name} is missing a handler`);
+ assert.ok(tool.annotations, `${tool.name} is missing MCP ToolAnnotations`);
+ assert.equal(typeof tool.annotations.readOnlyHint, 'boolean', `${tool.name} must set readOnlyHint`);
+ assert.equal(typeof tool.annotations.idempotentHint, 'boolean', `${tool.name} must set idempotentHint`);
+ assert.equal(typeof tool.annotations.openWorldHint, 'boolean', `${tool.name} must set openWorldHint`);
+ }
+});
+
+test('every tool is a public, read-only discovery surface', () => {
+ for (const tool of TOOLS) {
+ assert.equal(tool.annotations.readOnlyHint, true, `${tool.name} must be read-only`);
+ assert.equal(tool.annotations.idempotentHint, false, `${tool.name} must set idempotentHint:false`);
+ assert.equal(tool.annotations.openWorldHint, true, `${tool.name} talks to a live service`);
+ // Read-only tools must NOT declare destructiveHint — they mutate nothing.
+ assert.equal(
+ tool.annotations.destructiveHint,
+ undefined,
+ `${tool.name} is read-only — destructiveHint must be omitted`,
+ );
+ }
+});
+
+test('buildServer registers every tool with its annotations, without a signer', () => {
+ const server = buildServer();
+ 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/naming-mcp/LICENSE b/packages/naming-mcp/LICENSE
new file mode 100644
index 000000000..8e2251ab4
--- /dev/null
+++ b/packages/naming-mcp/LICENSE
@@ -0,0 +1,180 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship made available under
+ the License, as indicated by a copyright notice that is included in
+ or attached to the work (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other transformations
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
+ in the Work by the copyright owner or by an individual or Legal Entity
+ authorized to submit on behalf of the copyright owner. For the purposes
+ of this definition, "submitted" means any form of electronic, verbal,
+ or written communication sent to the Licensor or its representatives,
+ including but not limited to communication on electronic mailing lists,
+ source code control systems, and issue tracking systems that are managed
+ by, or on behalf of, the Licensor for the purpose of discussing and
+ improving the Work, but excluding communication that is conspicuously
+ marked or designated in writing by the copyright owner as "Not a
+ Contribution."
+
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
+ whom a Contribution has been received by the Licensor and included
+ within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by the combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a cross-claim
+ or counterclaim in a lawsuit) alleging that the Work or any
+ Contribution embodied within the Work constitutes direct or contributory
+ patent infringement, then any patent licenses granted to You under
+ this License for that Work shall terminate as of the date such
+ litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or Derivative
+ Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, You must include a readable copy of the
+ attribution notices contained within such NOTICE file, in
+ at least one of the following places: within a NOTICE text
+ file distributed as part of the Derivative Works; within
+ the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the
+ Derivative Works, if and wherever such third-party notices
+ normally appear. The contents of the NOTICE file are for
+ informational purposes only and do not modify the License.
+ You may add Your own attribution notices within Derivative
+ Works that You distribute, alongside or in addition to the
+ NOTICE text from the Work, provided that such additional
+ attribution notices cannot be construed as modifying the License.
+
+ You may add Your own license statement for Your modifications and
+ may provide additional grant of rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the
+ Derivative Works, and to permit persons to whom the Derivative Works
+ are furnished to do so.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or reproducing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or exemplary damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or all other
+ commercial damages or losses), even if such Contributor has been
+ advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may offer only
+ conditions consistent with this License.
+
+ END OF TERMS AND CONDITIONS
+
+ Copyright 2026 nirholas
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/naming-mcp/README.md b/packages/naming-mcp/README.md
new file mode 100644
index 000000000..33e28cbb2
--- /dev/null
+++ b/packages/naming-mcp/README.md
@@ -0,0 +1,133 @@
+<p align="center">
+ <a href="https://three.ws"><img src="https://three.ws/three-ws-mcp-icon.svg" alt="three.ws" width="88" height="88"></a>
+</p>
+
+<h1 align="center">@three-ws/naming-mcp</h1>
+
+<p align="center"><strong>The on-chain identity layer for AI agents — resolve .sol names and claim your agent a name on three.ws.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/naming-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/naming-mcp?logo=npm&color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/naming-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/naming-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>
+
+---
+
+> A [Model Context Protocol](https://modelcontextprotocol.io) server that gives any AI assistant the three.ws **naming / identity** layer over stdio. Resolve a Solana `.sol` name to the wallet that owns it, reverse-lookup a wallet to its primary name, and check whether a `*.threews.sol` agent handle is still free to claim.
+
+This is the three.ws identity layer: where avatars give your agent a *face* and scenes give it a *world*, names give it an *identity*. A `*.threews.sol` subdomain showcases an agent profile at `https://three.ws/u/<label>` — claiming one gives your agent a name. No API key, no signer, no payment — every call hits the public `/api/sns` and `/api/threews/subdomain` endpoints, backed by Solana / Bonfida SNS (mainnet).
+
+> **Note:** minting a `*.threews.sol` subdomain is the **authenticated write path** on the three.ws HTTP API. This MCP server exposes the public **resolution + availability** reads; once you find a free handle, claim it from your three.ws account.
+
+## Install
+
+```bash
+npm install @three-ws/naming-mcp
+```
+
+Or run with `npx` (no install):
+
+```bash
+npx @three-ws/naming-mcp
+```
+
+## Quick start
+
+**Claude Code**, one line:
+
+```bash
+claude mcp add naming -- npx -y @three-ws/naming-mcp
+```
+
+**Claude Desktop / Cursor** (`claude_desktop_config.json` or `mcp.json`):
+
+```json
+{
+ "mcpServers": {
+ "naming": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/naming-mcp"]
+ }
+ }
+}
+```
+
+Inspect the surface with the MCP Inspector:
+
+```bash
+npx -y @modelcontextprotocol/inspector npx @three-ws/naming-mcp
+```
+
+## Tools
+
+| Tool | Type | What it does |
+| ---------------------- | --------- | -------------------------------------------------------------------------------------------- |
+| `sns_resolve` | read-only | Resolve a `.sol` name → the base58 wallet that owns it. |
+| `sns_reverse` | read-only | Reverse-lookup a wallet → its primary `.sol` name. |
+| `threews_availability` | read-only | Check whether `<label>.threews.sol` is free to claim as a three.ws agent identity. |
+
+All three are live public reads against Solana mainnet. A `.sol` name with no owner (or a wallet with no favorite name) returns `resolved: false` — a routine, expected answer, not an error.
+
+### Input parameters
+
+**`sns_resolve`** — `name` (required: a `.sol` label, subdomain, or full name with or without the trailing `.sol`).
+
+**`sns_reverse`** — `address` (required: a base58 Solana public key).
+
+**`threews_availability`** — `label` (required: the handle to check, e.g. `nick` for `nick.threews.sol`; 1–63 chars of `[a-z0-9-]`).
+
+## Example
+
+```jsonc
+// sns_resolve
+> { "name": "bonfida" }
+{
+ "ok": true,
+ "name": "bonfida.sol",
+ "address": "Fw1ETanDZafof7xEULsnq9UY6o71Tpds89tNwPkWLb1v",
+ "resolved": true
+}
+
+// threews_availability
+> { "label": "test" }
+{
+ "ok": true,
+ "full": "test.threews.sol",
+ "label": "test",
+ "available": true,
+ "owner": null,
+ "on_chain_check": "ok",
+ "showcase_url": null
+}
+```
+
+## Requirements
+
+- **Node.js >= 20.**
+- Network access to `https://three.ws` (or your own `THREE_WS_BASE`).
+
+### Environment variables
+
+| Variable | Required | Default |
+| --------------------- | -------- | ------------------ |
+| `THREE_WS_BASE` | no | `https://three.ws` |
+| `THREE_WS_TIMEOUT_MS` | no | `20000` |
+
+## 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)
+
+---
+
+<p align="center">
+ <sub>
+ Part of the <a href="https://three.ws">three.ws</a> SDK suite — 3D AI agents, on-chain identity, and agent payments.<br/>
+ <a href="https://three.ws">Website</a> · <a href="https://three.ws/changelog">Changelog</a> · <a href="https://github.com/nirholas/three.ws">GitHub</a>
+ </sub>
+</p>
diff --git a/packages/naming-mcp/package.json b/packages/naming-mcp/package.json
new file mode 100644
index 000000000..f1426793f
--- /dev/null
+++ b/packages/naming-mcp/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "@three-ws/naming-mcp",
+ "version": "0.1.0",
+ "mcpName": "io.github.nirholas/naming-mcp",
+ "description": "Resolve Solana .sol names and check *.threews.sol agent-identity availability from any AI agent. sns_resolve maps a .sol name to its owner wallet, sns_reverse maps a wallet to its primary name, and threews_availability checks whether a three.ws agent handle is free to claim. No key, no signer, no payment.",
+ "type": "module",
+ "author": "nirholas <[email protected]>",
+ "license": "Apache-2.0",
+ "homepage": "https://three.ws",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/nirholas/three.ws.git",
+ "directory": "packages/naming-mcp"
+ },
+ "bugs": {
+ "url": "https://github.com/nirholas/three.ws/issues"
+ },
+ "keywords": [
+ "mcp",
+ "model-context-protocol",
+ "three.ws",
+ "solana",
+ "sns",
+ "naming",
+ "identity",
+ "ens",
+ "ai-agent"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "files": [
+ "src",
+ "server.json",
+ "README.md",
+ "LICENSE"
+ ],
+ "bin": {
+ "naming-mcp": "src/index.js"
+ },
+ "main": "./src/index.js",
+ "exports": {
+ ".": "./src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "scripts": {
+ "start": "node src/index.js",
+ "test": "node --test \"test/**/*.test.mjs\"",
+ "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
+ },
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ }
+}
diff --git a/packages/naming-mcp/server.json b/packages/naming-mcp/server.json
new file mode 100644
index 000000000..85f503bed
--- /dev/null
+++ b/packages/naming-mcp/server.json
@@ -0,0 +1,49 @@
+{
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
+ "name": "io.github.nirholas/naming-mcp",
+ "title": "three.ws Naming",
+ "description": "The on-chain identity layer for AI agents — resolve Solana .sol names, reverse-lookup wallets, and check whether a *.threews.sol agent handle is free to claim.",
+ "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/naming-mcp"
+ },
+ "version": "0.1.0",
+ "packages": [
+ {
+ "registryType": "npm",
+ "identifier": "@three-ws/naming-mcp",
+ "version": "0.1.0",
+ "runtimeHint": "npx",
+ "transport": {
+ "type": "stdio"
+ },
+ "environmentVariables": [
+ {
+ "name": "THREE_WS_BASE",
+ "description": "Base URL of the three.ws API that serves /api/sns and /api/threews/subdomain. Override only when self-hosting or targeting a preview deployment.",
+ "format": "string",
+ "isRequired": false,
+ "default": "https://three.ws"
+ },
+ {
+ "name": "THREE_WS_TIMEOUT_MS",
+ "description": "Per-request timeout in milliseconds. Resolution and availability checks hit a Solana RPC pool, so the default leaves room for a cold lookup.",
+ "format": "number",
+ "isRequired": false,
+ "default": "20000"
+ }
+ ]
+ }
+ ]
+}
diff --git a/packages/naming-mcp/src/index.js b/packages/naming-mcp/src/index.js
old mode 100644
new mode 100755
diff --git a/packages/naming-mcp/test/registration.test.mjs b/packages/naming-mcp/test/registration.test.mjs
new file mode 100644
index 000000000..a5a773ada
--- /dev/null
+++ b/packages/naming-mcp/test/registration.test.mjs
@@ -0,0 +1,92 @@
+// Tool-surface invariants for @three-ws/naming-mcp.
+//
+// Importing src/index.js is side-effect-free: the stdio transport only
+// connects when the file is the process entry point, and buildServer() needs
+// no key or signer. These tests run offline — they never touch the network.
+//
+// Run: node --test packages/naming-mcp/test/registration.test.mjs
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { TOOLS, buildServer } from '../src/index.js';
+
+const EXPECTED_NAMES = ['sns_resolve', 'sns_reverse', 'threews_availability'];
+
+test('exactly the expected tools are registered', () => {
+ assert.equal(TOOLS.length, 3);
+ assert.deepEqual(new Set(TOOLS.map((t) => t.name)), new Set(EXPECTED_NAMES));
+});
+
+test('every tool has a title, description, input schema and complete annotations', () => {
+ 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.equal(typeof tool.description, 'string', `${tool.name} is missing a description`);
+ assert.ok(tool.description.length > 0, `${tool.name} has an empty description`);
+ assert.ok(tool.inputSchema && typeof tool.inputSchema === 'object', `${tool.name} is missing inputSchema`);
+ assert.equal(typeof tool.handler, 'function', `${tool.name} is missing a handler`);
+ assert.ok(tool.annotations, `${tool.name} is missing MCP ToolAnnotations`);
+ assert.equal(typeof tool.annotations.readOnlyHint, 'boolean', `${tool.name} must set readOnlyHint`);
+ assert.equal(typeof tool.annotations.idempotentHint, 'boolean', `${tool.name} must set idempotentHint`);
+ assert.equal(typeof tool.annotations.openWorldHint, 'boolean', `${tool.name} must set openWorldHint`);
+ }
+});
+
+test('sns_resolve takes a required .sol name and is read-only', () => {
+ const tool = TOOLS.find((t) => t.name === 'sns_resolve');
+ assert.ok(tool, 'sns_resolve must exist');
+ assert.equal(tool.annotations.readOnlyHint, true);
+ assert.equal(tool.annotations.idempotentHint, false);
+ assert.equal(tool.annotations.openWorldHint, true);
+ assert.ok(tool.inputSchema.name, 'sns_resolve must accept a name parameter');
+ assert.match(tool.description, /\.sol/);
+});
+
+test('sns_reverse takes a required base58 address and is read-only', () => {
+ const tool = TOOLS.find((t) => t.name === 'sns_reverse');
+ assert.ok(tool, 'sns_reverse must exist');
+ assert.equal(tool.annotations.readOnlyHint, true);
+ assert.equal(tool.annotations.idempotentHint, false);
+ assert.equal(tool.annotations.openWorldHint, true);
+ assert.ok(tool.inputSchema.address, 'sns_reverse must accept an address parameter');
+ assert.match(tool.description, /wallet/i);
+});
+
+test('threews_availability takes a required label and is read-only', () => {
+ const tool = TOOLS.find((t) => t.name === 'threews_availability');
+ assert.ok(tool, 'threews_availability must exist');
+ assert.equal(tool.annotations.readOnlyHint, true);
+ assert.equal(tool.annotations.idempotentHint, false);
+ assert.equal(tool.annotations.openWorldHint, true);
+ assert.ok(tool.inputSchema.label, 'threews_availability must accept a label parameter');
+ assert.match(tool.description, /threews\.sol/);
+});
+
+test('every tool advertises readOnlyHint and openWorldHint (all are live public reads)', () => {
+ for (const tool of TOOLS) {
+ assert.equal(tool.annotations.readOnlyHint, true, `${tool.name} should be read-only`);
+ assert.equal(tool.annotations.openWorldHint, true, `${tool.name} talks to a live service`);
+ }
+});
+
+test('no read-only tool sets destructiveHint (it is meaningless for reads)', () => {
+ for (const tool of TOOLS) {
+ assert.equal(
+ Object.prototype.hasOwnProperty.call(tool.annotations, 'destructiveHint'),
+ false,
+ `${tool.name} is read-only — destructiveHint must not be set`,
+ );
+ }
+});
+
+test('buildServer registers every tool with its annotations, without a signer', () => {
+ const server = buildServer();
+ 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/scene-mcp/src/index.js b/packages/scene-mcp/src/index.js
old mode 100644
new mode 100755
diff --git a/packages/vanity-mcp/LICENSE b/packages/vanity-mcp/LICENSE
new file mode 100644
index 000000000..8e2251ab4
--- /dev/null
+++ b/packages/vanity-mcp/LICENSE
@@ -0,0 +1,180 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship made available under
+ the License, as indicated by a copyright notice that is included in
+ or attached to the work (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other transformations
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
+ in the Work by the copyright owner or by an individual or Legal Entity
+ authorized to submit on behalf of the copyright owner. For the purposes
+ of this definition, "submitted" means any form of electronic, verbal,
+ or written communication sent to the Licensor or its representatives,
+ including but not limited to communication on electronic mailing lists,
+ source code control systems, and issue tracking systems that are managed
+ by, or on behalf of, the Licensor for the purpose of discussing and
+ improving the Work, but excluding communication that is conspicuously
+ marked or designated in writing by the copyright owner as "Not a
+ Contribution."
+
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
+ whom a Contribution has been received by the Licensor and included
+ within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by the combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a cross-claim
+ or counterclaim in a lawsuit) alleging that the Work or any
+ Contribution embodied within the Work constitutes direct or contributory
+ patent infringement, then any patent licenses granted to You under
+ this License for that Work shall terminate as of the date such
+ litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or Derivative
+ Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, You must include a readable copy of the
+ attribution notices contained within such NOTICE file, in
+ at least one of the following places: within a NOTICE text
+ file distributed as part of the Derivative Works; within
+ the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the
+ Derivative Works, if and wherever such third-party notices
+ normally appear. The contents of the NOTICE file are for
+ informational purposes only and do not modify the License.
+ You may add Your own attribution notices within Derivative
+ Works that You distribute, alongside or in addition to the
+ NOTICE text from the Work, provided that such additional
+ attribution notices cannot be construed as modifying the License.
+
+ You may add Your own license statement for Your modifications and
+ may provide additional grant of rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the
+ Derivative Works, and to permit persons to whom the Derivative Works
+ are furnished to do so.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or reproducing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or exemplary damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or all other
+ commercial damages or losses), even if such Contributor has been
+ advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may offer only
+ conditions consistent with this License.
+
+ END OF TERMS AND CONDITIONS
+
+ Copyright 2026 nirholas
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/vanity-mcp/README.md b/packages/vanity-mcp/README.md
new file mode 100644
index 000000000..d288f7137
--- /dev/null
+++ b/packages/vanity-mcp/README.md
@@ -0,0 +1,135 @@
+<p align="center">
+ <a href="https://three.ws"><img src="https://three.ws/three-ws-mcp-icon.svg" alt="three.ws" width="88" height="88"></a>
+</p>
+
+<h1 align="center">@three-ws/vanity-mcp</h1>
+
+<p align="center"><strong>Read the three.ws vanity-address grind-bounty market + rarity gallery from any AI agent.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/vanity-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/vanity-mcp?logo=npm&color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/vanity-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/vanity-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>
+
+---
+
+> A [Model Context Protocol](https://modelcontextprotocol.io) server that gives any AI assistant the read/discovery surface of the three.ws **vanity-address grind-bounty market** over stdio. Quote how hard a Solana vanity pattern is and what to escrow for it, appraise the rarity of any address, and browse the live bounty board, claimable queue, stats, leaderboard, config, and the proof-of-grind gallery.
+
+The market is secret-blind: a requester escrows a USDC bounty for a pattern, a fleet of independent workers grinds it in parallel, and the first to submit a verified key matching the pattern is paid on-chain — yet the found secret is sealed to the requester, so the worker earns the bounty without ever seeing the wallet. **Posting a bounty and claiming one are the x402-paid write paths on the HTTP API**; this MCP exposes the read/discovery + rarity surface. No API key, no signer, no payment — every call hits the public `/api/vanity` endpoints.
+
+## Install
+
+```bash
+npm install @three-ws/vanity-mcp
+```
+
+Or run with `npx` (no install):
+
+```bash
+npx @three-ws/vanity-mcp
+```
+
+## Quick start
+
+**Claude Code**, one line:
+
+```bash
+claude mcp add vanity -- npx -y @three-ws/vanity-mcp
+```
+
+**Claude Desktop / Cursor** (`claude_desktop_config.json` or `mcp.json`):
+
+```json
+{
+ "mcpServers": {
+ "vanity": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/vanity-mcp"]
+ }
+ }
+}
+```
+
+Inspect the surface with the MCP Inspector:
+
+```bash
+npx -y @modelcontextprotocol/inspector npx @three-ws/vanity-mcp
+```
+
+## Tools
+
+| Tool | Type | What it does |
+| -------------------- | --------- | ---------------------------------------------------------------------------------------------------- |
+| `vanity_quote` | read-only | Price a pattern: expected attempts, rarity tier, and an honest suggested USDC bounty. Idempotent. |
+| `vanity_appraise` | read-only | Appraise any Solana address's rarity (pattern, score, bits, tier, attempts). Idempotent. |
+| `vanity_board` | read-only | Browse the grind-bounty board — filter by status, sort by recency/reward/expiry, paginate. |
+| `vanity_open` | read-only | List the claimable open-bounty queue workers poll. |
+| `vanity_stats` | read-only | Live market totals: open count, USDC escrowed, USDC paid out. |
+| `vanity_leaderboard` | read-only | Top grinders ranked by total USDC earned. |
+| `vanity_config` | read-only | Payout availability + asset/network metadata (settlement asset, decimals, networks, pricing band). |
+| `vanity_gallery` | read-only | Browse the proof-of-grind rarity gallery — sort, filter by tier/length/substring, paginate. |
+
+`vanity_quote` and `vanity_appraise` are pure functions of their input (same pattern/address → same result), so they're marked idempotent. The other six read the live market and gallery.
+
+### Input parameters
+
+**`vanity_quote`** — `prefix` (optional Base58 prefix), `suffix` (optional Base58 suffix), `ignoreCase` (bool, default false). At least one of prefix/suffix is required.
+
+**`vanity_appraise`** — `address` (required, Base58 32–44 chars), `prefixLen` (int, optional), `suffixLen` (int, optional).
+
+**`vanity_board`** — `status` (`open` | `all` | `settled`, default `open`), `sort` (`recency` | `reward` | `expiry`, default `recency`), `limit` (1–100, default 24), `offset` (default 0).
+
+**`vanity_open`** — `limit` (1–100, default 30).
+
+**`vanity_stats`** — no params.
+
+**`vanity_leaderboard`** — `limit` (1–100, default 10).
+
+**`vanity_config`** — no params.
+
+**`vanity_gallery`** — `sort` (`score` | `recency`, default `score`), `tier` (string), `minLength` (int), `contains` (string), `limit` (1–100, default 24), `offset` (default 0).
+
+## Example
+
+```jsonc
+// vanity_quote
+> { "prefix": "THREE" }
+{
+ "ok": true,
+ "pattern": { "prefix": "THREE", "suffix": null, "ignoreCase": false },
+ "difficulty": { "expectedAttempts": 656356768, "tier": "epic", "tierLabel": "Epic" },
+ "oracle": { "suggestedAtomics": "500000", "suggestedUsdc": "0.50" },
+ "band": { "floorAtomics": 50000, "maxAtomics": 50000000, "decimals": 6, "asset": "USDC" }
+}
+```
+
+## Requirements
+
+- **Node.js >= 20.**
+- Network access to `https://three.ws` (or your own `THREE_WS_BASE`).
+
+### Environment variables
+
+| Variable | Required | Default |
+| --------------------- | -------- | ------------------ |
+| `THREE_WS_BASE` | no | `https://three.ws` |
+| `THREE_WS_TIMEOUT_MS` | no | `20000` |
+
+## 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)
+
+---
+
+<p align="center">
+ <sub>
+ Part of the <a href="https://three.ws">three.ws</a> SDK suite — 3D AI agents, on-chain identity, and agent payments.<br/>
+ <a href="https://three.ws">Website</a> · <a href="https://three.ws/changelog">Changelog</a> · <a href="https://github.com/nirholas/three.ws">GitHub</a>
+ </sub>
+</p>
diff --git a/packages/vanity-mcp/package.json b/packages/vanity-mcp/package.json
new file mode 100644
index 000000000..c7f72b4fe
--- /dev/null
+++ b/packages/vanity-mcp/package.json
@@ -0,0 +1,54 @@
+{
+ "name": "@three-ws/vanity-mcp",
+ "version": "0.1.0",
+ "mcpName": "io.github.nirholas/vanity-mcp",
+ "description": "Read the three.ws vanity-address grind-bounty market and proof-of-grind rarity gallery from any AI agent. Quote a pattern's difficulty + USDC price, appraise any address's rarity, and browse the bounty board, claimable queue, stats, leaderboard, config, and gallery. Read-only — no key, no signer, no payment.",
+ "type": "module",
+ "author": "nirholas <[email protected]>",
+ "license": "Apache-2.0",
+ "homepage": "https://three.ws",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/nirholas/three.ws.git",
+ "directory": "packages/vanity-mcp"
+ },
+ "bugs": {
+ "url": "https://github.com/nirholas/three.ws/issues"
+ },
+ "keywords": [
+ "mcp",
+ "three.ws",
+ "solana",
+ "vanity-address",
+ "bounty",
+ "x402"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "files": [
+ "src",
+ "server.json",
+ "README.md",
+ "LICENSE"
+ ],
+ "bin": {
+ "vanity-mcp": "src/index.js"
+ },
+ "main": "./src/index.js",
+ "exports": {
+ ".": "./src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "scripts": {
+ "start": "node src/index.js",
+ "test": "node --test \"test/**/*.test.mjs\"",
+ "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
+ },
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "zod": "^3.23.8"
+ }
+}
diff --git a/packages/vanity-mcp/server.json b/packages/vanity-mcp/server.json
new file mode 100644
index 000000000..7f91f74c3
--- /dev/null
+++ b/packages/vanity-mcp/server.json
@@ -0,0 +1,49 @@
+{
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
+ "name": "io.github.nirholas/vanity-mcp",
+ "title": "three.ws Vanity",
+ "description": "Read the three.ws vanity-address grind-bounty market — quote a pattern's difficulty + USDC price, appraise any address's rarity, and browse the board, claimable queue, leaderboard, and proof-of-grind gallery.",
+ "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/vanity-mcp"
+ },
+ "version": "0.1.0",
+ "packages": [
+ {
+ "registryType": "npm",
+ "identifier": "@three-ws/vanity-mcp",
+ "version": "0.1.0",
+ "runtimeHint": "npx",
+ "transport": {
+ "type": "stdio"
+ },
+ "environmentVariables": [
+ {
+ "name": "THREE_WS_BASE",
+ "description": "Base URL of the three.ws API that serves /api/vanity. Override only when self-hosting or targeting a preview deployment.",
+ "format": "string",
+ "isRequired": false,
+ "default": "https://three.ws"
+ },
+ {
+ "name": "THREE_WS_TIMEOUT_MS",
+ "description": "Per-request timeout in milliseconds. All endpoints are reads, so the default is brisk with headroom for a cold cache.",
+ "format": "number",
+ "isRequired": false,
+ "default": "20000"
+ }
+ ]
+ }
+ ]
+}
diff --git a/packages/vanity-mcp/src/index.js b/packages/vanity-mcp/src/index.js
new file mode 100755
index 000000000..a7a5b2320
--- /dev/null
+++ b/packages/vanity-mcp/src/index.js
@@ -0,0 +1,137 @@
+#!/usr/bin/env node
+// @three-ws/vanity-mcp — MCP server entry point.
+//
+// Gives any AI assistant the three.ws vanity-address bounty market + rarity
+// gallery over stdio — all read/discovery surface:
+// • vanity_quote — pattern → honest difficulty + suggested USDC bounty
+// • vanity_appraise — rarity of any Solana address (pure math)
+// • vanity_board — browse the grind-bounty board
+// • vanity_open — claimable queue workers poll
+// • vanity_stats — live market totals
+// • vanity_leaderboard — top grinders by USDC earned
+// • vanity_config — payout availability + asset/network metadata
+// • vanity_gallery — browse the proof-of-grind rarity gallery
+//
+// A thin wrapper over the PUBLIC three.ws API (/api/vanity). No keys, no signer,
+// no payment — point THREE_WS_BASE at a deployment and go. Posting or claiming a
+// bounty is the x402-paid write path on the HTTP API; this MCP exposes the
+// read/discovery + rarity surface.
+//
+// Run standalone:
+// node packages/vanity-mcp/src/index.js
+//
+// Or wire into Claude Code / 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';
+
+import { def as vanityQuote } from './tools/vanity-quote.js';
+import { def as vanityAppraise } from './tools/vanity-appraise.js';
+import { def as vanityBoard } from './tools/vanity-board.js';
+import { def as vanityOpen } from './tools/vanity-open.js';
+import { def as vanityStats } from './tools/vanity-stats.js';
+import { def as vanityLeaderboard } from './tools/vanity-leaderboard.js';
+import { def as vanityConfig } from './tools/vanity-config.js';
+import { def as vanityGallery } from './tools/vanity-gallery.js';
+
+// Single source of truth for the advertised server version — package.json.
+const require = createRequire(import.meta.url);
+const { version: PKG_VERSION } = require('../package.json');
+
+export const TOOLS = [
+ vanityQuote,
+ vanityAppraise,
+ vanityBoard,
+ vanityOpen,
+ vanityStats,
+ vanityLeaderboard,
+ vanityConfig,
+ vanityGallery,
+];
+
+/**
+ * Construct a fully-registered McpServer without connecting a transport.
+ * Registration is env-free, so this is safe to import from tests.
+ * @returns {McpServer}
+ */
+export function buildServer() {
+ const server = new McpServer(
+ { name: 'vanity-mcp', title: 'three.ws Vanity', version: PKG_VERSION },
+ {
+ capabilities: { tools: {} },
+ instructions:
+ 'three.ws Vanity MCP — the read/discovery surface of the secret-blind grind-bounty market for HARD ' +
+ 'Solana vanity addresses. A requester escrows a USDC bounty for a pattern; a fleet of independent ' +
+ 'workers grinds it in parallel and the first to submit a verified key matching the pattern is paid ' +
+ 'on-chain — yet the found secret is sealed to the requester, so the worker earns the bounty without ' +
+ 'ever seeing the wallet. vanity_quote prices a pattern from an honest difficulty oracle; ' +
+ 'vanity_appraise scores the rarity of any address. vanity_board, vanity_open, vanity_stats, ' +
+ 'vanity_leaderboard, and vanity_config read the live market; vanity_gallery browses the ' +
+ 'proof-of-grind rarity gallery. All data comes live from the public three.ws /api/vanity endpoints ' +
+ '— no API key, signer, or payment required. Posting or claiming a bounty is the x402-paid write path ' +
+ 'on the HTTP API; this server exposes only reads.',
+ },
+ );
+
+ for (const tool of TOOLS) {
+ server.registerTool(
+ tool.name,
+ {
+ title: tool.title,
+ description: tool.description,
+ inputSchema: tool.inputSchema,
+ 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);
+ return { content: [{ type: 'text', text }] };
+ } catch (err) {
+ const payload = {
+ ok: false,
+ error: err?.code || 'unhandled',
+ message: err?.message || String(err),
+ ...(err?.status ? { status: err.status } : {}),
+ };
+ return {
+ content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
+ isError: true,
+ };
+ }
+ },
+ );
+ }
+
+ return server;
+}
+
+async function main() {
+ const server = buildServer();
+ const transport = new StdioServerTransport();
+ await server.connect(transport);
+ console.error(`[vanity-mcp@${PKG_VERSION}] connected over stdio with ${TOOLS.length} tools`);
+}
+
+// Connect stdio ONLY when this file is the process entry point. Importing the
+// module (tests, embedding) must not grab the transport. realpath both sides:
+// npm bin shims are symlinks, so argv[1] may differ from import.meta.url.
+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('[vanity-mcp] fatal:', err);
+ process.exit(1);
+ });
+}
diff --git a/packages/vanity-mcp/src/tools/vanity-config.js b/packages/vanity-mcp/src/tools/vanity-config.js
new file mode 100644
index 000000000..6b9c5db3f
--- /dev/null
+++ b/packages/vanity-mcp/src/tools/vanity-config.js
@@ -0,0 +1,20 @@
+// `vanity_config` — market payout availability + asset/network metadata. Read-only.
+//
+// Wraps GET /api/vanity/bounties?view=config. Reflects live deployment config
+// (which escrow networks are wired, whether payouts are configured), so it can
+// change between deploys — NOT idempotent.
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'vanity_config',
+ title: 'Bounty market config: payout + asset metadata',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Read the grind-bounty market configuration: whether on-chain payouts are configured (can a winner actually be paid?), the settlement asset (USDC) and its decimals, which escrow networks are live (Base / Solana), the pricing band (floor + max atomics), the bounty protocol version, and the sealed-envelope scheme. Check this before posting to confirm the market can pay out. Read-only, no params.',
+ inputSchema: {},
+ async handler() {
+ const data = await apiRequest('/api/vanity/bounties', { query: { view: 'config' } });
+ return { ok: true, ...data };
+ },
+};
diff --git a/packages/vanity-mcp/src/tools/vanity-gallery.js b/packages/vanity-mcp/src/tools/vanity-gallery.js
new file mode 100644
index 000000000..beba43017
--- /dev/null
+++ b/packages/vanity-mcp/src/tools/vanity-gallery.js
@@ -0,0 +1,38 @@
+// `vanity_gallery` — browse the proof-of-grind rarity gallery. Read-only.
+//
+// Wraps GET /api/vanity/gallery (default view). Published entries are added and
+// removed over time, so the listing is NOT idempotent.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'vanity_gallery',
+ title: 'Browse the proof-of-grind rarity gallery',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Browse the public proof-of-grind gallery: rare Solana addresses people have published with a verifiable grind receipt. Sort by rarity score or recency, filter by tier, minimum pattern length, or a substring the pattern must contain, and paginate. Each entry shows the address, pattern, rarity score/bits, tier, and an explorer link. Read-only.',
+ inputSchema: {
+ sort: z.enum(['score', 'recency']).default('score').describe('Order by rarity score (rarest first) or recency. Default score.'),
+ tier: z.string().optional().describe('Filter to a single rarity tier id.'),
+ minLength: z.number().int().min(0).optional().describe('Only patterns at least this many characters long.'),
+ contains: z.string().optional().describe('Only addresses whose vanity pattern contains this substring.'),
+ limit: z.number().int().min(1).max(100).optional().describe('Max entries to return (1–100, default 24).'),
+ offset: z.number().int().min(0).optional().describe('Pagination offset (default 0).'),
+ },
+ async handler(args) {
+ const data = await apiRequest('/api/vanity/gallery', {
+ query: {
+ view: 'gallery',
+ sort: args?.sort || 'score',
+ tier: args?.tier,
+ minLength: args?.minLength,
+ contains: args?.contains,
+ limit: args?.limit,
+ offset: args?.offset,
+ },
+ });
+ return { ok: true, ...data };
+ },
+};
diff --git a/packages/vanity-mcp/src/tools/vanity-leaderboard.js b/packages/vanity-mcp/src/tools/vanity-leaderboard.js
new file mode 100644
index 000000000..eff4fb1bd
--- /dev/null
+++ b/packages/vanity-mcp/src/tools/vanity-leaderboard.js
@@ -0,0 +1,29 @@
+// `vanity_leaderboard` — top grinders by USDC earned. Read-only.
+//
+// Wraps GET /api/vanity/bounties?view=leaderboard. The ranking shifts as workers
+// win bounties — NOT idempotent.
+
+import { z } from 'zod';
+
+import { apiRequest } from '../lib/api.js';
+
+export const def = {
+ name: 'vanity_leaderboard',
+ title: 'Top grinders by USDC earned',
+ annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
+ description:
+ 'Rank the worker fleet: the top grinders by total USDC earned from winning vanity-address bounties. Each entry shows a worker id and its cumulative payout. Read-only.',
+ inputSchema: {
+ limit: z.number().int().min(1).max(100).default(10).describe('How many top grinders to return (1–100, default 10).'),
+ },
+ async handler(args) {
+ const data = await apiRequest('/api/vanity/bounties', {
+ query: { view: 'leaderboard', limit: args?.limit ?? 10 },
+ });
+ return {
+ ok: true,
+ grinders: data?.grinders ?? [],
+ count: data?.count ?? (Array.isArray(data?.grinders) ? data.grinders.length : 0),
+ };
+ },
+};
diff --git a/packages/vanity-mcp/test/registration.test.mjs b/packages/vanity-mcp/test/registration.test.mjs
new file mode 100644
index 000000000..3722e2759
--- /dev/null
+++ b/packages/vanity-mcp/test/registration.test.mjs
@@ -0,0 +1,76 @@
+// Tool-surface invariants for @three-ws/vanity-mcp.
+//
+// Importing src/index.js is side-effect-free: the stdio transport only
+// connects when the file is the process entry point, and buildServer() needs
+// no key or signer. These tests run offline — they never touch the network.
+//
+// Run: node --test packages/vanity-mcp/test/registration.test.mjs
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { TOOLS, buildServer } from '../src/index.js';
+
+const EXPECTED_NAMES = [
+ 'vanity_quote',
+ 'vanity_appraise',
+ 'vanity_board',
+ 'vanity_open',
+ 'vanity_stats',
+ 'vanity_leaderboard',
+ 'vanity_config',
+ 'vanity_gallery',
+];
+
+// Every tool here is a read of the public /api/vanity surface.
+const READ_ONLY_TOOLS = new Set(EXPECTED_NAMES);
+
+test('exactly the expected tools are registered', () => {
+ assert.equal(TOOLS.length, 8);
+ assert.deepEqual(new Set(TOOLS.map((t) => t.name)), new Set(EXPECTED_NAMES));
+});
+
+test('every tool has a title, description, input schema and complete annotations', () => {
+ 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.equal(typeof tool.description, 'string', `${tool.name} is missing a description`);
+ assert.ok(tool.inputSchema && typeof tool.inputSchema === 'object', `${tool.name} is missing inputSchema`);
+ assert.equal(typeof tool.handler, 'function', `${tool.name} is missing a handler`);
+ assert.ok(tool.annotations, `${tool.name} is missing MCP ToolAnnotations`);
+ assert.equal(typeof tool.annotations.readOnlyHint, 'boolean', `${tool.name} must set readOnlyHint`);
+ assert.equal(typeof tool.annotations.idempotentHint, 'boolean', `${tool.name} must set idempotentHint`);
+ assert.equal(typeof tool.annotations.openWorldHint, 'boolean', `${tool.name} must set openWorldHint`);
+ }
+});
+
+test('every tool is a read of a live service: readOnlyHint and openWorldHint', () => {
+ 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.openWorldHint, true, `${name} talks to a live service`);
+ }
+});
+
+test('the two pure oracles are idempotent; live-market reads are not', () => {
+ const idempotent = new Set(['vanity_quote', 'vanity_appraise']);
+ for (const tool of TOOLS) {
+ assert.equal(
+ tool.annotations.idempotentHint,
+ idempotent.has(tool.name),
+ `${tool.name} idempotentHint should be ${idempotent.has(tool.name)}`,
+ );
+ }
+});
+
+test('buildServer registers every tool with its annotations, without a signer', () => {
+ const server = buildServer();
+ 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/public/changelog.json b/public/changelog.json
index 2608c1cbf..ee8a655b7 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-23T07:50:01.651Z",
+ "generated_at": "2026-06-23T08:03:05.273Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -197,6 +197,17 @@
"feature"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "update",
+ "title": "Five new MCP servers — drop three.ws scenes, vanity, naming, intel & marketplace into any AI agent",
+ "summary": "The same one-line install that gave any AI assistant our 3D avatars now opens up five more of the platform's capabilities. scene-mcp turns one sentence into a placed 3D diorama plan — the world to go with your avatar's character. vanity-mcp exposes the Solana vanity-address bounty market and rarity gallery — price a pattern's difficulty, browse open bounties, read the grinder leaderboard, appraise any address. naming-mcp resolves .sol names both ways and checks whether a *.threews.sol agent identity is free to claim. intel-mcp hands an agent the market-intelligence rails: smart-money scores for a coin, a wallet's realized track record, verified signal feeds, KOL trades, and ranked copy-trade wallets. marketplace-mcp browses the agent marketplace and skills catalog. Every tool is a thin wrapper over the live public three.ws API — no key, no signer, no mock data — and ships with MCP safety annotations so clients know which calls are read-only. Add any of them in one line: `claude mcp add scene -- npx -y @three-ws/scene-mcp` (swap in vanity, naming, intel, or marketplace).",
+ "link": null,
+ "tags": [
+ "sdk",
+ "feature"
+ ]
+ },
{
"date": "2026-06-23",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 6e77e0f0c..2964b7183 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -158,6 +158,14 @@
<category>feature</category>
<description>Your autonomous sniper already exits on take-profit, stop-loss, trailing stop, or max-hold, and the kill switch dumps every position at once — but until now there was no way to close just ONE open position on demand. The Sniper Strategies dashboard now puts a 'Sell now' button on each live position: tap it, confirm, and the agent market-sells its full holding of that coin from its own wallet at the current price, with a real signature and realized PnL. It runs the exact same exit path the bot uses automatically (fresh re-quote, graduated coins routed through the AMM, the protected execution engine, full custody-trail audit), so a manual exit is held to the same standard as an automatic one — and it's owner-only, with the position atomically claimed so a manual sell and the bot's own sweep can never both fire on the same bag.</description>
</item>
+ <item>
+ <title>Five new MCP servers — drop three.ws scenes, vanity, naming, intel &amp; marketplace into any AI agent</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-23:Five new MCP servers — drop three.ws scenes, vanity, naming, intel &amp; marketplace into any AI agent</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>sdk</category>
+ <description>The same one-line install that gave any AI assistant our 3D avatars now opens up five more of the platform's capabilities. scene-mcp turns one sentence into a placed 3D diorama plan — the world to go with your avatar's character. vanity-mcp exposes the Solana vanity-address bounty market and rarity gallery — price a pattern's difficulty, browse open bounties, read the grinder leaderboard, appraise any address. naming-mcp resolves .sol names both ways and checks whether a *.threews.sol agent identity is free to claim. intel-mcp hands an agent the market-intelligence rails: smart-money scores for a coin, a wallet's realized track record, verified signal feeds, KOL trades, and ranked copy-trade wallets. marketplace-mcp browses the agent marketplace and skills catalog. Every tool is a thin wrapper over the live public three.ws API — no key, no signer, no mock data — and ships with MCP safety annotations so clients know which calls are read-only. Add any of them in one line: `claude mcp add scene -- npx -y @three-ws/scene-mcp` (swap in vanity, naming, intel, or marketplace).</description>
+ </item>
<item>
<title>Fix: avatars look right in iOS AR, not collapsed and distorted</title>
<link>https://three.ws/changelog</link>
diff --git a/public/features.json b/public/features.json
index 99544c699..9bcf644ee 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-23T07:50:01.640Z",
+ "generated_at": "2026-06-23T08:03:05.260Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index 76b0a0e39..c3456ae94 100644
--- a/public/sitemap/index.html
+++ b/public/sitemap/index.html
@@ -56,25 +56,6 @@
.sm-brand img { width: 24px; height: 24px; border-radius: 5px; }
.sm-brand:hover { text-decoration: none; }
</style>
-
- <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
- <meta property="og:type" content="website">
- <meta property="og:site_name" content="three.ws">
- <meta property="og:locale" content="en_US">
- <meta property="og:title" content="Sitemap · three.ws">
- <meta property="og:description" content="Human-readable index of every page on three.ws.">
- <meta property="og:url" content="https://three.ws/sitemap">
- <meta property="og:image" content="https://three.ws/api/page-og?s=main&amp;t=Sitemap&amp;d=Human-readable+index+of+every+page+on+three.ws.&amp;p=%2Fsitemap">
- <meta property="og:image:width" content="1200">
- <meta property="og:image:height" content="630">
- <meta property="og:image:type" content="image/png">
- <meta property="og:image:alt" content="Sitemap — three.ws">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:site" content="@trythreews">
- <meta name="twitter:title" content="Sitemap · three.ws">
- <meta name="twitter:description" content="Human-readable index of every page on three.ws.">
- <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&amp;t=Sitemap&amp;d=Human-readable+index+of+every+page+on+three.ws.&amp;p=%2Fsitemap">
- <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Sitemap","description":"Human-readable index of every page on three.ws.","url":"https://three.ws/sitemap","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap"}]}</script>
</head>
<body>
<header class="sm-topbar">
diff --git a/src/agent-wallet-hub/tabs/snipe.js b/src/agent-wallet-hub/tabs/snipe.js
index 1141e4467..e4c0ddb16 100644
--- a/src/agent-wallet-hub/tabs/snipe.js
+++ b/src/agent-wallet-hub/tabs/snipe.js
@@ -1,28 +1,118 @@
/**
- * Agent Wallet hub — Snipe tab.
+ * Agent Wallet hub — Snipe tab: the conversational strategy builder.
*
- * Owner-only. Arming an autonomous strategy spends the agent's own funds, so the
- * full arming form + live positions/PnL stream live on the dedicated Sniper
- * dashboard (built by epic task 06, served at /dashboard/sniper, backed by
- * api/sniper/{strategy,stream,history,leaderboard}.js). The hub surfaces that
- * here as a real, reachable entry point — what the sniper does, the guardrails
- * it shares with discretionary trading, and a direct link into the dashboard —
- * rather than a dead placeholder.
+ * Owner-only. Describe a snipe strategy in plain English; an LLM compiles it to a
+ * validated agent_sniper_strategies config (every money/risk knob clamped to the
+ * agent's runtime trade guards), we render it as fully editable chips, then
+ * BACKTEST it against three.ws's own real captured history (pump_coin_intel ⋈
+ * pump_coin_outcomes) using the exact gates + exit logic the live worker runs — so
+ * the owner sees an honest projected win-rate, ROI distribution, and worst
+ * drawdown BEFORE risking a lamport. One tap arms it on the agent's own wallet.
+ *
+ * POST /api/sniper/compile → NL → validated strategy + rationale
+ * POST /api/sniper/backtest → strategy → honest metrics over real history
+ * POST /api/sniper/strategy → arm it (existing endpoint)
+ *
+ * Nothing is simulated: the backtest replays real labeled launches; thin history
+ * yields an explicit "insufficient data" verdict, never a flattering number.
*/
import { registerWalletTab } from '../registry.js';
+import { consumeCsrfToken } from '../../api.js';
+import { formatSol, shortAddress, explorerAddressUrl } from '../util.js';
+const LAMPORTS_PER_SOL = 1_000_000_000;
const STYLE_ID = 'awh-snipe-style';
+
const STYLE = `
-.awh-snipe { display: flex; flex-direction: column; gap: var(--space-3,12px); }
-.awh-snipe-icon { width: 38px; height: 38px; border-radius: var(--radius-md,10px); display: grid; place-items: center; background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); font-size: 18px; }
-.awh-snipe h2 { margin: 0; font-size: var(--text-lg,1.236rem); color: var(--ink-bright,#fff); font-family: var(--font-display, system-ui); }
-.awh-snipe p { margin: 0; color: var(--ink-dim,#888); font-size: var(--text-md,.8125rem); line-height: var(--leading-normal,1.618); max-width: 54ch; }
-.awh-snipe-points { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
-.awh-snipe-points li { display: flex; align-items: flex-start; gap: 9px; color: var(--ink, #c8c8c8); font-size: var(--text-md,.8125rem); line-height: 1.5; }
-.awh-snipe-points li::before { content: '◎'; color: var(--accent, #fff); flex: none; font-size: .85em; line-height: 1.7; opacity: .75; }
-.awh-snipe-cta { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; margin-top: 4px; }
-.awh-snipe-cta::after { content: '↗'; font-size: .9em; }
+.sb { display:flex; flex-direction:column; gap: var(--space-lg,18px); }
+.sb-card { background: var(--surface-1,rgba(255,255,255,.03)); border:1px solid var(--stroke,rgba(255,255,255,.08)); border-radius: var(--radius-lg,14px); padding: var(--space-lg,18px); }
+.sb-hero { background: linear-gradient(160deg, var(--wallet-accent-soft,rgba(139,92,246,.1)), var(--surface-1,rgba(255,255,255,.03))); border:1px solid var(--wallet-stroke,rgba(139,92,246,.3)); }
+.sb-card h2 { margin:0 0 4px; font-size: var(--text-lg,1.15rem); color: var(--ink-bright,#fff); font-family: var(--font-display, system-ui); }
+.sb-card h3 { margin:0 0 4px; font-size: var(--text-ui,.9rem); color: var(--ink-bright,#fff); font-weight:600; }
+.sb-card .sub { margin:0 0 var(--space-md,14px); font-size: var(--text-sm,.78rem); color: var(--ink-dim,#888); line-height:1.55; max-width: 60ch; }
+.sb-ta { width:100%; box-sizing:border-box; min-height:84px; resize:vertical; font:inherit; font-size: var(--text-md,.84rem); line-height:1.55; color: var(--ink,#e8e8e8); background: var(--surface-1,rgba(255,255,255,.03)); border:1px solid var(--stroke,rgba(255,255,255,.1)); border-radius: var(--radius-md,10px); padding:11px 13px; transition: border-color .14s; }
+.sb-ta:focus { outline:none; border-color: var(--wallet-stroke-strong,rgba(139,92,246,.5)); }
+.sb-egs { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
+.sb-eg { appearance:none; text-align:left; font:inherit; font-size: var(--text-2xs,.69rem); color: var(--ink-dim,#aaa); background: var(--surface-2,rgba(255,255,255,.05)); border:1px solid var(--stroke,rgba(255,255,255,.1)); border-radius: var(--radius-pill,999px); padding:4px 10px; cursor:pointer; transition: color .14s, border-color .14s; }
+.sb-eg:hover { color: var(--ink-bright,#fff); border-color: var(--wallet-stroke,rgba(139,92,246,.3)); }
+
+.sb-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top: var(--space-md,14px); align-items:center; }
+.sb-btn { appearance:none; font:inherit; font-size: var(--text-sm,.78rem); font-weight:600; cursor:pointer; border-radius: var(--radius-md,10px); padding:9px 16px; border:1px solid var(--stroke-strong,rgba(255,255,255,.14)); background: var(--surface-2,rgba(255,255,255,.06)); color: var(--ink,#e8e8e8); transition: background .14s, border-color .14s, transform .14s; }
+.sb-btn:hover { background: var(--surface-3,rgba(255,255,255,.09)); color: var(--ink-bright,#fff); }
+.sb-btn:active { transform: translateY(1px); }
+.sb-btn:disabled { opacity:.5; cursor:not-allowed; }
+.sb-btn:focus-visible { outline:2px solid var(--wallet-focus,rgba(139,92,246,.7)); outline-offset:2px; }
+.sb-btn.primary { background: var(--wallet-accent,#c4b5fd); border-color: var(--wallet-accent,#c4b5fd); color:#160d28; }
+.sb-btn.primary:hover { background: var(--wallet-accent-strong,#a78bfa); border-color: var(--wallet-accent-strong,#a78bfa); }
+.sb-btn.ghost { background:transparent; border-color: var(--stroke,rgba(255,255,255,.1)); }
+
+.sb-summary { font-size: var(--text-md,.84rem); color: var(--ink,#e8e8e8); line-height:1.55; }
+.sb-via { font-size: var(--text-2xs,.69rem); color: var(--ink-faint,rgba(255,255,255,.45)); margin-top:6px; }
+.sb-notes { margin:10px 0 0; padding:10px 12px; border-radius: var(--radius-md,10px); font-size: var(--text-sm,.76rem); line-height:1.5; }
+.sb-notes ul { margin:4px 0 0; padding-left:18px; } .sb-notes li { margin:2px 0; }
+.sb-notes.amber { background: color-mix(in srgb, var(--warn,#fbbf24) 10%, transparent); border:1px solid color-mix(in srgb, var(--warn,#fbbf24) 30%, transparent); color: var(--warn,#fbbf24); }
+.sb-notes.blue { background: color-mix(in srgb, var(--wallet-accent,#a78bfa) 9%, transparent); border:1px solid color-mix(in srgb, var(--wallet-accent,#a78bfa) 28%, transparent); color: var(--wallet-accent,#c4b5fd); }
+.sb-notes.red { background: color-mix(in srgb, var(--danger,#f87171) 10%, transparent); border:1px solid color-mix(in srgb, var(--danger,#f87171) 32%, transparent); color: var(--danger,#f87171); }
+
+.sb-fields { display:grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap:10px; margin-top: var(--space-md,14px); }
+.sb-fld { display:flex; flex-direction:column; gap:4px; }
+.sb-fld label { font-size: var(--text-2xs,.66rem); color: var(--ink-dim,#888); text-transform:uppercase; letter-spacing:.04em; }
+.sb-inwrap { position:relative; display:flex; align-items:center; }
+.sb-in { width:100%; box-sizing:border-box; font:inherit; font-size: var(--text-sm,.8rem); font-family: var(--font-mono,ui-monospace,monospace); color: var(--ink,#e8e8e8); background: var(--surface-1,rgba(255,255,255,.04)); border:1px solid var(--stroke,rgba(255,255,255,.1)); border-radius: var(--radius-sm,8px); padding:8px 10px; }
+.sb-in:focus { outline:none; border-color: var(--wallet-stroke-strong,rgba(139,92,246,.5)); }
+.sb-unit { position:absolute; right:9px; font-size: var(--text-2xs,.66rem); color: var(--ink-faint,rgba(255,255,255,.4)); pointer-events:none; }
+select.sb-in { appearance:none; cursor:pointer; }
+.sb-toggles { display:flex; flex-wrap:wrap; gap:14px; margin-top: var(--space-md,14px); }
+.sb-tog { display:flex; align-items:center; gap:7px; font-size: var(--text-sm,.78rem); color: var(--ink,#d8d8d8); cursor:pointer; }
+.sb-tog input { accent-color: var(--wallet-accent,#a78bfa); width:15px; height:15px; }
+.sb-stale { font-size: var(--text-2xs,.69rem); color: var(--warn,#fbbf24); }
+
+.sb-seg { display:inline-flex; gap:2px; background: var(--surface-2,rgba(255,255,255,.05)); border:1px solid var(--stroke,rgba(255,255,255,.1)); border-radius: var(--radius-pill,999px); padding:2px; }
+.sb-seg button { appearance:none; font:inherit; font-size: var(--text-2xs,.69rem); font-weight:600; color: var(--ink-dim,#999); background:transparent; border:0; border-radius: var(--radius-pill,999px); padding:5px 12px; cursor:pointer; }
+.sb-seg button.on { background: var(--wallet-accent,#c4b5fd); color:#160d28; }
+
+.sb-kpis { display:grid; grid-template-columns: repeat(auto-fit, minmax(108px,1fr)); gap:0; border:1px solid var(--stroke,rgba(255,255,255,.08)); border-radius: var(--radius-md,10px); overflow:hidden; margin-top: var(--space-md,14px); }
+.sb-kpi { padding:12px 13px; border-right:1px solid var(--stroke,rgba(255,255,255,.08)); border-bottom:1px solid var(--stroke,rgba(255,255,255,.08)); }
+.sb-kpi .l { font-size: var(--text-2xs,.63rem); color: var(--ink-faint,rgba(255,255,255,.45)); text-transform:uppercase; letter-spacing:.04em; display:block; margin-bottom:5px; }
+.sb-kpi .v { font-family: var(--font-mono,ui-monospace,monospace); font-size: var(--text-md,.95rem); font-weight:700; color: var(--ink-bright,#fff); }
+.sb-pos { color: var(--success,#4ade80); } .sb-neg { color: var(--danger,#f87171); } .sb-muted { color: var(--ink-dim,#888); }
+
+.sb-dist { margin-top: var(--space-md,14px); }
+.sb-dist-bar { position:relative; height:30px; border-radius: var(--radius-sm,8px); background: linear-gradient(90deg, color-mix(in srgb,var(--danger,#f87171) 22%,transparent), var(--surface-2,rgba(255,255,255,.05)) 50%, color-mix(in srgb,var(--success,#4ade80) 22%,transparent)); border:1px solid var(--stroke,rgba(255,255,255,.1)); overflow:hidden; }
+.sb-dist-zero { position:absolute; top:0; bottom:0; width:1px; background: var(--ink-faint,rgba(255,255,255,.4)); }
+.sb-dist-band { position:absolute; top:6px; bottom:6px; background: color-mix(in srgb,var(--wallet-accent,#a78bfa) 30%,transparent); border-radius:4px; }
+.sb-dist-med { position:absolute; top:2px; bottom:2px; width:2px; background: var(--wallet-accent,#c4b5fd); }
+.sb-dist-legend { display:flex; justify-content:space-between; font-size: var(--text-2xs,.66rem); color: var(--ink-faint,rgba(255,255,255,.45)); margin-top:5px; font-family: var(--font-mono,ui-monospace,monospace); gap:6px; flex-wrap:wrap; }
+.sb-splits { display:flex; height:10px; border-radius:999px; overflow:hidden; margin-top:10px; border:1px solid var(--stroke,rgba(255,255,255,.1)); }
+.sb-splits i { display:block; height:100%; }
+.sb-splits-legend { display:flex; flex-wrap:wrap; gap:10px; margin-top:7px; font-size: var(--text-2xs,.66rem); color: var(--ink-dim,#999); }
+.sb-splits-legend span { display:inline-flex; align-items:center; gap:5px; }
+.sb-dot { width:8px; height:8px; border-radius:2px; display:inline-block; }
+
+.sb-trades { margin-top: var(--space-md,14px); }
+.sb-trades h4 { margin:0 0 7px; font-size: var(--text-2xs,.69rem); text-transform:uppercase; letter-spacing:.04em; color: var(--ink-faint,rgba(255,255,255,.45)); }
+.sb-trade { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border-radius: var(--radius-sm,8px); background: var(--surface-1,rgba(255,255,255,.03)); border:1px solid var(--stroke,rgba(255,255,255,.07)); margin-bottom:6px; }
+.sb-trade .who { display:flex; flex-direction:column; gap:2px; min-width:0; }
+.sb-trade .sym { font-size: var(--text-sm,.78rem); color: var(--ink-bright,#fff); }
+.sb-trade .mint a { font-size: var(--text-2xs,.66rem); color: var(--ink-dim,#888); text-decoration:none; font-family: var(--font-mono,ui-monospace,monospace); }
+.sb-trade .mint a:hover { color: var(--wallet-accent,#c4b5fd); }
+.sb-trade .res { text-align:right; font-family: var(--font-mono,ui-monospace,monospace); font-size: var(--text-sm,.8rem); font-weight:700; flex:none; }
+.sb-trade .res small { display:block; font-weight:400; font-size: var(--text-2xs,.63rem); color: var(--ink-faint,rgba(255,255,255,.45)); text-transform:capitalize; }
+
+.sb-caveats { margin-top: var(--space-md,14px); font-size: var(--text-2xs,.7rem); color: var(--ink-faint,rgba(255,255,255,.5)); line-height:1.55; }
+.sb-caveats ul { margin:5px 0 0; padding-left:16px; } .sb-caveats li { margin:2px 0; }
+.sb-conf { display:inline-flex; align-items:center; gap:5px; font-size: var(--text-2xs,.66rem); font-weight:600; text-transform:uppercase; letter-spacing:.04em; padding:3px 9px; border-radius:999px; border:1px solid currentColor; }
+.sb-conf.high { color: var(--success,#4ade80); } .sb-conf.medium { color: var(--warn,#fbbf24); } .sb-conf.low { color: var(--ink-dim,#888); }
+
+.sb-skel { height:14px; border-radius:6px; background: var(--surface-2,rgba(255,255,255,.05)); animation: sb-sk 1.4s ease-in-out infinite; margin:9px 0; }
+.sb-spin { display:inline-block; width:13px; height:13px; border:2px solid rgba(0,0,0,.25); border-top-color: currentColor; border-radius:50%; animation: sb-rot .7s linear infinite; vertical-align:-2px; margin-right:6px; }
+.sb-err { background: color-mix(in srgb, var(--danger,#f87171) 12%, transparent); border:1px solid color-mix(in srgb, var(--danger,#f87171) 32%, transparent); color: var(--danger,#f87171); border-radius: var(--radius-md,10px); padding:10px 12px; font-size: var(--text-sm,.78rem); }
+.sb-dash { display:inline-flex; align-items:center; gap:6px; text-decoration:none; color: var(--ink-dim,#999); font-size: var(--text-2xs,.69rem); }
+.sb-dash:hover { color: var(--ink-bright,#fff); } .sb-dash::after { content:'↗'; }
+@keyframes sb-rot { to { transform: rotate(360deg); } }
+@keyframes sb-sk { 0%,100%{opacity:.4} 50%{opacity:.8} }
+@media (prefers-reduced-motion: reduce) { .sb-skel, .sb-spin { animation:none; } }
`;
function injectStyle() {
@@ -33,6 +123,85 @@ function injectStyle() {
document.head.appendChild(tag);
}
+const EXAMPLES = [
+ "Snipe creators who've graduated at least two coins, market cap under $30k, organic distribution. Take profit at 3x, stop loss 40%, 30% trailing stop, max 0.3 SOL per trade.",
+ 'Intel-confirmed only: quality 60+, bundle score under 0.3, top holder under 25%. 0.1 SOL each, 1 SOL/day, take profit 2x, stop loss 35%.',
+ 'Snipe brand-new launches with socials, max cap $25k. 0.2 SOL per snipe, stop loss 30%, trailing 25%, exit after 30 minutes.',
+];
+
+// ── fetch helper: never throws, always a designed result ──────────────────────
+async function call(url, { method = 'GET', body = null } = {}) {
+ try {
+ const opts = { method, credentials: 'include', headers: {} };
+ if (body != null) { opts.headers['content-type'] = 'application/json'; opts.body = JSON.stringify(body); }
+ if (method !== 'GET') {
+ const token = await consumeCsrfToken();
+ if (token) opts.headers['x-csrf-token'] = token;
+ }
+ const r = await fetch(url, opts);
+ let j = null;
+ try { j = await r.json(); } catch { /* empty */ }
+ if (!r.ok) return { ok: false, status: r.status, code: j?.error || 'error', message: j?.error_description || `request failed (${r.status})` };
+ return { ok: true, status: r.status, data: j };
+ } catch (err) {
+ return { ok: false, status: 0, code: 'network_error', message: err?.message || 'network error' };
+ }
+}
+
+function esc(s) {
+ return String(s ?? '').replace(/[<>&"]/g, (c) => ({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' }[c]));
+}
+const lamToSol = (l) => Number(BigInt(l || '0')) / LAMPORTS_PER_SOL;
+const fmtPctNum = (v, signed = false) => (v == null ? '—' : `${signed && v > 0 ? '+' : ''}${Number(v).toFixed(Number(v) % 1 === 0 ? 0 : 1)}%`);
+
+// Editable field spec. Type drives the UI<->API value conversion.
+const FIELDS = [
+ { key: 'trigger', label: 'Trigger', type: 'select', opts: [['new_mint', 'New launch'], ['intel_confirmed', 'Intel-confirmed']] },
+ { key: 'per_trade_lamports', label: 'Per trade', unit: 'SOL', type: 'sol' },
+ { key: 'daily_budget_lamports', label: 'Daily budget', unit: 'SOL', type: 'sol' },
+ { key: 'max_concurrent_positions', label: 'Max concurrent', type: 'int' },
+ { key: 'slippage_bps', label: 'Slippage', unit: '%', type: 'slip' },
+ { key: 'max_price_impact_pct', label: 'Max impact', unit: '%', type: 'num' },
+ { key: 'min_market_cap_usd', label: 'Min mcap', unit: '$', type: 'num', nullable: true },
+ { key: 'max_market_cap_usd', label: 'Max mcap', unit: '$', type: 'num', nullable: true },
+ { key: 'min_creator_graduated', label: 'Creator grad ≥', type: 'int', nullable: true },
+ { key: 'max_creator_launches', label: 'Creator launches ≤', type: 'int', nullable: true },
+ { key: 'take_profit_pct', label: 'Take profit', unit: '%', type: 'num', nullable: true },
+ { key: 'stop_loss_pct', label: 'Stop loss', unit: '%', type: 'num' },
+ { key: 'trailing_stop_pct', label: 'Trailing stop', unit: '%', type: 'num', nullable: true },
+ { key: 'max_hold_seconds', label: 'Max hold', unit: 'min', type: 'min' },
+ { key: 'min_quality_score', label: 'Min quality', type: 'num', nullable: true, intel: true },
+ { key: 'max_bundle_score', label: 'Max bundle', type: 'num', step: '0.05', nullable: true, intel: true },
+ { key: 'max_concentration_top1', label: 'Max top-holder', unit: '%', type: 'num', nullable: true, intel: true },
+];
+
+function fieldDisplay(s, f) {
+ const v = s[f.key];
+ if (f.type === 'sol') return v == null ? '' : String(+lamToSol(v).toFixed(4));
+ if (f.type === 'slip') return v == null ? '' : String(+(v / 100).toFixed(2));
+ if (f.type === 'min') return v == null ? '' : String(Math.round(v / 60));
+ return v == null ? '' : String(v);
+}
+
+function applyField(s, f, raw) {
+ if (f.type === 'select') { s[f.key] = raw; return; }
+ const txt = String(raw).trim();
+ if (txt === '') {
+ // Mandatory fields snap back to a safe value rather than going null/unsafe.
+ if (f.key === 'stop_loss_pct') { s[f.key] = 35; return; }
+ if (f.type === 'sol') { s[f.key] = '0'; return; }
+ if (!f.nullable) return;
+ s[f.key] = null; return;
+ }
+ const num = Number(txt);
+ if (!Number.isFinite(num) || num < 0) return;
+ if (f.type === 'sol') s[f.key] = String(Math.round(num * LAMPORTS_PER_SOL));
+ else if (f.type === 'slip') s[f.key] = Math.round(num * 100);
+ else if (f.type === 'min') s[f.key] = Math.round(num * 60);
+ else if (f.type === 'int') s[f.key] = Math.round(num);
+ else s[f.key] = num;
+}
+
registerWalletTab({
id: 'snipe',
label: 'Snipe',
@@ -40,36 +209,266 @@ registerWalletTab({
ownerOnly: true,
mount({ panel, ctx }) {
injectStyle();
- const { escapeHtml, agentId } = ctx;
- // The dashboard lists the owner's strategies (this agent's among them); the
- // hash hint keeps the origin traceable without depending on a query param.
+ const { agentId } = ctx;
const dashUrl = `/dashboard/sniper#agent=${encodeURIComponent(agentId)}`;
- panel.innerHTML = `
- <div class="awh-card">
- <div class="awh-snipe">
- <div class="awh-snipe-icon" aria-hidden="true">◎</div>
- <h2>Arm an autonomous strategy</h2>
- <p>
- Set a budget, entry filters, and exit rules, then let this agent snipe
- brand-new pump.fun launches on its own — from its own funded wallet,
- under the same per-trade caps, daily budget, and price-impact breaker
- that govern discretionary trades.
- </p>
- <ul class="awh-snipe-points">
- <li>Budget &amp; sizing: daily cap, per-trade cap, max concurrent positions.</li>
- <li>Entry filters: market cap, creator history, socials, SOL-quote only.</li>
- <li>Exits: take-profit, stop-loss, trailing stop, max hold — auto-executed.</li>
- <li>Live positions &amp; realized PnL stream as trades fill — with one-tap manual sell on any open position.</li>
- </ul>
- <a class="awh-btn awh-btn--primary awh-snipe-cta" href="${escapeHtml(dashUrl)}">
- Open the Sniper dashboard
- </a>
- <a class="awh-btn awh-snipe-cta" href="/terminal" style="margin-top:6px">
- Trade live in Mission Control
- </a>
+
+ let destroyed = false;
+ const state = {
+ source: '',
+ compiling: false,
+ compiled: null, // { via, strategy, summary, assumptions, clamped, warnings }
+ compileError: null,
+ window: 30,
+ backtesting: false,
+ backtest: null,
+ backtestError: null,
+ backtestStale: false,
+ arming: false,
+ };
+
+ // ── renderers ──────────────────────────────────────────────────────────
+ function render() {
+ if (destroyed) return;
+ panel.innerHTML = `<div class="sb">${renderComposer()}${state.compiled ? renderReview() : ''}</div>`;
+ wire();
+ }
+
+ function renderComposer() {
+ const busy = state.compiling;
+ return `<div class="sb-card sb-hero">
+ <h2>Describe a snipe strategy</h2>
+ <p class="sub">Write it in plain English. We compile it into a validated config — clamped to this agent's spend guards — then backtest it against three.ws's own real launch history before you risk a lamport.</p>
+ <textarea class="sb-ta" id="sb-src" placeholder="${esc(EXAMPLES[0])}" ${busy ? 'disabled' : ''}>${esc(state.source)}</textarea>
+ <div class="sb-egs">${EXAMPLES.map((e, i) => `<button class="sb-eg" data-eg="${i}">${esc(e.length > 60 ? e.slice(0, 58) + '…' : e)}</button>`).join('')}</div>
+ <div class="sb-actions">
+ <button class="sb-btn primary" id="sb-compile" ${busy ? 'disabled' : ''}>${busy ? '<span class="sb-spin"></span>Compiling…' : (state.compiled ? 'Re-compile' : 'Compile strategy')}</button>
+ <a class="sb-dash" href="${esc(dashUrl)}">Open the Sniper dashboard</a>
</div>
- </div>
- `;
- return {};
+ ${state.compileError ? `<div class="sb-err" style="margin-top:12px">${esc(state.compileError)} <button class="sb-btn ghost" id="sb-retry-c" style="margin-left:8px;padding:4px 10px">Retry</button></div>` : ''}
+ </div>`;
+ }
+
+ function renderReview() {
+ const c = state.compiled;
+ const s = c.strategy;
+ const intel = s.trigger === 'intel_confirmed';
+ const fields = FIELDS.filter((f) => !f.intel || intel).map((f) => renderField(s, f)).join('');
+
+ const toggles = `
+ <div class="sb-toggles">
+ ${tog('require_socials', 'Require socials', s.require_socials)}
+ ${tog('require_sol_quote', 'SOL-quote only', s.require_sol_quote)}
+ ${intel ? tog('avoid_dev_dump', 'Avoid dev dump', s.avoid_dev_dump) : ''}
+ </div>`;
+
+ const notes = [
+ c.clamped?.length ? noteBlock('blue', 'Clamped to your safety limits', c.clamped) : '',
+ c.assumptions?.length ? noteBlock('amber', 'Assumptions', c.assumptions) : '',
+ c.warnings?.length ? noteBlock('red', 'Before you arm', c.warnings) : '',
+ ].join('');
+
+ const canArm = BigInt(s.per_trade_lamports || '0') > 0n && BigInt(s.daily_budget_lamports || '0') > 0n && Number(s.stop_loss_pct) > 0;
+
+ return `<div class="sb-card">
+ <h3>Compiled strategy</h3>
+ <div class="sb-summary">${esc(c.summary)}</div>
+ <div class="sb-via">Compiled ${c.via === 'model' ? 'by the model' : 'from your wording'} · every field below is editable — adjust and re-backtest.</div>
+ ${notes}
+ <div class="sb-fields">${fields}</div>
+ ${toggles}
+ <div class="sb-actions">
+ <div class="sb-seg" role="group" aria-label="Backtest window">
+ ${[7, 30, 90].map((w) => `<button data-win="${w}" class="${w === state.window ? 'on' : ''}">${w}d</button>`).join('')}
+ </div>
+ <button class="sb-btn primary" id="sb-bt" ${state.backtesting ? 'disabled' : ''}>${state.backtesting ? '<span class="sb-spin"></span>Backtesting…' : 'Run backtest'}</button>
+ ${state.backtestStale ? '<span class="sb-stale">edited — re-run the backtest</span>' : ''}
+ </div>
+ ${renderBacktest()}
+ <div class="sb-actions" style="border-top:1px solid var(--stroke,rgba(255,255,255,.08));padding-top:14px;margin-top:18px">
+ <button class="sb-btn primary" id="sb-arm" ${canArm && !state.arming ? '' : 'disabled'}>${state.arming ? '<span class="sb-spin"></span>Arming…' : 'Arm this strategy →'}</button>
+ <span class="sb-via" style="margin:0">Arms on this agent's own funded wallet, under its spend guards. Disarm any time from the dashboard.</span>
+ </div>
+ </div>`;
+ }
+
+ function renderField(s, f) {
+ if (f.type === 'select') {
+ const opts = f.opts.map(([v, l]) => `<option value="${v}" ${s[f.key] === v ? 'selected' : ''}>${esc(l)}</option>`).join('');
+ return `<div class="sb-fld"><label for="f-${f.key}">${esc(f.label)}</label><div class="sb-inwrap"><select class="sb-in" id="f-${f.key}" data-field="${f.key}">${opts}</select></div></div>`;
+ }
+ const val = fieldDisplay(s, f);
+ const step = f.step || (f.type === 'sol' ? '0.01' : f.type === 'int' || f.type === 'min' ? '1' : 'any');
+ const ph = f.nullable ? 'any' : '';
+ return `<div class="sb-fld"><label for="f-${f.key}">${esc(f.label)}</label>
+ <div class="sb-inwrap">
+ <input class="sb-in" id="f-${f.key}" data-field="${f.key}" type="number" inputmode="decimal" min="0" step="${step}" value="${esc(val)}" placeholder="${ph}" />
+ ${f.unit ? `<span class="sb-unit">${esc(f.unit)}</span>` : ''}
+ </div></div>`;
+ }
+
+ function tog(key, label, on) {
+ return `<label class="sb-tog"><input type="checkbox" data-tog="${key}" ${on ? 'checked' : ''}/> ${esc(label)}</label>`;
+ }
+ function noteBlock(tone, title, items) {
+ return `<div class="sb-notes ${tone}"><strong>${esc(title)}</strong><ul>${items.map((i) => `<li>${esc(i)}</li>`).join('')}</ul></div>`;
+ }
+
+ function renderBacktest() {
+ if (state.backtesting) {
+ return `<div class="sb-card" style="margin-top:14px;background:var(--surface-1,rgba(255,255,255,.02))"><div class="sb-skel" style="width:40%"></div><div class="sb-skel"></div><div class="sb-skel" style="width:70%"></div></div>`;
+ }
+ if (state.backtestError) {
+ return `<div class="sb-err" style="margin-top:14px">${esc(state.backtestError)} <button class="sb-btn ghost" id="sb-bt-retry" style="margin-left:8px;padding:4px 10px">Retry</button></div>`;
+ }
+ const b = state.backtest;
+ if (!b) return '';
+ if (b.insufficient_data) {
+ return `<div class="sb-notes amber" style="margin-top:14px"><strong>Insufficient history</strong><div style="margin-top:4px">${esc(b.message)}</div></div>`;
+ }
+ const m = b.metrics;
+ const conf = b.caveats?.confidence || 'low';
+ const od = m.outcome_distribution || {};
+ const total = (od.graduated || 0) + (od.pumped || 0) + (od.flat || 0) + (od.rugged || 0);
+ const pctOf = (x) => (total ? (x / total) * 100 : 0);
+
+ // ROI distribution band (p10 → p90, median marker) mapped onto worst..best.
+ const lo = Math.min(m.roi_worst_pct, 0), hi = Math.max(m.roi_best_pct, 0);
+ const span = hi - lo || 1;
+ const pos = (v) => `${Math.max(0, Math.min(100, ((v - lo) / span) * 100))}%`;
+
+ const trade = (t) => `<div class="sb-trade">
+ <div class="who"><span class="sym">${esc(t.symbol || t.name || 'coin')}</span>
+ <span class="mint"><a href="${esc(explorerAddressUrl(t.mint, b.network))}" target="_blank" rel="noopener">${esc(shortAddress(t.mint, 4, 4))} ↗</a></span></div>
+ <div class="res ${t.roi_pct >= 0 ? 'sb-pos' : 'sb-neg'}">${fmtPctNum(t.roi_pct, true)}<small>${esc((t.exit_reason || '').replace('_', ' '))} · ${esc(t.outcome)} · ${t.ath_multiple}×</small></div>
+ </div>`;
+
+ return `<div class="sb-card" style="margin-top:14px;background:var(--surface-1,rgba(255,255,255,.02))">
+ <div style="display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap">
+ <h4 style="margin:0;font-size:var(--text-2xs,.69rem);text-transform:uppercase;letter-spacing:.04em;color:var(--ink-faint,rgba(255,255,255,.45))">Projected over ${b.sample_size} real launches · last ${b.window_days}d${b.cached ? ' · cached' : ''}</h4>
+ <span class="sb-conf ${esc(conf)}">${esc(conf)} confidence</span>
+ </div>
+ <div class="sb-kpis">
+ <div class="sb-kpi"><span class="l">Win rate</span><span class="v">${(m.win_rate * 100).toFixed(0)}%</span></div>
+ <div class="sb-kpi"><span class="l">EV / trade</span><span class="v ${m.expected_value_pct >= 0 ? 'sb-pos' : 'sb-neg'}">${fmtPctNum(m.expected_value_pct, true)}</span></div>
+ <div class="sb-kpi"><span class="l">Median ROI</span><span class="v ${m.roi_median_pct >= 0 ? 'sb-pos' : 'sb-neg'}">${fmtPctNum(m.roi_median_pct, true)}</span></div>
+ <div class="sb-kpi"><span class="l">Max drawdown</span><span class="v ${m.max_drawdown_pct > 0 ? 'sb-neg' : 'sb-muted'}">${m.max_drawdown_pct > 0 ? '−' : ''}${m.max_drawdown_pct.toFixed(1)}%</span></div>
+ <div class="sb-kpi"><span class="l">Net P&L</span><span class="v ${m.net_pnl_sol >= 0 ? 'sb-pos' : 'sb-neg'}">${formatSol(m.net_pnl_sol)} SOL</span></div>
+ <div class="sb-kpi"><span class="l">Trades</span><span class="v">${m.entries}<span style="font-size:.7em;color:var(--ink-faint)"> · ${m.wins}W ${m.losses}L</span></span></div>
+ </div>
+
+ <div class="sb-dist">
+ <div class="sb-dist-bar">
+ <div class="sb-dist-band" style="left:${pos(m.roi_p10_pct)};right:calc(100% - ${pos(m.roi_p90_pct)})"></div>
+ <div class="sb-dist-med" style="left:${pos(m.roi_median_pct)}"></div>
+ <div class="sb-dist-zero" style="left:${pos(0)}"></div>
+ </div>
+ <div class="sb-dist-legend"><span>worst ${fmtPctNum(m.roi_worst_pct, true)}</span><span>p10 ${fmtPctNum(m.roi_p10_pct, true)} · med ${fmtPctNum(m.roi_median_pct, true)} · p90 ${fmtPctNum(m.roi_p90_pct, true)}</span><span>best ${fmtPctNum(m.roi_best_pct, true)}</span></div>
+ </div>
+
+ ${total ? `<div style="margin-top:14px">
+ <div class="sb-splits">
+ <i style="background:#4ade80;width:${pctOf(od.graduated)}%"></i><i style="background:#34d399;width:${pctOf(od.pumped)}%"></i><i style="background:#888;width:${pctOf(od.flat)}%"></i><i style="background:#f87171;width:${pctOf(od.rugged)}%"></i>
+ </div>
+ <div class="sb-splits-legend">
+ <span><i class="sb-dot" style="background:#4ade80"></i>${od.graduated || 0} graduated</span>
+ <span><i class="sb-dot" style="background:#34d399"></i>${od.pumped || 0} pumped</span>
+ <span><i class="sb-dot" style="background:#888"></i>${od.flat || 0} flat</span>
+ <span><i class="sb-dot" style="background:#f87171"></i>${od.rugged || 0} rugged</span>
+ </div>
+ </div>` : ''}
+
+ ${(b.sample_hits?.length || b.sample_misses?.length) ? `<div class="sb-trades">
+ ${b.sample_hits?.length ? `<h4>Best simulated entries</h4>${b.sample_hits.map(trade).join('')}` : ''}
+ ${b.sample_misses?.length ? `<h4 style="margin-top:10px">Worst simulated entries</h4>${b.sample_misses.map(trade).join('')}` : ''}
+ </div>` : ''}
+
+ <div class="sb-caveats">${b.stake_assumed ? `Modeled at a ${b.stake_sol} SOL notional stake (set a per-trade size to model your real size). ` : `Modeled at ${b.stake_sol} SOL per trade. `}
+ <ul>${(b.caveats?.items || []).map((c) => `<li>${esc(c)}</li>`).join('')}</ul>
+ </div>
+ </div>`;
+ }
+
+ // ── wiring ─────────────────────────────────────────────────────────────
+ function wire() {
+ panel.querySelector('#sb-src')?.addEventListener('input', (e) => { state.source = e.target.value; });
+ panel.querySelectorAll('[data-eg]').forEach((b) => b.addEventListener('click', () => {
+ const ta = panel.querySelector('#sb-src');
+ if (ta) { ta.value = EXAMPLES[Number(b.dataset.eg)] || ''; state.source = ta.value; ta.focus(); }
+ }));
+ panel.querySelector('#sb-compile')?.addEventListener('click', onCompile);
+ panel.querySelector('#sb-retry-c')?.addEventListener('click', onCompile);
+
+ panel.querySelectorAll('[data-field]').forEach((el) => el.addEventListener('change', () => {
+ const f = FIELDS.find((x) => x.key === el.dataset.field);
+ if (!f || !state.compiled) return;
+ applyField(state.compiled.strategy, f, el.value);
+ invalidateBacktest();
+ render(); // reflect normalization (trigger toggles intel fields, snapbacks)
+ }));
+ panel.querySelectorAll('[data-tog]').forEach((el) => el.addEventListener('change', () => {
+ if (state.compiled) state.compiled.strategy[el.dataset.tog] = el.checked;
+ invalidateBacktest();
+ }));
+ panel.querySelectorAll('[data-win]').forEach((b) => b.addEventListener('click', () => {
+ const w = Number(b.dataset.win);
+ if (w !== state.window) { state.window = w; invalidateBacktest(); render(); }
+ }));
+ panel.querySelector('#sb-bt')?.addEventListener('click', onBacktest);
+ panel.querySelector('#sb-bt-retry')?.addEventListener('click', onBacktest);
+ panel.querySelector('#sb-arm')?.addEventListener('click', onArm);
+ }
+
+ function invalidateBacktest() {
+ if (state.backtest || state.backtestError) { state.backtest = null; state.backtestError = null; }
+ state.backtestStale = true;
+ }
+
+ async function onCompile() {
+ const text = (panel.querySelector('#sb-src')?.value || '').trim();
+ if (text.length < 3) { ctx.toast('Describe your strategy first.'); return; }
+ state.compiling = true; state.compileError = null; state.source = text; render();
+ const res = await call('/api/sniper/compile', { method: 'POST', body: { agent_id: agentId, network: ctx.getNetwork(), text } });
+ if (destroyed) return;
+ state.compiling = false;
+ if (!res.ok) { state.compileError = res.message || 'Could not compile — try again.'; render(); return; }
+ state.compiled = res.data;
+ state.backtest = null; state.backtestError = null; state.backtestStale = false;
+ render();
+ }
+
+ async function onBacktest() {
+ if (!state.compiled) return;
+ state.backtesting = true; state.backtestError = null; render();
+ const res = await call('/api/sniper/backtest', {
+ method: 'POST',
+ body: { agent_id: agentId, network: ctx.getNetwork(), window_days: state.window, strategy: state.compiled.strategy },
+ });
+ if (destroyed) return;
+ state.backtesting = false; state.backtestStale = false;
+ if (!res.ok) { state.backtestError = res.message || 'Backtest failed — try again.'; render(); return; }
+ state.backtest = res.data;
+ render();
+ }
+
+ async function onArm() {
+ const s = state.compiled?.strategy;
+ if (!s) return;
+ if (!(BigInt(s.per_trade_lamports || '0') > 0n) || !(BigInt(s.daily_budget_lamports || '0') > 0n)) {
+ ctx.toast('Set a per-trade size and a daily budget first.'); return;
+ }
+ state.arming = true; render();
+ const res = await call('/api/sniper/strategy', {
+ method: 'POST',
+ body: { ...s, agent_id: agentId, network: ctx.getNetwork(), enabled: true, kill_switch: false },
+ });
+ if (destroyed) return;
+ state.arming = false;
+ if (!res.ok) { ctx.toast(res.message || 'Could not arm the strategy.'); render(); return; }
+ ctx.toast('Armed — this agent is now sniping on its own wallet.');
+ render();
+ }
+
+ render();
+ return { destroy() { destroyed = true; } };
},
});
diff --git a/tests/strategy-compiler-backtest.test.js b/tests/strategy-compiler-backtest.test.js
new file mode 100644
index 000000000..988d4923b
--- /dev/null
+++ b/tests/strategy-compiler-backtest.test.js
@@ -0,0 +1,158 @@
+/**
+ * NL strategy compiler + historical backtester — pure logic tests.
+ *
+ * Money-adjacent: the compiler produces the leash on an autonomous trader and the
+ * backtester is the honesty layer holders trust before risking funds, so the
+ * invariants that keep them safe and faithful are pinned here:
+ * - a compiled strategy can NEVER emit an unsafe config (stop-loss mandatory,
+ * every knob clamped to the agent's runtime trade guards),
+ * - the backtest exit math matches the live decideExit priority exactly,
+ * - the cache hash is stable over the trade-determining fields only.
+ *
+ * These run without a model (the compiler degrades to its deterministic parser)
+ * and without a DB (simulateTrade / strategyHash / decideExit are all pure).
+ */
+
+import { describe, it, expect } from 'vitest';
+import { compileStrategyFromText } from '../api/_lib/strategy-compiler.js';
+import { simulateTrade, strategyHash } from '../api/_lib/strategy-backtest.js';
+import { decideExit } from '../workers/agent-sniper/exit-logic.js';
+
+const LAMPORTS_PER_SOL = 1_000_000_000;
+
+describe('compileStrategyFromText — safety invariants', () => {
+ it('compiles the canonical example into a valid, bounded strategy', async () => {
+ const r = await compileStrategyFromText(
+ "Snipe creators who've graduated at least two coins, market cap under $30k, organic distribution. Take profit at 3x, stop loss 40%, 30% trailing stop, max 0.3 SOL per trade.",
+ );
+ expect(r.ok).toBe(true);
+ const s = r.strategy;
+ // stop-loss is mandatory and must be > 0, always.
+ expect(Number(s.stop_loss_pct)).toBeGreaterThan(0);
+ // "3x" → +200% take profit.
+ expect(s.take_profit_pct).toBe(200);
+ expect(s.stop_loss_pct).toBe(40);
+ expect(s.trailing_stop_pct).toBe(30);
+ expect(Number(BigInt(s.per_trade_lamports))).toBe(0.3 * LAMPORTS_PER_SOL);
+ // "graduated at least two" → min_creator_graduated 2.
+ expect(s.min_creator_graduated).toBe(2);
+ // "$30k" cap.
+ expect(s.max_market_cap_usd).toBe(30000);
+ // "organic" pulls in the intel read.
+ expect(s.trigger).toBe('intel_confirmed');
+ expect(s.max_bundle_score).toBeLessThanOrEqual(0.3);
+ });
+
+ it('defaults a mandatory stop-loss when the user omits one', async () => {
+ const r = await compileStrategyFromText('snipe new launches, 0.1 sol each, take profit 2x');
+ expect(r.ok).toBe(true);
+ expect(Number(r.strategy.stop_loss_pct)).toBeGreaterThan(0);
+ expect(r.assumptions.join(' ').toLowerCase()).toContain('stop-loss');
+ });
+
+ it('clamps money + risk knobs to the agent runtime trade guards', async () => {
+ const tradeLimits = { per_trade_sol: 0.05, daily_budget_sol: 0.2, max_slippage_bps: 300, max_price_impact_pct: 8, max_concurrent: 2 };
+ const r = await compileStrategyFromText(
+ 'snipe with 5 sol per trade, 50 sol a day, 30% slippage, 50% max impact, 20 concurrent, stop loss 30%',
+ { tradeLimits },
+ );
+ expect(r.ok).toBe(true);
+ const s = r.strategy;
+ expect(Number(BigInt(s.per_trade_lamports)) / LAMPORTS_PER_SOL).toBeLessThanOrEqual(0.05);
+ expect(Number(BigInt(s.daily_budget_lamports)) / LAMPORTS_PER_SOL).toBeLessThanOrEqual(0.2);
+ expect(s.slippage_bps).toBeLessThanOrEqual(300);
+ expect(s.max_price_impact_pct).toBeLessThanOrEqual(8);
+ expect(s.max_concurrent_positions).toBeLessThanOrEqual(2);
+ expect(r.clamped.length).toBeGreaterThan(0);
+ });
+
+ it('rejects an empty description rather than emitting a config', async () => {
+ const r = await compileStrategyFromText(' ');
+ expect(r.ok).toBe(false);
+ expect(r.error).toBe('empty');
+ });
+
+ it('keeps per-trade ≤ daily budget', async () => {
+ const r = await compileStrategyFromText('1 sol per trade, stop loss 30%');
+ expect(r.ok).toBe(true);
+ const per = Number(BigInt(r.strategy.per_trade_lamports));
+ const day = Number(BigInt(r.strategy.daily_budget_lamports));
+ expect(per).toBeLessThanOrEqual(day);
+ });
+});
+
+describe('simulateTrade — exits match live decideExit priority', () => {
+ const base = { slippage_bps: 0, stop_loss_pct: 40, take_profit_pct: 200, trailing_stop_pct: 30 };
+
+ it('takes profit when the peak crosses the TP threshold', () => {
+ // peak 4x ≥ 1 + 200% = 3x → TP fires at exactly +200%.
+ const r = simulateTrade(base, 4, 0.1, 0);
+ expect(r.exitReason).toBe('take_profit');
+ expect(r.roiPct).toBeCloseTo(200, 5);
+ });
+
+ it('stops out at the stop-loss level when terminal is below it', () => {
+ // peak 1.5x (below 3x TP), terminal 0 (rugged) → stop-loss at −40%.
+ const r = simulateTrade(base, 1.5, 0, 0);
+ expect(r.exitReason).toBe('stop_loss');
+ expect(r.roiPct).toBeCloseTo(-40, 5);
+ });
+
+ it('trails the stop from the peak when terminal sits between SL and the trail', () => {
+ // peak 2x; trailing 30% off peak = 1.4x; SL 40% = 0.6x; terminal 1.3x is
+ // below the trail (1.4x) but above the SL (0.6x) → trailing stop at 1.4x.
+ const r = simulateTrade({ ...base, take_profit_pct: 500 }, 2, 1.3, 0);
+ expect(r.exitReason).toBe('trailing_stop');
+ expect(r.roiPct).toBeCloseTo(40, 5); // 2 * (1 - 0.3) - 1 = 0.4
+ });
+
+ it('holds to the terminal price (timeout) when no exit triggers', () => {
+ // No TP/SL/trailing reached: peak 1.2x, terminal 1.1x.
+ const r = simulateTrade({ stop_loss_pct: 90, take_profit_pct: 500, trailing_stop_pct: null, slippage_bps: 0 }, 1.2, 1.1, 0);
+ expect(r.exitReason).toBe('timeout');
+ expect(r.roiPct).toBeCloseTo(10, 5);
+ });
+
+ it('drags ROI down with slippage and price impact', () => {
+ const clean = simulateTrade(base, 4, 0.1, 0);
+ const costly = simulateTrade({ ...base, slippage_bps: 500 }, 4, 0.1, 20);
+ expect(costly.roiPct).toBeLessThan(clean.roiPct);
+ });
+
+ it('agrees with decideExit on the take-profit boundary', () => {
+ const pos = { entry_quote_lamports: '1000000000', stop_loss_pct: 40, take_profit_pct: 200, trailing_stop_pct: 30, max_hold_seconds: null };
+ const ev = 1e9;
+ // At exactly 3x the entry value, decideExit must call take_profit.
+ expect(decideExit(pos, 3 * ev, 3 * ev)).toBe('take_profit');
+ // Just below, it must not.
+ expect(decideExit(pos, 2.99 * ev, 2.99 * ev)).not.toBe('take_profit');
+ });
+});
+
+describe('strategyHash — stable over trade-determining fields only', () => {
+ const s = {
+ trigger: 'new_mint', per_trade_lamports: '300000000', slippage_bps: 500,
+ max_price_impact_pct: 10, stop_loss_pct: 40, take_profit_pct: 200,
+ allowed_categories: ['meme', 'ai'],
+ };
+
+ it('is deterministic for the same inputs', () => {
+ expect(strategyHash(s, 30, 'mainnet')).toBe(strategyHash(s, 30, 'mainnet'));
+ });
+
+ it('ignores cosmetic fields not in the hash set', () => {
+ const h1 = strategyHash(s, 30, 'mainnet');
+ const h2 = strategyHash({ ...s, telegram_chat_id: '12345', enabled: true }, 30, 'mainnet');
+ expect(h1).toBe(h2);
+ });
+
+ it('is insensitive to category order but sensitive to membership', () => {
+ expect(strategyHash({ ...s, allowed_categories: ['ai', 'meme'] }, 30, 'mainnet')).toBe(strategyHash(s, 30, 'mainnet'));
+ expect(strategyHash({ ...s, allowed_categories: ['meme'] }, 30, 'mainnet')).not.toBe(strategyHash(s, 30, 'mainnet'));
+ });
+
+ it('changes with the window and the network', () => {
+ expect(strategyHash(s, 30, 'mainnet')).not.toBe(strategyHash(s, 90, 'mainnet'));
+ expect(strategyHash(s, 30, 'mainnet')).not.toBe(strategyHash(s, 30, 'devnet'));
+ });
+});
diff --git a/workers/agent-sniper/exit-logic.js b/workers/agent-sniper/exit-logic.js
index 5c610b284..77420377e 100644
--- a/workers/agent-sniper/exit-logic.js
+++ b/workers/agent-sniper/exit-logic.js
@@ -7,8 +7,12 @@
// is evaluated with the EXACT stop-loss / trailing-stop / take-profit / timeout
// priority that governs real money. Keeping it here means the two can never drift.
-/** Coerce to a finite number, or null. */
+/** Coerce to a finite number, or null. A null/blank input is "disabled" (null) —
+ * NOT 0. (Number(null) === 0, so a missing take-profit / trailing-stop would
+ * otherwise fire immediately; the schema documents null as "no TP / no trailing
+ * stop", and this is the single source of truth that honors that.) */
export function pct(n) {
+ if (n == null || n === '') return null;
const x = Number(n);
return Number.isFinite(x) ? x : null;
}