Skip to content

Commit 0af70ba

Browse files
Merge branch 'main' into fweinberger/elicit-schema-catchall
2 parents ad00cfa + 0021561 commit 0af70ba

26 files changed

Lines changed: 640 additions & 23 deletions

.changeset/fast-dragons-lead.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@modelcontextprotocol/express': patch
3+
'@modelcontextprotocol/fastify': patch
4+
'@modelcontextprotocol/hono': patch
5+
'@modelcontextprotocol/node': patch
6+
'@modelcontextprotocol/client': patch
7+
'@modelcontextprotocol/server': patch
8+
---
9+
10+
tsdown exports resolution fix

.changeset/pre.json

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,48 @@
2121
"@modelcontextprotocol/test-helpers": "2.0.0-alpha.0",
2222
"@modelcontextprotocol/test-integration": "2.0.0-alpha.0"
2323
},
24-
"changesets": []
24+
"changesets": [
25+
"abort-handlers-on-close",
26+
"add-fastify-middleware",
27+
"add-hono-peer-dep",
28+
"add-resource-size-field",
29+
"brave-lions-glow",
30+
"busy-rice-smoke",
31+
"busy-weeks-hang",
32+
"cyan-cycles-pump",
33+
"drop-zod-peer-dep",
34+
"expose-auth-server-discovery",
35+
"extract-task-manager",
36+
"fast-dragons-lead",
37+
"finish-sdkerror-capability",
38+
"fix-abort-listener-leak",
39+
"fix-oauth-5xx-discovery",
40+
"fix-onerror-callbacks",
41+
"fix-server-protocol-version",
42+
"fix-session-status-codes",
43+
"fix-stdio-epipe-crash",
44+
"fix-stdio-windows-hide",
45+
"fix-streamable-http-error-response",
46+
"fix-task-session-isolation",
47+
"fix-transport-exact-optional-property-types",
48+
"fix-unknown-tool-protocol-error",
49+
"funky-baths-attack",
50+
"heavy-walls-swim",
51+
"oauth-error-http200",
52+
"quick-islands-occur",
53+
"reconnection-scheduler",
54+
"remove-websocket-transport",
55+
"respect-capability-negotiation",
56+
"rich-hounds-report",
57+
"schema-object-type-for-unions",
58+
"shy-times-learn",
59+
"spotty-cats-tickle",
60+
"stdio-skip-non-json",
61+
"support-standard-json-schema",
62+
"tame-camels-greet",
63+
"tender-snails-fold",
64+
"token-provider-composable-auth",
65+
"twelve-dodos-taste",
66+
"use-scopes-supported-in-dcr"
67+
]
2568
}

.github/workflows/release.yml

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: Release
22

3-
permissions:
4-
contents: write
5-
pull-requests: write
6-
73
on:
84
push:
95
branches:
@@ -12,9 +8,14 @@ on:
128
concurrency: ${{ github.workflow }}-${{ github.ref }}
139

1410
jobs:
15-
release:
16-
name: Release
11+
version:
12+
name: Version
1713
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
outputs:
18+
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
1819
steps:
1920
- uses: actions/checkout@v6
2021

@@ -29,17 +30,50 @@ jobs:
2930
node-version: 24
3031
cache: pnpm
3132
cache-dependency-path: pnpm-lock.yaml
32-
registry-url: 'https://registry.npmjs.org'
3333

3434
- name: Install dependencies
3535
run: pnpm install
3636

37-
- name: Create Release Pull Request or Publish to npm
37+
- name: Create or update Version Packages PR
3838
id: changesets
39+
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1
40+
env:
41+
GITHUB_TOKEN: ${{ github.token }}
42+
43+
publish:
44+
name: Publish
45+
needs: version
46+
if: needs.version.outputs.hasChangesets == 'false'
47+
runs-on: ubuntu-latest
48+
environment: release
49+
permissions:
50+
contents: write
51+
id-token: write
52+
steps:
53+
- uses: actions/checkout@v6
54+
55+
- name: Install pnpm
56+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
57+
with:
58+
run_install: false
59+
60+
- name: Setup Node.js
61+
uses: actions/setup-node@v6
62+
with:
63+
node-version: 24
64+
cache: pnpm
65+
cache-dependency-path: pnpm-lock.yaml
66+
registry-url: 'https://registry.npmjs.org'
67+
68+
- name: Install dependencies
69+
run: pnpm install
70+
71+
- name: Publish to npm
3972
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1
4073
with:
41-
publish: pnpm run build:all && pnpm changeset publish
74+
publish: pnpm run ci:publish
4275
env:
4376
GITHUB_TOKEN: ${{ github.token }}
4477
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4578
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
79+
NPM_CONFIG_PROVENANCE: 'true'

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"docs:check": "typedoc",
3030
"typecheck:all": "pnpm -r typecheck",
3131
"build:all": "pnpm -r build",
32+
"ci:publish": "pnpm run build:all && pnpm changeset publish",
3233
"prepack:all": "pnpm -r prepack",
3334
"lint:all": "pnpm sync:snippets --check && pnpm -r lint",
3435
"lint:fix:all": "pnpm sync:snippets && pnpm -r lint:fix",

