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 + active in agent registration metadata

nirholas3ffacfe94cb8
diff --git a/api/_lib/three-brand.js b/api/_lib/three-brand.js
index a58e08f3b..b1800253f 100644
--- a/api/_lib/three-brand.js
+++ b/api/_lib/three-brand.js
@@ -219,9 +219,14 @@ export function buildAgentOnchainAttributes(a) {
* agent discoverable in Metaplex's on-chain Agent Registry the asset needs an
* Agent Identity PDA whose `agentRegistrationUri` points at this JSON.
*
- * Shape matches the SDK's `AgentMetadata` interface exactly:
- * { type, name, description, services[], registrations[], supportedTrust[] }
- * so the registry indexer and any registry-aware client read it without coercion.
+ * Superset of the SDK's `AgentMetadata` interface — the six required fields
+ * (type/name/description/services/registrations/supportedTrust) are all present,
+ * so SDK-strict consumers read it without coercion. We additionally emit the
+ * EIP-8004 registration-v1 signals that Metaplex's Agent Registry indexes
+ * (`active`, `x402Support`, `x402Endpoints`, `agentMetadataUri`); without them the
+ * registry defaults the agent to "x402 Not Supported" / inactive even though every
+ * three.ws agent settles calls over x402. Mirrors the canonical served doc at
+ * /.well-known/agent-registration.json so on- and off-chain metadata agree.
*
* @param {object} a
* @param {string|number} a.agentId three.ws agent id (for the cross-registry link)
@@ -234,21 +239,43 @@ export function buildAgentRegistrationMetadata(a) {
const home = a.agentUrl || agentHomeUrl(a.agentId);
const description =
a.description?.trim() || `${a.name} — an autonomous agent on ${THREE_WS.name}.`;
+ const origin = env.APP_ORIGIN;
+ const cardUrl = `${origin}/.well-known/agent-card.json`;
+ // Real, reachable endpoints. `endpoint` is the SDK's field; the extra `version`
+ // keys are ignored by strict consumers and used by richer registry indexers.
const services = [
- { name: 'profile', endpoint: home },
- { name: 'agent-card', endpoint: `${env.APP_ORIGIN}/.well-known/agent-card.json` },
+ { name: 'web', endpoint: home },
+ { name: 'A2A', endpoint: cardUrl, version: '0.3.0' },
+ { name: 'MCP', endpoint: `${origin}/.well-known/openapi.yaml`, version: '2025-06-18' },
];
return {
- type: 'agent',
+ type: [
+ 'https://eips.ethereum.org/EIPS/eip-8004#registration-v1',
+ 'https://three.ws/specs/3d-agent-card-v1',
+ ],
name: a.name,
description,
+ active: true,
services,
- // Point back at the three.ws registry so the two identities resolve to each
- // other — Metaplex's `AgentRegistration` shape: { agentId, agentRegistry }.
+ x402Support: true,
+ x402Endpoints: [
+ {
+ url: `${origin}/api/mcp`,
+ method: 'POST',
+ description:
+ 'MCP tool call — 3D avatar viewer, glTF model validation/inspection/optimization, and Solana agent data',
+ networks: ['solana', 'base'],
+ scheme: 'exact',
+ priceUsdc: '0.001',
+ },
+ ],
+ // Cross-link back to the three.ws registry so the two identities resolve to
+ // each other — Metaplex's `AgentRegistration` shape: { agentId, agentRegistry }.
registrations: [{ agentId: String(a.agentId), agentRegistry: THREE_WS.website }],
- supportedTrust: [],
+ supportedTrust: ['reputation'],
+ agentMetadataUri: cardUrl,
};
}
diff --git a/tests/api/agent-registration-metadata.test.js b/tests/api/agent-registration-metadata.test.js
new file mode 100644
index 000000000..201be1a41
--- /dev/null
+++ b/tests/api/agent-registration-metadata.test.js
@@ -0,0 +1,67 @@
+// buildAgentRegistrationMetadata — the off-chain doc our on-chain Metaplex Agent
+// Registry flow pins (api/_lib/onchain-deploy.js -> registerAgentOnce). Regression
+// guard: the registry showed three.ws as "x402 Not Supported" / inactive because
+// 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';
+
+const agent = {
+ agentId: 'abc123',
+ name: 'three.ws',
+ description: 'AI-powered 3D model viewer and validation agent.',
+};
+
+describe('buildAgentRegistrationMetadata', () => {
+ it('keeps the six SDK-required AgentMetadata fields', () => {
+ const m = buildAgentRegistrationMetadata(agent);
+ for (const k of [
+ 'type',
+ 'name',
+ 'description',
+ 'services',
+ 'registrations',
+ 'supportedTrust',
+ ]) {
+ expect(m[k], `missing required field ${k}`).toBeDefined();
+ }
+ expect(Array.isArray(m.services)).toBe(true);
+ expect(
+ m.services.every((s) => typeof s.name === 'string' && typeof s.endpoint === 'string'),
+ ).toBe(true);
+ });
+
+ it('advertises x402 support so the registry does not default to "Not Supported"', () => {
+ const m = buildAgentRegistrationMetadata(agent);
+ expect(m.x402Support).toBe(true);
+ expect(m.active).toBe(true);
+ expect(Array.isArray(m.x402Endpoints)).toBe(true);
+ expect(m.x402Endpoints.length).toBeGreaterThan(0);
+ const ep = m.x402Endpoints[0];
+ expect(ep.scheme).toBe('exact');
+ expect(ep.networks).toContain('solana');
+ expect(String(ep.url)).toMatch(/^https?:\/\//);
+ });
+
+ it('declares the EIP-8004 registration-v1 type the Metaplex registry indexes', () => {
+ const m = buildAgentRegistrationMetadata(agent);
+ const types = Array.isArray(m.type) ? m.type : [m.type];
+ expect(types).toContain('https://eips.ethereum.org/EIPS/eip-8004#registration-v1');
+ });
+
+ it('cross-links the three.ws registry and points at the resolvable agent card', () => {
+ const m = buildAgentRegistrationMetadata(agent);
+ expect(m.registrations[0]).toEqual({
+ agentId: 'abc123',
+ agentRegistry: 'https://three.ws',
+ });
+ expect(m.agentMetadataUri).toMatch(/\/\.well-known\/agent-card\.json$/);
+ expect(m.services.some((s) => s.name === 'A2A')).toBe(true);
+ });
+
+ it('falls back to a generated description and home url when none supplied', () => {
+ const m = buildAgentRegistrationMetadata({ agentId: 7, name: 'Solo' });
+ expect(m.description).toContain('Solo');
+ expect(m.services.find((s) => s.name === 'web').endpoint).toMatch(/\/agent\/7$/);
+ });
+});