Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ada352f
codemod iterations
KKonstantinov Jun 23, 2026
f915e5b
Merge branch 'main' of github.com:modelcontextprotocol/typescript-sdk…
KKonstantinov Jun 23, 2026
ab4b658
fix(codemod): match extensionless SDK subpath import specifiers
KKonstantinov Jun 23, 2026
7097be9
add canonical zod schema exports from @modelcontextprotocol/sdk-share…
KKonstantinov Jun 24, 2026
c65285a
fix(codemod): infer client/server project type from v1 source
KKonstantinov Jun 24, 2026
7d5aac3
feat(codemod): map task request/notification schemas to method strings
KKonstantinov Jun 24, 2026
5a74b53
Merge branch 'main' into feature/codemod-iterations-3
KKonstantinov Jun 24, 2026
5ffdb38
fixes
KKonstantinov Jun 24, 2026
10a4549
clean up
KKonstantinov Jun 25, 2026
c2e70af
fix(codemod): split aliased imports per-symbol, drop undefined schema…
KKonstantinov Jun 25, 2026
4a15488
fixes
KKonstantinov Jun 25, 2026
ac39021
fixes
KKonstantinov Jun 25, 2026
6d56a49
readme fix
KKonstantinov Jun 25, 2026
3f198f5
fixes
KKonstantinov Jun 25, 2026
065e142
fix(codemod): bound detectFormatter walk at /Users/kkonstantinov for …
KKonstantinov Jun 25, 2026
62871a9
merge, fixes
KKonstantinov Jun 25, 2026
faab4bc
fixes
KKonstantinov Jun 25, 2026
b452a80
core -> core-internal, sdk-shared -> core
KKonstantinov Jun 25, 2026
3c69fe8
core -> core-internal, sdk-shared -> core
KKonstantinov Jun 25, 2026
7a94d1a
Merge branch 'main' of github.com:modelcontextprotocol/typescript-sdk…
KKonstantinov Jun 25, 2026
5621119
docs fix
KKonstantinov Jun 25, 2026
51bf8bc
fixes
KKonstantinov Jun 25, 2026
3d7f4de
docs+lint: document public core package; drop stale core token from m…
KKonstantinov Jun 25, 2026
0918528
docs+chore: fix stale rename prose in core; drop never-needed sdk-sha…
KKonstantinov Jun 25, 2026
68b2120
fix(codemod): route destructured .then() dynamic-import param; fix st…
KKonstantinov Jun 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/abort-handlers-on-close.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

Abort in-flight request handlers when the connection closes. Previously, request handlers would continue running after the transport disconnected, wasting resources and preventing proper cleanup. Also fixes `InMemoryTransport.close()` firing `onclose` twice on the initiating side.
5 changes: 5 additions & 0 deletions .changeset/add-core-public-package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modelcontextprotocol/core': minor
---

Add `@modelcontextprotocol/core`: the public home for the MCP specification and OAuth/OpenID Zod schemas. It bundles the SDK's internal schema definitions and re-exports only the `*Schema` values, so consumers can validate protocol payloads (`<TypeName>Schema.parse(value)` / `.safeParse(value)`) without depending on a package's internal barrel. Alongside the spec schemas it also re-exports the auth schemas v1 exposed from `@modelcontextprotocol/sdk/shared/auth.js` (e.g. `OAuthTokensSchema`, `OAuthMetadataSchema`, `IdJagTokenExchangeResponseSchema`). Spec types, error classes, enums, and guards continue to live on `@modelcontextprotocol/server` and `@modelcontextprotocol/client`.
2 changes: 1 addition & 1 deletion .changeset/add-resource-size-field.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

Add missing `size` field to `ResourceSchema` to match the MCP specification
2 changes: 1 addition & 1 deletion .changeset/add-sdk-http-error.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@modelcontextprotocol/core": minor
"@modelcontextprotocol/core-internal": minor
"@modelcontextprotocol/client": minor
---

Expand Down
2 changes: 1 addition & 1 deletion .changeset/busy-weeks-hang.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
'@modelcontextprotocol/server': patch
---

Expand Down
5 changes: 5 additions & 0 deletions .changeset/codemod-core-routing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modelcontextprotocol/codemod': minor
---

Route v1 `@modelcontextprotocol/sdk/types.js` schema imports to the new `@modelcontextprotocol/core` package. The `*Schema` Zod constants now migrate as a behavior-preserving import-path swap — `<Name>Schema.parse(value)` / `.safeParse(value)` keep working — while spec types, error classes, enums, and guards continue to resolve to `@modelcontextprotocol/client` / `@modelcontextprotocol/server` by context. A single `import { CallToolResult, CallToolResultSchema } from '.../types.js'` is split accordingly. The v1 OAuth/OpenID `*Schema` constants imported from `@modelcontextprotocol/sdk/shared/auth.js` are routed to `@modelcontextprotocol/core` the same way (their auth TYPES keep resolving to `client` / `server`). The previous `specSchemaAccess` transform (which rewrote `.parse()` into `specTypeSchemas.X['~standard'].validate(...)`) is removed.
5 changes: 5 additions & 0 deletions .changeset/codemod-infer-project-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modelcontextprotocol/codemod': patch
---

