Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
29 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
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
46 changes: 46 additions & 0 deletions common/eslint-config/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import nodePlugin from 'eslint-plugin-n';
import { fileURLToPath } from 'node:url';
import path from 'node:path';

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

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
languageOptions: {
parserOptions: {
// Ensure consumers of this shared config get a stable tsconfig root
tsconfigRootDir: __dirname
}
},
linterOptions: {
reportUnusedDisableDirectives: false
},
plugins: {
n: nodePlugin
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'n/prefer-node-protocol': 'error'
}
},
{
// Ignore generated protocol types everywhere
ignores: ['**/spec.types.ts']
},
{
files: ['src/client/**/*.ts', 'src/server/**/*.ts'],
ignores: ['**/*.test.ts'],
rules: {
'no-console': 'error'
}
},
eslintConfigPrettier
);

6 changes: 3 additions & 3 deletions eslint.config.mjs → common/eslint-config/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @ts-check

import eslint from '@eslint/js';
import * as eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import nodePlugin from 'eslint-plugin-n';
import * as eslintConfigPrettier from 'eslint-config-prettier/flat';
import * as nodePlugin from 'eslint-plugin-n';

export default tseslint.config(
eslint.configs.recommended,
Expand Down
34 changes: 34 additions & 0 deletions common/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@modelcontextprotocol/eslint-config",
"private": true,
"main": "eslint.config.mjs",
"type": "module",
"exports": {
".": "./eslint.config.mjs"
},
"dependencies": {
"typescript": "catalog:"
},
"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": {
"@modelcontextprotocol/tsconfig": "workspace:^",
"eslint": "^9.8.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-n": "^17.23.1",
"prettier": "3.6.2",
"typescript": "^5.5.4",
"typescript-eslint": "^8.48.1",
"@eslint/js": "^9.39.1"
}
}
8 changes: 8 additions & 0 deletions common/eslint-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@modelcontextprotocol/tsconfig",
"include": ["./"],
"exclude": ["node_modules", "dist"],
"compilerOptions": {
"baseUrl": "."
}
}
21 changes: 21 additions & 0 deletions common/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@modelcontextprotocol/tsconfig",
"private": true,
"main": "tsconfig.json",
"type": "module",
"dependencies": {
"typescript": "catalog:"
},
"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/ts-config",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"version": "2.0.0"
}
6 changes: 2 additions & 4 deletions tsconfig.json → common/tsconfig/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@
"pkce-challenge": ["./node_modules/pkce-challenge/dist/index.node"]
},
"types": ["node", "vitest/globals"]
},
"include": ["src/**/*", "test/**/*"],
"exclude": ["node_modules", "dist"]
}
}
}
28 changes: 28 additions & 0 deletions common/vitest-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@modelcontextprotocol/vitest-config",
"private": true,
"main": "vitest.config.mjs",
"type": "module",
"exports": {
".": "./vitest.config.mjs",
"./tsconfig.json": "./tsconfig.json"
},
"dependencies": {
"typescript": "catalog:"
},
"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/vitest-config",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"version": "2.0.0",
"devDependencies": {
"@modelcontextprotocol/tsconfig": "workspace:^"
}
}
8 changes: 8 additions & 0 deletions common/vitest-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@modelcontextprotocol/tsconfig",
"include": ["./"],
"exclude": ["node_modules", "dist"],
"compilerOptions": {
"baseUrl": "."
}
}
12 changes: 12 additions & 0 deletions common/vitest-config/vitest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
environment: 'node',
setupFiles: ['./vitest.setup.ts'],
include: ['test/**/*.test.ts']
}
});


8 changes: 8 additions & 0 deletions common/vitest-config/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { webcrypto } from 'node:crypto';

// Polyfill globalThis.crypto for environments (e.g. Node 18) where it is not defined.
// This is necessary for the tests to run in Node 18, specifically for the jose library, which relies on the globalThis.crypto object.
if (typeof globalThis.crypto === 'undefined') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(globalThis as any).crypto = webcrypto as unknown as Crypto;
}
7 changes: 7 additions & 0 deletions packages/client/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @ts-check

import baseConfig from '@modelcontextprotocol/eslint-config';

export default baseConfig;


110 changes: 110 additions & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"name": "@modelcontextprotocol/sdk-client",
"version": "2.0.0-alpha.0",
"description": "Model Context Protocol implementation for TypeScript",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
"homepage": "https://modelcontextprotocol.io",
"bugs": "https://github.com/modelcontextprotocol/typescript-sdk/issues",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/modelcontextprotocol/typescript-sdk.git"
},
"engines": {
"node": ">=18"
},
"keywords": [
"modelcontextprotocol",
"mcp"
],
"exports": {
".": {
"import": "./dist/index.js"
}
},
"typesVersions": {
"*": {
"*": [
"./dist/*"
]
}
},
"files": [
"dist"
],
"scripts": {
"fetch:spec-types": "tsx scripts/fetch-spec-types.ts",
"typecheck": "tsgo --noEmit",
"build": "npm run build:esm",
"build:esm": "mkdir -p dist && echo '{\"type\": \"module\"}' > dist/package.json && tsc -p tsconfig.prod.json",
"build:esm:w": "npm run build:esm -- -w",
"examples:simple-server:w": "tsx --watch src/examples/server/simpleStreamableHttp.ts --oauth",
"prepack": "npm run build:esm && npm run build:cjs",
"lint": "eslint src/ && prettier --check .",
"lint:fix": "eslint src/ --fix && prettier --write .",
"check": "npm run typecheck && npm run lint",
"test": "vitest run",
"test:watch": "vitest",
"start": "npm run server",
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
"client": "tsx scripts/cli.ts client"
},
"dependencies": {
"@modelcontextprotocol/shared": "workspace:^",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"content-type": "^1.0.5",
"cors": "^2.8.5",
"cross-spawn": "^7.0.5",
"eventsource": "^3.0.2",
"eventsource-parser": "^3.0.0",
"express": "^5.0.1",
"express-rate-limit": "^7.5.0",
"jose": "^6.1.1",
"json-schema-typed": "^8.0.2",
"pkce-challenge": "^5.0.0",
"raw-body": "^3.0.0",
"zod": "^3.25 || ^4.0",
"zod-to-json-schema": "^3.25.0"
},
"peerDependencies": {
"@cfworker/json-schema": "^4.1.1",
"zod": "^3.25 || ^4.0"
},
"peerDependenciesMeta": {
"@cfworker/json-schema": {
"optional": true
},
"zod": {
"optional": false
}
},
"devDependencies": {
"@modelcontextprotocol/tsconfig": "workspace:^",
"@modelcontextprotocol/vitest-config": "workspace:^",
"@modelcontextprotocol/eslint-config": "workspace:^",
"@cfworker/json-schema": "^4.1.1",
"@eslint/js": "^9.39.1",
"@types/content-type": "^1.1.8",
"@types/cors": "^2.8.17",
"@types/cross-spawn": "^6.0.6",
"@types/eventsource": "^1.1.15",
"@types/express": "^5.0.0",
"@types/express-serve-static-core": "^5.1.0",
"@types/node": "^22.12.0",
"@types/supertest": "^6.0.2",
"@types/ws": "^8.5.12",
"@typescript/native-preview": "^7.0.0-dev.20251103.1",
"eslint": "^9.8.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-n": "^17.23.1",
"prettier": "3.6.2",
"supertest": "^7.0.0",
"tsx": "^4.16.5",
"typescript": "^5.5.4",
"typescript-eslint": "^8.48.1",
"vitest": "^4.0.8",
"ws": "^8.18.0"
}
}
Loading
Loading