Skip to main content
Glama
tanamurayuuki

Gemini URL Context & Search MCP Server

Url.ts1.22 kB
import { InvalidUrlError, UnsupportedProtocolError } from './DomainError.js'; export class Url { private readonly url: URL; private constructor(url: URL) { this.url = url; } static create(urlString: string): Url { if (!urlString.trim()) { throw new InvalidUrlError(urlString); } let url: URL; try { url = new URL(urlString); } catch (cause) { throw new InvalidUrlError(urlString, cause as Error); } if (url.protocol !== 'http:' && url.protocol !== 'https:') { throw new UnsupportedProtocolError(url.protocol); } // Convert http to https if (url.protocol === 'http:') { url.protocol = 'https:'; } // Remove trailing slash from pathname (but keep it for root) if (url.pathname !== '/' && url.pathname.endsWith('/')) { url.pathname = url.pathname.slice(0, -1); } return new Url(url); } toString(): string { return this.url.toString(); } equals(other: Url): boolean { return this.toString() === other.toString(); } get domain(): string { return this.url.host; } get pathname(): string { return this.url.pathname; } get origin(): string { return this.url.origin; } }

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/tanamurayuuki/MCP-URLcontext'

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