@alvin0/ai-agent-sdk-mcp-server 0.1.12 → 0.1.14

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/dist/index.js CHANGED
@@ -158,7 +158,7 @@ const MCP_SERVER_DEFAULTS = Object.freeze({
158
158
  maxDefinitionBytes: 4194304,
159
159
  maxInputBytes: 1048576,
160
160
  maxOutputBytes: 4194304,
161
- operationTimeoutMs: 6e5,
161
+ operationTimeoutMs: 2147483647,
162
162
  teardownTimeoutMs: 3e4,
163
163
  observerTimeoutMs: 5e3
164
164
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["assertIdentity"],"sources":["../src/common/integration-operation.ts","../src/common/preferred-state.ts","../src/common/config.ts","../src/server/advanced-support.ts","../src/server/advanced-calls.ts","../src/server/advanced-registration.ts","../src/server/advanced.ts","../src/preferred/server.ts"],"sourcesContent":["import type { IntegrationOperationEvidenceFields, SdkLogger } from '@alvin0/ai-agent-sdk-core/observability'\n\nexport const MCP_SERVER_INTEGRATION_OPERATIONS = Object.freeze({\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 McpServerIntegrationFamily = keyof typeof MCP_SERVER_INTEGRATION_OPERATIONS\nexport type McpServerIntegrationOperation =\n (typeof MCP_SERVER_INTEGRATION_OPERATIONS)[McpServerIntegrationFamily][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 MESSAGES = Object.freeze({\n start: 'SDK integration operation started',\n attempt: 'SDK integration attempt started',\n success: 'SDK integration operation completed',\n failure: 'SDK integration operation failed',\n abort: 'SDK integration operation aborted',\n})\n\nexport function beginIntegrationOperation(\n logger: SdkLogger | undefined,\n family: McpServerIntegrationFamily,\n operation: McpServerIntegrationOperation,\n): IntegrationOperation {\n validateOperation(family, operation)\n const operationId = crypto.randomUUID(), startedAt = monotonicNow()\n emit(logger, 'info', MESSAGES.start, {\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 emit(logger, status === 'error' ? 'error' : 'info', terminalMessage(status), {\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 }\n return Object.freeze({\n attempt(attemptNumber: number) {\n if (!Number.isSafeInteger(attemptNumber) || attemptNumber < 1) {\n throw new TypeError('integration attemptNumber must be a positive safe integer')\n }\n const attemptId = crypto.randomUUID(), attemptStartedAt = monotonicNow()\n emit(logger, 'info', MESSAGES.attempt, {\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', terminalMessage(status), {\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 Object.freeze({\n success: () => finishAttempt('success'),\n fail: (code?: string) => finishAttempt('error', code),\n abort: () => finishAttempt('aborted'),\n })\n },\n success: () => finish('success'),\n fail: (code?: string) => finish('error', code),\n abort: () => finish('aborted'),\n })\n}\n\nexport function integrationErrorCode(error: unknown): string {\n if (typeof error === 'object' && error !== null) {\n for (const key of ['code', 'name']) {\n const descriptor = Object.getOwnPropertyDescriptor(error, key)\n if (descriptor !== undefined && 'value' in descriptor && typeof descriptor.value === 'string') {\n return boundedCode(descriptor.value)\n }\n }\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 validateOperation(family: McpServerIntegrationFamily, operation: McpServerIntegrationOperation): void {\n const operations = MCP_SERVER_INTEGRATION_OPERATIONS[family] as readonly string[] | undefined\n assertIdentity(family, 64, 'integration family')\n assertIdentity(operation, 64, 'integration operation')\n if (operations === undefined || !operations.includes(operation)) {\n throw new TypeError('Invalid MCP integration operation')\n }\n}\n\nfunction emit(logger: SdkLogger | undefined, level: 'info' | 'error', message: string,\n fields: IntegrationOperationEvidenceFields): void {\n try { logger?.[level](message, fields) } catch { /* logging never owns protocol completion */ }\n}\n\nfunction terminalMessage(status: 'success' | 'error' | 'aborted'): string {\n if (status === 'success') return MESSAGES.success\n if (status === 'error') return MESSAGES.failure\n return MESSAGES.abort\n}\nfunction monotonicNow(): number { return performance.now() }\nfunction durationSince(startedAt: number): number {\n const value = monotonicNow() - startedAt\n return Number.isFinite(value) ? Math.max(0, value) : 0\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}\nfunction assertIdentity(value: string, limit: number, label: string): void {\n if (typeof value !== 'string' || value.length === 0 || value.length > limit) {\n throw new TypeError(`${label} must contain 1-${limit} characters`)\n }\n}\n","import type { RuntimeAgentResponse } from '@alvin0/ai-agent-sdk-core/agent'\nimport type { SdkMcpRequestContext, SdkMcpServer } from './server-public-types.ts'\n\nexport type McpServerRuntimeFamily = 'mcp-web-server' | 'mcp-stdio-server'\n\nexport interface PreferredServerState {\n readonly agents: Readonly<Record<string, PreferredServerAgent>>\n}\n\nexport interface PreferredServerAgent {\n generate(input: string, options: { readonly signal?: AbortSignal }): Promise<RuntimeAgentResponse>\n}\n\nexport type InternalMcpServerFactory = (\n request: SdkMcpRequestContext,\n family: McpServerRuntimeFamily,\n) => SdkMcpServer\n\nexport const MCP_WEB_SERVER_FACTORY = Symbol.for('ai-agent-sdk.mcp-web-server.factory.v1')\n\nconst STATES = new WeakMap<object, PreferredServerState>()\n\nexport function attachPreferredState(options: object, state: PreferredServerState): void {\n STATES.set(options, state)\n}\n\nexport function copyPreferredState(source: object, target: object): void {\n const state = STATES.get(source)\n if (state !== undefined) STATES.set(target, state)\n}\n\nexport function preferredState(options: object): PreferredServerState | undefined {\n return STATES.get(options)\n}\n\nexport function internalMcpServerFactory(value: unknown): InternalMcpServerFactory | undefined {\n if ((typeof value !== 'object' || value === null) && typeof value !== 'function') return undefined\n const descriptor = Object.getOwnPropertyDescriptor(value, MCP_WEB_SERVER_FACTORY)\n return descriptor !== undefined && 'value' in descriptor && typeof descriptor.value === 'function'\n ? descriptor.value as InternalMcpServerFactory : undefined\n}\n","/** Internal limits shared by preferred and advanced Universal MCP servers. */\nexport const MCP_SERVER_DEFAULTS = Object.freeze({\n maxExports: 1_024,\n maxDefinitionBytes: 4 * 1024 * 1024,\n maxInputBytes: 1024 * 1024,\n maxOutputBytes: 4 * 1024 * 1024,\n operationTimeoutMs: 10 * 60_000,\n teardownTimeoutMs: 30_000,\n observerTimeoutMs: 5_000,\n})\n","import { waitForSettlement } from '@alvin0/ai-agent-sdk-core'\nimport { MCP_SERVER_DEFAULTS } from '../common/config.ts'\nimport type { SdkMcpServerOptions, McpServerErrorContext } from './advanced-types.ts'\n\nexport interface ResolvedMcpServerLimits {\n readonly maxExports: number\n readonly maxDefinitionBytes: number\n readonly maxInputBytes: number\n readonly maxOutputBytes: number\n readonly operationTimeoutMs: number\n readonly teardownTimeoutMs: number\n readonly observerTimeoutMs: number\n}\n\n\nexport function assertIdentity(value: string, field: string): void {\n if (value.trim().length === 0) throw new TypeError(`${field} must not be empty`)\n}\n\nfunction errorMessage(value: unknown): string {\n return value instanceof Error && value.message.length > 0 ? value.message : String(value)\n}\n\nexport function resolveLimits(options: SdkMcpServerOptions): ResolvedMcpServerLimits {\n return {\n maxExports: positiveSafeInteger(options.maxExports ?? MCP_SERVER_DEFAULTS.maxExports, 'maxExports'),\n maxDefinitionBytes: positiveSafeInteger(\n options.maxDefinitionBytes ?? MCP_SERVER_DEFAULTS.maxDefinitionBytes, 'maxDefinitionBytes',\n ),\n maxInputBytes: positiveSafeInteger(options.maxInputBytes ?? MCP_SERVER_DEFAULTS.maxInputBytes, 'maxInputBytes'),\n maxOutputBytes: positiveSafeInteger(options.maxOutputBytes ?? MCP_SERVER_DEFAULTS.maxOutputBytes, 'maxOutputBytes'),\n operationTimeoutMs: positiveSafeInteger(\n options.operationTimeoutMs ?? MCP_SERVER_DEFAULTS.operationTimeoutMs, 'operationTimeoutMs',\n ),\n teardownTimeoutMs: positiveSafeInteger(\n options.teardownTimeoutMs ?? MCP_SERVER_DEFAULTS.teardownTimeoutMs, 'teardownTimeoutMs',\n ),\n observerTimeoutMs: positiveSafeInteger(\n options.observerTimeoutMs ?? MCP_SERVER_DEFAULTS.observerTimeoutMs, 'observerTimeoutMs',\n ),\n }\n}\n\nexport async function reportError(\n options: SdkMcpServerOptions,\n limits: ResolvedMcpServerLimits,\n error: unknown,\n evidence: McpServerErrorContext,\n): Promise<void> {\n if (options.onError === undefined) return\n const pending = Promise.resolve().then(() => options.onError?.(error, Object.freeze({\n ...evidence,\n })))\n await waitForSettlement(pending, limits.observerTimeoutMs)\n}\n\nexport function internalErrorMessage(options: SdkMcpServerOptions, error: unknown, fallback: string): string {\n return options.exposeInternalErrors === true ? errorMessage(error) : fallback\n}\n\nfunction positiveSafeInteger(value: number, label: string): number {\n if (!Number.isSafeInteger(value) || value < 1) {\n throw new RangeError(`MCP server ${label} must be a positive safe integer`)\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 server value is not JSON serializable')\n return new TextEncoder().encode(serialized).byteLength\n}\n\nexport async function raceWithSignal<T>(\n pending: Promise<T>,\n signal: AbortSignal,\n teardownTimeoutMs: number,\n): Promise<T> {\n if (signal.aborted) throw signal.reason ?? new Error('MCP server operation aborted')\n try {\n return await new Promise<T>((resolve, reject) => {\n const abort = () => {\n signal.removeEventListener('abort', abort)\n reject(signal.reason ?? new Error('MCP server operation aborted'))\n }\n signal.addEventListener('abort', abort, { once: true })\n void pending.then(\n value => { signal.removeEventListener('abort', abort); resolve(value) },\n error => { signal.removeEventListener('abort', abort); reject(error) },\n )\n })\n } catch (error: unknown) {\n if (signal.aborted) await waitForSettlement(pending, teardownTimeoutMs)\n throw error\n }\n}","import type { AgentSession } from '@alvin0/ai-agent-sdk-core/agent'\nimport {\n type CallToolResult,\n type ServerContext,\n} from '@modelcontextprotocol/server'\nimport type { ContentBlock } from '@alvin0/ai-agent-sdk-core'\nimport { ToolCallId, isJsonValue, type JsonValue } from '@alvin0/ai-agent-sdk-core'\nimport type { ToolCatalog } from '@alvin0/ai-agent-sdk-core/tools'\nimport {\n dispatchToolCall,\n} from '@alvin0/ai-agent-sdk-core/tools'\nimport {\n beginIntegrationOperation,\n integrationErrorCode,\n type McpServerIntegrationFamily,\n} from '../common/integration-operation.ts'\nimport { type PreferredServerAgent } from '../common/preferred-state.ts'\nimport type {\n SdkMcpRequestContext,\n} from '../common/server-public-types.ts'\nimport type { SdkMcpServerOptions, McpAgentTool } from './advanced-types.ts'\nimport type { IntegrationAttempt, IntegrationOperation } from '../common/integration-operation.ts'\nimport { resolveLimits, serializedBytes, raceWithSignal, reportError, internalErrorMessage,\n type ResolvedMcpServerLimits ,\n} from './advanced-support.ts'\n\ntype McpResultBlock = CallToolResult['content'][number]\n\nexport function serverFamily(options: SdkMcpServerOptions): McpServerIntegrationFamily {\n return options.integrationFamily ?? 'mcp-web-server'\n}\n\nexport async function callRuntimeAgent(\n options: SdkMcpServerOptions,\n definition: { name: string; agent: PreferredServerAgent },\n args: { input: string },\n context: ServerContext,\n): Promise<CallToolResult> {\n const { name, agent } = definition\n const limits = resolveLimits(options)\n const operation = beginIntegrationOperation(options.logger, serverFamily(options), 'agent-call')\n const attempt = operation.attempt(1)\n if (serializedBytes(args) > limits.maxInputBytes) {\n attempt.fail('INPUT_TOO_LARGE'); operation.fail('INPUT_TOO_LARGE')\n return errorResult(`agent input exceeds the ${limits.maxInputBytes}-byte limit`, 'INPUT_TOO_LARGE')\n }\n const signal = AbortSignal.any([context.mcpReq.signal, AbortSignal.timeout(limits.operationTimeoutMs)])\n try {\n const response = await raceWithSignal(agent.generate(args.input, { signal }), signal, limits.teardownTimeoutMs)\n const result: CallToolResult = {\n content: [{ type: 'text', text: response.text || '(empty response)' }],\n structuredContent: { text: response.text, runId: response.runId, traceId: response.traceId },\n }\n if (serializedBytes(result) > limits.maxOutputBytes) {\n attempt.fail('OUTPUT_TOO_LARGE'); operation.fail('OUTPUT_TOO_LARGE')\n return errorResult(`agent result exceeds the ${limits.maxOutputBytes}-byte limit`, 'OUTPUT_TOO_LARGE')\n }\n attempt.success(); operation.success()\n return result\n } catch (error: unknown) {\n const code = integrationErrorCode(error)\n if (signal.aborted) { attempt.abort(); operation.abort() }\n else { attempt.fail(code); operation.fail(code) }\n await reportError(options, limits, error, {\n operation: 'agent', exportName: name, requestId: String(context.mcpReq.id),\n })\n return errorResult(internalErrorMessage(options, error, 'agent operation failed'), 'AGENT_FAILED')\n }\n}\n\nexport async function callSdkTool(\n options: SdkMcpServerOptions,\n toolName: string,\n args: Record<string, unknown>,\n context: ServerContext,\n): Promise<CallToolResult> {\n const limits = resolveLimits(options)\n const operation = beginIntegrationOperation(options.logger, serverFamily(options), 'tool-call')\n const attempt = operation.attempt(1)\n if (serializedBytes(args) > limits.maxInputBytes) {\n attempt.fail('INPUT_TOO_LARGE'); operation.fail('INPUT_TOO_LARGE')\n return errorResult(`tool input exceeds the ${limits.maxInputBytes}-byte limit`, 'INPUT_TOO_LARGE')\n }\n const catalog = options.tools\n if (catalog === undefined) {\n attempt.fail('UNKNOWN_TOOL'); operation.fail('UNKNOWN_TOOL')\n return errorResult(`tool '${toolName}' is not available`, 'UNKNOWN_TOOL')\n }\n try {\n const result = await dispatchSdkTool({ options, toolName, args, context, catalog, limits })\n if (serializedBytes(result) > limits.maxOutputBytes) {\n attempt.fail('OUTPUT_TOO_LARGE'); operation.fail('OUTPUT_TOO_LARGE')\n return errorResult(`tool result exceeds the ${limits.maxOutputBytes}-byte limit`, 'OUTPUT_TOO_LARGE')\n }\n return renderToolResult(result, { attempt, operation })\n } catch (error: unknown) {\n const code = integrationErrorCode(error)\n attempt.fail(code); operation.fail(code)\n await reportError(options, limits, error, {\n operation: 'tool', exportName: toolName, requestId: String(context.mcpReq.id),\n })\n return errorResult(internalErrorMessage(options, error, 'tool operation failed'), 'TOOL_OPERATION_FAILED')\n }\n}\n\nexport async function callAgent(\n options: SdkMcpServerOptions,\n invocation: { definition: McpAgentTool; request: SdkMcpRequestContext },\n args: { input: string; conversationId?: string },\n context: ServerContext,\n): Promise<CallToolResult> {\n const { definition, request } = invocation\n const limits = resolveLimits(options)\n const operation = beginIntegrationOperation(options.logger, serverFamily(options), 'agent-call')\n const attempt = operation.attempt(1)\n if (serializedBytes(args) > limits.maxInputBytes) {\n attempt.fail('INPUT_TOO_LARGE'); operation.fail('INPUT_TOO_LARGE')\n return errorResult(`agent input exceeds the ${limits.maxInputBytes}-byte limit`, 'INPUT_TOO_LARGE')\n }\n const signal = AbortSignal.any([context.mcpReq.signal, AbortSignal.timeout(limits.operationTimeoutMs)])\n try {\n const session = await createAgentSession({ definition, request, args, context, signal, limits })\n if (session.definition.id !== definition.agent.id) {\n attempt.fail('WRONG_AGENT_SESSION'); operation.fail('WRONG_AGENT_SESSION')\n return errorResult(\n `session factory for '${definition.name}' returned agent '${session.definition.id}', `\n + `expected '${definition.agent.id}'`,\n 'WRONG_AGENT_SESSION',\n )\n }\n return await runAgentSession(session, args.input, { signal, limits, attempt, operation })\n } catch (error: unknown) {\n const code = integrationErrorCode(error)\n if (signal.aborted) { attempt.abort(); operation.abort() }\n else { attempt.fail(code); operation.fail(code) }\n await reportError(options, limits, error, {\n operation: 'agent', exportName: definition.name, requestId: String(context.mcpReq.id),\n })\n return errorResult(internalErrorMessage(options, error, 'agent operation failed'), 'AGENT_FAILED')\n }\n}\n\nfunction toMcpContent(blocks: readonly ContentBlock[]): McpResultBlock[] {\n const result: McpResultBlock[] = []\n for (const block of blocks) {\n if (block.type === 'text') {\n result.push({ type: 'text', text: block.text })\n continue\n }\n if (block.type === 'image' && block.source.kind === 'base64') {\n result.push({\n type: 'image',\n data: block.source.data,\n mimeType: block.source.mediaType,\n })\n continue\n }\n if (block.type === 'image' && block.source.kind === 'url') {\n result.push({ type: 'text', text: `[image](${block.source.url})` })\n continue\n }\n if (block.type === 'image' && block.source.kind === 'file') {\n result.push({ type: 'text', text: `[image file: ${block.source.fileId}]` })\n continue\n }\n if (block.type === 'reasoning') {\n result.push({ type: 'text', text: block.text })\n continue\n }\n result.push({ type: 'text', text: JSON.stringify(jsonSafeBlock(block)) })\n }\n return result\n}\n\nfunction jsonSafeBlock(block: ContentBlock): JsonValue {\n if (isJsonValue(block)) return block\n return { type: block.type }\n}\n\nfunction errorResult(message: string, code: string): CallToolResult {\n return {\n isError: true,\n content: [{ type: 'text', text: `Error: ${message}` }],\n structuredContent: { error: { message, code } },\n }\n}\n\nfunction dispatchSdkTool(input: {\n options: SdkMcpServerOptions; toolName: string; args: Record<string, unknown>; context: ServerContext;\n catalog: ToolCatalog; limits: ResolvedMcpServerLimits;\n}) {\n const { options, toolName, args, context, catalog, limits } = input\n return dispatchToolCall({\n catalog,\n call: {\n callId: ToolCallId(`mcp:${String(context.mcpReq.id)}`),\n toolName,\n rawArguments: JSON.stringify(args),\n },\n position: { turn: 1, step: 1 },\n signal: AbortSignal.any([context.mcpReq.signal, AbortSignal.timeout(limits.operationTimeoutMs)]),\n defaultTimeoutMs: limits.operationTimeoutMs,\n teardownTimeoutMs: limits.teardownTimeoutMs,\n ...(options.approvals === undefined ? {} : { approvals: options.approvals }),\n ...(options.interceptors === undefined ? {} : { interceptors: options.interceptors }),\n })\n}\n\nfunction renderToolResult(\n result: Awaited<ReturnType<typeof dispatchSdkTool>>,\n evidence: { attempt: IntegrationAttempt; operation: IntegrationOperation },\n): CallToolResult {\n const { attempt, operation } = evidence\n const content = [\n ...toMcpContent(result.content),\n ...toMcpContent(result.additionalContext ?? []),\n ]\n if (result.isError) {\n attempt.fail(result.error.code); operation.fail(result.error.code)\n return {\n isError: true,\n content: content.length === 0 ? [{ type: 'text', text: result.error.message }] : content,\n structuredContent: { error: result.error },\n }\n }\n attempt.success(); operation.success()\n return {\n content: content.length === 0 ? [{ type: 'text', text: '(no output)' }] : content,\n ...(result.value === undefined ? {} : { structuredContent: result.value }),\n }\n}\n\nfunction createAgentSession(input: {\n definition: McpAgentTool; request: SdkMcpRequestContext; args: { conversationId?: string };\n context: ServerContext; signal: AbortSignal; limits: ResolvedMcpServerLimits;\n}) {\n const { definition, request, args, context, signal, limits } = input\n const creating = Promise.resolve(definition.createSession({\n ...(args.conversationId === undefined ? {} : { conversationId: args.conversationId }),\n request,\n call: context,\n }))\n return raceWithSignal(creating, signal, limits.teardownTimeoutMs)\n}\n\nasync function runAgentSession(\n session: AgentSession, input: string,\n evidence: { signal: AbortSignal; limits: ResolvedMcpServerLimits;\n attempt: IntegrationAttempt; operation: IntegrationOperation },\n): Promise<CallToolResult> {\n const { signal, limits, attempt, operation } = evidence\n const running = session.run(input, { signal })\n const response = await raceWithSignal(running, signal, limits.teardownTimeoutMs)\n if (!isJsonValue(response.outcome)) {\n attempt.fail('INVALID_AGENT_RESULT'); operation.fail('INVALID_AGENT_RESULT')\n return errorResult('agent outcome was not lossless JSON', 'INVALID_AGENT_RESULT')\n }\n const result: CallToolResult = {\n content: [{ type: 'text', text: response.text || '(empty response)' }],\n structuredContent: {\n text: response.text,\n outcome: response.outcome,\n conversationId: session.conversationId,\n },\n }\n if (serializedBytes(result) > limits.maxOutputBytes) {\n attempt.fail('OUTPUT_TOO_LARGE'); operation.fail('OUTPUT_TOO_LARGE')\n return errorResult(`agent result exceeds the ${limits.maxOutputBytes}-byte limit`, 'OUTPUT_TOO_LARGE')\n }\n attempt.success(); operation.success()\n return result\n}\n","import {\n McpServer,\n fromJsonSchema,\n} from '@modelcontextprotocol/server'\nimport type { ToolCatalog } from '@alvin0/ai-agent-sdk-core/tools'\nimport { preferredState, type PreferredServerAgent } from '../common/preferred-state.ts'\nimport type {\n SdkMcpRequestContext,\n} from '../common/server-public-types.ts'\nimport type { SdkMcpServerOptions } from './advanced-types.ts'\nimport { assertIdentity, serializedBytes, type ResolvedMcpServerLimits } from './advanced-support.ts'\nimport { callAgent, callRuntimeAgent, callSdkTool } from './advanced-calls.ts'\n\ninterface RegistrationContext {\n server: McpServer; names: Set<string>; options: SdkMcpServerOptions; request: SdkMcpRequestContext;\n}\n\nexport function registerExports(ctx: RegistrationContext, limits: ResolvedMcpServerLimits): void {\n const { options } = ctx\n const schemas = options.tools?.schemas() ?? []\n const runtimeAgents = Object.entries(preferredState(options)?.agents ?? {})\n validateExports({ options, schemas, runtimeAgents, limits })\n registerTools(ctx, schemas)\n registerAgents(ctx)\n registerRuntimeAgents(ctx, runtimeAgents)\n}\n\nfunction registerTools(ctx: RegistrationContext, schemas: ReturnType<ToolCatalog['schemas']>): void {\n const { server, names, options } = ctx\n for (const schema of schemas) {\n if (names.has(schema.name)) throw new TypeError(`duplicate MCP export '${schema.name}'`)\n names.add(schema.name)\n server.registerTool(\n schema.name,\n {\n description: schema.description,\n // The Worker/browser validator dereferences by attaching private\n // metadata. SDK tool schemas are intentionally frozen, so give the\n // protocol boundary an isolated mutable copy.\n inputSchema: fromJsonSchema<Record<string, unknown>>(structuredClone(schema.parameters)),\n },\n async (args, context) => await callSdkTool(options, schema.name, args, context),\n )\n }\n}\n\nfunction registerAgents(ctx: RegistrationContext): void {\n const { server, names, options, request } = ctx\n for (const agent of options.agents ?? []) {\n assertIdentity(agent.name, 'agent MCP tool name')\n if (names.has(agent.name)) throw new TypeError(`duplicate MCP export '${agent.name}'`)\n names.add(agent.name)\n server.registerTool(\n agent.name,\n {\n description: agent.description\n ?? agent.agent.description\n ?? `Run the ${agent.agent.name} agent for one conversational turn.`,\n inputSchema: fromJsonSchema<{ input: string; conversationId?: string }>({\n type: 'object',\n properties: {\n input: { type: 'string', minLength: 1 },\n conversationId: { type: 'string', minLength: 1 },\n },\n required: ['input'],\n additionalProperties: false,\n }),\n },\n async (args, context) => await callAgent(options, { definition: agent, request }, args, context),\n )\n }\n}\n\nfunction registerRuntimeAgents(\n ctx: RegistrationContext, runtimeAgents: [string, PreferredServerAgent][],\n): void {\n const { server, names, options } = ctx\n for (const [name, agent] of runtimeAgents) {\n assertIdentity(name, 'agent MCP tool name')\n if (names.has(name)) throw new TypeError(`duplicate MCP export '${name}'`)\n names.add(name)\n server.registerTool(name, {\n description: `Run the ${name} agent for one turn.`,\n inputSchema: fromJsonSchema<{ input: string }>({\n type: 'object', properties: { input: { type: 'string', minLength: 1 } },\n required: ['input'], additionalProperties: false,\n }),\n }, async (args, context) => await callRuntimeAgent(options, { name, agent }, args, context))\n }\n}\n\nfunction validateExports(input: {\n options: SdkMcpServerOptions; schemas: ReturnType<ToolCatalog['schemas']>;\n runtimeAgents: [string, PreferredServerAgent][]; limits: ResolvedMcpServerLimits;\n}): void {\n const { options, schemas, runtimeAgents, limits } = input\n if (schemas.length + (options.agents?.length ?? 0) + runtimeAgents.length > limits.maxExports) {\n throw new RangeError(`MCP server exceeds the ${limits.maxExports}-export limit`)\n }\n if (serializedBytes([schemas, options.agents?.map(agent => ({\n name: agent.name, description: agent.description, agentId: agent.agent.id,\n })) ?? [], runtimeAgents.map(([name]) => ({ name }))]) > limits.maxDefinitionBytes) {\n throw new RangeError(`MCP server definitions exceed the ${limits.maxDefinitionBytes}-byte limit`)\n }\n}\n","/** Export SDK tools and agents as a Universal fetch-shaped MCP server. */\n\nimport {\n McpServer,\n createMcpHandler,\n type CreateMcpHandlerOptions,\n} from '@modelcontextprotocol/server'\nimport {\n beginIntegrationOperation,\n integrationChildLogger,\n integrationErrorCode,\n} from '../common/integration-operation.ts'\nimport { copyPreferredState } from '../common/preferred-state.ts'\nimport type {\n SdkMcpHandlerOptions,\n SdkMcpHandlerRequestOptions,\n SdkMcpHttpHandler,\n SdkMcpRequestContext,\n SdkMcpServer,\n} from '../common/server-public-types.ts'\n\nexport type * from '../common/server-public-types.ts'\nexport type { McpAgentSessionContext, McpAgentTool, McpServerErrorContext, SdkMcpServerOptions }\n from './advanced-types.ts'\nimport type { SdkMcpServerOptions } from './advanced-types.ts'\nimport { assertIdentity, resolveLimits } from './advanced-support.ts'\nimport { registerExports } from './advanced-registration.ts'\nimport { serverFamily } from './advanced-calls.ts'\n\n/** Create one MCP server instance for a connection or HTTP request. */\nexport function createSdkMcpServer(\n options: SdkMcpServerOptions,\n request: SdkMcpRequestContext = { era: 'modern' },\n): SdkMcpServer {\n const limits = resolveLimits(options)\n assertIdentity(options.name, 'server name')\n if (options.version.trim().length === 0) throw new TypeError('MCP server version must not be empty')\n const server = new McpServer(\n { name: options.name, version: options.version },\n {\n capabilities: { tools: { listChanged: false } },\n ...(options.instructions === undefined ? {} : { instructions: options.instructions }),\n },\n )\n const names = new Set<string>()\n registerExports({ server, names, options, request }, limits)\n return server as unknown as SdkMcpServer\n}\n\n/** Create a fetch-shaped API for hosts that accept Request/Response. */\nexport function createSdkMcpHandler(\n options: SdkMcpServerOptions,\n handlerOptions?: SdkMcpHandlerOptions,\n): SdkMcpHttpHandler {\n const handler = createMcpHandler(\n request => createSdkMcpServer(withRequestLogger(options), request as SdkMcpRequestContext) as unknown as McpServer,\n handlerOptions as CreateMcpHandlerOptions,\n )\n return {\n fetch: async (request: Request, requestOptions?: SdkMcpHandlerRequestOptions) => {\n const operation = beginIntegrationOperation(\n integrationChildLogger(options.logger, 'mcp-server-request'), serverFamily(options), 'request',\n )\n const attempt = operation.attempt(1)\n try {\n const response = await handler.fetch(request, requestOptions as never)\n if (response.status >= 500) {\n attempt.fail(`HTTP_${response.status}`); operation.fail(`HTTP_${response.status}`)\n } else {\n attempt.success(); operation.success()\n }\n return response\n } catch (error: unknown) {\n const code = integrationErrorCode(error)\n attempt.fail(code); operation.fail(code)\n throw error\n }\n },\n close: handler.close,\n notify: handler.notify,\n bus: handler.bus,\n } as unknown as SdkMcpHttpHandler\n}\n\nfunction withRequestLogger(options: SdkMcpServerOptions): SdkMcpServerOptions {\n const logger = integrationChildLogger(options.logger, 'mcp-server-request')\n if (logger === undefined) return options\n const child = { ...options, logger }\n copyPreferredState(options, child)\n return child\n}\n","import type { RuntimeAgent, RuntimeAgentInvocationOptions, RuntimeAgentResponse } from '@alvin0/ai-agent-sdk-core/agent'\nimport type { SdkLogger, ToolCatalog } from '@alvin0/ai-agent-sdk-core/tools'\nimport { createSdkMcpHandler, createSdkMcpServer, type SdkMcpServerOptions } from '../server/advanced.ts'\nimport {\n attachPreferredState, copyPreferredState, MCP_WEB_SERVER_FACTORY,\n type InternalMcpServerFactory, type PreferredServerAgent,\n} from '../common/preferred-state.ts'\nimport { MCP_SERVER_DEFAULTS } from '../common/config.ts'\n\nexport interface McpServerDefinition {\n readonly id: string\n readonly logger?: SdkLogger\n readonly tools?: ToolCatalog\n readonly agents?: Readonly<Record<string, RuntimeAgent>>\n readonly maxRequestBytes?: number\n readonly maxResponseBytes?: number\n}\n\nexport interface McpWebServer {\n handle(request: Request, options?: { readonly signal?: AbortSignal }): Promise<Response>\n}\n\n/** Capture one inert Web-standard server definition; each handle call owns its request resources. */\nexport function createMcpServer(definition: McpServerDefinition): McpWebServer {\n const source = objectValue(definition)\n const id = identity(ownValue(source, 'id'), 'MCP server id')\n const logger = optionalObject<SdkLogger>(ownValue(source, 'logger', false), 'MCP server logger')\n const tools = captureToolCatalog(ownValue(source, 'tools', false))\n const agents = captureAgents(ownValue(source, 'agents', false))\n const maxRequestBytes = positive(\n ownValue(source, 'maxRequestBytes', false) ?? MCP_SERVER_DEFAULTS.maxInputBytes, 'maxRequestBytes',\n )\n const maxResponseBytes = positive(\n ownValue(source, 'maxResponseBytes', false) ?? MCP_SERVER_DEFAULTS.maxOutputBytes, 'maxResponseBytes',\n )\n const advanced: SdkMcpServerOptions = Object.freeze({\n name: id, version: '1.0.0',\n ...(logger === undefined ? {} : { logger }),\n ...(tools === undefined ? {} : { tools }),\n maxInputBytes: maxRequestBytes, maxOutputBytes: maxResponseBytes,\n })\n attachPreferredState(advanced, Object.freeze({ agents }))\n\n const factory: InternalMcpServerFactory = (request, family) => {\n const scoped: SdkMcpServerOptions = { ...advanced, integrationFamily: family }\n copyPreferredState(advanced, scoped)\n return createSdkMcpServer(scoped, request)\n }\n const handle = async (request: Request, options?: { readonly signal?: AbortSignal }): Promise<Response> => {\n if (!(request instanceof Request)) throw new TypeError('MCP Web server requires a Request')\n const signal = options?.signal === undefined ? request.signal\n : AbortSignal.any([request.signal, options.signal])\n signal.throwIfAborted()\n const forwarded = signal === request.signal ? request : new Request(request, { signal })\n if (!await requestFits(forwarded, maxRequestBytes)) return payloadTooLarge()\n const handlerOptions: SdkMcpServerOptions = { ...advanced, integrationFamily: 'mcp-web-server' }\n copyPreferredState(advanced, handlerOptions)\n const handler = createSdkMcpHandler(handlerOptions)\n try {\n const response = await handler.fetch(forwarded)\n return boundedResponse(response, maxResponseBytes, handler.close)\n } catch (error: unknown) {\n await settleClose(handler.close)\n throw error\n }\n }\n const result = { handle }\n Object.defineProperty(result, MCP_WEB_SERVER_FACTORY, { value: factory, enumerable: false })\n return Object.freeze(result)\n}\n\nfunction captureAgents(value: unknown): Readonly<Record<string, PreferredServerAgent>> {\n if (value === undefined) return Object.freeze({})\n const source = objectValue(value), entries: [string, PreferredServerAgent][] = []\n for (const key of Reflect.ownKeys(source)) {\n if (typeof key !== 'string') throw new TypeError('MCP agent names must be strings')\n identity(key, 'MCP agent name')\n const agent = objectValue(ownValue(source, key)) as RuntimeAgent\n const generate = method(agent, 'generate')\n entries.push([key, Object.freeze({\n generate: (input: string, options: RuntimeAgentInvocationOptions): Promise<RuntimeAgentResponse> =>\n Reflect.apply(generate, agent, [input, options]) as Promise<RuntimeAgentResponse>,\n })])\n }\n return Object.freeze(Object.fromEntries(entries))\n}\n\nfunction captureToolCatalog(value: unknown): ToolCatalog | undefined {\n if (value === undefined) return undefined\n const catalog = objectValue(value) as ToolCatalog\n const get = method(catalog, 'get'), has = method(catalog, 'has'), names = method(catalog, 'names')\n const schemas = method(catalog, 'schemas'), executionMode = method(catalog, 'executionMode')\n return Object.freeze({\n get: (name: string) => Reflect.apply(get, catalog, [name]) as ReturnType<ToolCatalog['get']>,\n has: (name: string) => Reflect.apply(has, catalog, [name]) as boolean,\n names: () => Reflect.apply(names, catalog, []) as readonly string[],\n schemas: () => Reflect.apply(schemas, catalog, []) as ReturnType<ToolCatalog['schemas']>,\n executionMode(name: string, args: unknown): 'parallel' | 'exclusive' {\n return Reflect.apply(executionMode, catalog, [name, args]) as 'parallel' | 'exclusive'\n },\n })\n}\n\nasync function requestFits(request: Request, limit: number): Promise<boolean> {\n const declared = request.headers.get('content-length')\n if (declared !== null) {\n const bytes = Number(declared)\n if (!Number.isSafeInteger(bytes) || bytes < 0 || bytes > limit) return false\n }\n if (request.body === null) return true\n try { return (await request.clone().arrayBuffer()).byteLength <= limit } catch { return false }\n}\n\nfunction boundedResponse(response: Response, limit: number, close: () => Promise<void>): Response {\n if (response.body === null) { void settleClose(close); return response }\n const declared = response.headers.get('content-length')\n if (declared !== null && Number(declared) > limit) {\n void response.body.cancel(); void settleClose(close)\n return responseTooLarge()\n }\n const reader = response.body.getReader()\n let bytes = 0, closed = false\n const finish = async (): Promise<void> => {\n if (closed) return\n closed = true\n await settleClose(close)\n }\n const body = new ReadableStream<Uint8Array>({\n async pull(controller) {\n try {\n const next = await reader.read()\n if (next.done) { controller.close(); await finish(); return }\n bytes += next.value.byteLength\n if (bytes > limit) {\n await reader.cancel(); await finish()\n controller.error(new RangeError('MCP response exceeded maxResponseBytes'))\n return\n }\n controller.enqueue(next.value)\n } catch (error: unknown) { await finish(); controller.error(error) }\n },\n async cancel(reason) { try { await reader.cancel(reason) } finally { await finish() } },\n })\n return new Response(body, { status: response.status, statusText: response.statusText, headers: response.headers })\n}\n\nfunction payloadTooLarge(): Response {\n return Response.json({ jsonrpc: '2.0', id: null,\n error: { code: -32600, message: 'MCP request exceeds maxRequestBytes' } }, { status: 413 })\n}\nfunction responseTooLarge(): Response {\n return Response.json({ jsonrpc: '2.0', id: null,\n error: { code: -32603, message: 'MCP response exceeds maxResponseBytes' } }, { status: 500 })\n}\nasync function settleClose(close: () => Promise<void>): Promise<void> { try { await close() } catch {} }\nfunction objectValue(value: unknown): object {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new TypeError('Invalid MCP server definition')\n }\n return value\n}\nfunction ownValue(source: object, key: PropertyKey, required = true): unknown {\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (descriptor === undefined) {\n if (!required) return undefined\n throw new TypeError(`Missing MCP server field ${String(key)}`)\n }\n if (!('value' in descriptor)) throw new TypeError(`MCP server field ${String(key)} must be data`)\n return descriptor.value\n}\nfunction method(source: object, key: PropertyKey): Function {\n const value = Reflect.get(source, key)\n if (typeof value !== 'function') throw new TypeError(`MCP server method ${String(key)} is invalid`)\n return value\n}\nfunction identity(value: unknown, label: string): string {\n if (typeof value !== 'string' || value.length < 1 || value.length > 128) throw new TypeError(`${label} is invalid`)\n return value\n}\nfunction positive(value: unknown, label: string): number {\n if (!Number.isSafeInteger(value) || Number(value) < 1) throw new TypeError(`MCP server ${label} is invalid`)\n return Number(value)\n}\nfunction optionalObject<T>(value: unknown, label: string): T | undefined {\n if (value === undefined) return undefined\n if ((typeof value !== 'object' || value === null) && typeof value !== 'function') {\n throw new TypeError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AM;CAAE,QAAQ,CAAC;AAAE;AACvG,SAAS,YAAY,OAAwB;CAC3C,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,MAAM,IAAI,UAAU,+BAA+B;CAErD,OAAO;AACT;AACA,SAAS,SAAS,QAAgB,KAAkB,WAAW,MAAe;CAC5E,MAAM,aAAa,OAAO,yBAAyB,QAAQ,GAAG;CAC9D,IAAI,eAAe,QAAW;EAC5B,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,IAAI,UAAU,4BAA4B,OAAO,GAAG,GAAG;CAC/D;CACA,IAAI,EAAE,WAAW,aAAa,MAAM,IAAI,UAAU,oBAAoB,OAAO,GAAG,EAAE,cAAc;CAChG,OAAO,WAAW;AACpB;AACA,SAAS,OAAO,QAAgB,KAA4B;CAC1D,MAAM,QAAQ,QAAQ,IAAI,QAAQ,GAAG;CACrC,IAAI,OAAO,UAAU,YAAY,MAAM,IAAI,UAAU,qBAAqB,OAAO,GAAG,EAAE,YAAY;CAClG,OAAO;AACT;AACA,SAAS,SAAS,OAAgB,OAAuB;CACvD,IAAI,OAAO,UAAU,YAAY,MAAM,SAAS,KAAK,MAAM,SAAS,KAAK,MAAM,IAAI,UAAU,GAAG,MAAM,YAAY;CAClH,OAAO;AACT;AACA,SAAS,SAAS,OAAgB,OAAuB;CACvD,IAAI,CAAC,OAAO,cAAc,KAAK,KAAK,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,UAAU,cAAc,MAAM,YAAY;CAC3G,OAAO,OAAO,KAAK;AACrB;AACA,SAAS,eAAkB,OAAgB,OAA8B;CACvE,IAAI,UAAU,QAAW,OAAO;CAChC,KAAK,OAAO,UAAU,YAAY,UAAU,SAAS,OAAO,UAAU,YACpE,MAAM,IAAI,UAAU,GAAG,MAAM,YAAY;CAE3C,OAAO;AACT"}
1
+ {"version":3,"file":"index.js","names":["assertIdentity"],"sources":["../src/common/integration-operation.ts","../src/common/preferred-state.ts","../src/common/config.ts","../src/server/advanced-support.ts","../src/server/advanced-calls.ts","../src/server/advanced-registration.ts","../src/server/advanced.ts","../src/preferred/server.ts"],"sourcesContent":["import type { IntegrationOperationEvidenceFields, SdkLogger } from '@alvin0/ai-agent-sdk-core/observability'\n\nexport const MCP_SERVER_INTEGRATION_OPERATIONS = Object.freeze({\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 McpServerIntegrationFamily = keyof typeof MCP_SERVER_INTEGRATION_OPERATIONS\nexport type McpServerIntegrationOperation =\n (typeof MCP_SERVER_INTEGRATION_OPERATIONS)[McpServerIntegrationFamily][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 MESSAGES = Object.freeze({\n start: 'SDK integration operation started',\n attempt: 'SDK integration attempt started',\n success: 'SDK integration operation completed',\n failure: 'SDK integration operation failed',\n abort: 'SDK integration operation aborted',\n})\n\nexport function beginIntegrationOperation(\n logger: SdkLogger | undefined,\n family: McpServerIntegrationFamily,\n operation: McpServerIntegrationOperation,\n): IntegrationOperation {\n validateOperation(family, operation)\n const operationId = crypto.randomUUID(), startedAt = monotonicNow()\n emit(logger, 'info', MESSAGES.start, {\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 emit(logger, status === 'error' ? 'error' : 'info', terminalMessage(status), {\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 }\n return Object.freeze({\n attempt(attemptNumber: number) {\n if (!Number.isSafeInteger(attemptNumber) || attemptNumber < 1) {\n throw new TypeError('integration attemptNumber must be a positive safe integer')\n }\n const attemptId = crypto.randomUUID(), attemptStartedAt = monotonicNow()\n emit(logger, 'info', MESSAGES.attempt, {\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', terminalMessage(status), {\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 Object.freeze({\n success: () => finishAttempt('success'),\n fail: (code?: string) => finishAttempt('error', code),\n abort: () => finishAttempt('aborted'),\n })\n },\n success: () => finish('success'),\n fail: (code?: string) => finish('error', code),\n abort: () => finish('aborted'),\n })\n}\n\nexport function integrationErrorCode(error: unknown): string {\n if (typeof error === 'object' && error !== null) {\n for (const key of ['code', 'name']) {\n const descriptor = Object.getOwnPropertyDescriptor(error, key)\n if (descriptor !== undefined && 'value' in descriptor && typeof descriptor.value === 'string') {\n return boundedCode(descriptor.value)\n }\n }\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 validateOperation(family: McpServerIntegrationFamily, operation: McpServerIntegrationOperation): void {\n const operations = MCP_SERVER_INTEGRATION_OPERATIONS[family] as readonly string[] | undefined\n assertIdentity(family, 64, 'integration family')\n assertIdentity(operation, 64, 'integration operation')\n if (operations === undefined || !operations.includes(operation)) {\n throw new TypeError('Invalid MCP integration operation')\n }\n}\n\nfunction emit(logger: SdkLogger | undefined, level: 'info' | 'error', message: string,\n fields: IntegrationOperationEvidenceFields): void {\n try { logger?.[level](message, fields) } catch { /* logging never owns protocol completion */ }\n}\n\nfunction terminalMessage(status: 'success' | 'error' | 'aborted'): string {\n if (status === 'success') return MESSAGES.success\n if (status === 'error') return MESSAGES.failure\n return MESSAGES.abort\n}\nfunction monotonicNow(): number { return performance.now() }\nfunction durationSince(startedAt: number): number {\n const value = monotonicNow() - startedAt\n return Number.isFinite(value) ? Math.max(0, value) : 0\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}\nfunction assertIdentity(value: string, limit: number, label: string): void {\n if (typeof value !== 'string' || value.length === 0 || value.length > limit) {\n throw new TypeError(`${label} must contain 1-${limit} characters`)\n }\n}\n","import type { RuntimeAgentResponse } from '@alvin0/ai-agent-sdk-core/agent'\nimport type { SdkMcpRequestContext, SdkMcpServer } from './server-public-types.ts'\n\nexport type McpServerRuntimeFamily = 'mcp-web-server' | 'mcp-stdio-server'\n\nexport interface PreferredServerState {\n readonly agents: Readonly<Record<string, PreferredServerAgent>>\n}\n\nexport interface PreferredServerAgent {\n generate(input: string, options: { readonly signal?: AbortSignal }): Promise<RuntimeAgentResponse>\n}\n\nexport type InternalMcpServerFactory = (\n request: SdkMcpRequestContext,\n family: McpServerRuntimeFamily,\n) => SdkMcpServer\n\nexport const MCP_WEB_SERVER_FACTORY = Symbol.for('ai-agent-sdk.mcp-web-server.factory.v1')\n\nconst STATES = new WeakMap<object, PreferredServerState>()\n\nexport function attachPreferredState(options: object, state: PreferredServerState): void {\n STATES.set(options, state)\n}\n\nexport function copyPreferredState(source: object, target: object): void {\n const state = STATES.get(source)\n if (state !== undefined) STATES.set(target, state)\n}\n\nexport function preferredState(options: object): PreferredServerState | undefined {\n return STATES.get(options)\n}\n\nexport function internalMcpServerFactory(value: unknown): InternalMcpServerFactory | undefined {\n if ((typeof value !== 'object' || value === null) && typeof value !== 'function') return undefined\n const descriptor = Object.getOwnPropertyDescriptor(value, MCP_WEB_SERVER_FACTORY)\n return descriptor !== undefined && 'value' in descriptor && typeof descriptor.value === 'function'\n ? descriptor.value as InternalMcpServerFactory : undefined\n}\n","/** Internal limits shared by preferred and advanced Universal MCP servers. */\nexport const MCP_SERVER_DEFAULTS = Object.freeze({\n maxExports: 1_024,\n maxDefinitionBytes: 4 * 1024 * 1024,\n maxInputBytes: 1024 * 1024,\n maxOutputBytes: 4 * 1024 * 1024,\n // Largest delay a timer honors: no practical deadline unless the host opts in to one.\n operationTimeoutMs: 2_147_483_647,\n teardownTimeoutMs: 30_000,\n observerTimeoutMs: 5_000,\n})\n","import { waitForSettlement } from '@alvin0/ai-agent-sdk-core'\nimport { MCP_SERVER_DEFAULTS } from '../common/config.ts'\nimport type { SdkMcpServerOptions, McpServerErrorContext } from './advanced-types.ts'\n\nexport interface ResolvedMcpServerLimits {\n readonly maxExports: number\n readonly maxDefinitionBytes: number\n readonly maxInputBytes: number\n readonly maxOutputBytes: number\n readonly operationTimeoutMs: number\n readonly teardownTimeoutMs: number\n readonly observerTimeoutMs: number\n}\n\n\nexport function assertIdentity(value: string, field: string): void {\n if (value.trim().length === 0) throw new TypeError(`${field} must not be empty`)\n}\n\nfunction errorMessage(value: unknown): string {\n return value instanceof Error && value.message.length > 0 ? value.message : String(value)\n}\n\nexport function resolveLimits(options: SdkMcpServerOptions): ResolvedMcpServerLimits {\n return {\n maxExports: positiveSafeInteger(options.maxExports ?? MCP_SERVER_DEFAULTS.maxExports, 'maxExports'),\n maxDefinitionBytes: positiveSafeInteger(\n options.maxDefinitionBytes ?? MCP_SERVER_DEFAULTS.maxDefinitionBytes, 'maxDefinitionBytes',\n ),\n maxInputBytes: positiveSafeInteger(options.maxInputBytes ?? MCP_SERVER_DEFAULTS.maxInputBytes, 'maxInputBytes'),\n maxOutputBytes: positiveSafeInteger(options.maxOutputBytes ?? MCP_SERVER_DEFAULTS.maxOutputBytes, 'maxOutputBytes'),\n operationTimeoutMs: positiveSafeInteger(\n options.operationTimeoutMs ?? MCP_SERVER_DEFAULTS.operationTimeoutMs, 'operationTimeoutMs',\n ),\n teardownTimeoutMs: positiveSafeInteger(\n options.teardownTimeoutMs ?? MCP_SERVER_DEFAULTS.teardownTimeoutMs, 'teardownTimeoutMs',\n ),\n observerTimeoutMs: positiveSafeInteger(\n options.observerTimeoutMs ?? MCP_SERVER_DEFAULTS.observerTimeoutMs, 'observerTimeoutMs',\n ),\n }\n}\n\nexport async function reportError(\n options: SdkMcpServerOptions,\n limits: ResolvedMcpServerLimits,\n error: unknown,\n evidence: McpServerErrorContext,\n): Promise<void> {\n if (options.onError === undefined) return\n const pending = Promise.resolve().then(() => options.onError?.(error, Object.freeze({\n ...evidence,\n })))\n await waitForSettlement(pending, limits.observerTimeoutMs)\n}\n\nexport function internalErrorMessage(options: SdkMcpServerOptions, error: unknown, fallback: string): string {\n return options.exposeInternalErrors === true ? errorMessage(error) : fallback\n}\n\nfunction positiveSafeInteger(value: number, label: string): number {\n if (!Number.isSafeInteger(value) || value < 1) {\n throw new RangeError(`MCP server ${label} must be a positive safe integer`)\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 server value is not JSON serializable')\n return new TextEncoder().encode(serialized).byteLength\n}\n\nexport async function raceWithSignal<T>(\n pending: Promise<T>,\n signal: AbortSignal,\n teardownTimeoutMs: number,\n): Promise<T> {\n if (signal.aborted) throw signal.reason ?? new Error('MCP server operation aborted')\n try {\n return await new Promise<T>((resolve, reject) => {\n const abort = () => {\n signal.removeEventListener('abort', abort)\n reject(signal.reason ?? new Error('MCP server operation aborted'))\n }\n signal.addEventListener('abort', abort, { once: true })\n void pending.then(\n value => { signal.removeEventListener('abort', abort); resolve(value) },\n error => { signal.removeEventListener('abort', abort); reject(error) },\n )\n })\n } catch (error: unknown) {\n if (signal.aborted) await waitForSettlement(pending, teardownTimeoutMs)\n throw error\n }\n}","import type { AgentSession } from '@alvin0/ai-agent-sdk-core/agent'\nimport {\n type CallToolResult,\n type ServerContext,\n} from '@modelcontextprotocol/server'\nimport type { ContentBlock } from '@alvin0/ai-agent-sdk-core'\nimport { ToolCallId, isJsonValue, type JsonValue } from '@alvin0/ai-agent-sdk-core'\nimport type { ToolCatalog } from '@alvin0/ai-agent-sdk-core/tools'\nimport {\n dispatchToolCall,\n} from '@alvin0/ai-agent-sdk-core/tools'\nimport {\n beginIntegrationOperation,\n integrationErrorCode,\n type McpServerIntegrationFamily,\n} from '../common/integration-operation.ts'\nimport { type PreferredServerAgent } from '../common/preferred-state.ts'\nimport type {\n SdkMcpRequestContext,\n} from '../common/server-public-types.ts'\nimport type { SdkMcpServerOptions, McpAgentTool } from './advanced-types.ts'\nimport type { IntegrationAttempt, IntegrationOperation } from '../common/integration-operation.ts'\nimport { resolveLimits, serializedBytes, raceWithSignal, reportError, internalErrorMessage,\n type ResolvedMcpServerLimits ,\n} from './advanced-support.ts'\n\ntype McpResultBlock = CallToolResult['content'][number]\n\nexport function serverFamily(options: SdkMcpServerOptions): McpServerIntegrationFamily {\n return options.integrationFamily ?? 'mcp-web-server'\n}\n\nexport async function callRuntimeAgent(\n options: SdkMcpServerOptions,\n definition: { name: string; agent: PreferredServerAgent },\n args: { input: string },\n context: ServerContext,\n): Promise<CallToolResult> {\n const { name, agent } = definition\n const limits = resolveLimits(options)\n const operation = beginIntegrationOperation(options.logger, serverFamily(options), 'agent-call')\n const attempt = operation.attempt(1)\n if (serializedBytes(args) > limits.maxInputBytes) {\n attempt.fail('INPUT_TOO_LARGE'); operation.fail('INPUT_TOO_LARGE')\n return errorResult(`agent input exceeds the ${limits.maxInputBytes}-byte limit`, 'INPUT_TOO_LARGE')\n }\n const signal = AbortSignal.any([context.mcpReq.signal, AbortSignal.timeout(limits.operationTimeoutMs)])\n try {\n const response = await raceWithSignal(agent.generate(args.input, { signal }), signal, limits.teardownTimeoutMs)\n const result: CallToolResult = {\n content: [{ type: 'text', text: response.text || '(empty response)' }],\n structuredContent: { text: response.text, runId: response.runId, traceId: response.traceId },\n }\n if (serializedBytes(result) > limits.maxOutputBytes) {\n attempt.fail('OUTPUT_TOO_LARGE'); operation.fail('OUTPUT_TOO_LARGE')\n return errorResult(`agent result exceeds the ${limits.maxOutputBytes}-byte limit`, 'OUTPUT_TOO_LARGE')\n }\n attempt.success(); operation.success()\n return result\n } catch (error: unknown) {\n const code = integrationErrorCode(error)\n if (signal.aborted) { attempt.abort(); operation.abort() }\n else { attempt.fail(code); operation.fail(code) }\n await reportError(options, limits, error, {\n operation: 'agent', exportName: name, requestId: String(context.mcpReq.id),\n })\n return errorResult(internalErrorMessage(options, error, 'agent operation failed'), 'AGENT_FAILED')\n }\n}\n\nexport async function callSdkTool(\n options: SdkMcpServerOptions,\n toolName: string,\n args: Record<string, unknown>,\n context: ServerContext,\n): Promise<CallToolResult> {\n const limits = resolveLimits(options)\n const operation = beginIntegrationOperation(options.logger, serverFamily(options), 'tool-call')\n const attempt = operation.attempt(1)\n if (serializedBytes(args) > limits.maxInputBytes) {\n attempt.fail('INPUT_TOO_LARGE'); operation.fail('INPUT_TOO_LARGE')\n return errorResult(`tool input exceeds the ${limits.maxInputBytes}-byte limit`, 'INPUT_TOO_LARGE')\n }\n const catalog = options.tools\n if (catalog === undefined) {\n attempt.fail('UNKNOWN_TOOL'); operation.fail('UNKNOWN_TOOL')\n return errorResult(`tool '${toolName}' is not available`, 'UNKNOWN_TOOL')\n }\n try {\n const result = await dispatchSdkTool({ options, toolName, args, context, catalog, limits })\n if (serializedBytes(result) > limits.maxOutputBytes) {\n attempt.fail('OUTPUT_TOO_LARGE'); operation.fail('OUTPUT_TOO_LARGE')\n return errorResult(`tool result exceeds the ${limits.maxOutputBytes}-byte limit`, 'OUTPUT_TOO_LARGE')\n }\n return renderToolResult(result, { attempt, operation })\n } catch (error: unknown) {\n const code = integrationErrorCode(error)\n attempt.fail(code); operation.fail(code)\n await reportError(options, limits, error, {\n operation: 'tool', exportName: toolName, requestId: String(context.mcpReq.id),\n })\n return errorResult(internalErrorMessage(options, error, 'tool operation failed'), 'TOOL_OPERATION_FAILED')\n }\n}\n\nexport async function callAgent(\n options: SdkMcpServerOptions,\n invocation: { definition: McpAgentTool; request: SdkMcpRequestContext },\n args: { input: string; conversationId?: string },\n context: ServerContext,\n): Promise<CallToolResult> {\n const { definition, request } = invocation\n const limits = resolveLimits(options)\n const operation = beginIntegrationOperation(options.logger, serverFamily(options), 'agent-call')\n const attempt = operation.attempt(1)\n if (serializedBytes(args) > limits.maxInputBytes) {\n attempt.fail('INPUT_TOO_LARGE'); operation.fail('INPUT_TOO_LARGE')\n return errorResult(`agent input exceeds the ${limits.maxInputBytes}-byte limit`, 'INPUT_TOO_LARGE')\n }\n const signal = AbortSignal.any([context.mcpReq.signal, AbortSignal.timeout(limits.operationTimeoutMs)])\n try {\n const session = await createAgentSession({ definition, request, args, context, signal, limits })\n if (session.definition.id !== definition.agent.id) {\n attempt.fail('WRONG_AGENT_SESSION'); operation.fail('WRONG_AGENT_SESSION')\n return errorResult(\n `session factory for '${definition.name}' returned agent '${session.definition.id}', `\n + `expected '${definition.agent.id}'`,\n 'WRONG_AGENT_SESSION',\n )\n }\n return await runAgentSession(session, args.input, { signal, limits, attempt, operation })\n } catch (error: unknown) {\n const code = integrationErrorCode(error)\n if (signal.aborted) { attempt.abort(); operation.abort() }\n else { attempt.fail(code); operation.fail(code) }\n await reportError(options, limits, error, {\n operation: 'agent', exportName: definition.name, requestId: String(context.mcpReq.id),\n })\n return errorResult(internalErrorMessage(options, error, 'agent operation failed'), 'AGENT_FAILED')\n }\n}\n\nfunction toMcpContent(blocks: readonly ContentBlock[]): McpResultBlock[] {\n const result: McpResultBlock[] = []\n for (const block of blocks) {\n if (block.type === 'text') {\n result.push({ type: 'text', text: block.text })\n continue\n }\n if (block.type === 'image' && block.source.kind === 'base64') {\n result.push({\n type: 'image',\n data: block.source.data,\n mimeType: block.source.mediaType,\n })\n continue\n }\n if (block.type === 'image' && block.source.kind === 'url') {\n result.push({ type: 'text', text: `[image](${block.source.url})` })\n continue\n }\n if (block.type === 'image' && block.source.kind === 'file') {\n result.push({ type: 'text', text: `[image file: ${block.source.fileId}]` })\n continue\n }\n if (block.type === 'reasoning') {\n result.push({ type: 'text', text: block.text })\n continue\n }\n result.push({ type: 'text', text: JSON.stringify(jsonSafeBlock(block)) })\n }\n return result\n}\n\nfunction jsonSafeBlock(block: ContentBlock): JsonValue {\n if (isJsonValue(block)) return block\n return { type: block.type }\n}\n\nfunction errorResult(message: string, code: string): CallToolResult {\n return {\n isError: true,\n content: [{ type: 'text', text: `Error: ${message}` }],\n structuredContent: { error: { message, code } },\n }\n}\n\nfunction dispatchSdkTool(input: {\n options: SdkMcpServerOptions; toolName: string; args: Record<string, unknown>; context: ServerContext;\n catalog: ToolCatalog; limits: ResolvedMcpServerLimits;\n}) {\n const { options, toolName, args, context, catalog, limits } = input\n return dispatchToolCall({\n catalog,\n call: {\n callId: ToolCallId(`mcp:${String(context.mcpReq.id)}`),\n toolName,\n rawArguments: JSON.stringify(args),\n },\n position: { turn: 1, step: 1 },\n signal: AbortSignal.any([context.mcpReq.signal, AbortSignal.timeout(limits.operationTimeoutMs)]),\n defaultTimeoutMs: limits.operationTimeoutMs,\n teardownTimeoutMs: limits.teardownTimeoutMs,\n ...(options.approvals === undefined ? {} : { approvals: options.approvals }),\n ...(options.interceptors === undefined ? {} : { interceptors: options.interceptors }),\n })\n}\n\nfunction renderToolResult(\n result: Awaited<ReturnType<typeof dispatchSdkTool>>,\n evidence: { attempt: IntegrationAttempt; operation: IntegrationOperation },\n): CallToolResult {\n const { attempt, operation } = evidence\n const content = [\n ...toMcpContent(result.content),\n ...toMcpContent(result.additionalContext ?? []),\n ]\n if (result.isError) {\n attempt.fail(result.error.code); operation.fail(result.error.code)\n return {\n isError: true,\n content: content.length === 0 ? [{ type: 'text', text: result.error.message }] : content,\n structuredContent: { error: result.error },\n }\n }\n attempt.success(); operation.success()\n return {\n content: content.length === 0 ? [{ type: 'text', text: '(no output)' }] : content,\n ...(result.value === undefined ? {} : { structuredContent: result.value }),\n }\n}\n\nfunction createAgentSession(input: {\n definition: McpAgentTool; request: SdkMcpRequestContext; args: { conversationId?: string };\n context: ServerContext; signal: AbortSignal; limits: ResolvedMcpServerLimits;\n}) {\n const { definition, request, args, context, signal, limits } = input\n const creating = Promise.resolve(definition.createSession({\n ...(args.conversationId === undefined ? {} : { conversationId: args.conversationId }),\n request,\n call: context,\n }))\n return raceWithSignal(creating, signal, limits.teardownTimeoutMs)\n}\n\nasync function runAgentSession(\n session: AgentSession, input: string,\n evidence: { signal: AbortSignal; limits: ResolvedMcpServerLimits;\n attempt: IntegrationAttempt; operation: IntegrationOperation },\n): Promise<CallToolResult> {\n const { signal, limits, attempt, operation } = evidence\n const running = session.run(input, { signal })\n const response = await raceWithSignal(running, signal, limits.teardownTimeoutMs)\n if (!isJsonValue(response.outcome)) {\n attempt.fail('INVALID_AGENT_RESULT'); operation.fail('INVALID_AGENT_RESULT')\n return errorResult('agent outcome was not lossless JSON', 'INVALID_AGENT_RESULT')\n }\n const result: CallToolResult = {\n content: [{ type: 'text', text: response.text || '(empty response)' }],\n structuredContent: {\n text: response.text,\n outcome: response.outcome,\n conversationId: session.conversationId,\n },\n }\n if (serializedBytes(result) > limits.maxOutputBytes) {\n attempt.fail('OUTPUT_TOO_LARGE'); operation.fail('OUTPUT_TOO_LARGE')\n return errorResult(`agent result exceeds the ${limits.maxOutputBytes}-byte limit`, 'OUTPUT_TOO_LARGE')\n }\n attempt.success(); operation.success()\n return result\n}\n","import {\n McpServer,\n fromJsonSchema,\n} from '@modelcontextprotocol/server'\nimport type { ToolCatalog } from '@alvin0/ai-agent-sdk-core/tools'\nimport { preferredState, type PreferredServerAgent } from '../common/preferred-state.ts'\nimport type {\n SdkMcpRequestContext,\n} from '../common/server-public-types.ts'\nimport type { SdkMcpServerOptions } from './advanced-types.ts'\nimport { assertIdentity, serializedBytes, type ResolvedMcpServerLimits } from './advanced-support.ts'\nimport { callAgent, callRuntimeAgent, callSdkTool } from './advanced-calls.ts'\n\ninterface RegistrationContext {\n server: McpServer; names: Set<string>; options: SdkMcpServerOptions; request: SdkMcpRequestContext;\n}\n\nexport function registerExports(ctx: RegistrationContext, limits: ResolvedMcpServerLimits): void {\n const { options } = ctx\n const schemas = options.tools?.schemas() ?? []\n const runtimeAgents = Object.entries(preferredState(options)?.agents ?? {})\n validateExports({ options, schemas, runtimeAgents, limits })\n registerTools(ctx, schemas)\n registerAgents(ctx)\n registerRuntimeAgents(ctx, runtimeAgents)\n}\n\nfunction registerTools(ctx: RegistrationContext, schemas: ReturnType<ToolCatalog['schemas']>): void {\n const { server, names, options } = ctx\n for (const schema of schemas) {\n if (names.has(schema.name)) throw new TypeError(`duplicate MCP export '${schema.name}'`)\n names.add(schema.name)\n server.registerTool(\n schema.name,\n {\n description: schema.description,\n // The Worker/browser validator dereferences by attaching private\n // metadata. SDK tool schemas are intentionally frozen, so give the\n // protocol boundary an isolated mutable copy.\n inputSchema: fromJsonSchema<Record<string, unknown>>(structuredClone(schema.parameters)),\n },\n async (args, context) => await callSdkTool(options, schema.name, args, context),\n )\n }\n}\n\nfunction registerAgents(ctx: RegistrationContext): void {\n const { server, names, options, request } = ctx\n for (const agent of options.agents ?? []) {\n assertIdentity(agent.name, 'agent MCP tool name')\n if (names.has(agent.name)) throw new TypeError(`duplicate MCP export '${agent.name}'`)\n names.add(agent.name)\n server.registerTool(\n agent.name,\n {\n description: agent.description\n ?? agent.agent.description\n ?? `Run the ${agent.agent.name} agent for one conversational turn.`,\n inputSchema: fromJsonSchema<{ input: string; conversationId?: string }>({\n type: 'object',\n properties: {\n input: { type: 'string', minLength: 1 },\n conversationId: { type: 'string', minLength: 1 },\n },\n required: ['input'],\n additionalProperties: false,\n }),\n },\n async (args, context) => await callAgent(options, { definition: agent, request }, args, context),\n )\n }\n}\n\nfunction registerRuntimeAgents(\n ctx: RegistrationContext, runtimeAgents: [string, PreferredServerAgent][],\n): void {\n const { server, names, options } = ctx\n for (const [name, agent] of runtimeAgents) {\n assertIdentity(name, 'agent MCP tool name')\n if (names.has(name)) throw new TypeError(`duplicate MCP export '${name}'`)\n names.add(name)\n server.registerTool(name, {\n description: `Run the ${name} agent for one turn.`,\n inputSchema: fromJsonSchema<{ input: string }>({\n type: 'object', properties: { input: { type: 'string', minLength: 1 } },\n required: ['input'], additionalProperties: false,\n }),\n }, async (args, context) => await callRuntimeAgent(options, { name, agent }, args, context))\n }\n}\n\nfunction validateExports(input: {\n options: SdkMcpServerOptions; schemas: ReturnType<ToolCatalog['schemas']>;\n runtimeAgents: [string, PreferredServerAgent][]; limits: ResolvedMcpServerLimits;\n}): void {\n const { options, schemas, runtimeAgents, limits } = input\n if (schemas.length + (options.agents?.length ?? 0) + runtimeAgents.length > limits.maxExports) {\n throw new RangeError(`MCP server exceeds the ${limits.maxExports}-export limit`)\n }\n if (serializedBytes([schemas, options.agents?.map(agent => ({\n name: agent.name, description: agent.description, agentId: agent.agent.id,\n })) ?? [], runtimeAgents.map(([name]) => ({ name }))]) > limits.maxDefinitionBytes) {\n throw new RangeError(`MCP server definitions exceed the ${limits.maxDefinitionBytes}-byte limit`)\n }\n}\n","/** Export SDK tools and agents as a Universal fetch-shaped MCP server. */\n\nimport {\n McpServer,\n createMcpHandler,\n type CreateMcpHandlerOptions,\n} from '@modelcontextprotocol/server'\nimport {\n beginIntegrationOperation,\n integrationChildLogger,\n integrationErrorCode,\n} from '../common/integration-operation.ts'\nimport { copyPreferredState } from '../common/preferred-state.ts'\nimport type {\n SdkMcpHandlerOptions,\n SdkMcpHandlerRequestOptions,\n SdkMcpHttpHandler,\n SdkMcpRequestContext,\n SdkMcpServer,\n} from '../common/server-public-types.ts'\n\nexport type * from '../common/server-public-types.ts'\nexport type { McpAgentSessionContext, McpAgentTool, McpServerErrorContext, SdkMcpServerOptions }\n from './advanced-types.ts'\nimport type { SdkMcpServerOptions } from './advanced-types.ts'\nimport { assertIdentity, resolveLimits } from './advanced-support.ts'\nimport { registerExports } from './advanced-registration.ts'\nimport { serverFamily } from './advanced-calls.ts'\n\n/** Create one MCP server instance for a connection or HTTP request. */\nexport function createSdkMcpServer(\n options: SdkMcpServerOptions,\n request: SdkMcpRequestContext = { era: 'modern' },\n): SdkMcpServer {\n const limits = resolveLimits(options)\n assertIdentity(options.name, 'server name')\n if (options.version.trim().length === 0) throw new TypeError('MCP server version must not be empty')\n const server = new McpServer(\n { name: options.name, version: options.version },\n {\n capabilities: { tools: { listChanged: false } },\n ...(options.instructions === undefined ? {} : { instructions: options.instructions }),\n },\n )\n const names = new Set<string>()\n registerExports({ server, names, options, request }, limits)\n return server as unknown as SdkMcpServer\n}\n\n/** Create a fetch-shaped API for hosts that accept Request/Response. */\nexport function createSdkMcpHandler(\n options: SdkMcpServerOptions,\n handlerOptions?: SdkMcpHandlerOptions,\n): SdkMcpHttpHandler {\n const handler = createMcpHandler(\n request => createSdkMcpServer(withRequestLogger(options), request as SdkMcpRequestContext) as unknown as McpServer,\n handlerOptions as CreateMcpHandlerOptions,\n )\n return {\n fetch: async (request: Request, requestOptions?: SdkMcpHandlerRequestOptions) => {\n const operation = beginIntegrationOperation(\n integrationChildLogger(options.logger, 'mcp-server-request'), serverFamily(options), 'request',\n )\n const attempt = operation.attempt(1)\n try {\n const response = await handler.fetch(request, requestOptions as never)\n if (response.status >= 500) {\n attempt.fail(`HTTP_${response.status}`); operation.fail(`HTTP_${response.status}`)\n } else {\n attempt.success(); operation.success()\n }\n return response\n } catch (error: unknown) {\n const code = integrationErrorCode(error)\n attempt.fail(code); operation.fail(code)\n throw error\n }\n },\n close: handler.close,\n notify: handler.notify,\n bus: handler.bus,\n } as unknown as SdkMcpHttpHandler\n}\n\nfunction withRequestLogger(options: SdkMcpServerOptions): SdkMcpServerOptions {\n const logger = integrationChildLogger(options.logger, 'mcp-server-request')\n if (logger === undefined) return options\n const child = { ...options, logger }\n copyPreferredState(options, child)\n return child\n}\n","import type { RuntimeAgent, RuntimeAgentInvocationOptions, RuntimeAgentResponse } from '@alvin0/ai-agent-sdk-core/agent'\nimport type { SdkLogger, ToolCatalog } from '@alvin0/ai-agent-sdk-core/tools'\nimport { createSdkMcpHandler, createSdkMcpServer, type SdkMcpServerOptions } from '../server/advanced.ts'\nimport {\n attachPreferredState, copyPreferredState, MCP_WEB_SERVER_FACTORY,\n type InternalMcpServerFactory, type PreferredServerAgent,\n} from '../common/preferred-state.ts'\nimport { MCP_SERVER_DEFAULTS } from '../common/config.ts'\n\nexport interface McpServerDefinition {\n readonly id: string\n readonly logger?: SdkLogger\n readonly tools?: ToolCatalog\n readonly agents?: Readonly<Record<string, RuntimeAgent>>\n readonly maxRequestBytes?: number\n readonly maxResponseBytes?: number\n}\n\nexport interface McpWebServer {\n handle(request: Request, options?: { readonly signal?: AbortSignal }): Promise<Response>\n}\n\n/** Capture one inert Web-standard server definition; each handle call owns its request resources. */\nexport function createMcpServer(definition: McpServerDefinition): McpWebServer {\n const source = objectValue(definition)\n const id = identity(ownValue(source, 'id'), 'MCP server id')\n const logger = optionalObject<SdkLogger>(ownValue(source, 'logger', false), 'MCP server logger')\n const tools = captureToolCatalog(ownValue(source, 'tools', false))\n const agents = captureAgents(ownValue(source, 'agents', false))\n const maxRequestBytes = positive(\n ownValue(source, 'maxRequestBytes', false) ?? MCP_SERVER_DEFAULTS.maxInputBytes, 'maxRequestBytes',\n )\n const maxResponseBytes = positive(\n ownValue(source, 'maxResponseBytes', false) ?? MCP_SERVER_DEFAULTS.maxOutputBytes, 'maxResponseBytes',\n )\n const advanced: SdkMcpServerOptions = Object.freeze({\n name: id, version: '1.0.0',\n ...(logger === undefined ? {} : { logger }),\n ...(tools === undefined ? {} : { tools }),\n maxInputBytes: maxRequestBytes, maxOutputBytes: maxResponseBytes,\n })\n attachPreferredState(advanced, Object.freeze({ agents }))\n\n const factory: InternalMcpServerFactory = (request, family) => {\n const scoped: SdkMcpServerOptions = { ...advanced, integrationFamily: family }\n copyPreferredState(advanced, scoped)\n return createSdkMcpServer(scoped, request)\n }\n const handle = async (request: Request, options?: { readonly signal?: AbortSignal }): Promise<Response> => {\n if (!(request instanceof Request)) throw new TypeError('MCP Web server requires a Request')\n const signal = options?.signal === undefined ? request.signal\n : AbortSignal.any([request.signal, options.signal])\n signal.throwIfAborted()\n const forwarded = signal === request.signal ? request : new Request(request, { signal })\n if (!await requestFits(forwarded, maxRequestBytes)) return payloadTooLarge()\n const handlerOptions: SdkMcpServerOptions = { ...advanced, integrationFamily: 'mcp-web-server' }\n copyPreferredState(advanced, handlerOptions)\n const handler = createSdkMcpHandler(handlerOptions)\n try {\n const response = await handler.fetch(forwarded)\n return boundedResponse(response, maxResponseBytes, handler.close)\n } catch (error: unknown) {\n await settleClose(handler.close)\n throw error\n }\n }\n const result = { handle }\n Object.defineProperty(result, MCP_WEB_SERVER_FACTORY, { value: factory, enumerable: false })\n return Object.freeze(result)\n}\n\nfunction captureAgents(value: unknown): Readonly<Record<string, PreferredServerAgent>> {\n if (value === undefined) return Object.freeze({})\n const source = objectValue(value), entries: [string, PreferredServerAgent][] = []\n for (const key of Reflect.ownKeys(source)) {\n if (typeof key !== 'string') throw new TypeError('MCP agent names must be strings')\n identity(key, 'MCP agent name')\n const agent = objectValue(ownValue(source, key)) as RuntimeAgent\n const generate = method(agent, 'generate')\n entries.push([key, Object.freeze({\n generate: (input: string, options: RuntimeAgentInvocationOptions): Promise<RuntimeAgentResponse> =>\n Reflect.apply(generate, agent, [input, options]) as Promise<RuntimeAgentResponse>,\n })])\n }\n return Object.freeze(Object.fromEntries(entries))\n}\n\nfunction captureToolCatalog(value: unknown): ToolCatalog | undefined {\n if (value === undefined) return undefined\n const catalog = objectValue(value) as ToolCatalog\n const get = method(catalog, 'get'), has = method(catalog, 'has'), names = method(catalog, 'names')\n const schemas = method(catalog, 'schemas'), executionMode = method(catalog, 'executionMode')\n return Object.freeze({\n get: (name: string) => Reflect.apply(get, catalog, [name]) as ReturnType<ToolCatalog['get']>,\n has: (name: string) => Reflect.apply(has, catalog, [name]) as boolean,\n names: () => Reflect.apply(names, catalog, []) as readonly string[],\n schemas: () => Reflect.apply(schemas, catalog, []) as ReturnType<ToolCatalog['schemas']>,\n executionMode(name: string, args: unknown): 'parallel' | 'exclusive' {\n return Reflect.apply(executionMode, catalog, [name, args]) as 'parallel' | 'exclusive'\n },\n })\n}\n\nasync function requestFits(request: Request, limit: number): Promise<boolean> {\n const declared = request.headers.get('content-length')\n if (declared !== null) {\n const bytes = Number(declared)\n if (!Number.isSafeInteger(bytes) || bytes < 0 || bytes > limit) return false\n }\n if (request.body === null) return true\n try { return (await request.clone().arrayBuffer()).byteLength <= limit } catch { return false }\n}\n\nfunction boundedResponse(response: Response, limit: number, close: () => Promise<void>): Response {\n if (response.body === null) { void settleClose(close); return response }\n const declared = response.headers.get('content-length')\n if (declared !== null && Number(declared) > limit) {\n void response.body.cancel(); void settleClose(close)\n return responseTooLarge()\n }\n const reader = response.body.getReader()\n let bytes = 0, closed = false\n const finish = async (): Promise<void> => {\n if (closed) return\n closed = true\n await settleClose(close)\n }\n const body = new ReadableStream<Uint8Array>({\n async pull(controller) {\n try {\n const next = await reader.read()\n if (next.done) { controller.close(); await finish(); return }\n bytes += next.value.byteLength\n if (bytes > limit) {\n await reader.cancel(); await finish()\n controller.error(new RangeError('MCP response exceeded maxResponseBytes'))\n return\n }\n controller.enqueue(next.value)\n } catch (error: unknown) { await finish(); controller.error(error) }\n },\n async cancel(reason) { try { await reader.cancel(reason) } finally { await finish() } },\n })\n return new Response(body, { status: response.status, statusText: response.statusText, headers: response.headers })\n}\n\nfunction payloadTooLarge(): Response {\n return Response.json({ jsonrpc: '2.0', id: null,\n error: { code: -32600, message: 'MCP request exceeds maxRequestBytes' } }, { status: 413 })\n}\nfunction responseTooLarge(): Response {\n return Response.json({ jsonrpc: '2.0', id: null,\n error: { code: -32603, message: 'MCP response exceeds maxResponseBytes' } }, { status: 500 })\n}\nasync function settleClose(close: () => Promise<void>): Promise<void> { try { await close() } catch {} }\nfunction objectValue(value: unknown): object {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new TypeError('Invalid MCP server definition')\n }\n return value\n}\nfunction ownValue(source: object, key: PropertyKey, required = true): unknown {\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (descriptor === undefined) {\n if (!required) return undefined\n throw new TypeError(`Missing MCP server field ${String(key)}`)\n }\n if (!('value' in descriptor)) throw new TypeError(`MCP server field ${String(key)} must be data`)\n return descriptor.value\n}\nfunction method(source: object, key: PropertyKey): Function {\n const value = Reflect.get(source, key)\n if (typeof value !== 'function') throw new TypeError(`MCP server method ${String(key)} is invalid`)\n return value\n}\nfunction identity(value: unknown, label: string): string {\n if (typeof value !== 'string' || value.length < 1 || value.length > 128) throw new TypeError(`${label} is invalid`)\n return value\n}\nfunction positive(value: unknown, label: string): number {\n if (!Number.isSafeInteger(value) || Number(value) < 1) throw new TypeError(`MCP server ${label} is invalid`)\n return Number(value)\n}\nfunction optionalObject<T>(value: unknown, label: string): T | undefined {\n if (value === undefined) return undefined\n if ((typeof value !== 'object' || value === null) && typeof value !== 'function') {\n throw new TypeError(`${label} is invalid`)\n }\n return value as T\n}\n"],"mappings":";;;;;AAEA,MAAa,oCAAoC,OAAO,OAAO;CAC7D,kBAAkB,OAAO,OAAO;EAAC;EAAW;EAAa;CAAY,CAAC;CACtE,oBAAoB,OAAO,OAAO;EAAC;EAAW;EAAa;EAAc;CAAO,CAAC;AACnF,CAAU;AAmBV,MAAM,WAAW,OAAO,OAAO;CAC7B,OAAO;CACP,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;AACT,CAAC;AAED,SAAgB,0BACd,QACA,QACA,WACsB;CACtB,kBAAkB,QAAQ,SAAS;CACnC,MAAM,cAAc,OAAO,WAAW,GAAG,YAAY,aAAa;CAClE,KAAK,QAAQ,QAAQ,SAAS,OAAO;E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,OAAO,WAAW;AACpB;AACA,SAAS,OAAO,QAAgB,KAA4B;CAC1D,MAAM,QAAQ,QAAQ,IAAI,QAAQ,GAAG;CACrC,IAAI,OAAO,UAAU,YAAY,MAAM,IAAI,UAAU,qBAAqB,OAAO,GAAG,EAAE,YAAY;CAClG,OAAO;AACT;AACA,SAAS,SAAS,OAAgB,OAAuB;CACvD,IAAI,OAAO,UAAU,YAAY,MAAM,SAAS,KAAK,MAAM,SAAS,KAAK,MAAM,IAAI,UAAU,GAAG,MAAM,YAAY;CAClH,OAAO;AACT;AACA,SAAS,SAAS,OAAgB,OAAuB;CACvD,IAAI,CAAC,OAAO,cAAc,KAAK,KAAK,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,UAAU,cAAc,MAAM,YAAY;CAC3G,OAAO,OAAO,KAAK;AACrB;AACA,SAAS,eAAkB,OAAgB,OAA8B;CACvE,IAAI,UAAU,QAAW,OAAO;CAChC,KAAK,OAAO,UAAU,YAAY,UAAU,SAAS,OAAO,UAAU,YACpE,MAAM,IAAI,UAAU,GAAG,MAAM,YAAY;CAE3C,OAAO;AACT"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "alvin0 - chaulamdinhai",
5
5
  "email": "chaulamdinhai@gmail.com"
6
6
  },
7
- "version": "0.1.12",
7
+ "version": "0.1.14",
8
8
  "description": "Universal Web Standards MCP server hosting for ai-agent-sdk",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -38,13 +38,13 @@
38
38
  "provenance": true
39
39
  },
40
40
  "dependencies": {
41
- "@modelcontextprotocol/server": "2.2.0"
41
+ "@modelcontextprotocol/server": "2.3.1"
42
42
  },
43
43
  "peerDependencies": {
44
- "@alvin0/ai-agent-sdk-core": "^0.1.12"
44
+ "@alvin0/ai-agent-sdk-core": "^0.1.14"
45
45
  },
46
46
  "devDependencies": {
47
- "@alvin0/ai-agent-sdk-core": "^0.1.12",
47
+ "@alvin0/ai-agent-sdk-core": "^0.1.14",
48
48
  "@arethetypeswrong/cli": "0.18.5",
49
49
  "playwright": "1.62.1",
50
50
  "publint": "0.3.24",