Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
be2e264
proof of concept: v2 monorepo, package split
KKonstantinov Dec 10, 2025
cfa0615
barrel exports, imports
KKonstantinov Dec 10, 2025
8922ada
add vitest config
KKonstantinov Dec 10, 2025
ebeacac
clean up
KKonstantinov Dec 10, 2025
d372e75
save commit
KKonstantinov Dec 10, 2025
4db8d1b
eslint, vitest setup; successful shared/ tests pass
KKonstantinov Dec 10, 2025
617f14e
save commit; successful tests; successful checks
KKonstantinov Dec 12, 2025
0446560
Merge branch 'main' of github.com:modelcontextprotocol/typescript-sdk…
KKonstantinov Dec 12, 2025
a089abc
save commit
KKonstantinov Dec 12, 2025
647e5f0
save commit
KKonstantinov Dec 12, 2025
6c0818f
lint fix
KKonstantinov Dec 12, 2025
ea354fc
main.yml fix
KKonstantinov Dec 12, 2025
951a234
main.yml fix
KKonstantinov Dec 12, 2025
a7e60b9
add packageManager in package.json
KKonstantinov Dec 12, 2025
9d1e86c
typecheck fix, test main.yml fix
KKonstantinov Dec 12, 2025
236e934
check:all fix
KKonstantinov Dec 12, 2025
f20be12
import fixes
KKonstantinov Dec 12, 2025
c9fcc39
test fix
KKonstantinov Dec 12, 2025
f939900
imports fix
KKonstantinov Dec 12, 2025
d9cd7fe
imports fix
KKonstantinov Dec 12, 2025
f057363
import sorting
KKonstantinov Dec 12, 2025
c3be975
clean up
KKonstantinov Dec 12, 2025
c3353c9
pr-pkg-new update
KKonstantinov Dec 12, 2025
f1c45f2
pkg-pr-new update
KKonstantinov Dec 12, 2025
3e0657f
test imports, pnpm catalogs, package.json cleanup
KKonstantinov Dec 12, 2025
9f519c5
introduce named catalogs, slim down dependencies to minimum required …
KKonstantinov Dec 12, 2025
3c11e9f
add pnpm minimum version in engines
KKonstantinov Dec 12, 2025
c182b5d
add packageManager to package.json
KKonstantinov Dec 12, 2025
3275de7
pkg-pr-new update
KKonstantinov Dec 12, 2025
2020e7f
merge commit
KKonstantinov Dec 15, 2025
c21a566
ajv fix on nodenext
KKonstantinov Dec 15, 2025
d957fc0
Merge branch 'main' of github.com:modelcontextprotocol/typescript-sdk…
KKonstantinov Dec 15, 2025
7e92ba4
clean up package.json files
KKonstantinov Dec 15, 2025
7bd609c
add tsdown
KKonstantinov Dec 15, 2025
15b27d0
update pnpm lock
KKonstantinov Dec 15, 2025
ea2fc03
eslint config
KKonstantinov Dec 15, 2025
5662909
merge commit
KKonstantinov Dec 15, 2025
b5390d4
imports fix
KKonstantinov Dec 15, 2025
228097e
Merge branch 'main' into feature/v2-monorepo-setup
KKonstantinov Dec 15, 2025
76a86a5
remove deprecated tseslint.config
KKonstantinov Dec 15, 2025
2dee387
Merge branch 'feature/v2-monorepo-setup' of github.com:KKonstantinov/…
KKonstantinov Dec 15, 2025
b532047
Merge branch 'main' of github.com:modelcontextprotocol/typescript-sdk…
KKonstantinov Dec 16, 2025
a942551
move examples out of packages, tsconfig clean up, tsdown config
KKonstantinov Dec 17, 2025
2ff0cc5
fix test_1277
KKonstantinov Dec 18, 2025
88573af
restructure test helpers, integration tests, clean up package.json
KKonstantinov Dec 18, 2025
3ad9577
helpers package.json fix
KKonstantinov Dec 18, 2025
f01e323
prettier fix
KKonstantinov Dec 18, 2025
9c9d10b
add changesets
KKonstantinov Dec 18, 2025
7eb6fe3
add changeset
KKonstantinov Dec 18, 2025
8bbd59f
changeset config
KKonstantinov Dec 18, 2025
3f6e352
changesets config
KKonstantinov Dec 18, 2025
60de202
test helpers
KKonstantinov Dec 18, 2025
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "@modelcontextprotocol/typescript-sdk" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"@modelcontextprotocol/sdk-examples-client",
"@modelcontextprotocol/sdk-examples-server",
"@modelcontextprotocol/sdk-examples-shared"
]
}
6 changes: 6 additions & 0 deletions .changeset/tender-snails-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modelcontextprotocol/sdk-client': patch
'@modelcontextprotocol/sdk-server': patch
---

Initial 2.0.0-alpha.0 client and server package
53 changes: 37 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,47 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
run_install: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- run: npm ci
- run: npm run check
- run: npm run build
- run: pnpm install
- run: pnpm run check:all
- run: pnpm run build:all
Comment on lines +29 to +34
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing to pnpm? Does it give us any advantages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm does not support monorepo workspaces and convenience features
pnpm is currently one of the most popular (if not the most) package manager for monorepos. A lot of it is very similar to npm, but it has a lot of features (incl monorepo) on top.


