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: three-token-mcp token lib + balance tool refinements
nirholas82aa2380704a
diff --git a/packages/three-token-mcp/src/lib/token.js b/packages/three-token-mcp/src/lib/token.jsindex 2d6828928..ae4ffe243 100644--- a/packages/three-token-mcp/src/lib/token.js+++ b/packages/three-token-mcp/src/lib/token.js@@ -54,6 +54,23 @@ export function fetchTokenPrice(usd) {const fmt = (atomics, decimals) => Number(BigInt(atomics)) / 10 ** decimals;+/**+ * Resolve just the $THREE mint (+ symbol/decimals if available). Prefers the+ * full config, but falls back to the price endpoint's `mint` so read-only tools+ * keep working even when /api/token/config is unavailable (e.g. the treasury+ * env isn't set yet) — burns still require the full config.+ */+export async function resolveMint() {+ try {+ const c = await fetchTokenConfig();+ if (c?.mint) return { mint: c.mint, symbol: c.symbol || '$THREE', decimals: c.decimals };+ } catch {+ /* fall through to price */+ }+ const p = await fetchTokenPrice();+ return { mint: p.mint, symbol: '$THREE', decimals: undefined };+}+/*** Split `totalAtomics` of $THREE into burn + treasury legs.* @param {bigint} totalAtomicsdiff --git a/packages/three-token-mcp/src/tools/three-balance.js b/packages/three-token-mcp/src/tools/three-balance.jsindex b126bf589..0daf91331 100644--- a/packages/three-token-mcp/src/tools/three-balance.js+++ b/packages/three-token-mcp/src/tools/three-balance.js@@ -4,7 +4,7 @@import { z } from 'zod';import { getSolBalance, getSplBalance, isValidPubkey, loadSigner } from '../lib/solana.js';-import { fetchTokenConfig } from '../lib/token.js';+import { resolveMint } from '../lib/token.js';export const def = {name: 'three_balance',@@ -27,20 +27,20 @@ export const def = {if (!isValidPubkey(owner)) {return { ok: false, error: 'invalid_pubkey' };}- const config = await fetchTokenConfig();+ const token = await resolveMint();const [sol, three] = await Promise.all([getSolBalance(owner),- getSplBalance(owner, config.mint),+ getSplBalance(owner, token.mint),]);return {ok: true,pubkey: owner,- symbol: config.symbol,+ symbol: token.symbol,three: {- mint: config.mint,+ mint: token.mint,amount: three.uiAmount,atomics: three.atomics,- decimals: three.decimals || config.decimals,+ decimals: three.decimals || token.decimals,},sol: sol.sol,lamports: sol.lamports,