Skip to main content
Glama
natashanajdovski

Service Health MCP Server

check_http_endpoint

Monitor HTTP/HTTPS endpoint health by testing connectivity, measuring response time, and validating status codes. Ideal for ensuring APIs, websites, and web services are responsive and operational.

Instructions

Check if an HTTP/HTTPS endpoint is healthy and responsive. This tool will test connectivity, measure response time, and validate status codes. Perfect for monitoring APIs, websites, and web services.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expectedStatusNoExpected HTTP status code
headersNoOptional HTTP headers to include
methodNoHTTP method to useGET
timeoutNoRequest timeout in milliseconds
urlYesThe URL to check (e.g., https://google.com)

Implementation Reference

  • The core handler function that executes the tool: validates input using Zod schema, converts parameters, calls HttpHealthChecker.checkEndpoint, formats the result, and handles errors.
    async execute(params: CheckHttpEndpointParams): Promise<string> { try { // Validate the input parameters const validatedParams = CheckHttpEndpointSchema.parse(params); // Convert to the format our health checker expects const checkOptions: HttpCheckOptions = { url: validatedParams.url, method: validatedParams.method, timeout: validatedParams.timeout, expectedStatus: validatedParams.expectedStatus, headers: validatedParams.headers }; // Perform the actual health check const result = await this.healthChecker.checkEndpoint(checkOptions); // Format the response in a way that's helpful for Claude and users return this.formatHealthCheckResponse(result); } catch (error) { // Handle validation errors or unexpected issues if (error instanceof z.ZodError) { const issues = error.errors.map(err => `${err.path.join('.')}: ${err.message}`).join(', '); return `❌ Input validation failed: ${issues}`; } return `❌ Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}`; } }
  • Zod schema used for runtime validation of tool input parameters.
    const CheckHttpEndpointSchema = z.object({ url: SecureUrlSchema .describe('The URL to check (e.g., https://google.com)'), method: z.enum(['GET', 'POST', 'PUT', 'DELETE']) .optional() .default('GET') .describe('HTTP method to use'), timeout: z.number() .min(1000, 'Timeout must be at least 1 second') .max(30000, 'Timeout cannot exceed 30 seconds') .optional() .default(10000) .describe('Request timeout in milliseconds'), expectedStatus: z.number() .min(100) .max(599) .optional() .default(200) .describe('Expected HTTP status code'), headers: z.record(z.string()) .optional() .describe('Optional HTTP headers to include') });
  • Static method providing the MCP tool definition, including name, description, and JSON inputSchema.
    static getDefinition() { console.error('🔧 DEBUG: getDefinition() called!'); return { name: 'check_http_endpoint', description: 'Check if an HTTP/HTTPS endpoint is healthy and responsive. ' + 'This tool will test connectivity, measure response time, and validate status codes. ' + 'Perfect for monitoring APIs, websites, and web services.', inputSchema: { type: 'object', properties: { url: { type: 'string', format: 'uri', description: 'The URL to check (e.g., https://google.com)' }, method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE'], default: 'GET', description: 'HTTP method to use' }, timeout: { type: 'number', minimum: 1000, maximum: 30000, default: 10000, description: 'Request timeout in milliseconds' }, expectedStatus: { type: 'number', minimum: 100, maximum: 599, default: 200, description: 'Expected HTTP status code' }, headers: { type: 'object', additionalProperties: { type: 'string' }, description: 'Optional HTTP headers to include' } }, required: ['url'] } };
  • src/server.ts:55-65 (registration)
    Registers the check_http_endpoint tool in the MCP listTools request handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ CheckHttpEndpointTool.getDefinition(), // Future tools will be added here: // - check_database_connection // - check_service_health // - get_health_summary ], }; });
  • src/server.ts:75-85 (registration)
    Dispatches calls to 'check_http_endpoint' in the MCP tools/call request handler by invoking the tool's execute method.
    switch (name) { case 'check_http_endpoint': const result = await this.checkHttpTool.execute(args as any || {}); return { content: [ { type: 'text', text: result, }, ], };

Other Tools

Related Tools

Latest Blog Posts

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/natashanajdovski/service-health-mcp'

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