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
import Ajv from 'ajv';
import addFormats from 'ajv-formats';
import { buildGettingStartedTool } from '../_lib/mcp-getting-started.js';
import { priceFor } from '../_lib/pump-pricing.js';
import { toolDefs as avatarDefs } from './tools/avatars.js';
import { toolDefs as modelDefs } from './tools/models.js';
import { toolDefs as printDefs } from './tools/print.js';
import { toolDefs as solanaDefs } from './tools/solana.js';
import { toolDefs as pumpfunDefs } from './tools/pumpfun.js';
import { toolDefs as agentDefs } from './tools/agents.js';
import { toolDefs as animationDefs } from './tools/animations.js';
import { toolDefs as memoryDefs } from './tools/memory.js';
import { toolDefs as embedDefs } from './tools/embed.js';
import { toolDefs as oracleDefs } from './tools/oracle.js';
import { toolDefs as traderDefs } from './tools/trader.js';
import { toolDefs as tokenizeDefs } from './tools/tokenize.js';
import { toolDefs as cryptoDataDefs } from './tools/crypto-data.js';
import { toolDefs as garmentDefs } from './tools/garments.js';
import { toolDefs as signDefs } from './tools/sign.js';
import { toolDefs as feedbackDefs } from './tools/feedback.js';
import { toolDefs as homeDefs } from './tools/home.js';
import { toolDefs as libraryDefs } from './tools/library.js';
import { toolDefs as cardDefs } from './tools/cards.js';
import { toolDefs as pairedDefs } from './tools/paired.js';
import { toolDefs as launchDefs } from './tools/launches.js';
import { toolDefs as agentLifecycleDefs } from './tools/agent-lifecycle.js';
import { toolDefs as customSkillDefs } from './tools/custom-skills.js';
import { toolDefs as skillImportDefs } from './tools/skill-imports.js';
import { toolDefs as resourceDefs } from './tools/resources.js';
import { toolDefs as mailDefs } from './tools/mail.js';
import { toolDefs as whitelistDefs } from './tools/whitelist.js';
import { toolDefs as domainDefs } from './tools/domains.js';
import { toolDefs as robinhoodDefs } from './tools/robinhood.js';
import { toolDefs as tokenDueDiligenceDefs } from './tools/token-due-diligence.js';
import { toolDefs as docsDefs } from './tools/docs.js';
import { toolDefs as expandDefs } from './tools/expand.js';
const baseDefs = [
...libraryDefs,
...avatarDefs,
...embedDefs,
...modelDefs,
...printDefs,
...animationDefs,
...signDefs,
...solanaDefs,
...pumpfunDefs,
...agentDefs,
...customSkillDefs,
...skillImportDefs,
...memoryDefs,
...oracleDefs,
...traderDefs,
...tokenizeDefs,
...cryptoDataDefs,
...garmentDefs,
...feedbackDefs,
...homeDefs,
...resourceDefs,
...cardDefs,
...pairedDefs,
...launchDefs,
...agentLifecycleDefs,
...mailDefs,
...whitelistDefs,
...domainDefs,
...robinhoodDefs,
...tokenDueDiligenceDefs,
...docsDefs,
...expandDefs,
];
// Free, public entry point — listed first so discovery clients see it up top.
// priceFor annotates the per-call price of the paid tools in the overview.
// Annotations: a static, local overview built at module load — read-only,
// deterministic, closed-world (destructiveHint is explicit because the MCP
// spec defaults it to true when omitted).
const gettingStarted = {
...buildGettingStartedTool({
server: 'three.ws',
tagline:
'The main three.ws MCP server: render and manage 3D avatars and models, animations, American Sign Language, a free searchable catalog of ready-made CC0 props, rigged characters and motion clips with paste-ready embed source, an agent registry, agent memory, prompt-only custom skills with one-call import from the public community skills registry, live pump.fun market data, Oracle conviction signals, the trader leaderboard + copy-trading system, and safe control of a connected Home Assistant house.',
tools: baseDefs,
priceFor,
access: [
'Connect with a three.ws account (OAuth) for your account-scoped avatars, agents, and memory.',
'Or pay per call via x402 (USDC) for the public tools — each priced tool shows its price in tools/list.',
],
links: { homepage: 'https://three.ws', source: 'https://github.com/nirholas/three.ws' },
}),
annotations: {
readOnlyHint: true,
destructiveHint: false,
idempotentHint: true,
openWorldHint: false,
},
};
const allDefs = [gettingStarted, ...baseDefs];
// Schema objects for tools/list — strip internal fields (scope, handler).
// Policy fields (group, tier, confirmFlag, previewTool) are not part of the MCP
// Tool schema, so they move under `_meta` where clients may read them.
export const TOOL_CATALOG = allDefs.map(
({ scope: _s, handler: _h, group, tier, confirmFlag, previewTool, ...schema }) =>
group || tier
? { ...schema, _meta: { ...(schema._meta || {}), 'three.ws/policy': { group, tier, confirmFlag, previewTool } } }
: schema,
);
// Compile each tool's inputSchema once per process so dispatch can validate
// args before invoking the handler. The handlers currently trust their args
// and pass them to DB / external APIs; dispatch-level validation is
// defense-in-depth that fails fast on malformed input with a clear MCP
// JSON-RPC error instead of bubbling up a Postgres parse error or worse.
//
// `useDefaults: true` lets the per-tool `default` in JSON Schema (e.g.
// limit defaults) fill in for clients that omit optional fields, matching
// the existing handler behavior (`args.limit || 25`).
//
// `coerceTypes: true` accepts string forms of integers ("25") which some
// older MCP clients emit — same forgiveness the handlers currently rely on.
const ajv = new Ajv({
allErrors: true,
useDefaults: true,
coerceTypes: true,
strict: false,
});
addFormats(ajv);
// Handler lookup for tools/call — keyed by tool name.
export const TOOLS = Object.fromEntries(
allDefs.map(({ name, scope, handler, inputSchema }) => [
name,
{
scope,
handler,
validate: inputSchema ? ajv.compile(inputSchema) : null,
},
]),
);