@mrfentmen/httpbin-mcp 1.0.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/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # HTTPBin MCP
2
+
3
+ HTTP request testing from the public HTTPBin API. No key required.
4
+
5
+ This file is self contained. It reads public data only and never writes to the machine. All output is bounded and honest about what could not be fetched.
6
+
7
+ ## Tools
8
+
9
+
10
+ * `get` GET echo.
11
+ * `ip` Outbound IP.
12
+ * `headers` Headers echo.
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ npm install
18
+ npm run build
19
+ node dist/index.js
20
+ ```
21
+
22
+ Data comes from the public HTTPBin API.
package/dist/api.js ADDED
@@ -0,0 +1,35 @@
1
+ const BASE = 'https://httpbin.org';
2
+ export async function get(args) {
3
+ const path = (args.path ?? '').trim().replace(/^\//, '');
4
+ if (!path)
5
+ return 'Provide an endpoint path.';
6
+ const res = await fetch(`${BASE}/${path}`, {
7
+ headers: { 'User-Agent': 'mrfentmen-httpbin-mcp/1.0', Accept: 'application/json' },
8
+ signal: AbortSignal.timeout(20000),
9
+ });
10
+ if (!res.ok)
11
+ throw new Error(`HTTPBin returned ${res.status}`);
12
+ const d = await res.text();
13
+ return `HTTPBin GET /${path} -> ${res.status}\n${d.slice(0, 600)}`;
14
+ }
15
+ export async function ip(_args) {
16
+ const res = await fetch(`${BASE}/ip`, {
17
+ headers: { 'User-Agent': 'mrfentmen-httpbin-mcp/1.0', Accept: 'application/json' },
18
+ signal: AbortSignal.timeout(20000),
19
+ });
20
+ if (!res.ok)
21
+ throw new Error(`HTTPBin returned ${res.status}`);
22
+ const d = (await res.json());
23
+ return `Outbound IP: ${String(d.origin ?? 'unknown')}`;
24
+ }
25
+ export async function headers(_args) {
26
+ const res = await fetch(`${BASE}/headers`, {
27
+ headers: { 'User-Agent': 'mrfentmen-httpbin-mcp/1.0', Accept: 'application/json' },
28
+ signal: AbortSignal.timeout(20000),
29
+ });
30
+ if (!res.ok)
31
+ throw new Error(`HTTPBin returned ${res.status}`);
32
+ const d = (await res.json());
33
+ const h = d.headers ?? {};
34
+ return 'Request headers:\n' + Object.entries(h).map(([k, v]) => `${k}: ${String(v)}`).join('\n');
35
+ }
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
+ import { createServer } from "./server.js";
3
+ const main = async () => { const server = createServer(); await server.connect(new StdioServerTransport()); };
4
+ main().catch((error) => { console.error("Fatal error:", error); process.exit(1); });
package/dist/server.js ADDED
@@ -0,0 +1,52 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { z } from "zod";
3
+ import { get } from "./api.js";
4
+ import { headers } from "./api.js";
5
+ import { ip } from "./api.js";
6
+ const text = (value) => ({ content: [{ type: "text", text: value }] });
7
+ const textError = (t) => ({ content: [{ type: "text", text: t }], isError: true });
8
+ const READ_ONLY = { readOnlyHint: true, openWorldHint: true };
9
+ const error = (e) => `Error: ${e instanceof Error ? e.message : String(e)}`;
10
+ export function createServer() {
11
+ const server = new McpServer({ name: "httpbin-mcp", version: "1.0.0" });
12
+ server.registerTool("get", {
13
+ title: "Get",
14
+ description: "Send a GET request and see echo.",
15
+ inputSchema: z.object({ path: z.string().describe("Endpoint path.") }),
16
+ annotations: READ_ONLY,
17
+ }, async (args) => {
18
+ try {
19
+ return text(await get(args));
20
+ }
21
+ catch (e) {
22
+ return textError(error(e));
23
+ }
24
+ });
25
+ server.registerTool("ip", {
26
+ title: "Ip",
27
+ description: "Your outbound IP.",
28
+ inputSchema: z.object({}),
29
+ annotations: READ_ONLY,
30
+ }, async (args) => {
31
+ try {
32
+ return text(await ip(args));
33
+ }
34
+ catch (e) {
35
+ return textError(error(e));
36
+ }
37
+ });
38
+ server.registerTool("headers", {
39
+ title: "Headers",
40
+ description: "Request headers echo.",
41
+ inputSchema: z.object({}),
42
+ annotations: READ_ONLY,
43
+ }, async (args) => {
44
+ try {
45
+ return text(await headers(args));
46
+ }
47
+ catch (e) {
48
+ return textError(error(e));
49
+ }
50
+ });
51
+ return server;
52
+ }
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "type": "module",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/mrfentmen/httpbin-mcp.git"
7
+ },
8
+ "bin": {
9
+ "httpbin-mcp": "./dist/index.js"
10
+ },
11
+ "main": "./dist/index.js",
12
+ "files": [
13
+ "dist",
14
+ "server.json",
15
+ "README.md"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc -p tsconfig.json",
19
+ "start": "node dist/index.js",
20
+ "dev": "npm run build && node dist/index.js"
21
+ },
22
+ "license": "MIT",
23
+ "dependencies": {
24
+ "@modelcontextprotocol/sdk": "^1.0.4",
25
+ "zod": "^3.23.8"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^22.0.0",
29
+ "typescript": "^5.6.0"
30
+ },
31
+ "name": "@mrfentmen/httpbin-mcp",
32
+ "description": "HTTP request testing from HTTPBin. No key required.",
33
+ "mcpName": "io.github.mrfentmen/httpbin-mcp",
34
+ "keywords": [
35
+ "mcp",
36
+ "httpbin",
37
+ "http",
38
+ "testing",
39
+ "dev"
40
+ ],
41
+ "engines": {
42
+ "node": ">=20"
43
+ }
44
+ }
package/server.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.mrfentmen/httpbin-mcp",
4
+ "description": "HTTP request testing from HTTPBin. No key required.",
5
+ "repository": {
6
+ "url": "https://github.com/mrfentmen/httpbin-mcp",
7
+ "source": "github"
8
+ },
9
+ "version": "1.0.0",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "@mrfentmen/httpbin-mcp",
14
+ "version": "1.0.0",
15
+ "transport": {
16
+ "type": "stdio"
17
+ }
18
+ }
19
+ ]
20
+ }