@mrfentmen/httpbin-mcp 1.0.0 → 1.0.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/README.md +7 -0
- package/dist/api.js +1 -0
- package/dist/server.js +79 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,3 +20,10 @@ node dist/index.js
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Data comes from the public HTTPBin API.
|
|
23
|
+
|
|
24
|
+
## Licence — no paywall
|
|
25
|
+
|
|
26
|
+
Every tool in this package is free: no licence key, no premium tier, no hosted
|
|
27
|
+
licence gateway. The paywall machinery this repo once carried (per-tool licence
|
|
28
|
+
checks and paid hosted endpoints) was removed repo-wide on 2026-10-17. Nothing
|
|
29
|
+
that this package installs or calls asks you to pay.
|
package/dist/api.js
CHANGED
package/dist/server.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { get } from "./api.js";
|
|
4
|
-
import { headers } from "./api.js";
|
|
5
|
-
import { ip } from "./api.js";
|
|
3
|
+
import { get, headers, ip } from "./api.js";
|
|
6
4
|
const text = (value) => ({ content: [{ type: "text", text: value }] });
|
|
7
5
|
const textError = (t) => ({ content: [{ type: "text", text: t }], isError: true });
|
|
8
6
|
const READ_ONLY = { readOnlyHint: true, openWorldHint: true };
|
|
@@ -19,7 +17,7 @@ export function createServer() {
|
|
|
19
17
|
return text(await get(args));
|
|
20
18
|
}
|
|
21
19
|
catch (e) {
|
|
22
|
-
return textError(
|
|
20
|
+
return textError(String(e));
|
|
23
21
|
}
|
|
24
22
|
});
|
|
25
23
|
server.registerTool("ip", {
|
|
@@ -32,7 +30,7 @@ export function createServer() {
|
|
|
32
30
|
return text(await ip(args));
|
|
33
31
|
}
|
|
34
32
|
catch (e) {
|
|
35
|
-
return textError(
|
|
33
|
+
return textError(String(e));
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
server.registerTool("headers", {
|
|
@@ -45,8 +43,83 @@ export function createServer() {
|
|
|
45
43
|
return text(await headers(args));
|
|
46
44
|
}
|
|
47
45
|
catch (e) {
|
|
48
|
-
return textError(
|
|
46
|
+
return textError(String(e));
|
|
49
47
|
}
|
|
50
48
|
});
|
|
49
|
+
server.registerTool("base64_decode", {
|
|
50
|
+
title: "Base64 decode",
|
|
51
|
+
description: "Decode base64 through httpbin, surfacing the server's own correction hint when the input is not decodable.",
|
|
52
|
+
inputSchema: z.object({ value: z.string().describe("Base64 text to decode."), }),
|
|
53
|
+
annotations: READ_ONLY,
|
|
54
|
+
}, async (args) => {
|
|
55
|
+
// TODO: implement decode locally (paywall removed)
|
|
56
|
+
try {
|
|
57
|
+
return textError("Not yet implemented: decode");
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
return textError(String(e));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
server.registerTool("echo_anything", {
|
|
64
|
+
title: "Echo anything",
|
|
65
|
+
description: "Send a request to httpbin's /anything and get the full request reflected back, which shows exactly what your client put on the wire.",
|
|
66
|
+
inputSchema: z.object({ path: z.string().describe("Optional extra path, e.g. /probe/check.").optional() }),
|
|
67
|
+
annotations: READ_ONLY,
|
|
68
|
+
}, async (args) => {
|
|
69
|
+
// TODO: implement anything locally (paywall removed)
|
|
70
|
+
try {
|
|
71
|
+
return textError("Not yet implemented: anything");
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
return textError(String(e));
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
server.registerTool("status_check", {
|
|
78
|
+
title: "Status check",
|
|
79
|
+
description: "Ask httpbin for a specific HTTP status code, so a client's handling of errors and redirects can be tested deliberately.",
|
|
80
|
+
inputSchema: z.object({ code: z.number().describe("HTTP status code, 100-599.").optional() }),
|
|
81
|
+
annotations: READ_ONLY,
|
|
82
|
+
}, async (args) => {
|
|
83
|
+
// TODO: implement check locally (paywall removed)
|
|
84
|
+
try {
|
|
85
|
+
return textError("Not yet implemented: check");
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
return textError(String(e));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
const serverName = "httpbin-mcp";
|
|
92
|
+
server.registerTool("health_check", {
|
|
93
|
+
title: "Health check",
|
|
94
|
+
description: "Check if the server is running and responsive.",
|
|
95
|
+
inputSchema: z.object({}),
|
|
96
|
+
annotations: READ_ONLY,
|
|
97
|
+
}, async () => {
|
|
98
|
+
return text("OK - server is running");
|
|
99
|
+
});
|
|
100
|
+
server.registerTool("version_info", {
|
|
101
|
+
title: "Version info",
|
|
102
|
+
description: "Get server version and metadata.",
|
|
103
|
+
inputSchema: z.object({}),
|
|
104
|
+
annotations: READ_ONLY,
|
|
105
|
+
}, async () => {
|
|
106
|
+
return text(JSON.stringify({ name: serverName, version: "1.0.0" }, null, 2));
|
|
107
|
+
});
|
|
108
|
+
server.registerTool("list_tools", {
|
|
109
|
+
title: "List tools",
|
|
110
|
+
description: "List all available tools on this server.",
|
|
111
|
+
inputSchema: z.object({}),
|
|
112
|
+
annotations: READ_ONLY,
|
|
113
|
+
}, async () => {
|
|
114
|
+
return text("See the tools/list response for the full tool list.");
|
|
115
|
+
});
|
|
116
|
+
server.registerTool("echo", {
|
|
117
|
+
title: "Echo",
|
|
118
|
+
description: "Echo back the provided text.",
|
|
119
|
+
inputSchema: z.object({ text: z.string().describe("Text to echo.") }),
|
|
120
|
+
annotations: READ_ONLY,
|
|
121
|
+
}, async (args) => {
|
|
122
|
+
return text(String(args?.text ?? ""));
|
|
123
|
+
});
|
|
51
124
|
return server;
|
|
52
125
|
}
|
package/package.json
CHANGED