Skip to main content
Glama

Travel Agent MCP Server

by nxGnosis
http.tsâ€ĸ823 B
import type { z } from "zod"; export class HttpError extends Error { constructor( public readonly status: number, message: string, public readonly data?: unknown, ) { super(message); this.name = "HttpError"; } } export async function fetchJson<T>( url: string, options?: RequestInit, schema?: z.ZodType<T>, ): Promise<T> { const response = await fetch(url, options); if (!response.ok) { throw new HttpError( response.status, `HTTP error ${response.status}: ${response.statusText}`, await response.text().catch(() => undefined), ); } const data = await response.json(); if (schema) { try { return schema.parse(data); } catch (error) { throw new Error( `Invalid response data: ${error instanceof Error ? error.message : String(error)}`, ); } } return data as T; }

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/nxGnosis/TravelAgentMCP'

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