Zum Inhalt springen

Typescript SDK Updates & Release Notes

Einträge
36
Quellen
1
Zuletzt aktualisiert

Folge Typescript SDK, um die Release Notes in deinen Feed zu holen.

Typescript SDK von Model Context Protocol

@modelcontextprotocol/express 2.0.2 reicht expectedResource durch

@modelcontextprotocol/express 2.0.2 reicht die neue optionale Option expectedResource von requireBearerAuth durch, sodass nur für diese Ressource ausgestellte Tokens akzeptiert werden, wobei Version 2.0.1 sie nicht weitergibt.

Patch Changes

  • #2929 40f8f4e Thanks @claude! - requireBearerAuth and verifyBearerToken take a new optional expectedResource, which makes them accept only tokens issued for this resource (the token's audience). Set it to the value your authorization server puts into tokens meant for this server, usually the server's URL. When it is set, a token is accepted only if the verifier reports that value in AuthInfo.resource; the two are compared as strings, ignoring a fragment and one trailing slash. A token reported for another value, or for none, is answered 401 invalid_token with the usual WWW-Authenticate challenge. When it is not set, nothing changes. To use it, pass expectedResource and have verifyAccessToken fill AuthInfo.resource, for example from the aud claim. The option is declared on a new exported type, VerifyBearerTokenOptions, which extends BearerAuthOptions; BearerAuthOptions itself is unchanged. The Express requireBearerAuth passes the option through. With Express, @modelcontextprotocol/express has to be upgraded to this release as well: 2.0.1 does not pass the option on, so nothing is compared. Its options type does not have the option, so TypeScript reports an expectedResource written in a call to the 2.0.1 `requireBearerA…

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/core 2.3.0: Lizenzfeld Apache-2.0

Im Paket @modelcontextprotocol/core 2.3.0 lautet das license-Feld nun Apache-2.0, ohne Codeänderung.

Patch Changes

  • #2908 633dd3e Thanks @claude! - The license field of the package manifests is now Apache-2.0; the LICENSE file shipped in each package carries the full terms, including the MIT text for earlier contributions. No code change.

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/codemod 2.3.0: Lizenzfeld Apache-2.0

Im Paket @modelcontextprotocol/codemod 2.3.0 lautet das license-Feld nun Apache-2.0, ohne Codeänderung.

Patch Changes

  • #2908 633dd3e Thanks @claude! - The license field of the package manifests is now Apache-2.0; the LICENSE file shipped in each package carries the full terms, including the MIT text for earlier contributions. No code change.

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/client 2.3.0: Redirects nur im selben Origin

@modelcontextprotocol/client 2.3.0 lässt HTTP-Client-Transports und OAuth-Helfer Redirects nur noch innerhalb desselben Origins mit unveränderter Methode folgen, andere Redirects werden nicht verfolgt, und in Browsern schlägt eine umgeleitete Anfrage fehl.

Minor Changes

  • #2901 433eb41 Thanks @claude! - The HTTP client transports and the OAuth client helpers now follow a redirect only when it stays within the origin of the request (same scheme, host and port, or http to https on the same host with default ports) and keeps the method (a 307 or 308, or any redirect of a GET). Any other redirect is not followed. A transport then fails the request with an error that names the target; the session is kept and later messages still send. OAuth metadata discovery moves on to the next well-known URL, and any other OAuth request fails with an error that gives the status. Same-origin redirects that keep the method keep working on Node, up to five in a row, and no code changes are needed there. If your endpoint redirects to another origin, configure the transport with the URL it redirects to. A requestInit.redirect of 'error' or 'manual' is passed to fetch as it is for the requests a transport sends to the server (POST, GET and DELETE of the Streamable HTTP transport, POST of the SSE transport); for its OAuth requests, and for any other value, requestInit.redirect is not consulted by default. Browsers do not expose the target of a redirect to a page, so there a redirected request fails instead of being followed. Setting `…

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

Version 2.2.0: expectedIssuer für OAuth-Provider, Listen, CommonJS-Fix

