Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(mcp-server): resolve symlink entry-point detection and fix import paths
nirholasee7e4cef81e2
diff --git a/mcp-server/src/index.js b/mcp-server/src/index.jsindex 4fd06c5a8..ea3ce4566 100755--- a/mcp-server/src/index.js+++ b/mcp-server/src/index.js@@ -21,6 +21,7 @@import { createRequire } from 'node:module';import { pathToFileURL } from 'node:url';+import { realpathSync } from 'node:fs';import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';@@ -173,8 +174,23 @@ async function main() {// Run the stdio boot ONLY when this file is the process entry point. Importing// the module for tests (or to reuse buildServer/buildTools) must NOT connect a// transport or require payment env.-const isEntryPoint =- Boolean(process.argv[1]) && import.meta.url === pathToFileURL(process.argv[1]).href;+//+// The entry path is compared both directly and via its realpath: when launched+// through the npm bin (`node_modules/.bin/3d-agent-mcp`, a symlink to this file),+// process.argv[1] is the symlink while import.meta.url is the resolved target —+// so a direct compare alone would wrongly treat the bin launch as "imported" and+// never start the server.+function isProcessEntryPoint() {+ const argvPath = process.argv[1];+ if (!argvPath) return false;+ if (import.meta.url === pathToFileURL(argvPath).href) return true;+ try {+ return import.meta.url === pathToFileURL(realpathSync(argvPath)).href;+ } catch {+ return false;+ }+}+const isEntryPoint = isProcessEntryPoint();if (isEntryPoint) {main().catch((err) => {diff --git a/mcp-server/src/lib/pose-presets.js b/mcp-server/src/lib/pose-presets.jsnew file mode 100644index 000000000..4b5af0fa5--- /dev/null+++ b/mcp-server/src/lib/pose-presets.js@@ -0,0 +1,421 @@+// Vendored from the three.ws monorepo: src/pose-presets.js (the data the+// public /pose page renders). Kept in sync by hand so this package is+// self-contained when published to npm. Do not edit here — edit the canonical+// src/pose-presets.js and re-copy.++// Preset poses for /pose. Each entry is { id, label, group, pose } where+// `pose` is a flat map of jointName → { x, y, z } Euler rotations in+// radians, optionally with a rootPosition translating the whole figure.+//+// Convention reminder: in rest pose every rotation is 0 and the mannequin+// stands upright with arms at its sides. Limbs extend along their joint+// group's local -Y axis. Positive shoulderL.z opens the left arm outward+// (to the figure's left); negative shoulderR.z opens the right arm outward.+// shoulderX is forward(-) / back(+); elbow.x is bend (negative bends the+// elbow naturally so the forearm comes up toward the shoulder).++const PI = Math.PI;+const HALF = PI / 2;++export const PRESET_GROUPS = ['Standing', 'Action', 'Sitting & Floor', 'Expressive'];++export const PRESETS = [+ // ─── STANDING ───+ {+ id: 'tpose',+ label: 'T-pose',+ group: 'Standing',+ pose: {+ shoulderL: { x: 0, y: 0, z: HALF },+ shoulderR: { x: 0, y: 0, z: -HALF },+ },+ },+ {+ id: 'apose',+ label: 'A-pose',+ group: 'Standing',+ pose: {+ shoulderL: { x: 0, y: 0, z: 0.55 },+ shoulderR: { x: 0, y: 0, z: -0.55 },+ },+ },+ {+ id: 'relaxed',+ label: 'Relaxed stand',+ group: 'Standing',+ pose: {+ shoulderL: { x: -0.08, y: 0, z: 0.10 },+ shoulderR: { x: -0.08, y: 0, z: -0.10 },+ elbowL: { x: -0.18, y: 0, z: 0 },+ elbowR: { x: -0.18, y: 0, z: 0 },+ hipL: { x: 0.04, y: 0, z: 0.04 },+ hipR: { x: -0.04, y: 0, z: -0.04 },+ head: { x: 0.06, y: 0, z: 0 },+ },+ },+ {+ id: 'contrapposto',+ label: 'Contrapposto',+ group: 'Standing',+ pose: {+ pelvis: { x: 0, y: 0, z: 0.10 },+ spine: { x: 0, y: 0, z: -0.06 },+ chest: { x: 0, y: -0.10, z: -0.04 },+ head: { x: 0, y: 0.20, z: -0.05 },+ shoulderL: { x: -0.12, y: 0, z: 0.18 },+ shoulderR: { x: -0.10, y: 0, z: -0.10 },+ elbowL: { x: -0.30, y: 0, z: 0 },+ elbowR: { x: -0.18, y: 0, z: 0 },+ hipL: { x: 0.05, y: 0, z: -0.05 },+ hipR: { x: -0.20, y: 0, z: 0.05 },+ kneeR: { x: 0.40, y: 0, z: 0 },+ ankleR: { x: -0.25, y: 0, z: 0 },+ },+ },+ {+ id: 'hands-up',+ label: 'Arms up (cheer)',+ group: 'Standing',+ pose: {+ shoulderL: { x: 0, y: 0, z: PI * 0.92 },+ shoulderR: { x: 0, y: 0, z: -PI * 0.92 },+ elbowL: { x: -0.10, y: 0, z: 0 },+ elbowR: { x: -0.10, y: 0, z: 0 },+ head: { x: -0.20, y: 0, z: 0 },+ },+ },+ {+ id: 'wave',+ label: 'Wave hello',+ group: 'Standing',+ pose: {+ shoulderL: { x: 0, y: 0, z: 0.10 },+ shoulderR: { x: 0, y: 0, z: -PI * 0.78 },+ elbowR: { x: -1.20, y: 0, z: 0 },+ wristR: { x: 0, y: 0, z: -0.30 },+ head: { x: 0, y: -0.20, z: 0 },+ },+ },+ {+ id: 'hands-on-hips',+ label: 'Hands on hips',+ group: 'Standing',+ pose: {+ shoulderL: { x: 0, y: -1.2, z: 0.55 },+ shoulderR: { x: 0, y: 1.2, z: -0.55 },+ elbowL: { x: -1.40, y: 0, z: 0 },+ elbowR: { x: -1.40, y: 0, z: 0 },+ chest: { x: -0.05, y: 0, z: 0 },+ },+ },++ // ─── ACTION ───+ {+ id: 'walk-step',+ label: 'Walking step',+ group: 'Action',+ pose: {+ shoulderL: { x: -0.55, y: 0, z: 0.05 },+ shoulderR: { x: 0.55, y: 0, z: -0.05 },+ elbowL: { x: -0.50, y: 0, z: 0 },+ elbowR: { x: -0.50, y: 0, z: 0 },+ hipL: { x: -0.55, y: 0, z: 0 },+ hipR: { x: 0.35, y: 0, z: 0 },+ kneeR: { x: 0.55, y: 0, z: 0 },+ ankleL: { x: -0.10, y: 0, z: 0 },+ ankleR: { x: 0.25, y: 0, z: 0 },+ chest: { x: 0.08, y: 0, z: 0 },+ },+ },+ {+ id: 'run',+ label: 'Running',+ group: 'Action',+ pose: {+ chest: { x: 0.18, y: 0, z: 0 },+ shoulderL: { x: -1.10, y: 0, z: 0.10 },+ shoulderR: { x: 1.10, y: 0, z: -0.10 },+ elbowL: { x: -1.50, y: 0, z: 0 },+ elbowR: { x: -1.50, y: 0, z: 0 },+ hipL: { x: -1.10, y: 0, z: 0 },+ hipR: { x: 0.50, y: 0, z: 0 },+ kneeL: { x: 1.20, y: 0, z: 0 },+ kneeR: { x: 0.30, y: 0, z: 0 },+ ankleL: { x: -0.30, y: 0, z: 0 },+ },+ },+ {+ id: 'jump',+ label: 'Jumping',+ group: 'Action',+ pose: {+ shoulderL: { x: 0, y: 0, z: PI * 0.85 },+ shoulderR: { x: 0, y: 0, z: -PI * 0.85 },+ elbowL: { x: -0.20, y: 0, z: 0 },+ elbowR: { x: -0.20, y: 0, z: 0 },+ hipL: { x: -0.55, y: 0, z: 0 },+ hipR: { x: -0.55, y: 0, z: 0 },+ kneeL: { x: 1.10, y: 0, z: 0 },+ kneeR: { x: 1.10, y: 0, z: 0 },+ ankleL: { x: -0.40, y: 0, z: 0 },+ ankleR: { x: -0.40, y: 0, z: 0 },+ chest: { x: -0.10, y: 0, z: 0 },+ rootPosition: { x: 0, y: 0.20, z: 0 },+ },+ },+ {+ id: 'punch',+ label: 'Punch (right)',+ group: 'Action',+ pose: {+ chest: { x: 0, y: -0.30, z: 0 },+ shoulderL: { x: -0.40, y: 0, z: 0.20 },+ shoulderR: { x: -HALF, y: 0, z: -0.30 },+ elbowL: { x: -1.80, y: 0, z: 0 },+ elbowR: { x: -0.15, y: 0, z: 0 },+ wristL: { x: -0.20, y: 0, z: 0 },+ hipL: { x: -0.10, y: 0, z: 0.10 },+ hipR: { x: -0.20, y: 0, z: 0 },+ kneeL: { x: 0.30, y: 0, z: 0 },+ kneeR: { x: 0.20, y: 0, z: 0 },+ },+ },+ {+ id: 'archery',+ label: 'Archery',+ group: 'Action',+ pose: {+ chest: { x: 0, y: -0.35, z: 0 },+ head: { x: 0, y: 0.10, z: 0 },+ shoulderL: { x: 0, y: 0, z: HALF + 0.05 },+ shoulderR: { x: 0, y: 0, z: -0.40 },+ elbowL: { x: -0.05, y: 0, z: 0 },+ elbowR: { x: -2.10, y: 0, z: 0 },+ wristR: { x: 0, y: 0.20, z: 0 },+ hipL: { x: 0, y: 0, z: 0.10 },+ hipR: { x: 0, y: 0, z: -0.10 },+ },+ },+ {+ id: 'superhero-landing',+ label: 'Superhero landing',+ group: 'Action',+ pose: {+ pelvis: { x: 0, y: 0.25, z: 0 },+ spine: { x: 0.20, y: 0, z: 0 },+ chest: { x: 0.25, y: 0, z: 0 },+ head: { x: 0.30, y: 0, z: 0 },+ shoulderL: { x: 0, y: 0, z: HALF + 0.30 },+ shoulderR: { x: -0.20, y: 0, z: -0.15 },+ elbowL: { x: -0.40, y: 0, z: 0 },+ elbowR: { x: -1.20, y: 0, z: 0 },+ hipL: { x: -1.20, y: 0, z: 0.30 },+ hipR: { x: -0.30, y: 0, z: -0.10 },+ kneeL: { x: 2.20, y: 0, z: 0 },+ kneeR: { x: 0.40, y: 0, z: 0 },+ ankleL: { x: -0.30, y: 0, z: 0 },+ rootPosition: { x: 0, y: -0.42, z: 0 },+ },+ },++ // ─── SITTING & FLOOR ───+ {+ id: 'sit-chair',+ label: 'Sitting (chair)',+ group: 'Sitting & Floor',+ pose: {+ hipL: { x: -HALF, y: 0, z: 0 },+ hipR: { x: -HALF, y: 0, z: 0 },+ kneeL: { x: HALF, y: 0, z: 0 },+ kneeR: { x: HALF, y: 0, z: 0 },+ shoulderL: { x: -0.20, y: 0, z: 0.15 },+ shoulderR: { x: -0.20, y: 0, z: -0.15 },+ elbowL: { x: -0.40, y: 0, z: 0 },+ elbowR: { x: -0.40, y: 0, z: 0 },+ rootPosition: { x: 0, y: -0.42, z: 0 },+ },+ },+ {+ id: 'sit-floor',+ label: 'Sitting (floor)',+ group: 'Sitting & Floor',+ pose: {+ hipL: { x: -1.85, y: 0.35, z: 0.40 },+ hipR: { x: -1.85, y: -0.35, z: -0.40 },+ kneeL: { x: 1.80, y: 0, z: 0 },+ kneeR: { x: 1.80, y: 0, z: 0 },+ shoulderL: { x: 0, y: 0, z: 0.20 },+ shoulderR: { x: 0, y: 0, z: -0.20 },+ elbowL: { x: -0.40, y: 0, z: 0 },+ elbowR: { x: -0.40, y: 0, z: 0 },+ rootPosition: { x: 0, y: -0.80, z: 0 },+ },+ },+ {+ id: 'kneel',+ label: 'Kneeling',+ group: 'Sitting & Floor',+ pose: {+ hipL: { x: -0.10, y: 0, z: 0 },+ hipR: { x: -HALF, y: 0, z: 0 },+ kneeL: { x: 0.20, y: 0, z: 0 },+ kneeR: { x: HALF + 0.40, y: 0, z: 0 },+ ankleL: { x: -0.20, y: 0, z: 0 },+ shoulderL: { x: -0.20, y: 0, z: 0.10 },+ shoulderR: { x: -0.20, y: 0, z: -0.10 },+ elbowL: { x: -0.30, y: 0, z: 0 },+ elbowR: { x: -0.30, y: 0, z: 0 },+ rootPosition: { x: 0, y: -0.42, z: 0 },+ },+ },+ {+ id: 'crouch',+ label: 'Crouching',+ group: 'Sitting & Floor',+ pose: {+ hipL: { x: -1.50, y: 0, z: 0.30 },+ hipR: { x: -1.50, y: 0, z: -0.30 },+ kneeL: { x: 2.20, y: 0, z: 0 },+ kneeR: { x: 2.20, y: 0, z: 0 },+ ankleL: { x: -0.40, y: 0, z: 0 },+ ankleR: { x: -0.40, y: 0, z: 0 },+ chest: { x: 0.30, y: 0, z: 0 },+ shoulderL: { x: -0.30, y: 0, z: 0.20 },+ shoulderR: { x: -0.30, y: 0, z: -0.20 },+ elbowL: { x: -0.60, y: 0, z: 0 },+ elbowR: { x: -0.60, y: 0, z: 0 },+ rootPosition: { x: 0, y: -0.55, z: 0 },+ },+ },+ {+ id: 'thinker',+ label: 'The thinker',+ group: 'Sitting & Floor',+ pose: {+ hipL: { x: -HALF, y: 0, z: 0 },+ hipR: { x: -HALF, y: 0.20, z: -0.05 },+ kneeL: { x: HALF, y: 0, z: 0 },+ kneeR: { x: HALF, y: 0, z: 0 },+ chest: { x: 0.30, y: -0.20, z: 0 },+ spine: { x: 0.15, y: 0, z: 0 },+ head: { x: 0.40, y: 0, z: 0 },+ shoulderL: { x: -0.60, y: 0, z: 0.05 },+ shoulderR: { x: -1.30, y: 0, z: -0.25 },+ elbowL: { x: -0.50, y: 0, z: 0 },+ elbowR: { x: -2.20, y: 0, z: 0 },+ wristR: { x: -0.30, y: 0, z: 0 },+ rootPosition: { x: 0, y: -0.42, z: 0 },+ },+ },++ // ─── EXPRESSIVE ───+ {+ id: 'praying',+ label: 'Praying',+ group: 'Expressive',+ pose: {+ head: { x: 0.20, y: 0, z: 0 },+ chest: { x: 0.05, y: 0, z: 0 },+ shoulderL: { x: -0.30, y: -0.45, z: 0.45 },+ shoulderR: { x: -0.30, y: 0.45, z: -0.45 },+ elbowL: { x: -1.80, y: 0, z: 0 },+ elbowR: { x: -1.80, y: 0, z: 0 },+ },+ },+ {+ id: 'meditate',+ label: 'Meditation',+ group: 'Expressive',+ pose: {+ hipL: { x: -1.40, y: 0.50, z: 0.55 },+ hipR: { x: -1.40, y: -0.50, z: -0.55 },+ kneeL: { x: 2.10, y: 0, z: 0 },+ kneeR: { x: 2.10, y: 0, z: 0 },+ shoulderL: { x: -0.20, y: 0, z: 0.15 },+ shoulderR: { x: -0.20, y: 0, z: -0.15 },+ elbowL: { x: -0.30, y: 0, z: 0 },+ elbowR: { x: -0.30, y: 0, z: 0 },+ wristL: { x: -0.40, y: 0, z: 0 },+ wristR: { x: -0.40, y: 0, z: 0 },+ head: { x: 0.10, y: 0, z: 0 },+ rootPosition: { x: 0, y: -0.80, z: 0 },+ },+ },+ {+ id: 'warrior2',+ label: 'Warrior II (yoga)',+ group: 'Expressive',+ pose: {+ pelvis: { x: 0, y: 0.30, z: 0 },+ chest: { x: 0, y: -0.30, z: 0 },+ head: { x: 0, y: 0.50, z: 0 },+ shoulderL: { x: 0, y: 0, z: HALF },+ shoulderR: { x: 0, y: 0, z: -HALF },+ hipL: { x: -0.10, y: 0.35, z: 0.20 },+ hipR: { x: -0.15, y: 0, z: -0.45 },+ kneeL: { x: 1.40, y: 0, z: 0 },+ ankleL: { x: -0.20, y: 0, z: 0 },+ rootPosition: { x: 0, y: -0.18, z: 0 },+ },+ },+ {+ id: 'arabesque',+ label: 'Arabesque (ballet)',+ group: 'Expressive',+ pose: {+ pelvis: { x: 0.25, y: 0, z: 0 },+ spine: { x: 0.10, y: 0, z: 0 },+ chest: { x: -0.10, y: 0, z: 0 },+ head: { x: -0.30, y: 0, z: 0 },+ shoulderL: { x: 0, y: 0, z: 0.95 },+ shoulderR: { x: 0, y: 0, z: -0.95 },+ elbowL: { x: -0.20, y: 0, z: 0 },+ elbowR: { x: -0.20, y: 0, z: 0 },+ hipL: { x: 0.50, y: 0, z: 0.10 },+ hipR: { x: 0, y: 0, z: -0.10 },+ ankleR: { x: -0.30, y: 0, z: 0 },+ },+ },+ {+ id: 'flex',+ label: 'Flex (muscle pose)',+ group: 'Expressive',+ pose: {+ chest: { x: 0, y: -0.10, z: 0 },+ shoulderL: { x: 0, y: -0.40, z: HALF + 0.10 },+ shoulderR: { x: 0, y: 0.40, z: -HALF - 0.10 },+ elbowL: { x: -2.00, y: 0, z: 0 },+ elbowR: { x: -2.00, y: 0, z: 0 },+ wristL: { x: -0.30, y: 0, z: 0 },+ wristR: { x: -0.30, y: 0, z: 0 },+ head: { x: 0, y: -0.20, z: -0.05 },+ },+ },+ {+ id: 'point',+ label: 'Pointing',+ group: 'Expressive',+ pose: {+ chest: { x: 0, y: 0.20, z: 0 },+ shoulderL: { x: 0, y: 0, z: 0.15 },+ shoulderR: { x: -HALF + 0.20, y: 0, z: -0.40 },+ elbowR: { x: -0.10, y: 0, z: 0 },+ wristR: { x: -0.15, y: 0, z: 0 },+ head: { x: 0, y: -0.30, z: 0 },+ },+ },+];++export function getPresetById(id) {+ return PRESETS.find((p) => p.id === id) || null;+}++export function getPresetsByGroup() {+ const map = {};+ for (const group of PRESET_GROUPS) map[group] = [];+ for (const preset of PRESETS) {+ if (!map[preset.group]) map[preset.group] = [];+ map[preset.group].push(preset);+ }+ return map;+}diff --git a/mcp-server/src/lib/pump-vanity.js b/mcp-server/src/lib/pump-vanity.jsnew file mode 100644index 000000000..672cbac8c--- /dev/null+++ b/mcp-server/src/lib/pump-vanity.js@@ -0,0 +1,124 @@+// Vendored from the three.ws monorepo: api/_lib/pump-vanity.js. Kept in sync+// by hand so this package is self-contained when published to npm. Do not edit+// here — edit the canonical api/_lib/pump-vanity.js and re-copy.++// Solana vanity address generator for pump.fun mint Keypairs.+//+// Vendored from nirholas/solana-wallet-toolkit (MIT) — TypeScript reference+// at typescript/src/lib/{generator,matcher,validation}.ts. Rewritten as a+// single JS module so it works inside Vercel's serverless runtime without+// a transpile step. Adds prefix + suffix + ignoreCase + async yielding so+// long prefixes don't block the event loop while we wait.++import { Keypair } from '@solana/web3.js';++// Solana base58 alphabet — excludes 0, O, I, l to avoid look-alikes.+export const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';+const BASE58_CHARS = new Set(BASE58_ALPHABET);++const MAX_PATTERN_LENGTH = 6;+const DEFAULT_MAX_ITERATIONS = 2_000_000;+const YIELD_EVERY = 10_000;++function validatePattern(pattern, label) {+ if (typeof pattern !== 'string' || pattern.length === 0) {+ throw vanityError('invalid_vanity', `${label} must be a non-empty string`);+ }+ if (pattern !== pattern.trim()) {+ throw vanityError('invalid_vanity', `${label} contains whitespace`);+ }+ if (pattern.length > MAX_PATTERN_LENGTH) {+ throw vanityError(+ 'invalid_vanity',+ `${label} length ${pattern.length} exceeds max ${MAX_PATTERN_LENGTH} (would take an extremely long time)`,+ );+ }+ for (let i = 0; i < pattern.length; i++) {+ if (!BASE58_CHARS.has(pattern[i])) {+ throw vanityError(+ 'invalid_vanity',+ `${label}: invalid base58 char '${pattern[i]}' at position ${i + 1}`,+ );+ }+ }+}++function vanityError(code, msg) {+ return Object.assign(new Error(msg), { status: 400, code });+}++export function isValidVanityPrefix(prefix) {+ if (!prefix || typeof prefix !== 'string') return false;+ if (prefix.length > MAX_PATTERN_LENGTH) return false;+ for (const c of prefix) if (!BASE58_CHARS.has(c)) return false;+ return true;+}++// Estimated attempts ≈ 58^n (per pattern position). Used by callers to set+// a reasonable maxIterations and to surface difficulty in error messages.+export function estimateAttempts({ prefix, suffix, ignoreCase = false } = {}) {+ const len = (prefix?.length || 0) + (suffix?.length || 0);+ if (len === 0) return 1;+ const alphabetSize = ignoreCase ? 33 : 58; // lowercase-folded alphabet ≈ 33 distinct+ return Math.pow(alphabetSize, len);+}++/**+ * Grind a Solana Keypair whose base58 address matches a prefix and/or suffix.+ *+ * @param {object} opts+ * @param {string} [opts.prefix] — required base58 prefix+ * @param {string} [opts.suffix] — required base58 suffix+ * @param {boolean} [opts.ignoreCase] — case-insensitive match+ * @param {number} [opts.maxIterations] — hard cap (default 2M)+ * @param {(attempts:number,rate:number)=>void} [opts.onProgress] — every 1k attempts+ * @returns {Promise<{ keypair: Keypair, iterations: number, durationMs: number }>}+ */+export async function grindMintKeypair({+ prefix,+ suffix,+ ignoreCase = false,+ maxIterations = DEFAULT_MAX_ITERATIONS,+ onProgress,+} = {}) {+ if (!prefix && !suffix) {+ const kp = Keypair.generate();+ return { keypair: kp, iterations: 1, durationMs: 0 };+ }+ if (prefix) validatePattern(prefix, 'prefix');+ if (suffix) validatePattern(suffix, 'suffix');++ const targetPrefix = prefix ? (ignoreCase ? prefix.toLowerCase() : prefix) : null;+ const targetSuffix = suffix ? (ignoreCase ? suffix.toLowerCase() : suffix) : null;+ const pLen = targetPrefix?.length || 0;+ const sLen = targetSuffix?.length || 0;++ const start = Date.now();+ let lastProgressAt = start;+ let lastProgressAttempts = 0;++ for (let i = 1; i <= maxIterations; i++) {+ const kp = Keypair.generate();+ const addr = kp.publicKey.toBase58();++ const head = ignoreCase ? addr.substring(0, pLen).toLowerCase() : addr.substring(0, pLen);+ if (targetPrefix && head !== targetPrefix) {+ if (i % YIELD_EVERY === 0) await new Promise((r) => setImmediate(r));+ continue;+ }+ const tail = ignoreCase ? addr.substring(addr.length - sLen).toLowerCase() : addr.substring(addr.length - sLen);+ if (targetSuffix && tail !== targetSuffix) {+ if (i % YIELD_EVERY === 0) await new Promise((r) => setImmediate(r));+ continue;+ }++ return { keypair: kp, iterations: i, durationMs: Date.now() - start };+ }++ throw Object.assign(+ new Error(+ `vanity ${prefix ? `prefix '${prefix}'` : ''}${prefix && suffix ? ' + ' : ''}${suffix ? `suffix '${suffix}'` : ''} not found in ${maxIterations} attempts (estimated ~${Math.round(estimateAttempts({ prefix, suffix, ignoreCase })).toLocaleString()})`,+ ),+ { status: 504, code: 'vanity_timeout' },+ );+}diff --git a/mcp-server/src/tools/pose-seed.js b/mcp-server/src/tools/pose-seed.jsindex 74afeda04..f47469557 100644--- a/mcp-server/src/tools/pose-seed.js+++ b/mcp-server/src/tools/pose-seed.js@@ -19,7 +19,7 @@ import { z } from 'zod';import { paid } from '../payments.js';import { jsonSchemaFromZod } from './_shared.js';-import { PRESETS, PRESET_GROUPS } from '../../../src/pose-presets.js';+import { PRESETS, PRESET_GROUPS } from '../lib/pose-presets.js';const TOOL_NAME = 'get_pose_seed';const TOOL_DESCRIPTION =diff --git a/mcp-server/src/tools/vanity-grinder.js b/mcp-server/src/tools/vanity-grinder.jsindex bf774f4d5..cb74256c8 100644--- a/mcp-server/src/tools/vanity-grinder.js+++ b/mcp-server/src/tools/vanity-grinder.js@@ -20,7 +20,7 @@ import { z } from 'zod';import { paid } from '../payments.js';import { jsonSchemaFromZod } from './_shared.js';-import { grindMintKeypair, estimateAttempts, BASE58_ALPHABET } from '../../../api/_lib/pump-vanity.js';+import { grindMintKeypair, estimateAttempts, BASE58_ALPHABET } from '../lib/pump-vanity.js';import bs58 from 'bs58';const TOOL_NAME = 'vanity_grinder';diff --git a/packages/ibm-x402-mcp/src/index.js b/packages/ibm-x402-mcp/src/index.jsindex b36d724b2..34bca3681 100644--- a/packages/ibm-x402-mcp/src/index.js+++ b/packages/ibm-x402-mcp/src/index.js@@ -16,6 +16,7 @@import { createRequire } from 'node:module';import { pathToFileURL } from 'node:url';+import { realpathSync } from 'node:fs';import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';@@ -119,8 +120,21 @@ async function main() {);}-const isEntryPoint =- Boolean(process.argv[1]) && import.meta.url === pathToFileURL(process.argv[1]).href;+// Compare the entry path directly and via realpath: launched through the npm+// bin (a symlink to this file), process.argv[1] is the symlink while+// import.meta.url is the resolved target, so a direct compare alone would never+// start the server.+function isProcessEntryPoint() {+ const argvPath = process.argv[1];+ if (!argvPath) return false;+ if (import.meta.url === pathToFileURL(argvPath).href) return true;+ try {+ return import.meta.url === pathToFileURL(realpathSync(argvPath)).href;+ } catch {+ return false;+ }+}+const isEntryPoint = isProcessEntryPoint();if (isEntryPoint) {main().catch((err) => {diff --git a/scripts/verify-packages.mjs b/scripts/verify-packages.mjsindex 68f6905e6..afc8aa0cf 100644--- a/scripts/verify-packages.mjs+++ b/scripts/verify-packages.mjs@@ -30,7 +30,7 @@ const PACKAGES = [{ dir: 'agent-ui-sdk', name: '@three-ws/agent-ui', type: 'resolve', subpaths: ['.'] },{ dir: 'sdk', name: '@three-ws/sdk', type: 'resolve', subpaths: ['.'] },{ dir: 'packages/avatar-cli', name: '@three-ws/avatar-cli', type: 'cli', bin: 'three-ws-avatar', siblings: ['packages/avatar-schema'] },- { dir: 'mcp-server', name: '@3d-agent/mcp-server', type: 'mcp', bin: '3d-agent-mcp', minTools: 15 },+ { dir: 'mcp-server', name: '@3d-agent/mcp-server', type: 'mcp', bin: '3d-agent-mcp', minTools: 15, env: { MCP_SVM_PAYMENT_ADDRESS: 'THREEsynthetic11111111111111111111111111111' } },{ dir: 'packages/pumpfun-mcp', name: '@three-ws/pumpfun-mcp', type: 'mcp', bin: 'pumpfun-mcp', minTools: 20 },{ dir: 'packages/ibm-watsonx-mcp', name: '@three-ws/ibm-watsonx-mcp',type: 'mcp', bin: 'ibm-watsonx-mcp', minTools: 6, env: { WATSONX_API_KEY: 'test', WATSONX_PROJECT_ID: 'test' } },{ dir: 'packages/ibm-x402-mcp', name: '@three-ws/ibm-x402-mcp', type: 'mcp', bin: 'ibm-x402-mcp', minTools: 6, env: { MCP_SVM_PAYMENT_ADDRESS: 'THREEsynthetic11111111111111111111111111111', WATSONX_API_KEY: 'test', WATSONX_PROJECT_ID: 'test' } },