gadgethumans-mcp 1.1.0 → 1.2.1

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.
Files changed (2) hide show
  1. package/index.js +29 -3
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -17,13 +17,29 @@ import {
17
17
  ListToolsRequestSchema,
18
18
  } from "@modelcontextprotocol/sdk/types.js";
19
19
 
20
+ const VERSION = require("./package.json").version;
20
21
  const ENDPOINT = process.env.MCP_ENDPOINT || "https://api.gadgethumans.com/mcp";
21
22
  const API_KEY =
22
23
  process.env.GADGETHUMANS_API_KEY || process.env.GADGETHUMANS_CREDITS_KEY || "";
23
24
  const BUY_URL = "https://api.gadgethumans.com/buy-credits";
25
+ const REST_BASE = process.env.GADGETHUMANS_REST || "https://api.gadgethumans.com";
26
+
27
+ // A 402 is the moment a caller decides whether we are real. Give it a ready-to-run
28
+ // proof call instead of a pricing lecture: most tool names are the REST route's own
29
+ // slug, so the same tool can be answered free (3/day per IP) with ?trial=1.
30
+ function trialUrl(name, args) {
31
+ if (!/^[a-z0-9][a-z0-9._-]{0,60}$/i.test(name || "")) return "";
32
+ const qs = new URLSearchParams();
33
+ for (const [k, v] of Object.entries(args || {})) {
34
+ if (v === undefined || v === null || typeof v === "object") continue;
35
+ qs.set(k, String(v));
36
+ }
37
+ qs.set("trial", "1");
38
+ return `${REST_BASE}/${name}?${qs.toString()}`;
39
+ }
24
40
 
25
41
  const server = new Server(
26
- { name: "gadgethumans-mcp", version: "1.1.0" },
42
+ { name: "gadgethumans-mcp", version: "1.2.0" },
27
43
  { capabilities: { tools: {} } }
28
44
  );
29
45
 
@@ -33,6 +49,9 @@ function rpcHeaders() {
33
49
  const h = {
34
50
  "Content-Type": "application/json",
35
51
  Accept: "application/json, text/event-stream",
52
+ // Identify the channel: without a UA every install lands in our "other" bucket and gets no
53
+ // trial, which is exactly how 1,597 installs/week produced zero calls.
54
+ "User-Agent": "gadgethumans-mcp/" + VERSION + " (agent-runtime; mcp-host; node)",
36
55
  };
37
56
  if (API_KEY) h["x-api-key"] = API_KEY;
38
57
  return h;
@@ -88,11 +107,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
88
107
  const { res, text } = await rpc("tools/call", { name, arguments: args || {} });
89
108
 
90
109
  if (res.status === 402) {
110
+ const free = trialUrl(name, args);
91
111
  const hint = API_KEY
92
- ? `The credits key on this install has no balance left. Top up at ${BUY_URL}?pack=500 ($5 = 500 calls) and set GADGETHUMANS_API_KEY to the key it returns.`
112
+ ? [
113
+ `The credits key on this install has no balance left. Top up at ${BUY_URL}?pack=500 ($5 = 500 calls) and set GADGETHUMANS_API_KEY to the key it returns.`,
114
+ free ? `\nOr check the answer for free (3 calls/day per IP, no key, no wallet):\n curl "${free}"` : "",
115
+ ].join("\n")
93
116
  : [
94
- "This tool is priced per call. Two ways to pay:",
117
+ "This tool is priced per call. Two ways to pay — and one way to check us for free:",
95
118
  "",
119
+ free
120
+ ? `0. Free proof call, right now — 3 answered calls/day per IP, no key, no wallet:\n curl "${free}"\n`
121
+ : "",
96
122
  "1. Prepaid credits — works in any MCP client, no wallet needed:",
97
123
  ` buy at ${BUY_URL}?pack=500 ($5 = 500 calls; 1 credit = $0.01)`,
98
124
  " the purchase returns an api_key; set it and restart:",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gadgethumans-mcp",
3
- "version": "1.1.0",
4
- "description": "MCP server for the GadgetHumans API: 216 tools in one install (ocr, ens, token safety, translate, sentiment, whois, hash, geocode, dns, weather, vat, timezone, ip, search, and a free x402 catalogue search ranked by measured 30-day call volume). Prepaid credits key or x402 USDC on Base.",
3
+ "version": "1.2.1",
4
+ "description": "MCP server for the GadgetHumans API: 226 tools in one install (ocr, ens, token safety, translate, sentiment, whois, hash, geocode, dns, weather, vat, timezone, ip, search, and a free x402 catalogue search ranked by measured 30-day call volume). Prepaid credits key or x402 USDC on Base.",
5
5
  "mcpName": "com.gadgethumans/gadgethumans-mcp",
6
6
  "type": "module",
7
7
  "main": "index.js",