unstale

npm / @ai-sdk/mcp

@ai-sdk/mcp

What changed in @ai-sdk/mcp 0.0 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

48 breaking14 security9 deprecations26 new APIs and options11 behavior and defaults1 tooling27 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

@ai-sdk/mcp 747 changes

Breaking changes 33

  • OpenTelemetry span collection is no longer built into ai; install this package and register its OpenTelemetry instance to continue receiving traces.

    7.0.0upgrade guide

  • Renames the tool callback option experimental_context to context and scopes it to tool-specific data declared by contextSchema and supplied through toolsContext.

    7.0.0upgrade guide

  • Declare a tool's typed, tool-specific context fields; callbacks receive only the fields declared in this schema.

    7.0.0upgrade guide

  • The deprecated export was removed; replace it with customProvider. Its options and behavior are unchanged.

    7.0.0upgrade guide

  • The deprecated export was removed; replace it with generateImage.

    7.0.0upgrade guide

  • The deprecated type export was removed; replace it with GenerateImageResult.

    7.0.0upgrade guide

  • The generation start callback was renamed to onStart.

    7.0.0upgrade guide

  • The per-step start callback was renamed to onStepStart.

    7.0.0upgrade guide

  • The deprecated generation option and generateText result property were removed; use output for both.

    7.0.0upgrade guide

  • The deprecated option was removed; replace remaining usages with prepareStep.

    7.0.0upgrade guide

  • Removes the tracer property; pass a custom OpenTelemetry Tracer to the OpenTelemetry constructor instead.

    7.0.0upgrade guide

  • Request bodies are no longer included in generateText and streamText step results by default; opt in with include.requestBody.

    7.0.0upgrade guide

  • generateText no longer includes response bodies by default; opt in with include.responseBody.

    7.0.0upgrade guide

  • Removes the deprecated top-level cachedInputTokens field; use inputTokenDetails.cacheReadTokens instead.

    7.0.0upgrade guide

  • Removes the deprecated top-level reasoningTokens field; use outputTokenDetails.reasoningTokens instead.

    7.0.0upgrade guide

  • The redirect option now defaults to 'error' instead of 'follow', rejecting HTTP redirects by default to help prevent SSRF attacks. Set redirect: 'follow' if your MCP server relies on redirects.

    1.0.102, 7.0.0upgrade guiderelease notes

  • The minimum supported Node.js version is raised to 22; supported versions are 22, 24, and 26.

    2.0.0, 7.0.0release notesupgrade guide

  • streamText now invokes onChunk for every TextStreamPart, including lifecycle, boundary, and terminal parts; handlers may need to guard chunk types.

    7.0.0upgrade guide

  • Renames the telemetry integration callback and tracing-channel event type from onEmbedFinish to onEmbedEnd.

    7.0.0upgrade guide

  • Renames the per-call callback for completed embed and embedMany operations from experimental_onFinish to onEnd.

    7.0.0upgrade guide

  • Renames the per-call callback for completed rerank operations from experimental_onFinish to onEnd.

    7.0.0upgrade guide

  • Renames the telemetry integration callback and tracing-channel event type from onRerankFinish to onRerankEnd.

    7.0.0upgrade guide

  • Renames the per-step lifecycle callback from onStepFinish to onStepEnd across generation, streaming, agents, and UI message stream helpers. Telemetry integrations should implement onStepEnd.

    7.0.0upgrade guide

  • Instructions returned from prepareStep now carry forward to future steps until another instructions or system override is returned.

    7.0.0upgrade guide

  • Messages returned from prepareStep now become the base for subsequent steps, combined with the previous step's response messages.

    7.0.0upgrade guide

  • Register a telemetry integration globally at application startup to enable telemetry collection.

    7.0.0upgrade guide

  • All AI SDK packages are ESM-only, so CommonJS require() is no longer supported; use ESM imports.

    7.0.0upgrade guide

  • Use runtimeContext for shared generation or agent state visible to prepareStep, events, and step results; shared top-level context usage moves to runtimeContext.

    7.0.0upgrade guide

  • Rename the tool-loop stop-condition helper and its imports to isStepCount.

    7.0.0upgrade guide

  • Each step's response.messages now contains only messages produced by that step, rather than accumulated messages from previous steps; use result.responseMessages for the full history.

    7.0.0upgrade guide

  • System messages in prompt or messages are rejected by default; move instructions to the top-level instructions option or opt in with allowSystemInMessages.

    7.0.0upgrade guide

  • Once a telemetry integration is registered, AI SDK calls emit telemetry events by default; set isEnabled to false per call to opt out.

    7.0.0upgrade guide

  • Pass tool-specific context values keyed by tool name, separating them from shared generation or agent runtime data.

    7.0.0upgrade guide