Infer client/server project type from source for v1 projects. A project being migrated still declares the single v1 `@modelcontextprotocol/sdk` dependency, so detecting the project type from `package.json` came back "unknown" and every file importing only shared protocol symbols defaulted to `@modelcontextprotocol/server` with an action-required warning. The codemod now scans the source for quoted `@modelcontextprotocol/sdk/client/…` and `…/server/…` import specifiers to infer the type (both → "both", one → that side, neither → "unknown"), routing shared symbols to the installed package and replacing the spurious warnings with at most an info note for genuinely ambiguous "both" projects.
5 changes: 5 additions & 0 deletions .changeset/codemod-task-handler-methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modelcontextprotocol/codemod': patch
---

Map the task request/notification schemas to their v2 method strings in the handler-registration transform. `setRequestHandler(GetTaskRequestSchema, …)`, `setNotificationHandler(TaskStatusNotificationSchema, …)`, and the other task handlers (`tasks/get`, `tasks/result`, `tasks/list`, `tasks/cancel`, `notifications/tasks/status`) now rewrite to the v2 two-argument method-string form instead of falling through to the generic "use the 3-argument form" manual-migration diagnostic.
2 changes: 1 addition & 1 deletion .changeset/custom-methods-minimal.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': minor
'@modelcontextprotocol/core-internal': minor
'@modelcontextprotocol/client': minor
'@modelcontextprotocol/server': minor
---
Expand Down
2 changes: 1 addition & 1 deletion .changeset/extract-task-manager.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@modelcontextprotocol/core": minor
"@modelcontextprotocol/core-internal": minor
"@modelcontextprotocol/client": minor
"@modelcontextprotocol/server": minor
---
Expand Down
2 changes: 1 addition & 1 deletion .changeset/finish-sdkerror-capability.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
'@modelcontextprotocol/client': patch
'@modelcontextprotocol/server': patch
---
Expand Down
2 changes: 1 addition & 1 deletion .changeset/fix-abort-listener-leak.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

Consolidate per-request cleanup in `_requestWithSchema` into a single `.finally()` block. This fixes an abort signal listener leak (listeners accumulated when a caller reused one `AbortSignal` across requests) and two cases where `_responseHandlers` entries leaked on send-failure paths.
2 changes: 1 addition & 1 deletion .changeset/fix-task-session-isolation.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

Fix InMemoryTaskStore to enforce session isolation. Previously, sessionId was accepted but ignored on all TaskStore methods, allowing any session to enumerate, read, and mutate tasks created by other sessions. The store now persists sessionId at creation time and enforces ownership on all reads and writes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

Add explicit `| undefined` to optional properties on the `Transport` interface and `TransportSendOptions` (`onclose`, `onerror`, `onmessage`, `sessionId`, `setProtocolVersion`, `setSupportedProtocolVersions`, `onresumptiontoken`).
Expand Down
2 changes: 1 addition & 1 deletion .changeset/fix-unknown-tool-protocol-error.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@modelcontextprotocol/core": minor
"@modelcontextprotocol/core-internal": minor
"@modelcontextprotocol/server": major
---

Expand Down
2 changes: 1 addition & 1 deletion .changeset/funky-baths-attack.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'@modelcontextprotocol/node': patch
'@modelcontextprotocol/test-integration': patch
'@modelcontextprotocol/server': patch
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

remove deprecated .tool, .prompt, .resource method signatures
6 changes: 6 additions & 0 deletions .changeset/idjag-spec-type-export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modelcontextprotocol/client': minor
'@modelcontextprotocol/server': minor
---

