credentialsUsableFor (services/credential-binding.ts)

mcp-compress-router · src/services/credential-binding.ts · typescript · MIT
auth

TypeScript utilities for validating and binding stored credentials against server URLs and issuers.

// Source: https://github.com/ameshkov/mcp-compress-router | License: MIT | Copyright 2026 Andrey Meshkov
// Provided via justclaw.it.com; keep this notice with the code.
import type { StoredCredentials } from '../utils/index.js';

/**
 * Normalizes a server URL for credential-binding comparison. The
 * canonical `URL.href` form lowercases the host, drops a default port,
 * and adds the trailing slash of an origin URL, so equivalent spellings
 * compare equal. A trailing slash on a non-origin path stays
 * significant: `https://example.com/mcp` and
 * `https://example.com/mcp/` are different endpoints.
 *
 * @param url - The server URL to normalize.
 * @returns The normalized URL, or undefined when the input is absent or
 *   not a valid absolute URL.
 */
function normalizeServerUrl(url: s

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key