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(okx-forge): answer a free service's discovery GET with 405, not a priced 402
nirholasb7b16c3dd550
diff --git a/api/okx/3d/[service].js b/api/okx/3d/[service].jsindex 754ae4282..9d8683174 100644--- a/api/okx/3d/[service].js+++ b/api/okx/3d/[service].js@@ -405,7 +405,18 @@ async function handleA2mcp(req, res, cfg) {// envs being present. Prepended into the MCP challenge + verify path.const xlayerAcceptsFor = (amount) => (xlayerSettleable() ? [okxXLayerAccept(resourceUrl, amount)] : []);- if (req.method === 'GET' || req.method === 'HEAD')+ if (req.method === 'GET' || req.method === 'HEAD') {+ // A free service has nothing to challenge for. Answering its GET with a+ // 402 (the shared default price, no less) told a reviewer the "free" row+ // costs money. This server holds no server-to-client stream, so the+ // honest answer is the same 405 the authenticated branch gives, and the+ // same shape the approved sellers on this marketplace answer GET with.+ if (!listPrice) {+ res.statusCode = 405;+ res.setHeader('allow', 'POST, DELETE');+ res.setHeader('cache-control', 'no-store');+ return res.end();+ }return handleSse(req, res, {resourcePath,challenge,@@ -413,6 +424,7 @@ async function handleA2mcp(req, res, cfg) {x402Amount: listPrice,paymentStatus: 402,});+ }if (req.method === 'DELETE') return handleTerminate(req, res);if (req.method !== 'POST') return send401(res, 'method not supported');diff --git a/tests/api/okx-forge.test.js b/tests/api/okx-forge.test.jsindex 4cc347121..3b0984afc 100644--- a/tests/api/okx-forge.test.js+++ b/tests/api/okx-forge.test.js@@ -256,6 +256,12 @@ describe('402 challenge: the OKX Agent Payments Protocol integration', () => {lane.poll = () => jsonResponse(200, { status: 'running' });const res = await post('forge-status', rpc(FORGE_STATUS_TOOL, { job_id: 'f1.job.abc' }));expect(res.statusCode).toBe(200);+ // ...including on GET, which a reviewer probes first: a free row answering+ // its discovery GET with a priced 402 reads as a paid service.+ const get = makeRes();+ await handler(makeReq({ method: 'GET', service: 'forge-status' }), get);+ expect(get.statusCode).toBe(405);+ expect(get.headers.allow).toBe('POST, DELETE');});});