Deprecations 7

  • CallSettings is split into LanguageModelCallOptions and RequestOptions; replace usages with LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>. The old type remains available as deprecated.

    7.0.0upgrade guide

  • Moves streamText's raw chunk inclusion option from top-level includeRawChunks to include.rawChunks; the old option remains supported as deprecated.

    7.0.0upgrade guide

  • Renames the final lifecycle callback from onFinish to onEnd for text generation, streaming, and agents. onFinish remains a deprecated alias, and onEnd takes precedence when both are provided.

    7.0.0upgrade guide

  • Renames experimental_onToolCallFinish for generateText and streamText; the old name remains a deprecated alias.

    7.0.0upgrade guide

  • Renames experimental_onToolCallStart for generateText and streamText; the old name remains a deprecated alias.

    7.0.0upgrade guide

  • Renames the full event stream property from fullStream to stream; fullStream remains available as a deprecated alias.

    7.0.0upgrade guide

  • Use instructions instead of the top-level system prompt option, including in prepareStep results, repair callbacks, and lifecycle events; system remains a deprecated fallback, and instructions takes precedence when both are provided.

    7.0.0upgrade guide

Behavior and default changes 6

  • The speech generation function graduated from experimental status and is now named generateSpeech; the old export remains a deprecated alias.

    7.0.0upgrade guide

  • Renames experimental_include to include for generateText, streamText, and ToolLoopAgent. The old name remains supported as a deprecated alias.

    7.0.0upgrade guide

  • The result type is now named SpeechResult; the old type remains a deprecated alias.

    7.0.0upgrade guide

  • Renames experimental_telemetry to telemetry. The old option remains a deprecated alias during the migration window.

    7.0.0upgrade guide

  • The transcription API graduated from experimental status and is now named transcribe; the old name remains a deprecated alias.

    7.0.0upgrade guide

  • The result type is now named TranscriptionResult; the old name remains a deprecated alias.

    7.0.0upgrade guide

Tooling 1

  • Run the v7 codemod suite from the project root to automate many v6-to-v7 code transformations.

    7.0.0upgrade guide

@ai-sdk/mcp 271 changes

Breaking changes 9

  • Untrusted MCP OAuth discovery and metadata-derived token or registration URLs require a DNS-pinned fetch on server runtimes without a protected default transport; browser workers without a DOM require an explicitly supplied custom fetch.

    2.0.95release notes

  • Newly registered OAuth clients can no longer bind existing unbound refresh tokens; tokens are cleared before saving registration information, and authorization stops if they remain in storage.

    2.0.93release notes

  • Managed event subscription creation now requires ttlMs as a millisecond duration or null instead of accepting expiresAt; responses still include the backend-calculated expiresAt deadline.

    2.0.76release notes

  • Rejects invalid or missing adapter operations, nullish results, and Promise or thenable results with MCPClientError before the transport starts.

    2.0.73release notes

  • Pass an integration implementing createAdapter instead of passing subscription operations directly; existing operations can be wrapped with { createAdapter: () => operations }.

    2.0.73release notes

  • The configured integration type is now Experimental_MCPEventAdapter and requires implementing createAdapter.

    2.0.73release notes

  • The former subscription operations interface is renamed to Experimental_MCPEventOperations; update imports and operation type annotations.

    2.0.73release notes

  • CommonJS exports are removed; consumers using require() must switch to ESM import syntax.

    2.0.0release notes

  • Only explicitly defined tools pass the schemas allowlist; inherited prototype properties no longer expose tools to the model or make them executable.

    2.0.0release notes