packages/client/CHANGELOG.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# @modelcontextprotocol/client
2+
3+
## 2.0.0-alpha.2
4+
5+
### Patch Changes
6+
7+
- [#1840](https://github.com/modelcontextprotocol/typescript-sdk/pull/1840) [`424cbae`](https://github.com/modelcontextprotocol/typescript-sdk/commit/424cbaeee13b7fe18d38048295135395b9ad81bb) Thanks [@KKonstantinov](https://github.com/KKonstantinov)! - tsdown exports resolution
8+
fix
9+
10+
## 2.0.0-alpha.1
11+
12+
### Major Changes
13+
14+
- [#1783](https://github.com/modelcontextprotocol/typescript-sdk/pull/1783) [`045c62a`](https://github.com/modelcontextprotocol/typescript-sdk/commit/045c62a1e0ada756afe90dd1442534e362269dbf) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Remove
15+
`WebSocketClientTransport`. WebSocket is not a spec-defined transport; use stdio or Streamable HTTP. The `Transport` interface remains exported for custom implementations. See #142.
16+
17+
### Minor Changes
18+
19+
- [#1527](https://github.com/modelcontextprotocol/typescript-sdk/pull/1527) [`dc896e1`](https://github.com/modelcontextprotocol/typescript-sdk/commit/dc896e198bdd1367d93a7c38846fdf9e78d84c6a) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Add
20+
`discoverOAuthServerInfo()` function and unified discovery state caching for OAuth
21+
- New `discoverOAuthServerInfo(serverUrl)` export that performs RFC 9728 protected resource metadata discovery followed by authorization server metadata discovery in a single call. Use this for operations like token refresh and revocation that need the authorization server
22+
URL outside of `auth()`.
23+
- New `OAuthDiscoveryState` type and optional `OAuthClientProvider` methods `saveDiscoveryState()` / `discoveryState()` allow providers to persist all discovery results (auth server URL, resource metadata URL, resource metadata, auth server metadata) across sessions. This
24+
avoids redundant discovery requests and handles browser redirect scenarios where discovery state would otherwise be lost.
25+
- New `'discovery'` scope for `invalidateCredentials()` to clear cached discovery state.
26+
- New `OAuthServerInfo` type exported for the return value of `discoverOAuthServerInfo()`.
27+
28+
- [#1673](https://github.com/modelcontextprotocol/typescript-sdk/pull/1673) [`462c3fc`](https://github.com/modelcontextprotocol/typescript-sdk/commit/462c3fc47dffac908d2ba27784d47ff010fa065e) Thanks [@KKonstantinov](https://github.com/KKonstantinov)! - refactor: extract task
29+
orchestration from Protocol into TaskManager
30+
31+
**Breaking changes:**
32+
- `taskStore`, `taskMessageQueue`, `defaultTaskPollInterval`, and `maxTaskQueueSize` moved from `ProtocolOptions` to `capabilities.tasks` on `ClientOptions`/`ServerOptions`
33+
34+
- [#1763](https://github.com/modelcontextprotocol/typescript-sdk/pull/1763) [`6711ed9`](https://github.com/modelcontextprotocol/typescript-sdk/commit/6711ed9ae8a6a98f415aaa4f145941a562b8e191) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Add
35+
`reconnectionScheduler` option to `StreamableHTTPClientTransport`. Lets non-persistent environments (serverless, mobile, desktop sleep/wake) override the default `setTimeout`-based SSE reconnection scheduling. The scheduler may return a cancel function that is invoked on
36+
`transport.close()`.
37+
38+
- [#1443](https://github.com/modelcontextprotocol/typescript-sdk/pull/1443) [`4aec5f7`](https://github.com/modelcontextprotocol/typescript-sdk/commit/4aec5f790624b1931cf62c006ae02b09d7562d2f) Thanks [@NSeydoux](https://github.com/NSeydoux)! - The client credentials providers now
39+
support scopes being added to the token request.
40+
41+
- [#1689](https://github.com/modelcontextprotocol/typescript-sdk/pull/1689) [`0784be1`](https://github.com/modelcontextprotocol/typescript-sdk/commit/0784be1a67fb3cc2aba0182d88151264f4ea73c8) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Support Standard Schema
42+
for tool and prompt schemas
43+
44+
Tool and prompt registration now accepts any schema library that implements the [Standard Schema spec](https://standardschema.dev/): Zod v4, Valibot, ArkType, and others. `RegisteredTool.inputSchema`, `RegisteredTool.outputSchema`, and `RegisteredPrompt.argsSchema` now use
45+
`StandardSchemaWithJSON` (requires both `~standard.validate` and `~standard.jsonSchema`) instead of the Zod-specific `AnySchema` type.
46+
47+
**Zod v4 schemas continue to work unchanged** — Zod v4 implements the required interfaces natively.
48+
49+
```typescript
50+
import { type } from 'arktype';
51+
52+
server.registerTool(
53+
'greet',
54+
{
55+
inputSchema: type({ name: 'string' })
56+
},
57+
async ({ name }) => ({ content: [{ type: 'text', text: `Hello, ${name}!` }] })
58+
);
59+
```
60+
61+
For raw JSON Schema (e.g. TypeBox output), use the new `fromJsonSchema` adapter:
62+
63+
```typescript
64+
import { fromJsonSchema, AjvJsonSchemaValidator } from '@modelcontextprotocol/core';
65+
66+
server.registerTool(
67+
'greet',
68+
{
69+
inputSchema: fromJsonSchema({ type: 'object', properties: { name: { type: 'string' } } }, new AjvJsonSchemaValidator())
70+
},
71+
handler
72+
);
73+
```
74+
75+
**Breaking changes:**
76+
- `experimental.tasks.getTaskResult()` no longer accepts a `resultSchema` parameter. Returns `GetTaskPayloadResult` (a loose `Result`); cast to the expected type at the call site.
77+
- Removed unused exports from `@modelcontextprotocol/core`: `SchemaInput`, `schemaToJson`, `parseSchemaAsync`, `getSchemaShape`, `getSchemaDescription`, `isOptionalSchema`, `unwrapOptionalSchema`. Use the new `standardSchemaToJsonSchema` and `validateStandardSchema` instead.
78+
- `completable()` remains Zod-specific (it relies on Zod's `.shape` introspection).
79+
80+
- [#1710](https://github.com/modelcontextprotocol/typescript-sdk/pull/1710) [`e563e63`](https://github.com/modelcontextprotocol/typescript-sdk/commit/e563e63bd2b3c2c1d1137406bef3f842c946201e) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Add `AuthProvider` for
81+
composable bearer-token auth; transports adapt `OAuthClientProvider` automatically
82+
- New `AuthProvider` interface: `{ token(): Promise<string | undefined>; onUnauthorized?(ctx): Promise<void> }`. Transports call `token()` before every request and `onUnauthorized()` on 401 (then retry once).
83+
- Transport `authProvider` option now accepts `AuthProvider | OAuthClientProvider`. OAuth providers are adapted internally via `adaptOAuthProvider()`no changes needed to existing `OAuthClientProvider` implementations.
84+
- For simple bearer tokens (API keys, gateway-managed tokens, service accounts): `{ authProvider: { token: async () => myKey } }`one-line object literal, no class.
85+
- New `adaptOAuthProvider(provider)` export for explicit adaptation.
86+
- New `handleOAuthUnauthorized(provider, ctx)` helperthe standard OAuth `onUnauthorized` behavior.
87+
- New `isOAuthClientProvider()` type guard.
88+
- New `UnauthorizedContext` type.
89+
- Exported previously-internal auth helpers for building custom flows: `applyBasicAuth`, `applyPostAuth`, `applyPublicAuth`, `executeTokenRequest`.
90+
91+
Transports are simplified internally~50 lines of inline OAuth orchestration (auth() calls, WWW-Authenticate parsing, circuit-breaker state) moved into the adapter's `onUnauthorized()` implementation. `OAuthClientProvider` itself is unchanged.
92+
93+
- [#1614](https://github.com/modelcontextprotocol/typescript-sdk/pull/1614) [`1a78b01`](https://github.com/modelcontextprotocol/typescript-sdk/commit/1a78b0138f1f3432968e53e810bac7929833eda2) Thanks [@pcarleton](https://github.com/pcarleton)! - Apply resolved scope consistently
94+
to both DCR and the authorization URL (SEP-835)
95+
96+
When `scopes_supported` is present in the protected resource metadata (`/.well-known/oauth-protected-resource`), the SDK already uses it as the default scope for the authorization URL. This change applies the same resolved scope to the dynamic client registration request
97+
body, ensuring both use a consistent value.
98+
- `registerClient()` now accepts an optional `scope` parameter that overrides `clientMetadata.scope` in the registration body.
99+
- `auth()` now computes the resolved scope once (WWW-AuthenticatePRM `scopes_supported``clientMetadata.scope`) and passes it to both DCR and the authorization request.
100+
101+
### Patch Changes
102+
103+
- [#1758](https://github.com/modelcontextprotocol/typescript-sdk/pull/1758) [`e86b183`](https://github.com/modelcontextprotocol/typescript-sdk/commit/e86b1835ccf213c3799ac19f4111d01816912333) Thanks [@KKonstantinov](https://github.com/KKonstantinov)! - tasks - disallow requesting
104+
a null TTL
105+
106+
- [#1824](https://github.com/modelcontextprotocol/typescript-sdk/pull/1824) [`fcde488`](https://github.com/modelcontextprotocol/typescript-sdk/commit/fcde4882276cb0a7d199e47f00120fe13f7f5d47) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Drop `zod` from
107+
`peerDependencies` (kept as direct dependency)
108+
109+
Since Standard Schema support landed, `zod` is purely an internal runtime dependency used for protocol message parsing. User-facing schemas (`registerTool`, `registerPrompt`) accept any Standard Schema library. `zod` remains in `dependencies` and auto-installs; users no
110+
longer need to install it alongside the SDK.
111+
112+
- [#1761](https://github.com/modelcontextprotocol/typescript-sdk/pull/1761) [`01954e6`](https://github.com/modelcontextprotocol/typescript-sdk/commit/01954e621afe525cc3c1bbe8d781e44734cf81c2) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Convert remaining
113+
capability-assertion throws to `SdkError(SdkErrorCode.CapabilityNotSupported, ...)`. Follow-up to #1454 which missed `Client.assertCapability()`, the task capability helpers in `experimental/tasks/helpers.ts`, and the sampling/elicitation capability checks in
114+
`experimental/tasks/server.ts`.
115+
116+
- [#1632](https://github.com/modelcontextprotocol/typescript-sdk/pull/1632) [`d99f3ee`](https://github.com/modelcontextprotocol/typescript-sdk/commit/d99f3ee5274bb17bb0eb02c85381200feb4b43e6) Thanks [@matantsach](https://github.com/matantsach)! - Continue OAuth metadata discovery
117+
on 502 (Bad Gateway) responses, matching the existing behavior for 4xx. This fixes MCP servers behind reverse proxies that return 502 for path-aware metadata URLs. Other 5xx errors still throw to avoid retrying against overloaded servers.
118+
119+
- [#1772](https://github.com/modelcontextprotocol/typescript-sdk/pull/1772) [`5276439`](https://github.com/modelcontextprotocol/typescript-sdk/commit/527643966e42a91711c50a0a6609f941f1dfe3e2) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Always set
120+
`windowsHide` when spawning stdio server processes on Windows, not just in Electron environments. Prevents unwanted console windows in non-Electron Windows applications.
121+
122+
- [#1390](https://github.com/modelcontextprotocol/typescript-sdk/pull/1390) [`9bc9abc`](https://github.com/modelcontextprotocol/typescript-sdk/commit/9bc9abc68bf2b097b15c76a9673d44fb3ff31d03) Thanks [@DePasqualeOrg](https://github.com/DePasqualeOrg)! - Fix
123+
StreamableHTTPClientTransport to handle error responses in SSE streams
124+
125+
- [#1343](https://github.com/modelcontextprotocol/typescript-sdk/pull/1343) [`4b5fdcb`](https://github.com/modelcontextprotocol/typescript-sdk/commit/4b5fdcba02c20f26d8b0f07acc87248288522842) Thanks [@christso](https://github.com/christso)! - Fix OAuth error handling for servers
126+
returning errors with HTTP 200 status
127+
128+
Some OAuth servers (e.g., GitHub) return error responses with HTTP 200 status instead of 4xx. The SDK now checks for an `error` field in the JSON response before attempting to parse it as tokens, providing users with meaningful error messages.
129+
130+
- [#1534](https://github.com/modelcontextprotocol/typescript-sdk/pull/1534) [`69a0626`](https://github.com/modelcontextprotocol/typescript-sdk/commit/69a062693f61e024d7a366db0c3e3ba74ff59d8e) Thanks [@josefaidt](https://github.com/josefaidt)! - remove npm references, use pnpm
131+
132+
- [#1386](https://github.com/modelcontextprotocol/typescript-sdk/pull/1386) [`00249ce`](https://github.com/modelcontextprotocol/typescript-sdk/commit/00249ce86dac558fb1089aea46d4d6d14e9a56c6) Thanks [@PederHP](https://github.com/PederHP)! - Respect capability negotiation in list
133+
methods by returning empty lists when server lacks capability
134+
135+
The Client now returns empty lists instead of sending requests to servers that don't advertise the corresponding capability:
136+
- `listPrompts()` returns `{ prompts: [] }` if server lacks prompts capability
137+
- `listResources()` returns `{ resources: [] }` if server lacks resources capability
138+
- `listResourceTemplates()` returns `{ resourceTemplates: [] }` if server lacks resources capability
139+
- `listTools()` returns `{ tools: [] }` if server lacks tools capability
140+
141+
This respects the MCP spec requirement that "Both parties SHOULD respect capability negotiation" and avoids unnecessary server warnings and traffic. The existing `enforceStrictCapabilities` option continues to throw errors when set to `true`.
142+
143+
- [#1534](https://github.com/modelcontextprotocol/typescript-sdk/pull/1534) [`69a0626`](https://github.com/modelcontextprotocol/typescript-sdk/commit/69a062693f61e024d7a366db0c3e3ba74ff59d8e) Thanks [@josefaidt](https://github.com/josefaidt)! - clean up package manager usage, all
144+
pnpm
145+
146+
- [#1595](https://github.com/modelcontextprotocol/typescript-sdk/pull/1595) [`13a0d34`](https://github.com/modelcontextprotocol/typescript-sdk/commit/13a0d345c0b88bf73264c41a793bf0ad44cfa620) Thanks [@bhosmer-ant](https://github.com/bhosmer-ant)! - Don't swallow fetch `TypeError`
147+
as CORS in non-browser environments. Network errors (DNS resolution failure, connection refused, invalid URL) in Node.js and Cloudflare Workers now propagate from OAuth discovery instead of being silently misattributed to CORS and returning `undefined`. This surfaces the real
148+
error to callers rather than masking it as "metadata not found."
149+
150+
- [#1279](https://github.com/modelcontextprotocol/typescript-sdk/pull/1279) [`71ae3ac`](https://github.com/modelcontextprotocol/typescript-sdk/commit/71ae3acee0203a1023817e3bffcd172d0966d2ac) Thanks [@KKonstantinov](https://github.com/KKonstantinov)! - Initial 2.0.0-alpha.0
151+
client and server package

packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/client",
3-
"version": "2.0.0-alpha.0",
3+
"version": "2.0.0-alpha.2",
44
"description": "Model Context Protocol implementation for TypeScript - Client package",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",

packages/client/tsdown.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'tsdown';
22

33
export default defineConfig({
4+
failOnWarn: 'ci-only',
45
// 1. Entry Points
56
// Directly matches package.json include/exclude globs
67
entry: ['src/index.ts', 'src/shimsNode.ts', 'src/shimsWorkerd.ts', 'src/shimsBrowser.ts'],
@@ -24,7 +25,8 @@ export default defineConfig({
2425
compilerOptions: {
2526
baseUrl: '.',
2627
paths: {
27-
'@modelcontextprotocol/core': ['../core/src/index.ts']
28+
'@modelcontextprotocol/core': ['../core/src/index.ts'],
29+
'@modelcontextprotocol/core/public': ['../core/src/exports/public/index.ts']
2830
}
2931
}
3032
},

0 commit comments

Comments
 (0)