Skip to main content
Glama

IT Tools MCP Server

index.ts•1.98 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; export function registerCurl(server: McpServer) { server.registerTool("curl", { description: "Make HTTP requests to web endpoints. Example: GET request to an API or POST data to a server", inputSchema: { url: z.string().describe("URL to request"), method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"]).default("GET").describe("HTTP method"), headers: z.record(z.string()).optional().describe("Request headers (object of key-value pairs)"), body: z.string().optional().describe("Request body (for POST/PUT/PATCH)") }, // VS Code compliance annotations annotations: { title: "Curl", description: "Make HTTP requests to web endpoints", readOnlyHint: false } }, async ({ url, method, headers, body }) => { try { const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), 10000); const response = await fetch(url, { method, headers: headers || {}, body: body && ["POST", "PUT", "PATCH"].includes(method) ? body : undefined, signal: controller.signal, }); clearTimeout(timeoutId); const responseText = await response.text(); return { content: [ { type: "text", text: `Status: ${response.status} ${response.statusText}` }, { type: "text", text: `Headers:\n${JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2)}` }, { type: "text", text: `Body:\n${responseText}` } ] }; } catch (error: any) { if (error.name === 'AbortError') { return { isError: true, content: [{ type: "text", text: `curl failed: Request timeout (10s)` }] }; } return { content: [{ type: "text", text: `curl failed: ${error.message || error}` }] }; } } ); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wrenchpilot/it-tools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server