@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
51 lines (50 loc) • 2.53 kB
TypeScript
/**
* Remote registry helpers for MCPRegistryClient
*
* Pure functions that resolve a registry configuration to an API base URL,
* validate responses from the official MCP Registry API (`/v0.1`) and map its
* server records to `McpRegistryEntry`. Nothing here performs I/O.
*
* API reference (spec `2025-12-01`):
* https://github.com/modelcontextprotocol/registry/blob/main/docs/reference/api/openapi.yaml
*
* @module mcp/mcpRegistryRemote
*/
import type { McpRegistryEntry, RegistryConfig, RemoteRegistryPage, RemoteRegistryRecord, RemoteRegistryTarget } from "../types/index.js";
/**
* Base URL of the official MCP Registry
*/
export declare const OFFICIAL_REGISTRY_URL = "https://registry.modelcontextprotocol.io";
/**
* Resolve a registry configuration to the API base URL the client queries.
*
* Returns `undefined` for registries the client does not query: `npm` and
* `github` sources, a `custom` registry without a URL, any URL that is not
* plain `http(s)` or that embeds credentials (fetch rejects those, and they
* would end up in logs), and a registry with an `authToken` on plain `http:`
* to a non-loopback host (the bearer token would cross the network in clear).
*/
export declare function resolveRemoteTarget(config: RegistryConfig): RemoteRegistryTarget | undefined;
/**
* Validate one `ServerResponse` (`{ server, _meta }`) from the registry.
* Returns `undefined` when it carries no usable server, so a bad record can
* be skipped without discarding its neighbours.
*/
export declare function parseRemoteRecord(value: unknown): RemoteRegistryRecord | undefined;
/**
* Validate a `ServerList` response (`{ servers, metadata: { nextCursor } }`).
* Throws when `servers` is not an array, which the caller reports as a
* malformed registry; individual bad records are skipped.
*/
export declare function parseRemotePage(value: unknown): RemoteRegistryPage;
/**
* Map a registry record to a catalog entry.
*
* Remote entries are never `verified`: that flag means "reviewed by NeuroLink"
* for the built-in catalog, and the registry's contents are the publishers'
* own claims. Only an `npm` package whose identifier and version are valid
* npm names gets a runnable `command`; anything else (other package types such
* as pypi, oci or nuget, or an npm package with a malformed identifier or
* version) is listed in `metadata.packages` only, for the caller to act on.
*/
export declare function mapRemoteRecord(record: RemoteRegistryRecord, apiBase: string): McpRegistryEntry;