@alvin0/ai-agent-sdk-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/client-ChEdrVJ_.d.ts +310 -0
- package/dist/client-ChEdrVJ_.d.ts.map +1 -0
- package/dist/client-D7Th3S7z.js +1250 -0
- package/dist/client-D7Th3S7z.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-D7Th3S7z.js","names":["isJsonObject"],"sources":["../src/client/result.ts","../src/common/integration-operation.ts","../src/common/support-error.ts","../src/client/close.ts","../src/client/config.ts","../src/client/runtime-helpers.ts","../src/client/connection.ts","../src/client/http-security.ts","../src/client/http-client.ts"],"sourcesContent":["import type { ContentBlock, ImageMediaType, JsonValue } from '@alvin0/ai-agent-sdk-core'\nimport type { SupportSafeError } from '@alvin0/ai-agent-sdk-core'\nimport { isJsonValue } from '@alvin0/ai-agent-sdk-core'\nimport type {\n McpClientStatus,\n McpCloseReport,\n McpProtocolState,\n McpToolResultValue,\n McpTransportKind,\n} from './api-types.ts'\nimport type { McpCallToolResult } from './public-types.ts'\n\nexport class McpRemoteToolError extends Error {\n readonly result: McpCallToolResult\n constructor(serverName: string, toolName: string, result: McpCallToolResult) {\n super(`MCP tool '${serverName}/${toolName}' failed: ${resultText(result)}`)\n this.name = 'McpRemoteToolError'\n this.result = result\n }\n}\n\nexport type McpConnectionStage = 'transport' | 'authentication' | 'handshake' | 'catalog' | 'unknown'\n\nexport class McpConnectionError extends Error {\n readonly code = 'MCP_CONNECT_FAILED' as const\n constructor(\n readonly stage: McpConnectionStage,\n readonly failure: SupportSafeError,\n readonly cleanup: McpCloseReport,\n cause: unknown,\n ) {\n super(`MCP connection failed during ${stage}`, { cause })\n this.name = 'McpConnectionError'\n }\n}\n\nexport function connectionFailureStage(status: McpClientStatus): McpConnectionStage {\n if (status === 'authentication-failed' || status === 'authentication-required'\n || status === 'oauth-authorization-required' || status === 'scope-authorization-required') return 'authentication'\n if (status === 'connecting') return 'handshake'\n return 'unknown'\n}\n\nexport function protocolState(\n client: { getNegotiatedProtocolVersion(): string | undefined; getProtocolEra(): 'modern' | 'legacy' | undefined },\n transport: McpTransportKind,\n fallback: boolean,\n): McpProtocolState {\n const version = client.getNegotiatedProtocolVersion()\n return Object.freeze({\n era: client.getProtocolEra() ?? 'legacy',\n ...(version === undefined ? {} : { version }), transport, fallback,\n })\n}\n\nexport function normalizeResult(result: McpCallToolResult): McpToolResultValue {\n const content = result.content.map((block, index) => {\n if (!isJsonValue(block)) throw new TypeError(`MCP result content[${index}] is not lossless JSON`)\n return block\n })\n const structured = result.structuredContent\n if (structured !== undefined && !isJsonValue(structured)) {\n throw new TypeError('MCP structuredContent is not lossless JSON')\n }\n return { content, ...(structured === undefined ? {} : { structuredContent: structured }) }\n}\n\nexport function renderMcpResult(value: JsonValue | undefined): readonly ContentBlock[] {\n if (!isJsonObject(value) || !Array.isArray(value.content)) {\n return [{ type: 'text', text: value === undefined ? '(no output)' : JSON.stringify(value, null, 2) }]\n }\n const blocks = value.content.flatMap(block => renderRemoteBlock(block))\n return blocks.length === 0 ? [{ type: 'text', text: '(no output)' }] : blocks\n}\n\nfunction renderRemoteBlock(value: JsonValue): ContentBlock[] {\n if (!isJsonObject(value) || typeof value.type !== 'string') {\n return [{ type: 'text', text: JSON.stringify(value) }]\n }\n if (value.type === 'text' && typeof value.text === 'string') return [{ type: 'text', text: value.text }]\n if (value.type === 'image' && typeof value.data === 'string'\n && typeof value.mimeType === 'string' && isImageMediaType(value.mimeType)) {\n return [{ type: 'image', source: { kind: 'base64', mediaType: value.mimeType, data: value.data } }]\n }\n if (value.type === 'resource' && isJsonObject(value.resource) && typeof value.resource.text === 'string') {\n return [{ type: 'text', text: value.resource.text }]\n }\n if (value.type === 'resource_link' && typeof value.uri === 'string') {\n const name = typeof value.name === 'string' ? value.name : value.uri\n return [{ type: 'text', text: `[MCP resource: ${name}](${value.uri})` }]\n }\n return [{ type: 'text', text: JSON.stringify(value, null, 2) }]\n}\n\nfunction resultText(result: McpCallToolResult): string {\n const text = result.content\n .filter((block): block is { readonly type: 'text'; readonly text: string } => (\n typeof block === 'object' && block !== null\n && 'type' in block && block.type === 'text'\n && 'text' in block && typeof block.text === 'string'\n ))\n .map(block => block.text).join('\\n').trim()\n return text || 'remote tool returned an error'\n}\n\nfunction isJsonObject(value: unknown): value is Record<string, JsonValue> {\n return isJsonValue(value) && typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isImageMediaType(value: string): value is ImageMediaType {\n return value === 'image/jpeg' || value === 'image/png' || value === 'image/gif' || value === 'image/webp'\n}\n","import type { IntegrationOperationEvidenceFields, SdkLogger } from '@alvin0/ai-agent-sdk-core/observability'\n\nexport const MCP_INTEGRATION_OPERATIONS = Object.freeze({\n 'mcp-http-client': Object.freeze(['connect', 'authenticate', 'catalog-refresh', 'reconnect', 'tool-call', 'close']),\n 'mcp-stdio-client': Object.freeze(['connect', 'catalog-refresh', 'reconnect', 'tool-call', 'close']),\n 'mcp-web-server': Object.freeze(['request', 'tool-call', 'agent-call']),\n 'mcp-stdio-server': Object.freeze(['request', 'tool-call', 'agent-call', 'close']),\n} as const)\n\nexport type McpIntegrationFamily = keyof typeof MCP_INTEGRATION_OPERATIONS\nexport type McpIntegrationOperationName = (typeof MCP_INTEGRATION_OPERATIONS)[McpIntegrationFamily][number]\n\nexport interface IntegrationAttempt {\n success(): void\n fail(errorCode?: string): void\n abort(): void\n}\n\nexport interface IntegrationOperation {\n attempt(attemptNumber: number): IntegrationAttempt\n success(): void\n fail(errorCode?: string): void\n abort(): void\n}\n\nconst START_MESSAGE = 'SDK integration operation started'\nconst ATTEMPT_START_MESSAGE = 'SDK integration attempt started'\nconst SUCCESS_MESSAGE = 'SDK integration operation completed'\nconst FAILURE_MESSAGE = 'SDK integration operation failed'\nconst ABORT_MESSAGE = 'SDK integration operation aborted'\n\nexport function beginIntegrationOperation(\n logger: SdkLogger | undefined,\n family: McpIntegrationFamily,\n operation: McpIntegrationOperationName,\n): IntegrationOperation {\n assertIdentity(operation, 64, 'integration operation')\n const operationId = operationIdentity()\n const startedAt = monotonicNow()\n emit(logger, 'info', START_MESSAGE, {\n integrationSchemaVersion: 1, integrationFamily: family,\n integrationOperation: operation, operationId, kind: 'logical-start',\n })\n let terminal = false\n const finish = (status: 'success' | 'error' | 'aborted', errorCode?: string): void => {\n if (terminal) return\n terminal = true\n const fields: IntegrationOperationEvidenceFields = {\n integrationSchemaVersion: 1, integrationFamily: family,\n integrationOperation: operation, operationId, kind: 'logical-terminal',\n status, durationMs: durationSince(startedAt),\n ...(errorCode === undefined ? {} : { errorCode: boundedCode(errorCode) }),\n }\n emit(logger, status === 'error' ? 'error' : 'info',\n status === 'success' ? SUCCESS_MESSAGE : status === 'error' ? FAILURE_MESSAGE : ABORT_MESSAGE,\n fields)\n }\n return {\n attempt(attemptNumber) {\n if (!Number.isSafeInteger(attemptNumber) || attemptNumber < 1) {\n throw new TypeError('integration attemptNumber must be a positive safe integer')\n }\n const attemptId = operationIdentity(), attemptStartedAt = monotonicNow()\n emit(logger, 'info', ATTEMPT_START_MESSAGE, {\n integrationSchemaVersion: 1, integrationFamily: family,\n integrationOperation: operation, operationId, kind: 'attempt-start',\n attemptId, attemptNumber,\n })\n let attemptTerminal = false\n const finishAttempt = (status: 'success' | 'error' | 'aborted', errorCode?: string): void => {\n if (attemptTerminal) return\n attemptTerminal = true\n emit(logger, status === 'error' ? 'error' : 'info',\n status === 'success' ? SUCCESS_MESSAGE : status === 'error' ? FAILURE_MESSAGE : ABORT_MESSAGE, {\n integrationSchemaVersion: 1, integrationFamily: family,\n integrationOperation: operation, operationId, kind: 'attempt-terminal',\n attemptId, attemptNumber, status, durationMs: durationSince(attemptStartedAt),\n ...(errorCode === undefined ? {} : { errorCode: boundedCode(errorCode) }),\n })\n }\n return {\n success: () => finishAttempt('success'),\n fail: code => finishAttempt('error', code),\n abort: () => finishAttempt('aborted'),\n }\n },\n success: () => finish('success'),\n fail: code => finish('error', code),\n abort: () => finish('aborted'),\n }\n}\n\nexport function integrationErrorCode(error: unknown): string {\n if (typeof error === 'object' && error !== null) {\n const code = Object.getOwnPropertyDescriptor(error, 'code')\n if (code !== undefined && 'value' in code && typeof code.value === 'string') return boundedCode(code.value)\n const name = Object.getOwnPropertyDescriptor(error, 'name')\n if (name !== undefined && 'value' in name && typeof name.value === 'string') return boundedCode(name.value)\n }\n return 'INTEGRATION_ERROR'\n}\n\nexport function integrationChildLogger(logger: SdkLogger | undefined, scope: string): SdkLogger | undefined {\n assertIdentity(scope, 64, 'integration scope')\n try { return logger?.child({ integrationScope: scope }) } catch { return undefined }\n}\n\nfunction emit(\n logger: SdkLogger | undefined,\n level: 'info' | 'error',\n message: string,\n fields: IntegrationOperationEvidenceFields,\n): void {\n try { logger?.[level](message, fields) } catch { /* diagnostic observers never own operation correctness */ }\n}\n\nfunction operationIdentity(): string {\n return globalThis.crypto.randomUUID()\n}\n\nfunction monotonicNow(): number {\n return globalThis.performance?.now() ?? Date.now()\n}\n\nfunction durationSince(startedAt: number): number {\n const value = monotonicNow() - startedAt\n return Number.isFinite(value) ? Math.max(0, value) : 0\n}\n\nfunction boundedCode(value: string): string {\n const normalized = value.replace(/[^A-Za-z0-9_.:-]/g, '_')\n return (normalized.length === 0 ? 'INTEGRATION_ERROR' : normalized).slice(0, 128)\n}\n\nfunction assertIdentity(value: string, limit: number, label: string): void {\n if (value.length === 0 || value.length > limit) throw new TypeError(`${label} must contain 1-${limit} characters`)\n}\n","import type { SupportSafeError } from '@alvin0/ai-agent-sdk-core'\n\nconst NO_USAGE = Object.freeze({ logicalCalls: 0, attempts: 0, complete: 0, partial: 0,\n estimated: 0, missing: 0, notApplicable: 0, possiblyBilledAttemptsWithoutUsage: 0 })\n\nexport function mcpSupportError(code: string, stage: string, message: string): SupportSafeError {\n return Object.freeze({ code, stage, message, usageCoverage: NO_USAGE,\n possiblyBilledAttemptsWithoutUsage: 0 })\n}\n","import type { SdkLogger } from '@alvin0/ai-agent-sdk-core/observability'\nimport { waitForSettlement } from '@alvin0/ai-agent-sdk-core'\nimport type { McpCloseReport } from './api-types.ts'\nimport { beginIntegrationOperation, type McpIntegrationFamily } from '../common/integration-operation.ts'\nimport { mcpSupportError } from '../common/support-error.ts'\n\nexport interface McpClosePlan {\n readonly logger?: SdkLogger\n readonly family: McpIntegrationFamily\n readonly timeoutMs: number\n readonly tasks: readonly (() => Promise<unknown>)[]\n readonly signal?: AbortSignal\n}\n\n/** Run every cleanup task under one deadline and retain only support-safe outcomes. */\nexport async function executeMcpClosePlan(plan: McpClosePlan): Promise<McpCloseReport> {\n const operation = beginIntegrationOperation(plan.logger, plan.family, 'close')\n const attempt = operation.attempt(1)\n const states: ('pending' | 'succeeded' | 'failed')[] = plan.tasks.map(() => 'pending')\n const tasks = plan.tasks.map(async (task, index) => {\n try {\n await Promise.resolve().then(task)\n states[index] = 'succeeded'\n } catch {\n states[index] = 'failed'\n }\n })\n let aborted = plan.signal?.aborted === true\n let removeAbort = (): void => undefined\n const abortObserved = plan.signal === undefined\n ? new Promise<never>(() => undefined)\n : new Promise<void>(resolve => {\n const observe = () => { aborted = true; resolve() }\n plan.signal?.addEventListener('abort', observe, { once: true })\n removeAbort = () => plan.signal?.removeEventListener('abort', observe)\n if (plan.signal?.aborted === true) observe()\n })\n await Promise.race([\n waitForSettlement(Promise.all(tasks), plan.timeoutMs),\n abortObserved,\n ])\n removeAbort()\n const unsettledOperations = states.filter(state => state === 'pending').length\n const failed = states.includes('failed')\n const error = aborted && unsettledOperations > 0\n ? mcpSupportError('MCP_CLOSE_ABORTED', 'mcp-close', 'MCP cleanup was interrupted before it settled')\n : unsettledOperations > 0\n ? mcpSupportError('MCP_CLOSE_TIMEOUT', 'mcp-close', 'MCP cleanup did not settle before its deadline')\n : failed\n ? mcpSupportError('MCP_CLOSE_FAILED', 'mcp-close', 'MCP cleanup failed')\n : undefined\n if (error === undefined) {\n attempt.success()\n operation.success()\n } else {\n attempt.fail(error.code)\n operation.fail(error.code)\n }\n return Object.freeze({\n state: 'closed',\n deadlineReached: !aborted && unsettledOperations > 0,\n unsettledOperations,\n ...(error === undefined ? {} : { error }),\n })\n}\n","/** Internal defaults shared by MCP client lifecycle, HTTP policy, and reconnect code. */\nexport const MCP_CLIENT_DEFAULTS = Object.freeze({\n toolCallTimeoutMs: 120_000,\n operationTimeoutMs: 120_000,\n closeTimeoutMs: 30_000,\n maxTools: 1_024,\n maxCatalogBytes: 4 * 1024 * 1024,\n maxToolResultBytes: 4 * 1024 * 1024,\n maxTransportBytes: 16 * 1024 * 1024,\n maxRedirectHops: 10,\n})\n\nexport const MCP_RECONNECT_DEFAULTS = Object.freeze({\n enabled: true,\n initialDelayMs: 500,\n maxDelayMs: 30_000,\n maxAttempts: 10,\n})\n\nexport const MCP_HTTP_REDIRECT_STATUSES: readonly number[] = Object.freeze([\n 301, 302, 303, 307, 308,\n])\n","import type { ToolFilter } from '@alvin0/ai-agent-sdk-core/tools'\nimport { isJsonValue, type JsonValue } from '@alvin0/ai-agent-sdk-core'\nimport type {\n McpAuthenticationKind,\n McpReconnectOptions,\n ResolvedMcpReconnectOptions,\n} from './api-types.ts'\nimport { MCP_RECONNECT_DEFAULTS } from './config.ts'\n\nexport function resolveMcpReconnectOptions(\n input: McpReconnectOptions | false | undefined,\n): ResolvedMcpReconnectOptions {\n if (input === false) return Object.freeze({ ...MCP_RECONNECT_DEFAULTS, enabled: false })\n const resolved = {\n enabled: input?.enabled ?? MCP_RECONNECT_DEFAULTS.enabled,\n initialDelayMs: input?.initialDelayMs ?? MCP_RECONNECT_DEFAULTS.initialDelayMs,\n maxDelayMs: input?.maxDelayMs ?? MCP_RECONNECT_DEFAULTS.maxDelayMs,\n maxAttempts: input?.maxAttempts ?? MCP_RECONNECT_DEFAULTS.maxAttempts,\n }\n timeoutMilliseconds(resolved.initialDelayMs, 'reconnect.initialDelayMs')\n timeoutMilliseconds(resolved.maxDelayMs, 'reconnect.maxDelayMs')\n if (resolved.initialDelayMs > resolved.maxDelayMs) {\n throw new TypeError('reconnect.initialDelayMs must be less than or equal to reconnect.maxDelayMs')\n }\n if (!Number.isInteger(resolved.maxAttempts) || resolved.maxAttempts < 1) {\n throw new TypeError('reconnect.maxAttempts must be a positive integer')\n }\n return Object.freeze(resolved)\n}\n\nexport function authenticationKindOf(\n provider: unknown,\n headers: Headers,\n): McpAuthenticationKind {\n if (provider === undefined) return headers.has('authorization') ? 'bearer' : 'none'\n return isOAuthClientProvider(provider) ? 'oauth' : 'bearer'\n}\n\nfunction isOAuthClientProvider(provider: unknown): boolean {\n if (typeof provider !== 'object' || provider === null) return false\n const candidate = provider as Record<string, unknown>\n return typeof candidate.clientInformation === 'function'\n && typeof candidate.tokens === 'function'\n && typeof candidate.saveTokens === 'function'\n && typeof candidate.redirectToAuthorization === 'function'\n && typeof candidate.saveCodeVerifier === 'function'\n && typeof candidate.codeVerifier === 'function'\n}\n\nexport function filterRemoteTools<T extends { readonly name: string }>(\n tools: readonly T[],\n filter: ToolFilter | undefined,\n): readonly T[] {\n const allow = filter?.allow === undefined ? undefined : new Set(filter.allow)\n const deny = new Set(filter?.deny ?? [])\n return tools.filter(tool => (allow === undefined || allow.has(tool.name)) && !deny.has(tool.name))\n}\n\nexport function publicToolName(serverName: string, remoteName: string, prefixed: boolean): string {\n return prefixed ? `mcp__${serverName}__${remoteName}` : remoteName\n}\n\nexport function isJsonObject(value: unknown): value is Record<string, JsonValue> {\n return isJsonValue(value) && typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport function assertServerName(name: string): void {\n if (!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(name)) {\n throw new TypeError('MCP serverName must match /^[A-Za-z][A-Za-z0-9_-]{0,63}$/')\n }\n}\n\nexport function assertPositive(value: number, field: string): void {\n if (!Number.isFinite(value) || value <= 0) throw new TypeError(`${field} must be a positive finite number`)\n}\n\nexport function positiveSafeInteger(value: number, field: string): number {\n if (!Number.isSafeInteger(value) || value < 1) throw new TypeError(`${field} must be a positive safe integer`)\n return value\n}\n\nexport function timeoutMilliseconds(value: number, field: string): number {\n if (!Number.isSafeInteger(value) || value < 1 || value > 2_147_483_647) {\n throw new RangeError(`${field} must be an integer between 1 and 2147483647 milliseconds`)\n }\n return value\n}\n\nexport function serializedBytes(value: unknown): number {\n const serialized = JSON.stringify(value)\n if (serialized === undefined) throw new TypeError('MCP value is not JSON serializable')\n return new TextEncoder().encode(serialized).byteLength\n}\n\nexport function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T> {\n timeoutMilliseconds(timeoutMs, 'timeoutMs')\n return new Promise<T>((resolve, reject) => {\n const timer = setTimeout(() => reject(new Error(message)), timeoutMs)\n void promise.then(\n value => { clearTimeout(timer); resolve(value) },\n error => { clearTimeout(timer); reject(error) },\n )\n })\n}\n\nexport class McpOperationTimeoutError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'McpOperationTimeoutError'\n }\n}\n\nexport function createAbortTimeoutScope(\n timeoutMs: number,\n message: string,\n callerSignal?: AbortSignal,\n): { readonly signal: AbortSignal; readonly dispose: () => void } {\n timeoutMilliseconds(timeoutMs, 'timeoutMs')\n const controller = new AbortController()\n const timeout = new McpOperationTimeoutError(message)\n const timer = setTimeout(() => controller.abort(timeout), timeoutMs)\n const signal = callerSignal === undefined\n ? controller.signal\n : AbortSignal.any([callerSignal, controller.signal])\n let active = true\n const dispose = (): void => {\n if (!active) return\n active = false\n clearTimeout(timer)\n signal.removeEventListener('abort', dispose)\n }\n signal.addEventListener('abort', dispose, { once: true })\n if (signal.aborted) dispose()\n return Object.freeze({ signal, dispose })\n}\n\nexport function withAbortTimeout<T>(\n operation: (signal: AbortSignal) => Promise<T>,\n timeoutMs: number,\n message: string,\n callerSignal?: AbortSignal,\n): Promise<T> {\n const scope = createAbortTimeoutScope(timeoutMs, message, callerSignal)\n let pending: Promise<T>\n try {\n scope.signal.throwIfAborted()\n pending = Promise.resolve(operation(scope.signal))\n }\n catch (error: unknown) { scope.dispose(); return Promise.reject(error) }\n return raceAbort(pending, scope.signal).finally(scope.dispose)\n}\n\nexport function raceAbort<T>(promise: Promise<T>, signal: AbortSignal): Promise<T> {\n if (signal.aborted) {\n void promise.catch(() => undefined)\n return Promise.reject(signal.reason ?? new Error('MCP operation aborted'))\n }\n return new Promise<T>((resolve, reject) => {\n const abort = () => {\n signal.removeEventListener('abort', abort)\n reject(signal.reason ?? new Error('MCP operation aborted'))\n }\n signal.addEventListener('abort', abort, { once: true })\n void promise.then(\n value => { signal.removeEventListener('abort', abort); resolve(value) },\n error => { signal.removeEventListener('abort', abort); reject(error) },\n )\n })\n}\n\nexport function errorOf(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n","/** MCP client lifecycle and remote-tool bridge for Universal runtimes. */\nimport {\n Client,\n InsufficientScopeError,\n SSEClientTransport,\n StreamableHTTPClientTransport,\n UnauthorizedError,\n type ClientOptions,\n type Tool,\n type Transport,\n} from '@modelcontextprotocol/client'\nimport type { JsonValue } from '@alvin0/ai-agent-sdk-core'\nimport {\n ToolRegistry,\n type ToolCatalog,\n type ToolCatalogSnapshot,\n type ToolDefinition,\n type ToolSource,\n type ToolSourceSnapshotOptions,\n} from '@alvin0/ai-agent-sdk-core/tools'\nimport type { McpProtocolClient } from './public-types.ts'\nimport type {\n McpAuthenticationKind,\n McpAuthorizationState,\n McpClientLifecycleOptions,\n McpClientRuntimeOptions,\n McpClientState,\n McpClientStatus,\n McpCloseReport,\n McpOAuthCallbackOptions,\n McpProtocolState,\n McpTransportFactory,\n McpTransportKind,\n ResolvedMcpReconnectOptions,\n} from './api-types.ts'\nimport {\n McpRemoteToolError,\n normalizeResult,\n protocolState,\n renderMcpResult,\n} from './result.ts'\nimport { beginIntegrationOperation, integrationErrorCode,\n type McpIntegrationFamily } from '../common/integration-operation.ts'\nimport { executeMcpClosePlan } from './close.ts'\nimport { mcpSupportError } from '../common/support-error.ts'\nimport { MCP_CLIENT_DEFAULTS } from './config.ts'\nimport {\n McpOperationTimeoutError,\n assertServerName,\n errorOf,\n filterRemoteTools,\n isJsonObject,\n positiveSafeInteger,\n timeoutMilliseconds,\n publicToolName,\n raceAbort,\n resolveMcpReconnectOptions,\n serializedBytes,\n withAbortTimeout,\n} from './runtime-helpers.ts'\n\nexport type * from './public-types.ts'\nexport type * from './api-types.ts'\n\ntype OAuthCapableTransport = StreamableHTTPClientTransport | SSEClientTransport\n\ninterface PendingHttpAuthorization {\n readonly client: Client\n readonly transport: OAuthCapableTransport\n}\n\nfunction isOAuthCapableTransport(transport: Transport | undefined): transport is OAuthCapableTransport {\n return transport instanceof StreamableHTTPClientTransport || transport instanceof SSEClientTransport\n}\n\nfunction transportKindOf(transport: Transport): McpTransportKind {\n if (transport instanceof StreamableHTTPClientTransport) return 'streamable-http'\n if (transport instanceof SSEClientTransport) return 'sse'\n return 'custom'\n}\n\nfunction shouldTryLegacyTransport(error: unknown): boolean {\n if (UnauthorizedError.isInstance(error) || InsufficientScopeError.isInstance(error)) return false\n return !(error instanceof Error && error.name === 'AbortError')\n}\n\n/**\n * Owns one MCP server connection across transport generations.\n *\n * The ToolCatalog object is stable for the lifetime of this connection. A\n * successful list refresh swaps its registrations synchronously; a failed\n * refresh leaves the last-known-good catalog intact.\n */\nexport class McpClientConnection implements ToolSource {\n readonly kind = 'tool-source' as const\n readonly apiVersion = 1 as const\n readonly id: string\n readonly serverName: string\n readonly tools: ToolCatalog\n\n private readonly options: McpClientLifecycleOptions\n private readonly transportFactory: McpTransportFactory\n private readonly fallbackTransportFactory: McpTransportFactory | undefined\n private readonly authenticationKind: McpAuthenticationKind\n private readonly integrationFamily: McpIntegrationFamily\n private readonly toolCallTimeoutMs: number\n private readonly operationTimeoutMs: number\n private readonly closeTimeoutMs: number\n private readonly maxTools: number\n private readonly maxCatalogBytes: number\n private readonly maxToolResultBytes: number\n private readonly reconnect: ResolvedMcpReconnectOptions\n private readonly registry = new ToolRegistry()\n private toolDisposers: (() => void)[] = []\n private current: Client | undefined\n private pendingAuthorization: PendingHttpAuthorization | undefined\n private connecting: Promise<void> | undefined\n private syncTail: Promise<void> = Promise.resolve()\n private pendingToolSyncs = 0\n private reconnectTimer: ReturnType<typeof setTimeout> | undefined\n private reconnectAttempts = 0\n private catalogRevision = 0\n private connectedAt: number | undefined\n private closed = false\n private closeTask: Promise<McpCloseReport> | undefined\n private currentState: McpClientState\n\n constructor(\n options: McpClientLifecycleOptions,\n transportFactory: McpTransportFactory,\n runtime: McpClientRuntimeOptions = {},\n ) {\n assertServerName(options.serverName)\n this.toolCallTimeoutMs = timeoutMilliseconds(\n options.toolCallTimeoutMs ?? MCP_CLIENT_DEFAULTS.toolCallTimeoutMs, 'toolCallTimeoutMs',\n )\n this.operationTimeoutMs = timeoutMilliseconds(\n options.operationTimeoutMs ?? MCP_CLIENT_DEFAULTS.operationTimeoutMs, 'operationTimeoutMs',\n )\n this.closeTimeoutMs = timeoutMilliseconds(\n options.closeTimeoutMs ?? MCP_CLIENT_DEFAULTS.closeTimeoutMs, 'closeTimeoutMs',\n )\n this.maxTools = positiveSafeInteger(options.maxTools ?? MCP_CLIENT_DEFAULTS.maxTools, 'maxTools')\n this.maxCatalogBytes = positiveSafeInteger(\n options.maxCatalogBytes ?? MCP_CLIENT_DEFAULTS.maxCatalogBytes, 'maxCatalogBytes',\n )\n this.maxToolResultBytes = positiveSafeInteger(\n options.maxToolResultBytes ?? MCP_CLIENT_DEFAULTS.maxToolResultBytes, 'maxToolResultBytes',\n )\n const toolFilter = options.toolFilter === undefined ? undefined : Object.freeze({\n ...(options.toolFilter.allow === undefined ? {} : { allow: Object.freeze([...options.toolFilter.allow]) }),\n ...(options.toolFilter.deny === undefined ? {} : { deny: Object.freeze([...options.toolFilter.deny]) }),\n })\n this.reconnect = resolveMcpReconnectOptions(options.reconnect)\n this.options = Object.freeze({ ...options, ...(toolFilter === undefined ? {} : { toolFilter }) })\n this.transportFactory = transportFactory\n this.fallbackTransportFactory = runtime.fallbackTransportFactory\n this.authenticationKind = runtime.authenticationKind ?? 'unknown'\n this.integrationFamily = runtime.integrationFamily ?? 'mcp-http-client'\n this.serverName = options.serverName\n this.id = options.serverName\n this.tools = this.registry\n this.currentState = Object.freeze({\n status: 'idle', serverName: options.serverName, attempt: 0, catalogRevision: 0,\n })\n }\n\n get state(): McpClientState { return this.currentState }\n\n snapshot(options: ToolSourceSnapshotOptions): ToolCatalogSnapshot {\n options.signal.throwIfAborted()\n return Object.freeze({\n revision: String(this.catalogRevision),\n tools: Object.freeze(this.registry.names().map(name => this.registry.get(name) as ToolDefinition)),\n })\n }\n\n /**\n * Use the currently owned protocol client for resources, prompts, or other\n * MCP operations that do not map to the SDK ToolCatalog.\n */\n async withClient<T>(operation: (client: McpProtocolClient, signal: AbortSignal) => Promise<T>): Promise<T>\n async withClient<TClient, T>(operation: (client: TClient, signal: AbortSignal) => Promise<T>): Promise<T>\n async withClient<T>(operation: (client: McpProtocolClient, signal: AbortSignal) => Promise<T>): Promise<T> {\n const generation = this.current\n if (generation === undefined) throw new Error(`MCP server '${this.serverName}' is not connected`)\n const message = `MCP operation on '${this.serverName}' exceeded ${this.operationTimeoutMs}ms`\n try {\n return await withAbortTimeout(\n signal => Promise.resolve().then(() => operation(generation as unknown as McpProtocolClient, signal)),\n this.operationTimeoutMs,\n message,\n )\n } catch (error: unknown) {\n if (error instanceof McpOperationTimeoutError && this.current === generation) {\n this.current = undefined\n this.clearTools()\n await this.closeGeneration(generation)\n if (!this.closed) this.scheduleReconnect(error)\n }\n throw error\n }\n }\n\n /** Connect, negotiate capabilities, and publish the first tool snapshot. */\n connect(): Promise<void> {\n if (this.closed) return Promise.reject(new Error(`MCP client '${this.serverName}' is closed`))\n if (this.current !== undefined\n && (this.currentState.status === 'ready' || this.currentState.status === 'scope-authorization-required')) {\n return Promise.resolve()\n }\n if (this.pendingAuthorization !== undefined) {\n return Promise.reject(new Error(`MCP client '${this.serverName}' is waiting for its OAuth callback`))\n }\n if (this.connecting !== undefined) return this.connecting\n if (this.reconnectTimer !== undefined) {\n clearTimeout(this.reconnectTimer)\n this.reconnectTimer = undefined\n }\n const attempt = this.connectGeneration(this.currentState.status === 'reconnecting')\n const tracked = attempt.finally(() => {\n if (this.connecting === tracked) this.connecting = undefined\n })\n this.connecting = tracked\n return tracked\n }\n\n /** Force a fresh tools/list and atomically replace the published snapshot. */\n refreshTools(options: { readonly signal?: AbortSignal } = {}): Promise<void> {\n const generation = this.current\n if (generation === undefined) return Promise.reject(new Error(`MCP server '${this.serverName}' is not connected`))\n return this.enqueueToolSync(generation, undefined, options.signal)\n }\n\n /**\n * Validate an OAuth callback, exchange its authorization code on the pending\n * HTTP transport, then reconnect with a fresh transport generation.\n */\n async finishOAuth(\n callbackParams: URLSearchParams,\n options: McpOAuthCallbackOptions,\n ): Promise<void> {\n if (this.closed) throw new Error(`MCP client '${this.serverName}' is closed`)\n const pending = this.pendingAuthorization\n if (pending === undefined) throw new Error(`MCP client '${this.serverName}' has no pending OAuth authorization`)\n if (options.expectedState.length === 0 || callbackParams.get('state') !== options.expectedState) {\n throw new Error(`MCP client '${this.serverName}' rejected an OAuth callback with mismatched state`)\n }\n if (callbackParams.has('error')) {\n throw new Error(`MCP client '${this.serverName}' OAuth authorization was denied or failed`)\n }\n\n const operation = beginIntegrationOperation(this.options.logger, this.integrationFamily, 'authenticate')\n const attempt = operation.attempt(1)\n this.pendingAuthorization = undefined\n try {\n await withAbortTimeout(\n () => pending.transport.finishAuth(callbackParams),\n this.operationTimeoutMs,\n `MCP OAuth callback exceeded ${this.operationTimeoutMs}ms`,\n options.signal,\n )\n attempt.success()\n operation.success()\n } catch (error: unknown) {\n attempt.fail(integrationErrorCode(error))\n operation.fail(integrationErrorCode(error))\n const failure = errorOf(error)\n this.publish('failed', this.reconnectAttempts, failure)\n throw failure\n } finally {\n await this.closeGeneration(pending.client)\n }\n await this.connect()\n }\n\n /** Stop reconnecting, close the live generation, and unregister its tools. */\n async close(): Promise<void> { await this.closeWithReport() }\n\n closeWithReport(options: { readonly signal?: AbortSignal } = {}): Promise<McpCloseReport> {\n if (this.closeTask !== undefined) return this.closeTask\n this.closeTask = this.performClose(options.signal)\n return this.closeTask\n }\n\n private async performClose(signal?: AbortSignal): Promise<McpCloseReport> {\n this.closed = true\n if (this.reconnectTimer !== undefined) clearTimeout(this.reconnectTimer)\n this.reconnectTimer = undefined\n const generation = this.current\n this.current = undefined\n const tasks: (() => Promise<unknown>)[] = []\n if (generation !== undefined) {\n try {\n const transport = generation.transport\n if (transport instanceof StreamableHTTPClientTransport && transport.sessionId !== undefined) {\n tasks.push(() => transport.terminateSession())\n }\n } catch { /* connection may still be initializing */ }\n tasks.push(() => generation.close())\n }\n const pending = this.pendingAuthorization\n this.pendingAuthorization = undefined\n if (pending !== undefined && pending.client !== generation) {\n tasks.push(() => pending.client.close())\n }\n const connecting = this.connecting\n if (connecting !== undefined) tasks.push(() => connecting)\n if (this.pendingToolSyncs > 0) tasks.push(() => this.syncTail)\n const report = await executeMcpClosePlan({\n ...this.options.logger === undefined ? {} : { logger: this.options.logger },\n family: this.integrationFamily, ...(signal === undefined ? {} : { signal }),\n timeoutMs: this.closeTimeoutMs, tasks,\n })\n this.clearTools()\n this.publish('closed', this.reconnectAttempts)\n return report\n }\n\n private async connectGeneration(reconnecting: boolean): Promise<void> {\n const attempt = reconnecting ? this.reconnectAttempts : 0\n const operation = beginIntegrationOperation(\n this.options.logger,\n this.integrationFamily,\n reconnecting ? 'reconnect' : 'connect',\n )\n this.publish(reconnecting ? 'reconnecting' : 'connecting', attempt)\n const factories = [this.transportFactory, this.fallbackTransportFactory]\n .filter((factory): factory is McpTransportFactory => factory !== undefined)\n let lastFailure: Error | undefined\n\n for (let index = 0; index < factories.length; index++) {\n const physicalAttempt = operation.attempt(index + 1)\n let generation: Client\n try { generation = this.createGeneration() }\n catch (error: unknown) {\n const code = integrationErrorCode(error)\n physicalAttempt.fail(code); operation.fail(code)\n throw error\n }\n let starting = true\n let transport: Transport | undefined\n this.current = generation\n generation.onclose = () => {\n if (!starting) this.generationDown(generation)\n }\n try {\n const openedTransport = (factories[index] as McpTransportFactory)() as unknown as Transport\n transport = openedTransport\n await withAbortTimeout(\n () => generation.connect(openedTransport),\n this.operationTimeoutMs,\n `MCP connection '${this.serverName}' exceeded ${this.operationTimeoutMs}ms`,\n this.options.signal,\n )\n if (this.current !== generation || this.closed) throw new Error(`MCP connection '${this.serverName}' closed during startup`)\n await this.enqueueToolSync(generation, undefined, this.options.signal)\n if (this.current !== generation || this.closed) throw new Error(`MCP connection '${this.serverName}' closed during tool discovery`)\n this.connectedAt = Date.now()\n starting = false\n this.publish('ready', this.reconnectAttempts, undefined, {\n protocol: protocolState(generation, transportKindOf(transport), index > 0),\n })\n physicalAttempt.success()\n operation.success()\n if (this.authenticationKind !== 'none' && this.authenticationKind !== 'unknown') {\n const authentication = beginIntegrationOperation(\n this.options.logger, this.integrationFamily, 'authenticate',\n )\n authentication.attempt(1).success()\n authentication.success()\n }\n return\n } catch (error: unknown) {\n physicalAttempt.fail(integrationErrorCode(error))\n starting = false\n const failure = errorOf(error)\n lastFailure = failure\n if (this.current === generation) this.current = undefined\n\n if (UnauthorizedError.isInstance(error)) {\n if (this.authenticationKind === 'oauth' && isOAuthCapableTransport(transport)) {\n this.pendingAuthorization = { client: generation, transport }\n this.publish('oauth-authorization-required', this.reconnectAttempts, failure, {\n authorization: { kind: 'oauth', reason: 'authorization-code-required' },\n })\n operation.fail(integrationErrorCode(error))\n this.logAuthenticationFailure(error)\n throw failure\n }\n await this.closeGeneration(generation)\n const status = this.authenticationKind === 'bearer' ? 'authentication-failed' : 'authentication-required'\n this.publish(status, this.reconnectAttempts, failure, {\n authorization: {\n kind: this.authenticationKind,\n reason: this.authenticationKind === 'bearer' ? 'invalid-credentials' : 'credentials-required',\n },\n })\n operation.fail(integrationErrorCode(error))\n this.logAuthenticationFailure(error)\n throw failure\n }\n\n await this.closeGeneration(generation)\n const canFallback = index + 1 < factories.length && shouldTryLegacyTransport(error)\n if (canFallback) continue\n if (!this.closed) this.scheduleReconnect(failure)\n operation.fail(integrationErrorCode(error))\n throw failure\n }\n }\n const failure = lastFailure ?? new Error(`MCP connection '${this.serverName}' has no transport candidate`)\n if (!this.closed) this.scheduleReconnect(failure)\n operation.fail(integrationErrorCode(failure))\n throw failure\n }\n\n private createGeneration(): Client {\n let generation!: Client\n generation = new Client(\n {\n name: this.options.clientName ?? 'ai-agent-sdk',\n version: this.options.clientVersion ?? '0.0.0',\n },\n this.clientOptions((error, items) => {\n if (this.current !== generation || this.closed) return\n if (error !== null || items === null) {\n try {\n this.options.onStateChange?.(Object.freeze({\n ...this.currentState,\n ...(error === null ? {} : { error }),\n ...(error === null ? {} : {\n supportError: mcpSupportError(\n integrationErrorCode(error), 'mcp-client', 'MCP client operation failed',\n ),\n }),\n }))\n } catch { /* lifecycle observers do not own connection state */ }\n return\n }\n void this.enqueueToolSync(generation, items).catch(error => {\n try {\n this.options.onStateChange?.(Object.freeze({\n ...this.currentState,\n error: errorOf(error),\n supportError: mcpSupportError(\n integrationErrorCode(error), 'mcp-client', 'MCP client operation failed',\n ),\n }))\n } catch { /* lifecycle observers do not own connection state */ }\n })\n }),\n )\n return generation\n }\n\n private clientOptions(onToolsChanged: (error: Error | null, tools: Tool[] | null) => void): ClientOptions {\n return {\n capabilities: {},\n versionNegotiation: { mode: this.options.protocol ?? 'auto' },\n listChanged: {\n tools: { autoRefresh: true, onChanged: onToolsChanged },\n },\n }\n }\n\n private generationDown(generation: Client): void {\n if (this.closed || this.current !== generation) return\n this.current = undefined\n this.scheduleReconnect(new Error(`MCP connection '${this.serverName}' closed`))\n }\n\n private scheduleReconnect(error: Error): void {\n if (this.closed || this.reconnectTimer !== undefined) return\n const policy = this.reconnect\n if (!policy.enabled) {\n this.publish('failed', this.reconnectAttempts, error)\n return\n }\n if (this.connectedAt !== undefined && Date.now() - this.connectedAt >= policy.maxDelayMs) {\n this.reconnectAttempts = 0\n }\n this.connectedAt = undefined\n this.reconnectAttempts += 1\n if (this.reconnectAttempts > policy.maxAttempts) {\n this.clearTools()\n this.publish('failed', policy.maxAttempts, error)\n return\n }\n const delay = Math.min(policy.maxDelayMs, policy.initialDelayMs * 2 ** (this.reconnectAttempts - 1))\n this.publish('reconnecting', this.reconnectAttempts, error)\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = undefined\n void this.connect().catch(() => undefined)\n }, delay)\n const timer = this.reconnectTimer as ReturnType<typeof setTimeout> & { unref?: () => void }\n timer.unref?.()\n }\n\n private enqueueToolSync(\n generation: Client,\n supplied?: readonly Tool[],\n callerSignal?: AbortSignal,\n ): Promise<void> {\n this.pendingToolSyncs += 1\n const run = this.syncTail.then(async () => {\n if (this.closed || this.current !== generation) return\n const operation = beginIntegrationOperation(this.options.logger, this.integrationFamily, 'catalog-refresh')\n const attempt = operation.attempt(1)\n try {\n const tools = supplied ?? (await withAbortTimeout(\n signal => generation.listTools(undefined, { cacheMode: 'refresh', signal }),\n this.operationTimeoutMs,\n `MCP tool discovery exceeded ${this.operationTimeoutMs}ms`,\n callerSignal,\n )).tools\n if (this.closed || this.current !== generation) {\n attempt.abort(); operation.abort(); return\n }\n this.swapTools(tools)\n attempt.success(); operation.success()\n } catch (error: unknown) {\n attempt.fail(integrationErrorCode(error)); operation.fail(integrationErrorCode(error))\n throw error\n }\n })\n const tracked = run.finally(() => { this.pendingToolSyncs -= 1 })\n this.syncTail = tracked.catch(() => undefined)\n return tracked\n }\n\n private swapTools(remoteTools: readonly Tool[]): void {\n if (remoteTools.length > this.maxTools) {\n throw new RangeError(`MCP server '${this.serverName}' exceeds the ${this.maxTools}-tool limit`)\n }\n if (serializedBytes(remoteTools) > this.maxCatalogBytes) {\n throw new RangeError(`MCP server '${this.serverName}' catalog exceeds the ${this.maxCatalogBytes}-byte limit`)\n }\n const next = new ToolRegistry()\n const seen = new Set<string>()\n for (const remote of filterRemoteTools(remoteTools, this.options.toolFilter)) {\n const name = publicToolName(this.serverName, remote.name, this.options.prefixToolNames !== false)\n if (seen.has(name)) throw new Error(`MCP server '${this.serverName}' produced duplicate tool name '${name}'`)\n seen.add(name)\n next.register(this.bridgeTool(name, remote))\n }\n this.clearTools(false)\n this.toolDisposers = next.names().map(name => this.registry.register(next.get(name) as ToolDefinition))\n this.bumpCatalogRevision()\n }\n\n private bridgeTool(publicName: string, remote: Tool): ToolDefinition<Record<string, JsonValue>> {\n const inputSchema = isJsonObject(remote.inputSchema)\n ? structuredClone(remote.inputSchema)\n : { type: 'object', additionalProperties: true }\n return {\n name: publicName,\n description: remote.description?.trim() || `Tool '${remote.name}' from MCP server '${this.serverName}'.`,\n parameters: inputSchema,\n timeoutMs: this.toolCallTimeoutMs,\n parse: raw => {\n if (!isJsonObject(raw)) throw new TypeError('MCP tool arguments must be a JSON object')\n return raw\n },\n execute: async (args, context) => {\n const generation = this.current\n if (generation === undefined) throw new Error(`MCP server '${this.serverName}' is not connected`)\n const operation = beginIntegrationOperation(context.logger, this.integrationFamily, 'tool-call')\n const attempt = operation.attempt(1)\n try {\n const result = await raceAbort(generation.callTool(\n { name: remote.name, arguments: args },\n {\n signal: context.signal,\n toolDefinition: remote,\n timeout: this.toolCallTimeoutMs,\n },\n ), context.signal)\n if (serializedBytes(result) > this.maxToolResultBytes) {\n throw new RangeError(\n `MCP tool '${this.serverName}/${remote.name}' result exceeds the ${this.maxToolResultBytes}-byte limit`,\n )\n }\n if (result.isError === true) throw new McpRemoteToolError(this.serverName, remote.name, result)\n const normalized = normalizeResult(result)\n attempt.success(); operation.success()\n return normalized\n } catch (error: unknown) {\n if (context.signal.aborted) {\n attempt.abort(); operation.abort()\n } else {\n attempt.fail(integrationErrorCode(error)); operation.fail(integrationErrorCode(error))\n }\n if (InsufficientScopeError.isInstance(error)) {\n this.publish('scope-authorization-required', this.reconnectAttempts, errorOf(error), {\n authorization: {\n kind: this.authenticationKind,\n reason: 'insufficient-scope',\n ...(error.requiredScope === undefined ? {} : { requiredScope: error.requiredScope }),\n },\n ...(this.currentState.protocol === undefined ? {} : { protocol: this.currentState.protocol }),\n })\n } else if (UnauthorizedError.isInstance(error)) {\n const transport = generation.transport\n if (this.current === generation) this.current = undefined\n if (this.authenticationKind === 'oauth' && isOAuthCapableTransport(transport)) {\n this.pendingAuthorization = { client: generation, transport }\n this.publish('oauth-authorization-required', this.reconnectAttempts, errorOf(error), {\n authorization: { kind: 'oauth', reason: 'authorization-code-required' },\n ...(this.currentState.protocol === undefined ? {} : { protocol: this.currentState.protocol }),\n })\n } else {\n await this.closeGeneration(generation)\n this.publish(\n this.authenticationKind === 'bearer' ? 'authentication-failed' : 'authentication-required',\n this.reconnectAttempts,\n errorOf(error),\n {\n authorization: {\n kind: this.authenticationKind,\n reason: this.authenticationKind === 'bearer' ? 'invalid-credentials' : 'credentials-required',\n },\n ...(this.currentState.protocol === undefined ? {} : { protocol: this.currentState.protocol }),\n },\n )\n }\n }\n throw error\n }\n },\n render: value => renderMcpResult(value),\n meta: () => ({ kind: 'mcp', serverName: this.serverName, remoteToolName: remote.name }),\n ...(this.options.trustReadOnlyAnnotations === true && remote.annotations?.readOnlyHint === true\n ? { isConcurrencySafe: () => true }\n : {}),\n }\n }\n\n private clearTools(recordRevision = true): void {\n if (this.toolDisposers.length === 0) return\n for (const dispose of this.toolDisposers) dispose()\n this.toolDisposers = []\n if (recordRevision) this.bumpCatalogRevision()\n }\n\n private bumpCatalogRevision(): void {\n if (this.catalogRevision < Number.MAX_SAFE_INTEGER) this.catalogRevision += 1\n this.currentState = Object.freeze({ ...this.currentState, catalogRevision: this.catalogRevision })\n try { this.options.onStateChange?.(this.currentState) } catch { /* observers do not own state */ }\n }\n\n private logAuthenticationFailure(error: unknown): void {\n const operation = beginIntegrationOperation(this.options.logger, this.integrationFamily, 'authenticate')\n const attempt = operation.attempt(1)\n const code = integrationErrorCode(error)\n attempt.fail(code)\n operation.fail(code)\n }\n\n private async closeGeneration(generation: Client): Promise<boolean> {\n const report = await executeMcpClosePlan({ family: this.integrationFamily,\n timeoutMs: this.closeTimeoutMs, tasks: [() => generation.close()] })\n return report.error === undefined\n }\n\n private publish(\n status: McpClientStatus,\n attempt: number,\n error?: Error,\n details: { readonly authorization?: McpAuthorizationState; readonly protocol?: McpProtocolState } = {},\n ): void {\n this.currentState = Object.freeze({\n status,\n serverName: this.serverName,\n attempt,\n catalogRevision: this.catalogRevision,\n ...(error === undefined ? {} : { error }),\n ...(error === undefined ? {} : {\n supportError: mcpSupportError(\n integrationErrorCode(error), 'mcp-client', 'MCP client operation failed',\n ),\n }),\n ...(details.authorization === undefined ? {} : { authorization: Object.freeze(details.authorization) }),\n ...(details.protocol === undefined ? {} : { protocol: Object.freeze(details.protocol) }),\n })\n try { this.options.onStateChange?.(this.currentState) } catch { /* lifecycle observers do not own connection state */ }\n }\n}\n\nexport { McpConnectionError, McpRemoteToolError } from './result.ts'\nexport { resolveMcpReconnectOptions } from './runtime-helpers.ts'\n","import { waitForSettlement } from '@alvin0/ai-agent-sdk-core'\nimport type { McpHttpClientOptions } from './api-types.ts'\nimport type { McpFetch } from './public-types.ts'\nimport { createAbortTimeoutScope, positiveSafeInteger, raceAbort, timeoutMilliseconds } from './runtime-helpers.ts'\nimport { MCP_CLIENT_DEFAULTS, MCP_HTTP_REDIRECT_STATUSES } from './config.ts'\n\nexport interface McpHttpSecurityOptions {\n readonly allowedOrigins?: readonly string[]\n readonly requireHttps: boolean\n readonly allowPrivateNetwork: boolean\n readonly allowRedirects: boolean\n readonly validateEndpoint?: (url: URL, signal: AbortSignal) => void | Promise<void>\n readonly maxTransportBytes: number\n readonly timeoutMs: number\n readonly teardownTimeoutMs: number\n}\n\nexport function snapshotHttpSecurityOptions(options: McpHttpClientOptions): McpHttpSecurityOptions {\n const allowedOrigins = options.allowedOrigins?.map((origin, index) => {\n let url: URL\n try { url = new URL(origin) } catch { throw new TypeError(`allowedOrigins[${index}] must be an absolute URL`) }\n if (url.username.length > 0 || url.password.length > 0) {\n throw new TypeError(`allowedOrigins[${index}] must not contain credentials`)\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n throw new TypeError(`allowedOrigins[${index}] must use http or https`)\n }\n return url.origin\n })\n return Object.freeze({\n ...(allowedOrigins === undefined ? {} : { allowedOrigins: Object.freeze([...new Set(allowedOrigins)]) }),\n requireHttps: options.requireHttps !== false,\n allowPrivateNetwork: options.allowPrivateNetwork === true,\n allowRedirects: options.allowRedirects === true,\n ...(options.validateEndpoint === undefined ? {} : { validateEndpoint: options.validateEndpoint }),\n maxTransportBytes: positiveSafeInteger(\n options.maxTransportBytes ?? MCP_CLIENT_DEFAULTS.maxTransportBytes, 'maxTransportBytes',\n ),\n timeoutMs: timeoutMilliseconds(\n options.operationTimeoutMs ?? MCP_CLIENT_DEFAULTS.operationTimeoutMs, 'operationTimeoutMs',\n ),\n teardownTimeoutMs: timeoutMilliseconds(\n options.closeTimeoutMs ?? MCP_CLIENT_DEFAULTS.closeTimeoutMs, 'closeTimeoutMs',\n ),\n })\n}\n\nexport function validateHttpEndpoint(value: string | URL, options: McpHttpSecurityOptions): URL {\n const url = new URL(value)\n if (url.username.length > 0 || url.password.length > 0) {\n throw new TypeError('MCP HTTP endpoint URL must not contain credentials')\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n throw new TypeError('MCP HTTP endpoint URL must use http or https')\n }\n if (!options.allowPrivateNetwork && isPrivateHostname(url.hostname)) {\n throw new TypeError(`MCP HTTP endpoint host '${url.hostname}' is private or local`)\n }\n if (options.requireHttps && url.protocol !== 'https:') {\n throw new TypeError('MCP HTTP endpoint URL must use https under the configured policy')\n }\n if (options.allowedOrigins !== undefined && !options.allowedOrigins.includes(url.origin)) {\n throw new TypeError(`MCP HTTP endpoint origin '${url.origin}' is not allowed`)\n }\n return url\n}\n\nexport function createGuardedMcpFetch(baseFetch: McpFetch, options: McpHttpSecurityOptions): McpFetch {\n if (typeof baseFetch !== 'function') throw new TypeError('MCP HTTP transport requires fetch')\n return ((input: string | URL, init?: RequestInit): Promise<Response> => {\n const scope = createAbortTimeoutScope(\n options.timeoutMs,\n `MCP HTTP operation exceeded its ${options.timeoutMs}ms deadline`,\n init?.signal ?? undefined,\n )\n const pending = (async (): Promise<Response> => {\n const signal = scope.signal\n signal.throwIfAborted()\n let currentUrl = validateHttpEndpoint(input, options)\n await validateBeforeFetch(currentUrl, options, signal)\n let requestInit: RequestInit = { ...init, signal, redirect: 'manual' }\n let response: Response\n for (let hop = 0; ; hop++) {\n signal.throwIfAborted()\n const fetching = Promise.resolve(baseFetch(currentUrl, requestInit))\n try { response = await raceAbort(fetching, signal) }\n catch (error) {\n // A custom fetch may ignore abort and deliver a body after the public\n // request has ended. Retain cleanup ownership without delaying rejection.\n void fetching.then(late => cancelResponse(late, options.teardownTimeoutMs), () => undefined)\n .catch(() => undefined)\n throw error\n }\n if (response.type === 'opaqueredirect') {\n await cancelResponse(response, options.teardownTimeoutMs)\n throw new Error('MCP HTTP transport rejected an opaque redirect')\n }\n if (!MCP_HTTP_REDIRECT_STATUSES.includes(response.status)) break\n if (!options.allowRedirects) {\n await cancelResponse(response, options.teardownTimeoutMs)\n throw new Error('MCP HTTP transport rejected a redirect')\n }\n if (hop >= MCP_CLIENT_DEFAULTS.maxRedirectHops) {\n await cancelResponse(response, options.teardownTimeoutMs)\n throw new Error(`MCP HTTP transport exceeded the ${MCP_CLIENT_DEFAULTS.maxRedirectHops}-redirect limit`)\n }\n const location = response.headers.get('location')\n if (location === null) {\n await cancelResponse(response, options.teardownTimeoutMs)\n throw new Error('MCP HTTP transport received a redirect without a location')\n }\n await cancelResponse(response, options.teardownTimeoutMs)\n const nextUrl = validateHttpEndpoint(new URL(location, currentUrl), options)\n await validateBeforeFetch(nextUrl, options, signal)\n const crossesOrigin = nextUrl.origin !== currentUrl.origin\n requestInit = redirectInit(requestInit, response.status, crossesOrigin)\n currentUrl = nextUrl\n }\n if (response.url.length > 0) {\n try {\n const responseUrl = validateHttpEndpoint(response.url, options)\n if (responseUrl.origin !== currentUrl.origin) {\n throw new Error('MCP HTTP transport response escaped the validated origin')\n }\n } catch (error) {\n await cancelResponse(response, options.teardownTimeoutMs)\n throw error\n }\n }\n const declared = Number(response.headers.get('content-length'))\n if (Number.isFinite(declared) && declared > options.maxTransportBytes) {\n if (response.body !== null) {\n await waitForSettlement(response.body.cancel().catch(() => undefined), options.teardownTimeoutMs)\n }\n throw new Error(`MCP HTTP response exceeds the ${options.maxTransportBytes}-byte limit`)\n }\n if (response.body === null) { scope.dispose(); return response }\n const limited = limitedResponseBody(\n response.body, options.maxTransportBytes, options.teardownTimeoutMs, signal, scope.dispose,\n )\n return new Response(limited, {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n })\n })()\n return raceAbort(pending, scope.signal).catch(error => { scope.dispose(); throw error })\n }) as McpFetch\n}\n\nfunction limitedResponseBody(\n body: ReadableStream<Uint8Array>,\n maxBytes: number,\n teardownTimeoutMs: number,\n signal: AbortSignal,\n dispose: () => void,\n): ReadableStream<Uint8Array> {\n const reader = body.getReader()\n let received = 0\n let settled = false\n let controller: ReadableStreamDefaultController<Uint8Array> | undefined\n const settle = (): void => {\n if (settled) return\n settled = true\n signal.removeEventListener('abort', abort)\n dispose()\n }\n const abort = (): void => {\n if (settled) return\n const reason = signal.reason ?? new Error('MCP HTTP response body was aborted')\n settle()\n controller?.error(reason)\n void waitForSettlement(reader.cancel(reason).catch(() => undefined), teardownTimeoutMs)\n }\n const source = {\n type: undefined,\n start(value: ReadableStreamDefaultController<Uint8Array>) {\n controller = value\n signal.addEventListener('abort', abort, { once: true })\n if (signal.aborted) abort()\n },\n async pull(value: ReadableStreamDefaultController<Uint8Array>) {\n if (settled) return\n try {\n const next = await raceAbort(reader.read(), signal)\n if (next.done) { settle(); value.close(); return }\n received += next.value.byteLength\n if (received > maxBytes) {\n const error = new Error(`MCP HTTP response exceeds the ${maxBytes}-byte limit`)\n settle()\n value.error(error)\n await waitForSettlement(reader.cancel(error).catch(() => undefined), teardownTimeoutMs)\n return\n }\n value.enqueue(next.value)\n } catch (error) {\n if (settled) return\n settle()\n value.error(error)\n }\n },\n async cancel(reason: unknown) {\n settle()\n await waitForSettlement(reader.cancel(reason).catch(() => undefined), teardownTimeoutMs)\n },\n }\n return new ReadableStream<Uint8Array>(source)\n}\n\nasync function validateBeforeFetch(\n url: URL,\n options: McpHttpSecurityOptions,\n signal: AbortSignal,\n): Promise<void> {\n signal.throwIfAborted()\n if (options.validateEndpoint === undefined) return\n const pending = Promise.resolve().then(() => {\n signal.throwIfAborted()\n return options.validateEndpoint?.(new URL(url), signal)\n })\n await raceAbort(pending, signal)\n signal.throwIfAborted()\n}\n\nfunction redirectInit(previous: RequestInit, status: number, crossesOrigin: boolean): RequestInit {\n const method = (previous.method ?? 'GET').toUpperCase()\n const switchesToGet = status === 303 || ((status === 301 || status === 302) && method === 'POST')\n if (!switchesToGet && typeof ReadableStream !== 'undefined'\n && previous.body instanceof ReadableStream) {\n throw new Error('MCP HTTP transport cannot replay a streaming body across a redirect')\n }\n const headers = crossesOrigin ? new Headers() : new Headers(previous.headers)\n if (switchesToGet) {\n headers.delete('content-length')\n headers.delete('content-type')\n }\n return {\n ...previous,\n redirect: 'manual',\n headers,\n ...(switchesToGet ? { method: 'GET', body: null } : {}),\n }\n}\n\nasync function cancelResponse(response: Response, timeoutMs: number): Promise<void> {\n if (response.body === null) return\n await waitForSettlement(response.body.cancel().catch(() => undefined), timeoutMs)\n}\n\nexport function mergeHeaders(base: RequestInit['headers'], extra: RequestInit['headers']): Headers {\n const headers = new Headers(base)\n new Headers(extra).forEach((value, key) => { headers.set(key, value) })\n return headers\n}\n\nfunction isPrivateHostname(value: string): boolean {\n const hostname = value.toLowerCase().replace(/^\\[|\\]$/g, '')\n if (hostname === 'localhost' || hostname.endsWith('.localhost')\n || hostname.endsWith('.local') || hostname.endsWith('.internal')\n || hostname.endsWith('.home.arpa') || !hostname.includes('.')) return true\n if (hostname.includes(':')) return true\n const octets = hostname.split('.').map(Number)\n if (octets.length !== 4 || octets.some(octet => !Number.isInteger(octet) || octet < 0 || octet > 255)) {\n return false\n }\n const [first = 0, second = 0] = octets\n return first === 0 || first === 10 || first === 127 || first >= 224\n || (first === 100 && second >= 64 && second <= 127)\n || (first === 169 && second === 254)\n || (first === 172 && second >= 16 && second <= 31)\n || (first === 192 && second === 168)\n || (first === 198 && (second === 18 || second === 19))\n}\n","import {\n SSEClientTransport,\n StreamableHTTPClientTransport,\n type SSEClientTransportOptions,\n type StreamableHTTPClientTransportOptions,\n} from '@modelcontextprotocol/client'\nimport type { McpHttpClientOptions } from './api-types.ts'\nimport type { McpTransport } from './public-types.ts'\nimport { McpClientConnection } from './connection.ts'\nimport { McpConnectionError, connectionFailureStage } from './result.ts'\nimport { mcpSupportError } from '../common/support-error.ts'\nimport {\n createGuardedMcpFetch,\n mergeHeaders,\n snapshotHttpSecurityOptions,\n validateHttpEndpoint,\n} from './http-security.ts'\nimport { authenticationKindOf } from './runtime-helpers.ts'\n\n/** Construct an HTTP client without opening the connection yet. */\nexport function createMcpHttpClient(options: McpHttpClientOptions): McpClientConnection {\n const security = snapshotHttpSecurityOptions(options)\n const url = validateHttpEndpoint(options.url, security)\n const {\n url: _url, fetch: injectedFetch, headers, transport, legacySse,\n allowedOrigins: _allowedOrigins, requireHttps: _requireHttps,\n allowPrivateNetwork: _allowPrivateNetwork, allowRedirects: _allowRedirects,\n validateEndpoint: _validateEndpoint, maxTransportBytes: _maxTransportBytes,\n ...lifecycle\n } = options\n const legacyOptions = legacySse === false ? undefined : legacySse\n const primaryFactory = (): McpTransport => {\n const requestInit = { ...transport?.requestInit }\n if (headers !== undefined) requestInit.headers = mergeHeaders(transport?.requestInit?.headers, headers)\n const guardedFetch = createGuardedMcpFetch(transport?.fetch ?? injectedFetch ?? globalThis.fetch, security)\n return new StreamableHTTPClientTransport(url, {\n ...transport, fetch: guardedFetch,\n ...(Object.keys(requestInit).length === 0 ? {} : { requestInit }),\n } as StreamableHTTPClientTransportOptions) as unknown as McpTransport\n }\n const fallbackFactory = legacySse === false ? undefined : (): McpTransport => {\n const fallbackUrl = validateHttpEndpoint(legacyOptions?.url ?? url, security)\n const fallbackOptions = legacyOptions?.transport\n const requestInit = { ...fallbackOptions?.requestInit }\n if (headers !== undefined) requestInit.headers = mergeHeaders(fallbackOptions?.requestInit?.headers, headers)\n const guardedFetch = createGuardedMcpFetch(\n fallbackOptions?.fetch ?? transport?.fetch ?? injectedFetch ?? globalThis.fetch,\n security,\n )\n return new SSEClientTransport(fallbackUrl, {\n ...fallbackOptions,\n ...(fallbackOptions?.authProvider === undefined && transport?.authProvider !== undefined\n ? { authProvider: transport.authProvider } : {}),\n fetch: guardedFetch,\n ...(Object.keys(requestInit).length === 0 ? {} : { requestInit }),\n } as SSEClientTransportOptions) as unknown as McpTransport\n }\n return new McpClientConnection(lifecycle, primaryFactory, {\n authenticationKind: authenticationKindOf(\n transport?.authProvider,\n mergeHeaders(transport?.requestInit?.headers, headers),\n ),\n ...(fallbackFactory === undefined ? {} : { fallbackTransportFactory: fallbackFactory }),\n integrationFamily: 'mcp-http-client',\n })\n}\n\n/** Construct and fully initialize an HTTP client. */\nexport async function connectMcpHttp(options: McpHttpClientOptions): Promise<McpClientConnection> {\n const connection = createMcpHttpClient(options)\n try { await connection.connect(); return connection }\n catch (error: unknown) {\n const stage = connectionFailureStage(connection.state.status)\n const cleanup = await connection.closeWithReport()\n throw new McpConnectionError(\n stage,\n mcpSupportError('MCP_CONNECT_FAILED', stage, 'MCP connection startup failed'),\n cleanup,\n error,\n )\n }\n}\n"],"mappings":";;;;;AAYA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,AAAS;CACT,YAAY,YAAoB,UAAkB,QAA2B;EAC3E,MAAM,aAAa,WAAW,GAAG,SAAS,YAAY,WAAW,MAAM,GAAG;EAC1E,K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E,MAAM,cAAc,qBAAqB,eAAe,OAAO,KAAK,QAAQ;EAC5E,MAAM,kBAAkB,eAAe;EACvC,MAAM,cAAc,EAAE,GAAG,iBAAiB,YAAY;EACtD,IAAI,YAAY,QAAW,YAAY,UAAU,aAAa,iBAAiB,aAAa,SAAS,OAAO;EAC5G,MAAM,eAAe,sBACnB,iBAAiB,SAAS,WAAW,SAAS,iBAAiB,WAAW,OAC1E,QACF;EACA,OAAO,IAAI,mBAAmB,aAAa;GACzC,GAAG;GACH,GAAI,iBAAiB,iBAAiB,UAAa,WAAW,iBAAiB,SAC3E,EAAE,cAAc,UAAU,aAAa,IAAI,CAAC;GAChD,OAAO;GACP,GAAI,OAAO,KAAK,WAAW,CAAC,CAAC,WAAW,IAAI,CAAC,IAAI,EAAE,YAAY;EACjE,CAA8B;CAChC;CACA,OAAO,IAAI,oBAAoB,WAAW,gBAAgB;EACxD,oBAAoB,qBAClB,WAAW,cACX,aAAa,WAAW,aAAa,SAAS,OAAO,CACvD;EACA,GAAI,oBAAoB,SAAY,CAAC,IAAI,EAAE,0BAA0B,gBAAgB;EACrF,mBAAmB;CACrB,CAAC;AACH;;AAGA,eAAsB,eAAe,SAA6D;CAChG,MAAM,aAAa,oBAAoB,OAAO;CAC9C,IAAI;EAAE,MAAM,WAAW,QAAQ;EAAG,OAAO;CAAW,SAC7C,OAAgB;EACrB,MAAM,QAAQ,uBAAuB,WAAW,MAAM,MAAM;EAC5D,MAAM,UAAU,MAAM,WAAW,gBAAgB;EACjD,MAAM,IAAI,mBACR,OACA,gBAAgB,sBAAsB,OAAO,+BAA+B,GAC5E,SACA,KACF;CACF;AACF"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as McpStreamableHttpReconnectionOptions, C as McpAuthenticationProvider, D as McpProtocolClient, E as McpFetch, M as McpTransport, N as McpVersionNegotiationMode, O as McpRemoteToolDefinition, S as ResolvedMcpReconnectOptions, T as McpCallToolResult, _ as McpProtocolState, a as McpConnectionError, b as McpTransportFactory, c as McpAuthorizationState, d as McpClientState, f as McpClientStatus, g as McpOAuthCallbackOptions, h as McpHttpClientOptions, i as resolveMcpReconnectOptions, j as McpStreamableHttpTransportOptions, k as McpSseTransportOptions, l as McpClientLifecycleOptions, m as McpConnectionPublicShape, n as createMcpHttpClient, o as McpRemoteToolError, p as McpCloseReport, r as McpClientConnection, s as McpAuthenticationKind, t as connectMcpHttp, u as McpClientRuntimeOptions, v as McpReconnectOptions, w as McpBearerAuthProvider, x as McpTransportKind, y as McpToolResultValue } from "./client-ChEdrVJ_.js";
|
|
2
|
+
export { type McpAuthenticationKind, type McpAuthenticationProvider, type McpAuthorizationState, type McpBearerAuthProvider, type McpCallToolResult, McpClientConnection, type McpClientLifecycleOptions, type McpClientRuntimeOptions, type McpClientState, type McpClientStatus, type McpCloseReport, McpConnectionError, type McpConnectionPublicShape, type McpFetch, type McpHttpClientOptions, type McpOAuthCallbackOptions, type McpProtocolClient, type McpProtocolState, type McpReconnectOptions, type McpRemoteToolDefinition, McpRemoteToolError, type McpSseTransportOptions, type McpStreamableHttpReconnectionOptions, type McpStreamableHttpTransportOptions, type McpToolResultValue, type McpTransport, type McpTransportFactory, type McpTransportKind, type McpVersionNegotiationMode, type ResolvedMcpReconnectOptions, connectMcpHttp, createMcpHttpClient, resolveMcpReconnectOptions };
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as McpConnectionError, i as resolveMcpReconnectOptions, n as createMcpHttpClient, o as McpRemoteToolError, r as McpClientConnection, t as connectMcpHttp } from "./client-D7Th3S7z.js";
|
|
2
|
+
|
|
3
|
+
export { McpClientConnection, McpConnectionError, McpRemoteToolError, connectMcpHttp, createMcpHttpClient, resolveMcpReconnectOptions };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as McpStreamableHttpReconnectionOptions, C as McpAuthenticationProvider, D as McpProtocolClient, E as McpFetch, M as McpTransport, N as McpVersionNegotiationMode, O as McpRemoteToolDefinition, S as ResolvedMcpReconnectOptions, T as McpCallToolResult, _ as McpProtocolState, a as McpConnectionError, b as McpTransportFactory, c as McpAuthorizationState, d as McpClientState, f as McpClientStatus, g as McpOAuthCallbackOptions, h as McpHttpClientOptions, i as resolveMcpReconnectOptions, j as McpStreamableHttpTransportOptions, k as McpSseTransportOptions, l as McpClientLifecycleOptions, m as McpConnectionPublicShape, n as createMcpHttpClient, o as McpRemoteToolError, p as McpCloseReport, r as McpClientConnection, s as McpAuthenticationKind, t as connectMcpHttp, u as McpClientRuntimeOptions, v as McpReconnectOptions, w as McpBearerAuthProvider, x as McpTransportKind, y as McpToolResultValue } from "./client-ChEdrVJ_.js";
|
|
2
|
+
export { type McpAuthenticationKind, type McpAuthenticationProvider, type McpAuthorizationState, type McpBearerAuthProvider, type McpCallToolResult, McpClientConnection, type McpClientLifecycleOptions, type McpClientRuntimeOptions, type McpClientState, type McpClientStatus, type McpCloseReport, McpConnectionError, type McpConnectionPublicShape, type McpFetch, type McpHttpClientOptions, type McpOAuthCallbackOptions, type McpProtocolClient, type McpProtocolState, type McpReconnectOptions, type McpRemoteToolDefinition, McpRemoteToolError, type McpSseTransportOptions, type McpStreamableHttpReconnectionOptions, type McpStreamableHttpTransportOptions, type McpToolResultValue, type McpTransport, type McpTransportFactory, type McpTransportKind, type McpVersionNegotiationMode, type ResolvedMcpReconnectOptions, connectMcpHttp, createMcpHttpClient, resolveMcpReconnectOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as McpConnectionError, i as resolveMcpReconnectOptions, n as createMcpHttpClient, o as McpRemoteToolError, r as McpClientConnection, t as connectMcpHttp } from "./client-D7Th3S7z.js";
|
|
2
|
+
|
|
3
|
+
export { McpClientConnection, McpConnectionError, McpRemoteToolError, connectMcpHttp, createMcpHttpClient, resolveMcpReconnectOptions };
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@alvin0/ai-agent-sdk-mcp-server";
|
package/dist/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@alvin0/ai-agent-sdk-mcp-server"
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alvin0/ai-agent-sdk-mcp",
|
|
3
|
+
"author": {
|
|
4
|
+
"name": "alvin0 - chaulamdinhai",
|
|
5
|
+
"email": "chaulamdinhai@gmail.com"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.1.0",
|
|
8
|
+
"description": "Universal MCP HTTP client for ai-agent-sdk",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/alvin0/ai-agent-sdk.git",
|
|
13
|
+
"directory": "packages/mcp"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/alvin0/ai-agent-sdk/tree/main/packages/mcp#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/alvin0/ai-agent-sdk/issues"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./client": {
|
|
35
|
+
"types": "./dist/client.d.ts",
|
|
36
|
+
"import": "./dist/client.js",
|
|
37
|
+
"default": "./dist/client.js"
|
|
38
|
+
},
|
|
39
|
+
"./server": {
|
|
40
|
+
"types": "./dist/server.d.ts",
|
|
41
|
+
"import": "./dist/server.js",
|
|
42
|
+
"default": "./dist/server.js"
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public",
|
|
48
|
+
"provenance": true
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@modelcontextprotocol/client": "2.0.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@alvin0/ai-agent-sdk-core": "^0.1.0",
|
|
55
|
+
"@alvin0/ai-agent-sdk-mcp-server": "^0.1.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"@alvin0/ai-agent-sdk-mcp-server": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@alvin0/ai-agent-sdk-core": "^0.1.0",
|
|
64
|
+
"@alvin0/ai-agent-sdk-mcp-server": "^0.1.0",
|
|
65
|
+
"@arethetypeswrong/cli": "0.18.5",
|
|
66
|
+
"playwright": "1.62.1",
|
|
67
|
+
"publint": "0.3.24",
|
|
68
|
+
"tsdown": "0.22.14",
|
|
69
|
+
"typescript": "7.0.2",
|
|
70
|
+
"vitest": "4.1.11",
|
|
71
|
+
"wrangler": "4.127.1"
|
|
72
|
+
},
|
|
73
|
+
"aiAgentSdk": {
|
|
74
|
+
"runtime": "universal",
|
|
75
|
+
"coreApi": 1,
|
|
76
|
+
"roles": [
|
|
77
|
+
"mcp-client",
|
|
78
|
+
"tool-source"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"build": "tsdown",
|
|
83
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true});require('node:fs').rmSync('artifacts',{recursive:true,force:true})\"",
|
|
84
|
+
"typecheck": "tsc --noEmit",
|
|
85
|
+
"test": "vitest run --config vitest.config.ts",
|
|
86
|
+
"pack": "pnpm pack --pack-destination artifacts",
|
|
87
|
+
"test:pack": "node scripts/test-packed.mts",
|
|
88
|
+
"check:publint": "publint",
|
|
89
|
+
"check:types": "attw --profile esm-only --pack ."
|
|
90
|
+
}
|
|
91
|
+
}
|