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(registry): advertise x402 on the EVM ERC-8004 registration too

nirholasf216a409938e
diff --git a/api/_lib/three-brand.js b/api/_lib/three-brand.js
index c945b1183..eaa98e122 100644
--- a/api/_lib/three-brand.js
+++ b/api/_lib/three-brand.js
@@ -299,6 +299,32 @@ export function buildAgentRegistrationMetadata(a) {
};
}
+/**
+ * ERC-8004 registration-file fields that the Agent Registry subgraph indexes
+ * (see api/agents/8004/agent.js `registrationFile { active x402Support mcpEndpoint
+ * a2aEndpoint webEndpoint supportedTrusts ... }`). The EVM registration flow
+ * (api/agents/register) pins an agent-manifest JSON whose base shape lacks these
+ * flat fields, so the indexer defaults `x402Support` to false and shows three.ws
+ * agents as inactive / "x402 Not Supported". Spread these in to advertise the
+ * truth: every three.ws agent settles calls over x402. Mirrors the Solana
+ * registry doc above so on- and cross-chain registries agree.
+ *
+ * @param {string} [origin] public app origin (defaults to env.APP_ORIGIN)
+ */
+export function erc8004RegistryFields(origin = env.APP_ORIGIN) {
+ const o = String(origin || env.APP_ORIGIN).replace(/\/$/, '');
+ return {
+ active: true,
+ x402Support: true,
+ webEndpoint: o,
+ a2aEndpoint: `${o}/.well-known/agent-card.json`,
+ a2aVersion: '0.3.0',
+ mcpEndpoint: `${o}/api/mcp`,
+ mcpVersion: '2025-06-18',
+ supportedTrusts: ['reputation'],
+ };
+}
+
// ── Agent token (pump.fun) ───────────────────────────────────────────────────
/**
diff --git a/api/agents/register/[action].js b/api/agents/register/[action].js
index 5aee0e79d..f48d55377 100644
--- a/api/agents/register/[action].js
+++ b/api/agents/register/[action].js
@@ -8,6 +8,7 @@ import { cors, json, method, wrap, error, readJson, rateLimited } from '../../_l
import { parse } from '../../_lib/validate.js';
import { limits, clientIp } from '../../_lib/rate-limit.js';
import { env } from '../../_lib/env.js';
+import { erc8004RegistryFields } from '../../_lib/three-brand.js';
import { r2, publicUrl } from '../../_lib/r2.js';
import { SERVER_CHAIN_META } from '../../_lib/onchain.js';
import { publishFeedEvent } from '../../_lib/feed.js';
@@ -99,6 +100,9 @@ async function handlePrep(req, res) {
$schema: 'https://3d-agent.io/schemas/manifest/0.1.json', spec: 'agent-manifest/0.1',
name: body.name, description: body.description, image: '', tags: [],
body: { uri: '', format: 'gltf-binary' }, _baseURI: `ipfs://`,
+ // ERC-8004 registration-file fields the registry subgraph indexes — without
+ // them the agent shows as inactive / "x402 Not Supported".
+ ...erc8004RegistryFields(env.APP_ORIGIN),
...(body.brain && { brain: body.brain }),
...(body.skills?.length > 0 && { skills: body.skills }),
...(body.embedPolicy && { embedPolicy: body.embedPolicy }),
diff --git a/tests/api/agent-registration-metadata.test.js b/tests/api/agent-registration-metadata.test.js
index 201be1a41..75d27c925 100644
--- a/tests/api/agent-registration-metadata.test.js
+++ b/tests/api/agent-registration-metadata.test.js
@@ -4,7 +4,10 @@
// this doc omitted the EIP-8004 signals. These tests lock the truthful shape in.
import { describe, it, expect } from 'vitest';
-import { buildAgentRegistrationMetadata } from '../../api/_lib/three-brand.js';
+import {
+ buildAgentRegistrationMetadata,
+ erc8004RegistryFields,
+} from '../../api/_lib/three-brand.js';
const agent = {
agentId: 'abc123',
@@ -65,3 +68,24 @@ describe('buildAgentRegistrationMetadata', () => {
expect(m.services.find((s) => s.name === 'web').endpoint).toMatch(/\/agent\/7$/);
});
});
+
+describe('erc8004RegistryFields', () => {
+ // These flat field names must match exactly what the registry subgraph reads in
+ // api/agents/8004/agent.js — a rename there silently drops the value to its
+ // `?? false` / null default, which is the bug this guards against.
+ it('emits active + x402Support so the EVM registry does not show "Not Supported"', () => {
+ const f = erc8004RegistryFields('https://three.ws');
+ expect(f.active).toBe(true);
+ expect(f.x402Support).toBe(true);
+ expect(f.supportedTrusts).toContain('reputation');
+ });
+
+ it('exposes absolute web/a2a/mcp endpoints under the given origin', () => {
+ const f = erc8004RegistryFields('https://three.ws/');
+ expect(f.webEndpoint).toBe('https://three.ws');
+ expect(f.a2aEndpoint).toBe('https://three.ws/.well-known/agent-card.json');
+ expect(f.mcpEndpoint).toBe('https://three.ws/api/mcp');
+ expect(f.a2aVersion).toBe('0.3.0');
+ expect(f.mcpVersion).toBe('2025-06-18');
+ });
+});