import type { MCPServerConfig } from "./types"; export type MCPPoolSharingMode = "per-session" | "shared"; export type MCPPoolTransport = "stdio" | "http" | "sse"; export type MCPPoolCapabilityProfile = "tools-only" | "roots"; export declare class MCPPoolConfigError extends Error { readonly code: "MCP_USERINFO_NOT_ALLOWED" | "MCP_INVALID_ENDPOINT" | "MCP_SESSION_ID_REQUIRED" | "MCP_DUPLICATE_HEADER" | "MCP_AUTH_BINDING_REQUIRED"; constructor(code: MCPPoolConfigError["code"], message: string); } export interface MCPEndpointIdentity { /** JSON-encoded canonical endpoint identity used in the pool key. */ identity: string; /** Query text after only the permitted percent-hex case normalization. */ queryIdentityInput?: string; /** SHA-256 of queryIdentityInput, when a query was configured. */ queryHash?: string; } export interface MCPPoolKeyOptions { /** Original (unexpanded/uncredentialed) config used for stable identity. */ keyConfig?: MCPServerConfig; /** Effective child environment after config substitutions. */ effectiveEnv?: Record; /** Effective current working directory. */ effectiveCwd?: string; /** Session identity. W2 always supplies this for per-session leases. */ sessionId?: string; sharingMode?: MCPPoolSharingMode; transport?: MCPPoolTransport; pluginNetworkPolicyId?: string; capabilityProfile?: MCPPoolCapabilityProfile; authBindingKind?: string; authScopeId?: string; /** Expanded HTTP/SSE headers. */ effectiveHeaders?: Record; } export interface MCPPoolKeyIdentity { schemaVersion: number; serverName: string; sharingMode: MCPPoolSharingMode; transport: MCPPoolTransport; command: string; argsNormalized: string[]; effectiveCwdRealpath: string; endpointIdentity: string; envIdentity: string[]; headerIdentity: string[]; noInheritEnv: boolean; authBindingKind: string; authScopeId: string; pluginNetworkPolicyId: string; capabilityProfile: MCPPoolCapabilityProfile; /** Resolved protocol preference (auto | 2026-07-28 | legacy); partitions protocol generations. */ protocolPreference: string; sessionId?: string; } /** * Canonicalize an HTTP/SSE URL without serializing its path or query through URL. * The raw configured path/query are retained so duplicate/empty query parameters * and encoded reserved characters remain distinct identities. */ export declare function canonicalizeMCPEndpoint(raw: string): MCPEndpointIdentity; /** Build the ordered C5 identity object before hashing. */ export declare function buildMCPPoolKeyIdentity(serverName: string, config: MCPServerConfig, options?: MCPPoolKeyOptions): MCPPoolKeyIdentity; /** Compute the SHA-256 key for a C5 identity. */ export declare function computeMCPPoolKey(serverName: string, config: MCPServerConfig, options?: MCPPoolKeyOptions): string;