@agentutility/mcp-retail 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @agentutility/mcp-retail
2
+
3
+ > Product copy + product discovery, per call.
4
+
5
+ Turn a product name into a marketing-ready description and selling points, and turn a shopping query into ranked products with buy links and prices. The e-commerce primitives a shopping or merchandising agent needs.
6
+
7
+ **Pricing:** pay-per-call in USDC on Base. No subscriptions, no API keys. See per-tool prices below.
8
+
9
+ ## Install — Claude Desktop
10
+
11
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
12
+
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "agentutility-retail": {
17
+ "command": "npx",
18
+ "args": ["-y", "@agentutility/mcp-retail"],
19
+ "env": { "X402_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY_HEX" }
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ Restart Claude Desktop. 5 tools appear in the tool palette.
26
+
27
+ ## Install — Cursor
28
+
29
+ Add to `.cursor/mcp.json`:
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "agentutility-retail": {
35
+ "command": "npx",
36
+ "args": ["-y", "@agentutility/mcp-retail"],
37
+ "env": { "X402_PRIVATE_KEY": "0x..." }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ## Funding
44
+
45
+ Send any amount of **USDC on Base mainnet** to the address derived from your `X402_PRIVATE_KEY`. The MCP server uses it to pay for tool calls automatically.
46
+
47
+ USDC on Base contract: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`
48
+
49
+ ## Tools (5)
50
+
51
+ | Tool | Description |
52
+ |---|---|
53
+ | `find-products` | (0.02 USDC/call) Find products API (alias of product-search). Returns ranked product results with buy links, retailer, snippet, and detected price for a shopping query. Backed by Decodo Google search scoped to buy intent. |
54
+ | `product-describe` | (0.01 USDC/call) Product description generator / e-commerce copywriter / product listing copy / selling points API. Given a product name (and optional category, audience, attributes), returns a conversion-focused description, bullet selling points, key features, a positioning angle, and suggested listing titles. LLM-backed (Morpheus primary, Venice fallback). Generates copy from supplied facts; does not invent specs or claims. |
55
+ | `product-description` | (0.01 USDC/call) Product description API (alias of product-describe). Turns a product name + attributes into a marketing-ready description, selling points, key features, and listing titles. LLM-backed; copy from supplied facts only. |
56
+ | `product-search` | (0.02 USDC/call) Product search / shopping search API / find products + buy links for agents. Given a product query (and optional retailer), returns ranked shopping results with product title, buy link, retailer domain, snippet, and any detected price. Backed by Decodo Google search scoped to buy intent. For general web search use search/web-search. |
57
+ | `shop-search` | (0.02 USDC/call) Shopping search API (alias of product-search). Find products and buy links for a query with title, buy link, retailer, snippet, and detected price. Backed by Decodo Google search scoped to buy intent. |
58
+
59
+ ## How it works
60
+
61
+ 1. Agent calls a tool (e.g. `find-products`).
62
+ 2. MCP server POSTs to `https://x402.agentutility.ai/find-products`.
63
+ 3. The endpoint responds **HTTP 402** with payment instructions.
64
+ 4. The MCP server signs an EIP-3009 USDC transfer authorization with `X402_PRIVATE_KEY` and retries.
65
+ 5. CDP facilitator settles on Base.
66
+ 6. The endpoint returns the actual response.
67
+
68
+ The agent never sees the payment flow — it just gets the result.
69
+
70
+ ## Links
71
+
72
+ - Cluster overview: https://agentutility.ai/retail/
73
+ - All MCP packages: https://mcp.agentutility.ai/
74
+ - Source: https://github.com/rooz21/x402/tree/main/packages/mcp-retail
75
+
76
+ ---
77
+
78
+ **Version:** 0.1.0 · **License:** MIT
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @agentutility/mcp-<cluster> — stdio MCP server exposing the cluster's
4
+ * x402-paid endpoints as MCP tools. Forwards every CallToolRequest to
5
+ * x402.agentutility.ai, where @x402/fetch handles 402 → payment → retry
6
+ * using the agent's own wallet (X402_PRIVATE_KEY env var).
7
+ *
8
+ * Boilerplate is single-sourced at packages/_template/src/index.ts and
9
+ * copied verbatim into each packages/mcp-<cluster>/src/index.ts by
10
+ * scripts/generate-mcp-clusters.mjs. The codegen also writes a matching
11
+ * tools.generated.ts so this file imports CLUSTER_SLUG + VERSION + TOOLS
12
+ * rather than hard-coding.
13
+ *
14
+ * Required env: X402_PRIVATE_KEY (hex EVM key, USDC on Base).
15
+ * Optional env: X402_BASE_URL (default https://x402.agentutility.ai)
16
+ * X402_RPC_URL (default https://mainnet.base.org)
17
+ */
18
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
19
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
20
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
21
+ import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
22
+ import { ExactEvmScheme, toClientEvmSigner } from "@x402/evm";
23
+ import { privateKeyToAccount } from "viem/accounts";
24
+ import { createPublicClient, http } from "viem";
25
+ import { base } from "viem/chains";
26
+ import { TOOLS, CLUSTER_SLUG, VERSION } from "./tools.generated.js";
27
+ const BASE_URL = (process.env.X402_BASE_URL || "https://x402.agentutility.ai").replace(/\/$/, "");
28
+ const RPC_URL = process.env.X402_RPC_URL || "https://mainnet.base.org";
29
+ const PK = process.env.X402_PRIVATE_KEY;
30
+ if (!PK) {
31
+ console.error(`[@agentutility/mcp-${CLUSTER_SLUG}] FATAL: X402_PRIVATE_KEY env var is required.`);
32
+ console.error("Set it to a hex-encoded EVM private key with USDC balance on Base (chain 8453).");
33
+ console.error("USDC on Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
34
+ process.exit(1);
35
+ }
36
+ const account = privateKeyToAccount((PK.startsWith("0x") ? PK : `0x${PK}`));
37
+ const publicClient = createPublicClient({
38
+ chain: base,
39
+ transport: http(RPC_URL),
40
+ });
41
+ const signer = toClientEvmSigner(account, publicClient);
42
+ const client = new x402Client().register("eip155:8453", new ExactEvmScheme(signer));
43
+ const paidFetch = wrapFetchWithPayment(fetch, client);
44
+ async function trackedFetch(url, init) {
45
+ const headers = new Headers(init?.headers);
46
+ headers.set("X-Agent-Channel", `mcp-stdio-${CLUSTER_SLUG}`);
47
+ headers.set("X-Agent-Id", "47167");
48
+ if (!headers.has("User-Agent")) {
49
+ headers.set("User-Agent", `agentutility-mcp/${CLUSTER_SLUG}/${VERSION}`);
50
+ }
51
+ return paidFetch(url, { ...init, headers });
52
+ }
53
+ const server = new Server({ name: `agentutility-${CLUSTER_SLUG}`, version: VERSION }, { capabilities: { tools: {} } });
54
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
55
+ tools: TOOLS.map((t) => ({
56
+ name: t.name,
57
+ description: t.description,
58
+ inputSchema: t.input_schema,
59
+ })),
60
+ }));
61
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
62
+ const name = req.params.name;
63
+ const tool = TOOLS.find((t) => t.name === name);
64
+ if (!tool) {
65
+ return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
66
+ }
67
+ try {
68
+ const res = await trackedFetch(`${BASE_URL}/${tool.http_name}`, {
69
+ method: "POST",
70
+ headers: { "Content-Type": "application/json" },
71
+ body: JSON.stringify(req.params.arguments ?? {}),
72
+ });
73
+ const body = await res.text();
74
+ if (!res.ok) {
75
+ return { content: [{ type: "text", text: `HTTP ${res.status}: ${body}` }], isError: true };
76
+ }
77
+ return { content: [{ type: "text", text: body }] };
78
+ }
79
+ catch (err) {
80
+ return {
81
+ content: [{ type: "text", text: `tool call failed: ${err instanceof Error ? err.message : String(err)}` }],
82
+ isError: true,
83
+ };
84
+ }
85
+ });
86
+ await server.connect(new StdioServerTransport());
@@ -0,0 +1,151 @@
1
+ /** Auto-generated by scripts/generate-mcp-clusters.mjs. Do not edit by hand. */
2
+ export const CLUSTER_SLUG = "retail";
3
+ export const VERSION = "0.1.0";
4
+ export const TOOLS = [
5
+ {
6
+ "name": "find-products",
7
+ "http_name": "find-products",
8
+ "description": "(0.02 USDC/call) Find products API (alias of product-search). Returns ranked product results with buy links, retailer, snippet, and detected price for a shopping query. Backed by Decodo Google search scoped to buy intent.",
9
+ "method": "POST",
10
+ "input_schema": {
11
+ "type": "object",
12
+ "properties": {
13
+ "query": {
14
+ "type": "string",
15
+ "description": "Product to find. Max 300 chars."
16
+ },
17
+ "num_results": {
18
+ "type": "number",
19
+ "description": "Results to return, 1-20. Default 10."
20
+ },
21
+ "retailer": {
22
+ "type": "string",
23
+ "description": "Optional retailer/domain to scope to."
24
+ }
25
+ },
26
+ "required": [
27
+ "query"
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "name": "product-describe",
33
+ "http_name": "product-describe",
34
+ "description": "(0.01 USDC/call) Product description generator / e-commerce copywriter / product listing copy / selling points API. Given a product name (and optional category, audience, attributes), returns a conversion-focused description, bullet selling points, key features, a positioning angle, and suggested listing titles. LLM-backed (Morpheus primary, Venice fallback). Generates copy from supplied facts; does not invent specs or claims.",
35
+ "method": "POST",
36
+ "input_schema": {
37
+ "type": "object",
38
+ "properties": {
39
+ "product": {
40
+ "type": "string",
41
+ "description": "Product name or short description. Required, max 2000 chars."
42
+ },
43
+ "category": {
44
+ "type": "string",
45
+ "description": "Optional product category, e.g. 'running shoes'."
46
+ },
47
+ "audience": {
48
+ "type": "string",
49
+ "description": "Optional target audience."
50
+ },
51
+ "attributes": {
52
+ "type": "array",
53
+ "description": "Optional known attributes/features (strings)."
54
+ },
55
+ "tone": {
56
+ "type": "string",
57
+ "description": "Optional copy tone, e.g. 'premium', 'playful'."
58
+ }
59
+ },
60
+ "required": [
61
+ "product"
62
+ ]
63
+ }
64
+ },
65
+ {
66
+ "name": "product-description",
67
+ "http_name": "product-description",
68
+ "description": "(0.01 USDC/call) Product description API (alias of product-describe). Turns a product name + attributes into a marketing-ready description, selling points, key features, and listing titles. LLM-backed; copy from supplied facts only.",
69
+ "method": "POST",
70
+ "input_schema": {
71
+ "type": "object",
72
+ "properties": {
73
+ "product": {
74
+ "type": "string",
75
+ "description": "Product name or short description. Required, max 2000 chars."
76
+ },
77
+ "category": {
78
+ "type": "string",
79
+ "description": "Optional product category."
80
+ },
81
+ "audience": {
82
+ "type": "string",
83
+ "description": "Optional target audience."
84
+ },
85
+ "attributes": {
86
+ "type": "array",
87
+ "description": "Optional known attributes/features (strings)."
88
+ },
89
+ "tone": {
90
+ "type": "string",
91
+ "description": "Optional copy tone."
92
+ }
93
+ },
94
+ "required": [
95
+ "product"
96
+ ]
97
+ }
98
+ },
99
+ {
100
+ "name": "product-search",
101
+ "http_name": "product-search",
102
+ "description": "(0.02 USDC/call) Product search / shopping search API / find products + buy links for agents. Given a product query (and optional retailer), returns ranked shopping results with product title, buy link, retailer domain, snippet, and any detected price. Backed by Decodo Google search scoped to buy intent. For general web search use search/web-search.",
103
+ "method": "POST",
104
+ "input_schema": {
105
+ "type": "object",
106
+ "properties": {
107
+ "query": {
108
+ "type": "string",
109
+ "description": "Product to find, e.g. 'noise cancelling headphones under 200'. Max 300 chars."
110
+ },
111
+ "num_results": {
112
+ "type": "number",
113
+ "description": "Results to return, 1-20. Default 10."
114
+ },
115
+ "retailer": {
116
+ "type": "string",
117
+ "description": "Optional retailer/domain to scope to, e.g. 'amazon.com'."
118
+ }
119
+ },
120
+ "required": [
121
+ "query"
122
+ ]
123
+ }
124
+ },
125
+ {
126
+ "name": "shop-search",
127
+ "http_name": "shop-search",
128
+ "description": "(0.02 USDC/call) Shopping search API (alias of product-search). Find products and buy links for a query with title, buy link, retailer, snippet, and detected price. Backed by Decodo Google search scoped to buy intent.",
129
+ "method": "POST",
130
+ "input_schema": {
131
+ "type": "object",
132
+ "properties": {
133
+ "query": {
134
+ "type": "string",
135
+ "description": "Product to find. Max 300 chars."
136
+ },
137
+ "num_results": {
138
+ "type": "number",
139
+ "description": "Results to return, 1-20. Default 10."
140
+ },
141
+ "retailer": {
142
+ "type": "string",
143
+ "description": "Optional retailer/domain to scope to."
144
+ }
145
+ },
146
+ "required": [
147
+ "query"
148
+ ]
149
+ }
150
+ }
151
+ ];
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@agentutility/mcp-retail",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for the @agentutility retail cluster — pay-per-call x402 tools, no API keys, USDC on Base.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "bin": {
9
+ "agentutility-mcp-retail": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/rooz21/x402",
18
+ "directory": "packages/mcp-retail"
19
+ },
20
+ "homepage": "https://mcp.agentutility.ai/retail/",
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "keywords": [
26
+ "mcp",
27
+ "model-context-protocol",
28
+ "x402",
29
+ "agentutility",
30
+ "agent-tools",
31
+ "retail"
32
+ ],
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "^1.0.4",
35
+ "@x402/fetch": "^2.12.0",
36
+ "@x402/evm": "^2.12.0",
37
+ "viem": "^2.21.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^22.0.0",
41
+ "typescript": "^5.5.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=18"
45
+ }
46
+ }