Add the v2 `IdJagTokenExchangeResponse` type to the public API and register its schema as an MCP spec type. `IdJagTokenExchangeResponse` is now exported from `@modelcontextprotocol/client` and `@modelcontextprotocol/server`, `'IdJagTokenExchangeResponse'` joins the `SpecTypeName` union, and `isSpecType.IdJagTokenExchangeResponse(value)` / `specTypeSchemas.IdJagTokenExchangeResponse` validate it by name — matching how the OAuth/OpenID auth schemas are already exposed. The Zod schema itself, `IdJagTokenExchangeResponseSchema`, is available from `@modelcontextprotocol/core`.
3 changes: 2 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
"@modelcontextprotocol/examples-server-quickstart": "2.0.0-alpha.0",
"@modelcontextprotocol/examples-shared": "2.0.0-alpha.0",
"@modelcontextprotocol/client": "2.0.0-alpha.0",
"@modelcontextprotocol/core": "2.0.0-alpha.0",
"@modelcontextprotocol/core-internal": "2.0.0-alpha.0",
"@modelcontextprotocol/express": "2.0.0-alpha.0",
"@modelcontextprotocol/fastify": "2.0.0-alpha.0",
"@modelcontextprotocol/hono": "2.0.0-alpha.0",
"@modelcontextprotocol/node": "2.0.0-alpha.0",
"@modelcontextprotocol/server": "2.0.0-alpha.0",
"@modelcontextprotocol/server-legacy": "2.0.0-alpha.0",
"@modelcontextprotocol/core": "2.0.0-alpha.0",
"@modelcontextprotocol/codemod": "2.0.0-alpha.0",
"@modelcontextprotocol/test-conformance": "2.0.0-alpha.0",
"@modelcontextprotocol/test-helpers": "2.0.0-alpha.0",
Expand Down
2 changes: 1 addition & 1 deletion .changeset/quick-islands-occur.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'@modelcontextprotocol/node': patch
'@modelcontextprotocol/client': patch
'@modelcontextprotocol/server': patch
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

remove npm references, use pnpm
2 changes: 1 addition & 1 deletion .changeset/register-rawshape-compat.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
'@modelcontextprotocol/server': patch
---

Expand Down
2 changes: 1 addition & 1 deletion .changeset/restore-task-wire-types.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': minor
'@modelcontextprotocol/core-internal': minor
'@modelcontextprotocol/server': minor
'@modelcontextprotocol/client': minor
---
Expand Down
2 changes: 1 addition & 1 deletion .changeset/rich-hounds-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'@modelcontextprotocol/node': patch
'@modelcontextprotocol/client': patch
'@modelcontextprotocol/server': patch
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

clean up package manager usage, all pnpm
2 changes: 1 addition & 1 deletion .changeset/schema-object-type-for-unions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

Ensure `standardSchemaToJsonSchema` emits `type: "object"` at the root, fixing discriminated-union tool/prompt schemas that previously produced `{oneOf: [...]}` without the MCP-required top-level type. Also throws a clear error when given an explicitly non-object schema (e.g. `z.string()`). Fixes #1643.
2 changes: 1 addition & 1 deletion .changeset/sep-2577-deprecate-runtime-apis.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
'@modelcontextprotocol/server': patch
'@modelcontextprotocol/client': patch
---
Expand Down
2 changes: 1 addition & 1 deletion .changeset/sep-2663-tasks-removal.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': major
'@modelcontextprotocol/core-internal': major
'@modelcontextprotocol/server': major
'@modelcontextprotocol/client': major
---
Expand Down
2 changes: 1 addition & 1 deletion .changeset/sep-414-trace-context-meta-keys.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

Add reserved trace context `_meta` key constants (`TRACEPARENT_META_KEY`, `TRACESTATE_META_KEY`, `BAGGAGE_META_KEY`) per SEP-414, plus docs and a passthrough regression test. The spec reserves the unprefixed `_meta` keys `traceparent`, `tracestate`, and `baggage` (W3C Trace Context / W3C Baggage formats) for distributed tracing; the SDK passes them through untouched.
2 changes: 1 addition & 1 deletion .changeset/shy-times-learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'@modelcontextprotocol/node': patch
'@modelcontextprotocol/test-integration': patch
'@modelcontextprotocol/server': patch
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

deprecated .tool, .prompt, .resource method removal
2 changes: 1 addition & 1 deletion .changeset/spec-reference-types-2026-07-28.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
'@modelcontextprotocol/codemod': patch
---

Expand Down
4 changes: 2 additions & 2 deletions .changeset/stdio-max-buffer-size.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
'@modelcontextprotocol/client': patch
'@modelcontextprotocol/server': patch
---

Add a configurable `maxBufferSize` (default 10 MB) to the stdio transports. When a single message would push the read buffer past the limit, the transport now emits an `onerror` and closes instead of growing the buffer unbounded. Configure via `new StdioClientTransport({ ..., maxBufferSize })` or `new StdioServerTransport(stdin, stdout, { maxBufferSize })`. The default is exported from `@modelcontextprotocol/core` as `STDIO_DEFAULT_MAX_BUFFER_SIZE`.
Add a configurable `maxBufferSize` (default 10 MB) to the stdio transports. When a single message would push the read buffer past the limit, the transport now emits an `onerror` and closes instead of growing the buffer unbounded. Configure via `new StdioClientTransport({ ..., maxBufferSize })` or `new StdioServerTransport(stdin, stdout, { maxBufferSize })`. The default is exported from `@modelcontextprotocol/core-internal` as `STDIO_DEFAULT_MAX_BUFFER_SIZE`.
2 changes: 1 addition & 1 deletion .changeset/stdio-skip-non-json.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