Security 12

  • On Node.js, MCP OAuth discovery for untrusted authorization-server, redirect, token, and registration URLs requires an explicit custom fetch with connection-time DNS validation, such as createGuardedFetch().

    2.0.98release notes

  • OAuth authorization, code exchange, and refresh requests now include the canonical MCP resource when protected resource metadata is unavailable or custom resource validation returns undefined, preventing unbound authorization grants.

    2.0.92release notes

  • Binds OAuth client credentials to their authorization server, including when the selected server is approved by validateAuthorizationServerURL.

    1.0.98, 2.0.80release notesrelease notes

  • Prevents authorization server paths beginning with repeated slashes from bypassing validation.

    1.0.92, 2.0.70release notesrelease notes

  • Failed OAuth tokens are identified for conditional invalidation.

    2.0.65release notes

  • Pre-registered OAuth clients are preserved after client authentication errors, and dynamically registered credentials are replaced only with explicit provider provenance.

    1.0.85, 2.0.55release notesrelease notes

  • DNS validation and connection pinning remain in place when frameworks or instrumentation wrap global fetch before or after the SDK loads.

    0.0.39, 1.0.90, 2.0.51release notesrelease notesrelease notes

  • Prevents SSRF in OAuth metadata discovery.

    0.0.39, 1.0.90, 2.0.49release notesrelease notesrelease notes

  • OAuth client registration is hardened according to the latest protocol.

    2.0.33release notes

  • OAuth credentials are protected from exfiltration during rediscovery.

    2.0.0release notes

  • The OAuth metadata issuer is validated during discovery.

    2.0.0release notes

  • Secure JSON parsing prevents prototype pollution.

    2.0.0release notes

Deprecations 2

  • Use clientName in place of the deprecated MCPClient name property.

    2.0.0release notes

  • The name property is deprecated in favor of clientName.

    2.0.0release notes

New APIs and options 19

  • MCP App CSP metadata now supports baseUriDomains.

    2.0.97release notes

  • The stdio transport now supports the shell option.

    2.0.79release notes

  • Experimental event adapters implement synchronous createAdapter({ transport }) to receive the configured transport description and return bound subscription operations, so applications no longer configure the endpoint twice.

    2.0.73release notes

  • Adds experimental adapters for backend-owned subscription lifecycles without a local event store.

    2.0.70release notes

  • Adds an exclusive configuration union that distinguishes managed and direct event APIs from a single MCPClientConfig.

    2.0.70release notes

  • Adds compatibility for webhook-based MCP events.

    2.0.70release notes

  • Exports MCPClientError for typed MCP failure handling.

    2.0.67release notes

  • Adds an error for OAuth authorization server pin mismatches.

    2.0.66release notes

  • Adds the foundation for the latest 2026 protocol discovery.

    2.0.33release notes

  • Adds support for MCP 2026 streamable HTTP.

    2.0.33release notes

  • An optional hook lets developers validate authorization servers.

    2.0.0release notes

  • HTTP and SSE transports can use a custom fetch implementation.

    2.0.0release notes

  • MCP Apps are supported.

    2.0.0release notes

  • HTTP transport failures expose an optional response body.

    2.0.0release notes

  • HTTP transport failures expose an optional response status code so consumers can branch without parsing the error message.

    2.0.0release notes

  • HTTP transport failures expose an optional response URL.

    2.0.0release notes

  • The redirect option controls HTTP redirect behavior.

    2.0.0release notes

  • Server instructions are accessible through the client.

    2.0.0release notes

  • The serverInfo exposed by the MCP server is surfaced to clients.

    2.0.0release notes

Behavior and default changes 3

  • Graduated to a stable API; its experimental name remains available as a compatible alias.

    2.0.88release notes

  • Renames the unreleased client event configuration to experimental_events.

    2.0.70release notes

  • Server-provided tool annotations are now surfaced in tool metadata.

    1.0.78, 2.0.45release notesrelease notes

