gadgethumans-mcp 1.1.0 → 1.2.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/index.js +25 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -21,9 +21,24 @@ const ENDPOINT = process.env.MCP_ENDPOINT || "https://api.gadgethumans.com/mcp";
|
|
|
21
21
|
const API_KEY =
|
|
22
22
|
process.env.GADGETHUMANS_API_KEY || process.env.GADGETHUMANS_CREDITS_KEY || "";
|
|
23
23
|
const BUY_URL = "https://api.gadgethumans.com/buy-credits";
|
|
24
|
+
const REST_BASE = process.env.GADGETHUMANS_REST || "https://api.gadgethumans.com";
|
|
25
|
+
|
|
26
|
+
// A 402 is the moment a caller decides whether we are real. Give it a ready-to-run
|
|
27
|
+
// proof call instead of a pricing lecture: most tool names are the REST route's own
|
|
28
|
+
// slug, so the same tool can be answered free (3/day per IP) with ?trial=1.
|
|
29
|
+
function trialUrl(name, args) {
|
|
30
|
+
if (!/^[a-z0-9][a-z0-9._-]{0,60}$/i.test(name || "")) return "";
|
|
31
|
+
const qs = new URLSearchParams();
|
|
32
|
+
for (const [k, v] of Object.entries(args || {})) {
|
|
33
|
+
if (v === undefined || v === null || typeof v === "object") continue;
|
|
34
|
+
qs.set(k, String(v));
|
|
35
|
+
}
|
|
36
|
+
qs.set("trial", "1");
|
|
37
|
+
return `${REST_BASE}/${name}?${qs.toString()}`;
|
|
38
|
+
}
|
|
24
39
|
|
|
25
40
|
const server = new Server(
|
|
26
|
-
{ name: "gadgethumans-mcp", version: "1.
|
|
41
|
+
{ name: "gadgethumans-mcp", version: "1.2.0" },
|
|
27
42
|
{ capabilities: { tools: {} } }
|
|
28
43
|
);
|
|
29
44
|
|
|
@@ -88,11 +103,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
88
103
|
const { res, text } = await rpc("tools/call", { name, arguments: args || {} });
|
|
89
104
|
|
|
90
105
|
if (res.status === 402) {
|
|
106
|
+
const free = trialUrl(name, args);
|
|
91
107
|
const hint = API_KEY
|
|
92
|
-
?
|
|
108
|
+
? [
|
|
109
|
+
`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.`,
|
|
110
|
+
free ? `\nOr check the answer for free (3 calls/day per IP, no key, no wallet):\n curl "${free}"` : "",
|
|
111
|
+
].join("\n")
|
|
93
112
|
: [
|
|
94
|
-
"This tool is priced per call. Two ways to pay:",
|
|
113
|
+
"This tool is priced per call. Two ways to pay — and one way to check us for free:",
|
|
95
114
|
"",
|
|
115
|
+
free
|
|
116
|
+
? `0. Free proof call, right now — 3 answered calls/day per IP, no key, no wallet:\n curl "${free}"\n`
|
|
117
|
+
: "",
|
|
96
118
|
"1. Prepaid credits — works in any MCP client, no wallet needed:",
|
|
97
119
|
` buy at ${BUY_URL}?pack=500 ($5 = 500 calls; 1 credit = $0.01)`,
|
|
98
120
|
" 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.
|
|
4
|
-
"description": "MCP server for the GadgetHumans API:
|
|
3
|
+
"version": "1.2.0",
|
|
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",
|