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.

feat(wk): x402 Bazaar discovery endpoint at /.well-known/x402.json

nirholas680994bfbba0
diff --git a/api/wk.js b/api/wk.js
index fd2e96e11..8acfbdaac 100644
--- a/api/wk.js
+++ b/api/wk.js
@@ -77,6 +77,85 @@ function handleX402(req, res) {
}, { 'cache-control': 'public, max-age=300' });
}
+// ── x402 Bazaar discovery (/.well-known/x402.json) ───────────────────────────
+// Crawled by agentic.market / Bazaar to index our paid endpoints.
+// Schema: https://x402.org/schemas/discovery.json
+
+const RAW_AMOUNT_TO_USDC = (raw) => {
+ const n = Number(raw || 0) / 1_000_000;
+ const decimals = n < 0.01 ? 4 : 2;
+ const s = n.toFixed(decimals);
+ const trimmed = s.includes('.') ? s.replace(/0+$/, '').replace(/\.$/, '') : s;
+ return `$${trimmed}`;
+};
+
+function handleX402Discovery(req, res) {
+ const origin = env.APP_ORIGIN;
+ const mcpUrl = `${origin}/api/mcp`;
+ const price = RAW_AMOUNT_TO_USDC(env.X402_MAX_AMOUNT_REQUIRED);
+
+ const accepts = [];
+ if (env.X402_PAY_TO_SOLANA) {
+ accepts.push({
+ scheme: 'exact',
+ network: 'solana',
+ network_label: 'solana-mainnet',
+ price,
+ payTo: env.X402_PAY_TO_SOLANA,
+ asset: env.X402_ASSET_MINT_SOLANA,
+ asset_symbol: 'USDC',
+ extra: { name: 'USDC', decimals: 6, feePayer: env.X402_FEE_PAYER_SOLANA },
+ });
+ }
+ if (env.X402_PAY_TO_BASE) {
+ accepts.push({
+ scheme: 'exact',
+ network: 'base',
+ network_label: 'base-mainnet',
+ price,
+ payTo: env.X402_PAY_TO_BASE,
+ asset: env.X402_ASSET_ADDRESS_BASE,
+ asset_symbol: 'USDC',
+ extra: { name: 'USDC', version: '2', decimals: 6 },
+ });
+ }
+
+ return json(res, 200, {
+ $schema: 'https://x402.org/schemas/discovery.json',
+ service: {
+ name: 'three.ws',
+ legal_name: 'three.ws',
+ tagline: 'AI-powered 3D model viewer and validation agent.',
+ description: 'three.ws is an agent-first 3D model platform. Drag-and-drop glTF/GLB preview, model validation/inspection/optimization, plus Solana agent data — all reachable as MCP tool calls behind a single x402 v1 endpoint. USDC on Solana mainnet and Base mainnet.',
+ operator: 'three.ws',
+ mission: 'Make 3D model tooling and Solana agent data machine-native so any AI agent can transact with the HTTP 402 protocol.',
+ website: origin,
+ docs: `${origin}/docs/mcp`,
+ repository: 'https://github.com/overstepping/3D-Agent',
+ contact: `${origin}/`,
+ tags: ['x402', 'x402-v1', 'mcp', 'agent-first', '3d', 'gltf', 'glb', 'three-js', 'solana', 'base', 'usdc'],
+ environment: 'apex',
+ origin,
+ },
+ resources: [
+ {
+ path: '/api/mcp',
+ url: mcpUrl,
+ method: 'POST',
+ description: 'MCP 2025-06-18 Streamable HTTP transport — 3D avatar viewer, glTF model validation/inspection/optimization, and Solana agent data exposed as MCP tools. JSON-RPC 2.0 batch-aware. Currency: USDC.',
+ mimeType: 'application/json',
+ accepts,
+ links: {
+ openapi: `${origin}/openapi.json`,
+ docs: `${origin}/docs/mcp`,
+ agent_card: `${origin}/.well-known/agent-card.json`,
+ payment_config: `${origin}/.well-known/x402`,
+ },
+ },
+ ],
+ }, { 'cache-control': 'public, max-age=300' });
+}
+
// ── dispatcher ────────────────────────────────────────────────────────────────
function handleChatPlugin(req, res) {
@@ -103,6 +182,7 @@ const DISPATCH = {
'oauth-authorization-server': handleOauthAuthServer,
'oauth-protected-resource': handleOauthProtectedResource,
'x402': handleX402,
+ 'x402-discovery': handleX402Discovery,
};
export default wrap(async (req, res) => {
diff --git a/vercel.json b/vercel.json
index 51b582610..349248133 100644
--- a/vercel.json
+++ b/vercel.json
@@ -20,6 +20,10 @@
"src": "/\\.well-known/chat-plugin\\.json",
"dest": "/api/wk?name=chat-plugin"
},
+ {
+ "src": "/\\.well-known/x402\\.json",
+ "dest": "/api/wk?name=x402-discovery"
+ },
{
"src": "/\\.well-known/x402",
"dest": "/api/wk?name=x402"