Fixes and other changes 26

  • Pending HTTP MCP requests are rejected when their SSE response stream closes or disconnects before the matching JSON-RPC response, preventing tool calls from hanging indefinitely.

    2.0.101release notes

  • When server/discover fails over Streamable HTTP, the client now rejects with the network error instead of falling back to initialize against the same unreachable server.

    2.0.96release notes

  • Input-required results are handled through the registered elicitation handler, then the original tool, prompt, or resource request is retried with its answers and request state.

    2.0.88release notes

  • The browser fetch receiver is preserved to prevent illegal-invocation errors.

    2.0.88release notes

  • Unsupported-version discovery errors now include the requested and advertised versions and explain how to select legacy initialization, while preserving original error details and avoiding automatic legacy fallback.

    2.0.86release notes

  • Fixes conversion failures for primitive or nullish results from output schemas or execute wrappers; strings become text and undefined outputs become JSON null while preserving MCP content conversion.

    2.0.84release notes

  • Over Streamable HTTP, the client waits for the discovery response instead of falling back to initialize after 1 s, preventing slow modern-only servers from being rejected.

    2.0.81release notes

  • Response bodies are now extracted in SSE transport errors.

    2.0.79release notes

  • MCP tools can now execute without options.

    0.0.40, 1.0.93, 2.0.74release notesrelease notesrelease notes

  • Preserves OAuth credentials when callback codes are rejected.

    1.0.91, 2.0.67release notesrelease notes

  • Rejects startup when the connection closes before an endpoint is received.

    2.0.67release notes

  • Preserves prototype-named tools, providers, and provider metadata as own properties without changing lookup object prototypes, preventing inherited names from resolving as registered providers or breaking image metadata aggregation.

    0.0.38, 1.0.89, 2.0.62release notesrelease notesrelease notes

  • Explicit environment values for the stdio transport are now preserved.

    0.0.36, 1.0.86, 2.0.58release notesrelease notesrelease notes

  • Avoids duplicate OAuth refreshes for stale 401 responses in legacy SSE.

    1.0.82, 2.0.53release notesrelease notes

  • OAuth callbacks use the stored authorization server when protected resource metadata rediscovery fails.

    1.0.81, 2.0.51release notesrelease notes

  • MCP tool results can return structuredContent without content; the serialized structured result is added as text.

    2.0.45release notes

  • Origin-only OAuth issuers now accept trailing slashes.

    1.0.79, 2.0.44release notesrelease notes

  • Creating an MCP tool set now fetches all paginated tool definitions.

    1.0.74, 2.0.37release notesrelease notes

  • Command shims such as npx can now be spawned on Windows.

    0.0.29, 1.0.73, 2.0.36release notesrelease notesrelease notes

  • Rejects SSE requests when POST responses are unsuccessful.

    1.0.72, 2.0.35release notesrelease notes

  • Transport request headers use the negotiated protocol version, with support for official SDK negotiation and protocol version 2025-11-25.

    2.0.0release notes

  • The MCP server name is propagated through dynamic tool parts.

    2.0.0release notes

  • Trailing slashes are stripped from the OAuth resource parameter.

    2.0.0release notes

  • Output schema validation is bypassed when a tool returns isError.

    2.0.0release notes

  • CallToolResultSchema and PromptMessageSchema accept resource_link content parts, avoiding hard rejection with zod ≥ 4.4.x.

    2.0.0release notes

  • The server name is propagated through dynamic tool parts.

    2.0.0release notes

@ai-sdk/mcp 114 changes

Breaking changes 3

  • Untrusted MCP OAuth discovery and metadata-derived token or registration URLs require a DNS-pinned fetch on server runtimes without a protected default transport; explicitly supplied fetch implementations must provide equivalent connect-time validation.

    1.0.104release notes

  • MCP client imports move from ai to the new @ai-sdk/mcp package, with the stdio transport imported from @ai-sdk/mcp/mcp-stdio.

    1.0.0release notes

  • ToolCallOptions is renamed to ToolExecutionOptions.

    1.0.0release notes

Security 1

  • Private OAuth endpoints are rejected before credentials are sent, preventing credential disclosure.

    0.0.39, 1.0.75release notesrelease notes

New APIs and options 7

  • OAuthClientProvider.invalidateCredentials accepts optional token context so providers sharing storage can atomically delete only the rejected token generation and preserve tokens saved by a concurrent refresh.

    1.0.91release notes

  • The MCP client gains elicitation support.

    1.0.0release notes

  • The MCP client definition can specify a client version.

    1.0.0release notes

  • The MCP client gains support for resources.

    1.0.0release notes

  • The MCP client supports prompts exposed by MCP servers.

    1.0.0release notes

  • The _meta field from MCP tool definitions is exposed.

    1.0.0release notes

  • MCP clients gain OAuth support.

    1.0.0release notes

Behavior and default changes 2

  • MCP scope selection now applies to dynamic client registration as well as authorization.

    1.0.75release notes

  • MCPClient is made stable.

    1.0.0release notes

Fixes and other changes 1

@ai-sdk/mcp 0.04 changes

Breaking changes 3

  • Untrusted MCP OAuth discovery and metadata-derived URLs require a DNS-pinned fetch on server runtimes without a protected default transport; browser workers without a DOM require an explicitly supplied custom fetch.

    0.0.45release notes

  • HTTP transport requests now reject redirects by default; trusted destinations can still be followed with redirect: 'follow'.

    0.0.44release notes

  • OAuth credentials and pending authorization flows are bound to the authorization-server issuer and token endpoint. Mismatched callbacks and issuer or endpoint changes are rejected before credential exchange.

    0.0.43release notes

Security 1

  • Providers must explicitly identify dynamically registered client information and support invalidation to recover automatically from unbound legacy registrations or expired client credentials.

    0.0.43release notes