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): restore the studio resource and prompt helpers the MCP census calls so the catalog and count checks stop crashing

nirholas2f439686f9fb
diff --git a/api/_mcp-studio/dispatch.js b/api/_mcp-studio/dispatch.js
index 745f09896..79949bf46 100644
--- a/api/_mcp-studio/dispatch.js
+++ b/api/_mcp-studio/dispatch.js
@@ -260,6 +260,20 @@ function widgetResources({ widgets = true, personas = true } = {}) {
return personas ? all : all.filter((r) => r.uri !== PERSONA_COMPONENT_URI);
}
+/**
+ * The resources/list payload a surface serves (no widget HTML bodies). The MCP
+ * census (api/_lib/mcp-census.js) counts these so the published totals match
+ * what each studio endpoint answers.
+ */
+export function resourcesForSurface(name = 'full') {
+ return widgetResources(surfaceOf(name)).map(({ text: _t, ...r }) => r);
+}
+
+/** Does this surface serve the guided prompts (api/_mcp/prompts.js)? */
+export function surfaceServesPrompts(name = 'full') {
+ return Boolean(surfaceOf(name).prompts);
+}
+
const log = logger('mcp-studio');
function ok(id, result) {
diff --git a/tests/mcp-studio-census-surface.test.js b/tests/mcp-studio-census-surface.test.js
new file mode 100644
index 000000000..bad3b3a70
--- /dev/null
+++ b/tests/mcp-studio-census-surface.test.js
@@ -0,0 +1,34 @@
+// The MCP census (api/_lib/mcp-census.js) counts each studio endpoint through two
+// helpers on the studio dispatcher. When they went missing the census, the
+// published catalog and the count checks all crashed with "is not a function".
+import { describe, it, expect } from 'vitest';
+import { resourcesForSurface, surfaceServesPrompts, SURFACE_NAMES } from '../api/_mcp-studio/dispatch.js';
+
+describe('studio dispatcher census helpers', () => {
+ it('lists the model viewer and persona widgets on the full surface without their HTML bodies', () => {
+ const resources = resourcesForSurface('full');
+ expect(resources).toHaveLength(2);
+ for (const r of resources) {
+ expect(r.uri).toMatch(/^ui:\/\//);
+ expect(r).not.toHaveProperty('text');
+ }
+ });
+
+ it('lists only the model viewer on the ChatGPT surface and nothing on Grok', () => {
+ expect(resourcesForSurface('chatgpt')).toHaveLength(1);
+ expect(resourcesForSurface('grok')).toEqual([]);
+ });
+
+ it('reports which surfaces serve the guided prompts', () => {
+ expect(surfaceServesPrompts('full')).toBe(true);
+ expect(surfaceServesPrompts('grok')).toBe(true);
+ expect(surfaceServesPrompts('chatgpt')).toBe(false);
+ });
+
+ it('answers every named surface', () => {
+ for (const name of SURFACE_NAMES) {
+ expect(Array.isArray(resourcesForSurface(name))).toBe(true);
+ expect(typeof surfaceServesPrompts(name)).toBe('boolean');
+ }
+ });
+});