gadgethumans-mcp 1.2.0 → 1.2.2
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 +10 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ 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 || "";
|
|
@@ -25,7 +26,7 @@ const REST_BASE = process.env.GADGETHUMANS_REST || "https://api.gadgethumans.com
|
|
|
25
26
|
|
|
26
27
|
// A 402 is the moment a caller decides whether we are real. Give it a ready-to-run
|
|
27
28
|
// 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 (
|
|
29
|
+
// slug, so the same tool can be answered free (25/day per IP) with ?trial=1.
|
|
29
30
|
function trialUrl(name, args) {
|
|
30
31
|
if (!/^[a-z0-9][a-z0-9._-]{0,60}$/i.test(name || "")) return "";
|
|
31
32
|
const qs = new URLSearchParams();
|
|
@@ -34,11 +35,14 @@ function trialUrl(name, args) {
|
|
|
34
35
|
qs.set(k, String(v));
|
|
35
36
|
}
|
|
36
37
|
qs.set("trial", "1");
|
|
37
|
-
|
|
38
|
+
// MCP tool names use underscores; the paid routes are hyphenated. Without this the "free
|
|
39
|
+
// proof call" we hand a caller at the 402 moment answers 404 Unknown endpoint.
|
|
40
|
+
const slug = name.replace(/_/g, "-");
|
|
41
|
+
return `${REST_BASE}/${slug}?${qs.toString()}`;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
const server = new Server(
|
|
41
|
-
{ name: "gadgethumans-mcp", version: "1.2.
|
|
45
|
+
{ name: "gadgethumans-mcp", version: "1.2.2" },
|
|
42
46
|
{ capabilities: { tools: {} } }
|
|
43
47
|
);
|
|
44
48
|
|
|
@@ -48,6 +52,9 @@ function rpcHeaders() {
|
|
|
48
52
|
const h = {
|
|
49
53
|
"Content-Type": "application/json",
|
|
50
54
|
Accept: "application/json, text/event-stream",
|
|
55
|
+
// Identify the channel: without a UA every install lands in our "other" bucket and gets no
|
|
56
|
+
// trial, which is exactly how 1,597 installs/week produced zero calls.
|
|
57
|
+
"User-Agent": "gadgethumans-mcp/" + VERSION + " (agent-runtime; mcp-host; node)",
|
|
51
58
|
};
|
|
52
59
|
if (API_KEY) h["x-api-key"] = API_KEY;
|
|
53
60
|
return h;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gadgethumans-mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
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",
|