`ReadBuffer.readMessage()` now silently skips non-JSON lines instead of throwing `SyntaxError`. This prevents noisy `onerror` callbacks when hot-reload tools (tsx, nodemon) write debug output like "Gracefully restarting..." to stdout. Lines that parse as JSON but fail JSONRPC schema validation still throw.
4 changes: 2 additions & 2 deletions .changeset/support-standard-json-schema.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': minor
'@modelcontextprotocol/core-internal': minor
'@modelcontextprotocol/server': minor
'@modelcontextprotocol/client': minor
---
Expand Down Expand Up @@ -30,5 +30,5 @@ server.registerTool('greet', {

**Breaking changes:**
- `experimental.tasks.getTaskResult()` no longer accepts a `resultSchema` parameter. Returns `GetTaskPayloadResult` (a loose `Result`); cast to the expected type at the call site.
- Removed unused exports from `@modelcontextprotocol/core`: `SchemaInput`, `schemaToJson`, `parseSchemaAsync`, `getSchemaShape`, `getSchemaDescription`, `isOptionalSchema`, `unwrapOptionalSchema`. Use the new `standardSchemaToJsonSchema` and `validateStandardSchema` instead.
- Removed unused exports from `@modelcontextprotocol/core-internal`: `SchemaInput`, `schemaToJson`, `parseSchemaAsync`, `getSchemaShape`, `getSchemaDescription`, `isOptionalSchema`, `unwrapOptionalSchema`. Use the new `standardSchemaToJsonSchema` and `validateStandardSchema` instead.
- `completable()` remains Zod-specific (it relies on Zod's `.shape` introspection).
2 changes: 1 addition & 1 deletion .changeset/workerd-shim-vendors-cfworker.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': minor
'@modelcontextprotocol/core-internal': minor
'@modelcontextprotocol/client': patch
'@modelcontextprotocol/server': patch
---
Expand Down
2 changes: 1 addition & 1 deletion .changeset/wraphandler-hook.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
'@modelcontextprotocol/client': patch
'@modelcontextprotocol/server': patch
---
Expand Down
2 changes: 1 addition & 1 deletion .changeset/zod-json-schema-compat.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
---

Allow additional JSON Schema properties in elicitInput's requestedSchema type by adding .catchall(z.unknown()), matching the pattern used by inputSchema. This fixes type incompatibility when using Zod v4's .toJSONSchema() output which includes extra properties like $schema and additionalProperties.
2 changes: 1 addition & 1 deletion .changeset/zod-jsonschema-fallback.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/core-internal': patch
'@modelcontextprotocol/server': patch
'@modelcontextprotocol/client': patch
---
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ jobs:

- name: Publish preview packages
run:
pnpm dlx pkg-pr-new publish --packageManager=npm --pnpm './packages/server' './packages/server-legacy' './packages/client'
pnpm dlx pkg-pr-new publish --packageManager=npm --pnpm './packages/core' './packages/server' './packages/server-legacy' './packages/client'
'./packages/codemod' './packages/middleware/express' './packages/middleware/fastify' './packages/middleware/hono' './packages/middleware/node'
8 changes: 4 additions & 4 deletions .github/workflows/update-spec-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
- name: Check for changes
id: check_changes
run: |
if git diff --quiet packages/core/src/types/spec.types.2026-07-28.ts; then
if git diff --quiet packages/core-internal/src/types/spec.types.2026-07-28.ts; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
LATEST_SHA=$(grep "Last updated from commit:" packages/core/src/types/spec.types.2026-07-28.ts | cut -d: -f2 | tr -d ' ')
LATEST_SHA=$(grep "Last updated from commit:" packages/core-internal/src/types/spec.types.2026-07-28.ts | cut -d: -f2 | tr -d ' ')
echo "sha=$LATEST_SHA" >> $GITHUB_OUTPUT
fi

Expand All @@ -59,12 +59,12 @@ jobs:
git config user.email "github-actions[bot]@users.noreply.github.com"

git checkout -B update-spec-types
git add packages/core/src/types/spec.types.2026-07-28.ts
git add packages/core-internal/src/types/spec.types.2026-07-28.ts
git commit -m "chore: update spec.types.2026-07-28.ts from upstream"
git push -f --no-verify origin update-spec-types

# Create PR if it doesn't exist, or update if it does
PR_BODY="This PR updates \`packages/core/src/types/spec.types.2026-07-28.ts\` from the Model Context Protocol specification.
PR_BODY="This PR updates \`packages/core-internal/src/types/spec.types.2026-07-28.ts\` from the Model Context Protocol specification.

Source file: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/${{ steps.check_changes.outputs.sha }}/schema/draft/schema.ts

Expand Down
Loading
Loading