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.

fix(mcp): serve three://models again by calling the catalog export that exists

nirholas6b6fbd24805f
diff --git a/api/_mcp/resources.js b/api/_mcp/resources.js
index fefcc62c6..ca84e74a1 100644
--- a/api/_mcp/resources.js
+++ b/api/_mcp/resources.js
@@ -695,13 +695,13 @@ async function readModels() {
// The full picker catalog (context, tool calling, per-model health from the
// last roster probe) and the daily free allowance, the same payload
// GET /api/v1/models carries.
- const { publicModelCatalog, freeTierAllowance } = await import('../_lib/model-catalog.js');
- const [catalog, freeTier] = await Promise.all([publicModelCatalog({ health: 'cached' }), freeTierAllowance()]);
+ const { listCatalogModels, freeTierAllowance } = await import('../_lib/model-catalog.js');
+ const [catalog, freeTier] = await Promise.all([listCatalogModels({ health: 'cached' }), freeTierAllowance()]);
return {
agent_models: agentModels,
chat_models: chatModels,
models: catalog.models,
- health_checked_at: catalog.healthCheckedAt,
+ health_checked_at: catalog.health_checked_at,
free_tier: freeTier,
note: 'agent_models ids are what an agent brain accepts (create_agent model argument). Prices are USD per million tokens, [input, output]; free models are [0, 0], and null means the model is not metered by list price. `models` adds context, tool calling (a model without tools can chat but cannot drive a run) and live health; `free_tier` is the daily allowance free models draw on.',
};
diff --git a/tests/mcp-resources.test.js b/tests/mcp-resources.test.js
index 59f71e3bb..8ffa727cc 100644
--- a/tests/mcp-resources.test.js
+++ b/tests/mcp-resources.test.js
@@ -76,6 +76,8 @@ vi.mock('../api/_lib/db.js', () => ({
return [];
}
if (q.startsWith("SELECT meta->>'solana_address' AS address")) return [{ address: ADDRESS }];
+ // No stored override: the free-tier allowance falls back to its defaults.
+ if (q.startsWith('SELECT value FROM app_settings WHERE key')) return [];
throw new Error(`unexpected query in test: ${q.slice(0, 120)}`);
}),
isDbUnavailableError: () => false,
@@ -217,7 +219,11 @@ describe('resources/read access', () => {
it('prices models through the model a key routes to, and free models at zero', async () => {
const out = await resources.handleResourceMethod('mcp', 'resources/read', { uri: 'three://models' }, anon, req);
- const { agent_models, chat_models } = JSON.parse(out.contents[0].text);
+ const { agent_models, chat_models, models, free_tier } = JSON.parse(out.contents[0].text);
+ // The picker catalog and the free allowance ride along, the same payload GET /api/v1/models carries.
+ expect(Array.isArray(models)).toBe(true);
+ expect(models.length).toBeGreaterThan(0);
+ expect(free_tier.daily_messages).toBeGreaterThan(0);
const byId = new Map(agent_models.map((m) => [m.id, m]));
// ibm-granite names no priced model; its OpenRouter route does.
expect(byId.get('ibm-granite').price_usd_per_mtok).toEqual([0.05, 0.1]);