rwagenthub-mcp 1.0.5 → 1.0.7
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 +12 -10
- package/package.json +4 -2
package/index.js
CHANGED
|
@@ -41,22 +41,23 @@ async function callGateway(api, inputs) {
|
|
|
41
41
|
return res.json();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// ── Type mapper:
|
|
45
|
-
function toZod(
|
|
44
|
+
// ── Type mapper: JSON Schema property → Zod ───────────────────────────────────
|
|
45
|
+
function toZod(propName, prop, requiredList) {
|
|
46
46
|
let schema;
|
|
47
|
-
if (
|
|
47
|
+
if (prop.type === "number") {
|
|
48
48
|
schema = z.number();
|
|
49
|
-
} else if (
|
|
49
|
+
} else if (prop.type === "boolean") {
|
|
50
50
|
schema = z.boolean();
|
|
51
|
-
} else if (
|
|
51
|
+
} else if (prop.oneOf) {
|
|
52
52
|
schema = z.union([z.string(), z.array(z.string())]);
|
|
53
53
|
} else {
|
|
54
54
|
schema = z.string();
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
if (
|
|
57
|
+
if (prop.description) schema = schema.describe(prop.description);
|
|
58
|
+
const isRequired = requiredList?.includes(propName);
|
|
59
|
+
if (!isRequired) schema = schema.optional();
|
|
60
|
+
if (prop.default !== undefined) schema = schema.default(prop.default);
|
|
60
61
|
return schema;
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -73,9 +74,10 @@ async function main() {
|
|
|
73
74
|
const server = new McpServer({ name: "agenthub", version: "1.0.0" });
|
|
74
75
|
|
|
75
76
|
for (const api of apis) {
|
|
77
|
+
const { properties = {}, required: requiredList = [] } = api.inputSchema ?? {};
|
|
76
78
|
const zodShape = {};
|
|
77
|
-
for (const [fieldName,
|
|
78
|
-
zodShape[fieldName] = toZod(
|
|
79
|
+
for (const [fieldName, prop] of Object.entries(properties)) {
|
|
80
|
+
zodShape[fieldName] = toZod(fieldName, prop, requiredList);
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
server.tool(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rwagenthub-mcp",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "MCP server for AgentHub —
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "MCP server for AgentHub — 24 AI APIs (flights, weather, crypto, stocks, search, DeFi, code execution...) paid via x402 USDC on Base",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"rwagenthub-mcp": "./index.js"
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"crypto",
|
|
22
22
|
"flights",
|
|
23
23
|
"weather",
|
|
24
|
+
"stocks",
|
|
25
|
+
"finnhub",
|
|
24
26
|
"defi",
|
|
25
27
|
"base"
|
|
26
28
|
],
|