test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18, 24]
node-version: [22, 24]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
run_install: false
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- run: pnpm install

- run: npm ci
- run: npm test
- run: pnpm test:all

publish:
runs-on: ubuntu-latest
Expand All @@ -55,13 +70,19 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
registry-url: 'https://registry.npmjs.org'

- run: npm ci
- run: pnpm install

- name: Determine npm tag
id: npm-tag
Expand All @@ -84,6 +105,6 @@ jobs:
echo "tag=" >> $GITHUB_OUTPUT
fi
- run: npm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }}
- run: pnpm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30 changes: 22 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Publish Any Commit

permissions:
contents: read

on:
pull_request:
push:
Expand All @@ -14,14 +16,26 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we merge this on main, will we still be able to ship v1.x versions as usual or we now need to do that manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would be able to, because the .yml version would still be the old one on the v1 branch.

with:
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install

- name: Build packages
run: pnpm run build:all

- run: npm ci
- name: Build
run: npm run build
- name: Publish
run: npx pkg-pr-new publish
- name: Publish preview packages
run: pnpm dlx pkg-pr-new publish --packageManager=pnpm --pnpm './packages/server' './packages/client'
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

permissions:
contents: write
pull-requests: write

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run build:all && pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
26 changes: 17 additions & 9 deletions .github/workflows/update-spec-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '24'
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: npm ci
run: pnpm install

- name: Fetch latest spec types
run: npm run fetch:spec-types
run: pnpm run fetch:spec-types

- name: Check for changes
id: check_changes
run: |
if git diff --quiet src/spec.types.ts; then
if git diff --quiet packages/core/src/types/spec.types.ts; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
LATEST_SHA=$(grep "Last updated from commit:" src/spec.types.ts | cut -d: -f2 | tr -d ' ')
LATEST_SHA=$(grep "Last updated from commit:" packages/core/src/types/spec.types.ts | cut -d: -f2 | tr -d ' ')
echo "sha=$LATEST_SHA" >> $GITHUB_OUTPUT
fi

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

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

# Create PR if it doesn't exist, or update if it does
PR_BODY="This PR updates \`src/spec.types.ts\` from the Model Context Protocol specification.
PR_BODY="This PR updates \`packages/core/src/types/spec.types.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
81 changes: 81 additions & 0 deletions common/eslint-config/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// @ts-check
import path from 'node:path';
import { fileURLToPath } from 'node:url';

import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import importPlugin from 'eslint-plugin-import';
import nodePlugin from 'eslint-plugin-n';
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
import { configs } from 'typescript-eslint';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

export default defineConfig(
eslint.configs.recommended,
...configs.recommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
{
languageOptions: {
parserOptions: {
// Ensure consumers of this shared config get a stable tsconfig root
tsconfigRootDir: __dirname
}
},
linterOptions: {
reportUnusedDisableDirectives: false
},
plugins: {
n: nodePlugin,
'simple-import-sort': simpleImportSortPlugin
},
settings: {
'import/resolver': {
typescript: {
// Let the TS resolver handle NodeNext-style imports like "./foo.js"
extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts'],
// Use the tsconfig in each package root (when running ESLint from that package)
project: 'tsconfig.json'
}
}
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'n/prefer-node-protocol': 'error',
'@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/test/**',
'**/*.test.ts',
'**/*.test.tsx',
'**/scripts/**',
'**/vitest.config.*',
'**/tsdown.config.*',
'**/eslint.config.*',
'**/vitest.setup.*'
],
optionalDependencies: false,
peerDependencies: true
}
]
}
},
{
// Ignore generated protocol types everywhere
ignores: ['**/spec.types.ts']
},
{
files: ['packages/client/**/*.ts', 'packages/server/**/*.ts'],
ignores: ['**/*.test.ts'],
rules: {
'no-console': 'error'
}
},
eslintConfigPrettier
);
36 changes: 36 additions & 0 deletions common/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@modelcontextprotocol/eslint-config",
"private": true,
"main": "eslint.config.mjs",
"type": "module",
"exports": {
".": "./eslint.config.mjs"
},
"dependencies": {
"typescript": "catalog:devTools"
},
"repository": {
"type": "git",
"url": "https://github.com/modelcontextprotocol/typescript-sdk.git"
},
"bugs": {
"url": "https://github.com/modelcontextprotocol/typescript-sdk/issues"
},
"homepage": "https://github.com/modelcontextprotocol/typescript-sdk/tree/develop/common/eslint-config",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"version": "2.0.0",
"devDependencies": {
"@eslint/js": "catalog:devTools",
"eslint": "catalog:devTools",
"eslint-config-prettier": "catalog:devTools",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-n": "catalog:devTools",
"eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "catalog:devTools",
"typescript": "catalog:devTools",
"typescript-eslint": "catalog:devTools"
}
}
Loading
Loading