Version 2.2.0 verlangt für die Machine-to-Machine-OAuth-Provider den Parameter expectedIssuer (sonst veraltet und mit Warnung), prüft in fetchToken() die Zugehörigkeit zum Authorization Server, lässt die list*()-Aufrufe ohne Cursor die gesamte Liste zurückgeben und behebt die Typprüfung in CommonJS-TypeScript-Projekten.

Package Version
@modelcontextprotocol/client 2.2.0
@modelcontextprotocol/server 2.2.0
@modelcontextprotocol/core 2.2.0
@modelcontextprotocol/server-legacy 2.2.0
@modelcontextprotocol/codemod 2.2.0
@modelcontextprotocol/node, express, hono, fastify unchanged

Upgrade notes

  • Pass expectedIssuer to the machine-to-machine OAuth providers. Constructing ClientCredentialsProvider, PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider or CrossAppAccessProvider without it is deprecated and logs a warning. Set it to the issuer of the authorization server the credentials were registered with. (#2887)
  • fetchToken() checks which authorization server the client information belongs to. It throws AuthorizationServerMismatchError before sending anything when the provider's client information is bound to a different authorization server. (#2887)
  • List calls return the whole list. listTools(), listPrompts(), listResources() and listResourceTemplates() called without a cursor now follow nextCursor until the server stops sending one. listMaxPages still caps the walk. (#2886)

Fixes

  • CommonJS TypeScript projects type-check again: the jose types used by the DPoP API are inlined into the declaration files (regression in 2.1.0). (#2883) …

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

Version 1.31.0: OAuth-Zugangsdaten an Authorization Server gebunden

Version 1.31.0 bindet gespeicherte OAuth-Zugangsdaten an den ausstellenden Authorization Server, speichert dafür ein neues Feld issuer und erfordert für ClientCredentialsProvider, PrivateKeyJwtProvider und StaticPrivateKeyJwtProvider den Parameter expectedIssuer.

Upgrade notes

  • Stored OAuth tokens and client information now include an issuer field. Storage that rejects unknown fields needs to allow it.
  • Pass expectedIssuer when constructing ClientCredentialsProvider, PrivateKeyJwtProvider or StaticPrivateKeyJwtProvider. Constructing them without it is deprecated.

What's Changed

Full Changelog: https://github.com/modelcontextprotocol/typescript-sdk/compare/1.30.1...1.31.0

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/server 2.2.0: Fehlerbehebungen bei Promise und Streams

@modelcontextprotocol/server 2.2.0 behebt eine kurzzeitig unbehandelte Promise-Rejection beim Senden von Benachrichtigungen über geschlossene Verbindungen, einen Stack Overflow in createMcpHandler bei wiederverwendeter Server-Instanz und beendet subscriptions/listen-Streams direkt nach der Bestätigung, wenn kein angefragter Benachrichtigungstyp unterstützt wird.

Patch Changes

  • #2885 9dd722f Thanks @claude! - Sending a notification on a closed connection no longer produces a briefly unhandled promise rejection (seen as unhandledrejection on Cloudflare Workers) in addition to the returned rejection.

  • #2778 e3fb9ed Thanks @vjymisal0! - Fix a stack overflow in createMcpHandler when the factory returns the same server instance for more than one request. Returning a fresh instance per request is still required.

  • #2651 c55efa6 Thanks @sushantkumar23! - createMcpHandler now ends a subscriptions/listen stream right after the acknowledgement when it honored none of the requested notification types, instead of holding the stream open with nothing to deliver. The client receives the acknowledgement and then the resultType: "complete" result. Streams that honor at least one type are unchanged. …

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/core 2.2.0: expectedIssuer und Issuer-Prüfung

In @modelcontextprotocol/core 2.2.0 ist das Erstellen von ClientCredentialsProvider, PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider oder CrossAppAccessProvider ohne expectedIssuer veraltet, fetchToken() wirft bei abweichendem Authorization Server einen AuthorizationServerMismatchError, und die Schemas akzeptieren einen optionalen issuer-Stempel.

Minor Changes

  • #2887 edd12e2 Thanks @maxisbey! - Constructing ClientCredentialsProvider, PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider or CrossAppAccessProvider without expectedIssuer is deprecated: the constructor logs one console.warn and that call signature is marked @deprecated. Behaviour is otherwise unchanged. Pass the issuer of the authorization server the credentials were registered with.

    fetchToken() throws AuthorizationServerMismatchError, before sending anything, when the provider's client information is bound to a different authorization server than the one it is called with. The AuthorizationServerMismatchError message no longer assumes the authorization-code callback; its fields are unchanged.

    OAuthTokensSchema and OAuthClientInformationSchema accept the optional issuer stamp, so a provider that reads storage back through them keeps it. auth() overwrites it on every save.

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/codemod 2.2.0: v1-to-v2 erhält Header und Direktiven

Der v1-to-v2-Codemod in @modelcontextprotocol/codemod 2.2.0 setzt umgeschriebene Imports an die Stelle des ersten v1-Imports, sodass Lizenz-Header und Direktiven wie 'use client' erhalten bleiben, wobei in einigen Fällen noch bekannte Lücken bestehen.

Patch Changes

  • #2582 f091897 Thanks @axits-lab! - The v1-to-v2 codemod now writes rewritten imports where the first v1 import stood, not at the top of the file, so a license header, // @ts-nocheck, /// <reference> or a 'use client' / 'use server' / 'use strict' directive above it stays in place. Known gap: when a later step of the codemod replaces or removes the import (for example a file whose only SDK import is ErrorCode or StreamableHTTPError), the new import can still land above or inside the header, and a /** */ header can be removed. Files already migrated with codemod 2.1.0 or earlier are not repaired; check the top of those files.

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/client 2.2.0: expectedIssuer für Auth-Provider empfohlen

In @modelcontextprotocol/client 2.2.0 ist das Erstellen von ClientCredentialsProvider, PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider oder CrossAppAccessProvider ohne expectedIssuer veraltet, fetchToken() wirft bei abweichendem Authorization Server einen AuthorizationServerMismatchError, und die Schemas akzeptieren einen optionalen issuer-Stempel.

Minor Changes

  • #2887 edd12e2 Thanks @maxisbey! - Constructing ClientCredentialsProvider, PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider or CrossAppAccessProvider without expectedIssuer is deprecated: the constructor logs one console.warn and that call signature is marked @deprecated. Behaviour is otherwise unchanged. Pass the issuer of the authorization server the credentials were registered with.

    fetchToken() throws AuthorizationServerMismatchError, before sending anything, when the provider's client information is bound to a different authorization server than the one it is called with. The AuthorizationServerMismatchError message no longer assumes the authorization-code callback; its fields are unchanged.

    OAuthTokensSchema and OAuthClientInformationSchema accept the optional issuer stamp, so a provider that reads storage back through them keeps it. auth() overwrites it on every save.

Patch Changes …

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

TypeScript SDK Version 1.30.1: Body- und Batch-Limits, Auth-Fix

Version 1.30.1 des TypeScript SDK liest HTTP-Request-Bodys mit Größenlimit, begrenzt die Länge von JSON-RPC-Batches und behebt in der Authentifizierung den Verlust des Resource-URI ohne abschließenden Schrägstrich.

What's Changed

New Contributors

Full Changelog: https://github.com/modelcontextprotocol/typescript-sdk/compare/1.30.0...1.30.1

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/server 2.1.0: OAuth-Scope-Challenges per scopeChallenge

@modelcontextprotocol/server 2.1.0 fügt für Tools, Ressourcen, Resource Templates und Prompts anfragezeitliche OAuth-Scope-Challenges über einen scopeChallenge-Callback hinzu, die bei unzureichendem Scope vor der Verarbeitung eine HTTP-403-Antwort mit insufficient_scope liefern.

Minor Changes

  • #1624 6032170 Thanks @SamMorrowDrums! - Add request-time OAuth scope challenges for tools, resources, resource templates, and prompts. Each primitive's scopeChallenge callback receives the parsed request and verified authentication info, then either continues or returns the exact scope set for an insufficient_scope response. requireScopes provides a small helper for static all-of checks.

    createMcpHandler and Streamable HTTP transports return HTTP 403 with an insufficient_scope challenge before handler execution or SSE setup. The preflight is active whenever a registered primitive carries a scopeChallenge callback — there is no handler- or transport-level configuration. The challenge's WWW-Authenticate header is built by the same formatter as the bearer-auth 401/403 answers, and its resource_metadata parameter is derived from the verified AuthInfo: requireBearerAuth / verifyBearerToken now stamp their configured resourceMetadataUrl onto the AuthInfo they return (new optional AuthInfo.resourceMetadataUrl field), with a fallback to the well-known location for an HTTP(S) RFC 8707 resource identifier; the parameter is omitted when neither is available. …

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/node 2.1.0: OAuth-Scope-Challenges per scopeChallenge

@modelcontextprotocol/node 2.1.0 fügt für Tools, Ressourcen, Resource Templates und Prompts anfragezeitliche OAuth-Scope-Challenges über einen scopeChallenge-Callback hinzu, die bei unzureichendem Scope vor der Verarbeitung eine HTTP-403-Antwort mit insufficient_scope liefern.

Minor Changes

  • #1624 6032170 Thanks @SamMorrowDrums! - Add request-time OAuth scope challenges for tools, resources, resource templates, and prompts. Each primitive's scopeChallenge callback receives the parsed request and verified authentication info, then either continues or returns the exact scope set for an insufficient_scope response. requireScopes provides a small helper for static all-of checks.

    createMcpHandler and Streamable HTTP transports return HTTP 403 with an insufficient_scope challenge before handler execution or SSE setup. The preflight is active whenever a registered primitive carries a scopeChallenge callback — there is no handler- or transport-level configuration. The challenge's WWW-Authenticate header is built by the same formatter as the bearer-auth 401/403 answers, and its resource_metadata parameter is derived from the verified AuthInfo: requireBearerAuth / verifyBearerToken now stamp their configured resourceMetadataUrl onto the AuthInfo they return (new optional AuthInfo.resourceMetadataUrl field), with a fallback to the well-known location for an HTTP(S) RFC 8707 resource identifier; the parameter is omitted when neither is available. …

Originalquelle(öffnet in neuem Tab)Problem melden

Typescript SDK von Model Context Protocol

@modelcontextprotocol/hono 2.0.1: Body-Größenlimit und Batch-Begrenzung

@modelcontextprotocol/hono 2.0.1 liest Streamable-HTTP-Request-Bodys nur noch mit einem Standardlimit von 4 MiB (konfigurierbar über maxRequestBodySize), antwortet bei Überschreitung mit 413 Payload Too Large und begrenzt JSON-RPC-Batches auf 100 Nachrichten.

Patch Changes

  • #2698 7b781ed Thanks @maxisbey! - Read Streamable HTTP request bodies with a size limit. Every SDK-owned body read — WebStandardStreamableHTTPServerTransport (and the Node transport built on it), createMcpHandler, toNodeHandler, and createMcpHonoApp's JSON pre-parse — now stops at 4 MiB by default (the limit the legacy SSE transport already uses; the Express adapter and stdio bound their reads too) and answers 413 Payload Too Large before anything is parsed. toWebRequest (when it reads the Node stream itself) now rejects once the body exceeds the limit with an error whose name is 'RequestBodyTooLargeError' and status is 413, and toNodeHandler answers that with 413; hand-wired callers of toWebRequest should handle the rejection or pass a pre-parsed body, and isLegacyRequest reports such a request as non-legacy so the modern handler answers it. JSON-RPC batch arrays are limited to 100 messages; a longer batch is answered 400 / -32600 and none of it is dispatched.

    The limit is configurable with a new maxRequestBodySize option (bytes, default DEFAULT_MAX_REQUEST_BODY_SIZE = 4 MiB, exported from @modelcontextprotocol/server) on …

Originalquelle(öffnet in neuem Tab)Problem melden