diff --git a/.changeset/README.md b/.changeset/README.md deleted file mode 100644 index 8385205249..0000000000 --- a/.changeset/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# 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) diff --git a/.changeset/config.json b/.changeset/config.json deleted file mode 100644 index bae546e8e1..0000000000 --- a/.changeset/config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$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/examples-client", "@modelcontextprotocol/examples-server", "@modelcontextprotocol/examples-shared"] -} diff --git a/.changeset/tender-snails-fold.md b/.changeset/tender-snails-fold.md deleted file mode 100644 index 138596950c..0000000000 --- a/.changeset/tender-snails-fold.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@modelcontextprotocol/client': patch -'@modelcontextprotocol/server': patch ---- - -Initial 2.0.0-alpha.0 client and server package diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 495ca55814..b92f67d815 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,7 @@ on: push: branches: - - main + - v1.x pull_request: workflow_dispatch: release: @@ -16,47 +16,32 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - id: pnpm-install - with: - run_install: false - - uses: actions/setup-node@v6 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 24 - cache: pnpm - cache-dependency-path: pnpm-lock.yaml + cache: npm - - run: pnpm install - - run: pnpm run check:all - - run: pnpm run build:all + - run: npm ci + - run: npm run check + - run: npm run build test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - node-version: [20, 22, 24] + node-version: [18, 24] steps: - - uses: actions/checkout@v6 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - id: pnpm-install - with: - run_install: false - - uses: actions/setup-node@v6 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: pnpm - cache-dependency-path: pnpm-lock.yaml - - - run: pnpm install + cache: npm - - run: pnpm test:all + - run: npm ci + - run: npm test publish: runs-on: ubuntu-latest @@ -70,19 +55,13 @@ 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: pnpm - cache-dependency-path: pnpm-lock.yaml + cache: npm registry-url: 'https://registry.npmjs.org' - - run: pnpm install + + - run: npm ci - name: Determine npm tag id: npm-tag @@ -105,6 +84,6 @@ jobs: echo "tag=" >> $GITHUB_OUTPUT fi - - run: pnpm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }} + - run: npm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1167b176ad..00ffd6efe5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,6 @@ name: Publish Any Commit - permissions: contents: read - on: pull_request: push: @@ -16,26 +14,14 @@ jobs: 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 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 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: Build packages - run: pnpm run build:all + cache: npm - - name: Publish preview packages - run: pnpm dlx pkg-pr-new publish --packageManager=npm --pnpm './packages/server' './packages/client' + - run: npm ci + - name: Build + run: npm run build + - name: Publish + run: npx pkg-pr-new publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ed0b1061b8..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,45 +0,0 @@ -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: ${{ github.token }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/update-spec-types.yml b/.github/workflows/update-spec-types.yml index 4a54f76c50..dbc00ebd51 100644 --- a/.github/workflows/update-spec-types.yml +++ b/.github/workflows/update-spec-types.yml @@ -15,35 +15,27 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v6 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - id: pnpm-install - with: - run_install: false + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v6 + uses: actions/setup-node@v4 with: - node-version: 24 - cache: pnpm - cache-dependency-path: pnpm-lock.yaml + node-version: '24' - name: Install dependencies - run: pnpm install + run: npm ci - name: Fetch latest spec types - run: pnpm run fetch:spec-types + run: npm run fetch:spec-types - name: Check for changes id: check_changes run: | - if git diff --quiet packages/core/src/types/spec.types.ts; then + if git diff --quiet src/spec.types.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.ts | cut -d: -f2 | tr -d ' ') + LATEST_SHA=$(grep "Last updated from commit:" src/spec.types.ts | cut -d: -f2 | tr -d ' ') echo "sha=$LATEST_SHA" >> $GITHUB_OUTPUT fi @@ -56,12 +48,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.ts + git add src/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 \`packages/core/src/types/spec.types.ts\` from the Model Context Protocol specification. + PR_BODY="This PR updates \`src/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 diff --git a/CLAUDE.md b/CLAUDE.md index 2a0b253a6c..6e768e559f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,21 +5,14 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Build & Test Commands ```sh -pnpm install # Install all workspace dependencies - -pnpm build:all # Build all packages -pnpm lint:all # Run ESLint + Prettier checks across all packages -pnpm lint:fix:all # Auto-fix lint and formatting issues across all packages -pnpm typecheck:all # Type-check all packages -pnpm test:all # Run all tests (vitest) across all packages -pnpm check:all # typecheck + lint across all packages - -# Run a single package script (examples) -# Run a single package script from the repo root with pnpm filter -pnpm --filter @modelcontextprotocol/core test # vitest run (core) -pnpm --filter @modelcontextprotocol/core test:watch # vitest (watch) -pnpm --filter @modelcontextprotocol/core test -- path/to/file.test.ts -pnpm --filter @modelcontextprotocol/core test -- -t "test name" +npm run build # Build ESM and CJS versions +npm run lint # Run ESLint and Prettier check +npm run lint:fix # Auto-fix lint and formatting issues +npm test # Run all tests (vitest) +npm run test:watch # Run tests in watch mode +npx vitest path/to/file.test.ts # Run specific test file +npx vitest -t "test name" # Run tests matching pattern +npm run typecheck # Type-check without emitting ``` ## Code Style Guidelines @@ -38,64 +31,64 @@ pnpm --filter @modelcontextprotocol/core test -- -t "test name" The SDK is organized into three main layers: -1. **Types Layer** (`packages/core/src/types/types.ts`) - Protocol types generated from the MCP specification. All JSON-RPC message types, schemas, and protocol constants are defined here using Zod v4. +1. **Types Layer** (`src/types.ts`) - Protocol types generated from the MCP specification. All JSON-RPC message types, schemas, and protocol constants are defined here using Zod v4. -2. **Protocol Layer** (`packages/core/src/shared/protocol.ts`) - The abstract `Protocol` class that handles JSON-RPC message routing, request/response correlation, capability negotiation, and transport management. Both `Client` and `Server` extend this class. +2. **Protocol Layer** (`src/shared/protocol.ts`) - The abstract `Protocol` class that handles JSON-RPC message routing, request/response correlation, capability negotiation, and transport management. Both `Client` and `Server` extend this class. 3. **High-Level APIs**: - - `Client` (`packages/client/src/client/client.ts`) - Client implementation extending Protocol with typed methods for MCP operations - - `Server` (`packages/server/src/server/server.ts`) - Server implementation extending Protocol with request handler registration - - `McpServer` (`packages/server/src/server/mcp.ts`) - High-level server API with simplified resource/tool/prompt registration + - `Client` (`src/client/index.ts`) - Low-level client extending Protocol with typed methods for all MCP operations + - `Server` (`src/server/index.ts`) - Low-level server extending Protocol with request handler registration + - `McpServer` (`src/server/mcp.ts`) - High-level server API with simplified resource/tool/prompt registration ### Transport System -Transports (`packages/core/src/shared/transport.ts`) provide the communication layer: +Transports (`src/shared/transport.ts`) provide the communication layer: -- **Streamable HTTP** (`packages/server/src/server/streamableHttp.ts`, `packages/client/src/client/streamableHttp.ts`) - Recommended transport for remote servers, supports SSE for streaming -- **SSE** (`packages/server/src/server/sse.ts`, `packages/client/src/client/sse.ts`) - Legacy HTTP+SSE transport for backwards compatibility -- **stdio** (`packages/server/src/server/stdio.ts`, `packages/client/src/client/stdio.ts`) - For local process-spawned integrations +- **Streamable HTTP** (`src/server/streamableHttp.ts`, `src/client/streamableHttp.ts`) - Recommended transport for remote servers, supports SSE for streaming +- **SSE** (`src/server/sse.ts`, `src/client/sse.ts`) - Legacy HTTP+SSE transport for backwards compatibility +- **stdio** (`src/server/stdio.ts`, `src/client/stdio.ts`) - For local process-spawned integrations ### Server-Side Features - **Tools/Resources/Prompts**: Registered via `McpServer.tool()`, `.resource()`, `.prompt()` methods -- **OAuth/Auth**: Full OAuth 2.0 server implementation in `packages/server/src/server/auth/` -- **Completions**: Auto-completion support via `packages/server/src/server/completable.ts` +- **OAuth/Auth**: Full OAuth 2.0 server implementation in `src/server/auth/` +- **Completions**: Auto-completion support via `src/server/completable.ts` ### Client-Side Features -- **Auth**: OAuth client support in `packages/client/src/client/auth.ts` and `packages/client/src/client/auth-extensions.ts` -- **Middleware**: Request middleware in `packages/client/src/client/middleware.ts` +- **Auth**: OAuth client support in `src/client/auth.ts` and `src/client/auth-extensions.ts` +- **Middleware**: Request middleware in `src/client/middleware.ts` - **Sampling**: Clients can handle `sampling/createMessage` requests from servers (LLM completions) - **Elicitation**: Clients can handle `elicitation/create` requests for user input (form or URL mode) - **Roots**: Clients can expose filesystem roots to servers via `roots/list` ### Experimental Features -Located in `packages/*/src/experimental/`: +Located in `src/experimental/`: -- **Tasks**: Long-running task support with polling/resumption (`packages/core/src/experimental/tasks/`) +- **Tasks**: Long-running task support with polling/resumption (`src/experimental/tasks/`) ### Zod Compatibility The SDK uses `zod/v4` internally but supports both v3 and v4 APIs. Compatibility utilities: -- `packages/core/src/util/zod-compat.ts` - Schema parsing helpers that work across versions -- `packages/core/src/util/zod-json-schema-compat.ts` - Converts Zod schemas to JSON Schema +- `src/server/zod-compat.ts` - Schema parsing helpers that work across versions +- `src/server/zod-json-schema-compat.ts` - Converts Zod schemas to JSON Schema ### Validation -Pluggable JSON Schema validation (`packages/core/src/validation/`): +Pluggable JSON Schema validation (`src/validation/`): - `ajv-provider.ts` - Default Ajv-based validator - `cfworker-provider.ts` - Cloudflare Workers-compatible alternative ### Examples -Runnable examples in `examples/`: +Runnable examples in `src/examples/`: -- `examples/server/src/` - Various server configurations (stateful, stateless, OAuth, etc.) -- `examples/client/src/` - Client examples (basic, OAuth, parallel calls, etc.) -- `examples/shared/src/` - Shared utilities (OAuth demo provider, etc.) +- `server/` - Various server configurations (stateful, stateless, OAuth, etc.) +- `client/` - Client examples (basic, OAuth, parallel calls, etc.) +- `shared/` - Shared utilities like in-memory event store ## Message Flow (Bidirectional Protocol) @@ -105,9 +98,9 @@ MCP is bidirectional: both client and server can send requests. Understanding th ``` Protocol (abstract base) -├── Client (packages/client/src/client/client.ts) - can send requests TO server, handle requests FROM server -└── Server (packages/server/src/server/server.ts) - can send requests TO client, handle requests FROM client - └── McpServer (packages/server/src/server/mcp.ts) - high-level wrapper around Server +├── Client (src/client/index.ts) - can send requests TO server, handle requests FROM server +└── Server (src/server/index.ts) - can send requests TO client, handle requests FROM client + └── McpServer (src/server/mcp.ts) - high-level wrapper around Server ``` ### Outbound Flow: Sending Requests diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64c8ab1401..ace9542dbf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,40 +2,20 @@ We welcome contributions to the Model Context Protocol TypeScript SDK! This document outlines the process for contributing to the project. -## Branches - -This repository has two main branches: - -- **`main`** – v2 of the SDK (currently in development). This is a monorepo with split packages. -- **`v1.x`** – stable v1 release. Bug fixes and patches for v1 should target this branch. - -**Which branch should I use as a base?** - -- For **new features** or **v2-related work**: base your PR on `main` -- For **v1 bug fixes** or **patches**: base your PR on `v1.x` - ## Getting Started -This project uses [pnpm](https://pnpm.io/) as its package manager. If you don't have pnpm installed, enable it via [corepack](https://nodejs.org/api/corepack.html) (included with Node.js 16.9+): - -```bash -corepack enable -``` - -Then: - 1. Fork the repository 2. Clone your fork: `git clone https://github.com/YOUR-USERNAME/typescript-sdk.git` -3. Install dependencies: `pnpm install` -4. Build the project: `pnpm build:all` -5. Run tests: `pnpm test:all` +3. Install dependencies: `npm install` +4. Build the project: `npm run build` +5. Run tests: `npm test` ## Development Process -1. Create a new branch for your changes (based on `main` or `v1.x` as appropriate) +1. Create a new branch for your changes 2. Make your changes -3. Run `pnpm lint:all` to ensure code style compliance -4. Run `pnpm test:all` to verify all tests pass +3. Run `npm run lint` to ensure code style compliance +4. Run `npm test` to verify all tests pass 5. Submit a pull request ## Pull Request Guidelines @@ -48,17 +28,8 @@ Then: ## Running Examples -See [`examples/server/README.md`](examples/server/README.md) and [`examples/client/README.md`](examples/client/README.md) for a full list of runnable examples. - -Quick start: - -```bash -# Run a server example -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts - -# Run a client example (in another terminal) -pnpm --filter @modelcontextprotocol/examples-client exec tsx src/simpleStreamableHttp.ts -``` +- Start the server: `npm run server` +- Run the client: `npm run client` ## Code of Conduct diff --git a/README.md b/README.md index dc0116c96b..254671c8f3 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,13 @@ -# MCP TypeScript SDK - -> [!IMPORTANT] -> **This is the `main` branch which contains v2 of the SDK (currently in development, pre-alpha).** -> -> We anticipate a stable v2 release in Q1 2026. Until then, **v1.x remains the recommended version** for production use. v1.x will continue to receive bug fixes and security updates for at least 6 months after v2 ships to give people time to upgrade. -> -> For v1 documentation and code, see the [`v1.x` branch](https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x). - -![NPM Version](https://img.shields.io/npm/v/%40modelcontextprotocol%2Fserver) ![NPM Version](https://img.shields.io/npm/v/%40modelcontextprotocol%2Fclient) ![MIT licensed](https://img.shields.io/npm/l/%40modelcontextprotocol%2Fserver) +# MCP TypeScript SDK [![NPM Version](https://img.shields.io/npm/v/%40modelcontextprotocol%2Fsdk)](https://www.npmjs.com/package/@modelcontextprotocol/sdk) [![MIT licensed](https://img.shields.io/npm/l/%40modelcontextprotocol%2Fsdk)](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/LICENSE)
Table of Contents - [Overview](#overview) -- [Packages](#packages) - [Installation](#installation) -- [Quick Start (runnable examples)](#quick-start-runnable-examples) +- [Quick Start](#quick-start) +- [Core Concepts](#core-concepts) +- [Examples](#examples) - [Documentation](#documentation) - [Contributing](#contributing) - [License](#license) @@ -24,83 +16,142 @@ ## Overview -The Model Context Protocol (MCP) allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction. +The Model Context Protocol allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction. This TypeScript SDK implements +[the full MCP specification](https://modelcontextprotocol.io/specification/draft), making it easy to: -This repository contains the TypeScript SDK implementation of the MCP specification and ships: +- Create MCP servers that expose resources, prompts and tools +- Build MCP clients that can connect to any MCP server +- Use standard transports like stdio and Streamable HTTP -- MCP **server** libraries (tools/resources/prompts, Streamable HTTP, stdio, auth helpers) -- MCP **client** libraries (transports, high-level helpers, OAuth helpers) -- Runnable **examples** (under [`examples/`](examples/)) +## Installation -## Packages +```bash +npm install @modelcontextprotocol/sdk zod +``` -This monorepo publishes split packages: +This SDK has a **required peer dependency** on `zod` for schema validation. The SDK internally imports from `zod/v4`, but maintains backwards compatibility with projects using Zod v3.25 or later. You can use either API in your code by importing from `zod/v3` or `zod/v4`: -- **`@modelcontextprotocol/server`**: build MCP servers -- **`@modelcontextprotocol/client`**: build MCP clients +## Quick Start -Both packages have a **required peer dependency** on `zod` for schema validation. The SDK internally imports from `zod/v4`, but remains compatible with projects using Zod v3.25+. +To see the SDK in action end-to-end, start from the runnable examples in `src/examples`: -## Installation +1. **Install dependencies** (from the SDK repo root): -### Server + ```bash + npm install + ``` -```bash -npm install @modelcontextprotocol/server zod -``` +2. **Run the example Streamable HTTP server**: -### Client + ```bash + npx tsx src/examples/server/simpleStreamableHttp.ts + ``` -```bash -npm install @modelcontextprotocol/client zod -``` +3. **Run the interactive client in another terminal**: -## Quick Start (runnable examples) + ```bash + npx tsx src/examples/client/simpleStreamableHttp.ts + ``` -The runnable examples live under `examples/` and are kept in sync with the docs. +This pair of examples demonstrates tools, resources, prompts, sampling, elicitation, tasks and logging. For a guided walkthrough and variations (stateless servers, JSON-only responses, SSE compatibility, OAuth, etc.), see [docs/server.md](docs/server.md) and +[docs/client.md](docs/client.md). -1. **Install dependencies** (from repo root): +## Core Concepts -```bash -pnpm install -``` +### Servers and transports -2. **Run a Streamable HTTP example server**: +An MCP server is typically created with `McpServer` and connected to a transport such as Streamable HTTP or stdio. The SDK supports: -```bash -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts -``` +- **Streamable HTTP** for remote servers (recommended). +- **HTTP + SSE** for backwards compatibility only. +- **stdio** for local, process-spawned integrations. -Alternatively, from within the example package: +Runnable server examples live under `src/examples/server` and are documented in [docs/server.md](docs/server.md). -```bash -cd examples/server -pnpm tsx src/simpleStreamableHttp.ts -``` +### Tools, resources, prompts -3. **Run the interactive client in another terminal**: +- **Tools** let LLMs ask your server to take actions (computation, side effects, network calls). +- **Resources** expose read-only data that clients can surface to users or models. +- **Prompts** are reusable templates that help users talk to models in a consistent way. -```bash -pnpm --filter @modelcontextprotocol/examples-client exec tsx src/simpleStreamableHttp.ts -``` +The detailed APIs, including `ResourceTemplate`, completions, and display-name metadata, are covered in [docs/server.md](docs/server.md#tools-resources-and-prompts), with runnable implementations in [`simpleStreamableHttp.ts`](src/examples/server/simpleStreamableHttp.ts). -Alternatively, from within the example package: +### Capabilities: sampling, elicitation, and tasks -```bash -cd examples/client -pnpm tsx src/simpleStreamableHttp.ts -``` +The SDK includes higher-level capabilities for richer workflows: -Next steps: +- **Sampling**: server-side tools can ask connected clients to run LLM completions. +- **Form elicitation**: tools can request non-sensitive input via structured forms. +- **URL elicitation**: servers can ask users to complete secure flows in a browser (e.g., API key entry, payments, OAuth). +- **Tasks (experimental)**: long-running tool calls can be turned into tasks that you poll or resume later. -- Server examples index: [`examples/server/README.md`](examples/server/README.md) -- Client examples index: [`examples/client/README.md`](examples/client/README.md) -- Guided walkthroughs: [`docs/server.md`](docs/server.md) and [`docs/client.md`](docs/client.md) +Conceptual overviews and links to runnable examples are in: + +- [docs/capabilities.md](docs/capabilities.md) + +Key example servers include: + +- [`toolWithSampleServer.ts`](src/examples/server/toolWithSampleServer.ts) +- [`elicitationFormExample.ts`](src/examples/server/elicitationFormExample.ts) +- [`elicitationUrlExample.ts`](src/examples/server/elicitationUrlExample.ts) + +### Clients + +The high-level `Client` class connects to MCP servers over different transports and exposes helpers like `listTools`, `callTool`, `listResources`, `readResource`, `listPrompts`, and `getPrompt`. + +Runnable clients live under `src/examples/client` and are described in [docs/client.md](docs/client.md), including: + +- Interactive Streamable HTTP client ([`simpleStreamableHttp.ts`](src/examples/client/simpleStreamableHttp.ts)) +- Streamable HTTP client with SSE fallback ([`streamableHttpWithSseFallbackClient.ts`](src/examples/client/streamableHttpWithSseFallbackClient.ts)) +- OAuth-enabled clients and polling/parallel examples + +### Node.js Web Crypto (globalThis.crypto) compatibility + +Some parts of the SDK (for example, JWT-based client authentication in `auth-extensions.ts` via `jose`) rely on the Web Crypto API exposed as `globalThis.crypto`. + +See [docs/faq.md](docs/faq.md) for details on supported Node.js versions and how to polyfill `globalThis.crypto` when running on older Node.js runtimes. + +## Examples + +The SDK ships runnable examples under `src/examples`. Use these tables to find the scenario you care about and jump straight to the corresponding code and docs. + +### Server examples + +| Scenario | Description | Example file(s) | Related docs | +| --------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | +| Streamable HTTP server (stateful) | Feature-rich server with tools, resources, prompts, logging, tasks, sampling, and optional OAuth. | [`simpleStreamableHttp.ts`](src/examples/server/simpleStreamableHttp.ts) | [`server.md`](docs/server.md), [`capabilities.md`](docs/capabilities.md) | +| Streamable HTTP server (stateless) | No session tracking; good for simple API-style servers. | [`simpleStatelessStreamableHttp.ts`](src/examples/server/simpleStatelessStreamableHttp.ts) | [`server.md`](docs/server.md) | +| JSON response mode (no SSE) | Streamable HTTP with JSON responses only and limited notifications. | [`jsonResponseStreamableHttp.ts`](src/examples/server/jsonResponseStreamableHttp.ts) | [`server.md`](docs/server.md) | +| Server notifications over Streamable HTTP | Demonstrates server-initiated notifications using SSE with Streamable HTTP. | [`standaloneSseWithGetStreamableHttp.ts`](src/examples/server/standaloneSseWithGetStreamableHttp.ts) | [`server.md`](docs/server.md) | +| Deprecated HTTP+SSE server | Legacy HTTP+SSE transport for backwards-compatibility testing. | [`simpleSseServer.ts`](src/examples/server/simpleSseServer.ts) | [`server.md`](docs/server.md) | +| Backwards-compatible server (Streamable HTTP + SSE) | Single server that supports both Streamable HTTP and legacy SSE clients. | [`sseAndStreamableHttpCompatibleServer.ts`](src/examples/server/sseAndStreamableHttpCompatibleServer.ts) | [`server.md`](docs/server.md) | +| Form elicitation server | Uses form elicitation to collect non-sensitive user input. | [`elicitationFormExample.ts`](src/examples/server/elicitationFormExample.ts) | [`capabilities.md`](docs/capabilities.md#elicitation) | +| URL elicitation server | Demonstrates URL-mode elicitation in an OAuth-protected server. | [`elicitationUrlExample.ts`](src/examples/server/elicitationUrlExample.ts) | [`capabilities.md`](docs/capabilities.md#elicitation) | +| Sampling and tasks server | Combines tools, logging, sampling, and experimental task-based execution. | [`toolWithSampleServer.ts`](src/examples/server/toolWithSampleServer.ts) | [`capabilities.md`](docs/capabilities.md) | +| OAuth demo authorization server | In-memory OAuth provider used with the example servers. | [`demoInMemoryOAuthProvider.ts`](src/examples/server/demoInMemoryOAuthProvider.ts) | [`server.md`](docs/server.md) | + +### Client examples + +| Scenario | Description | Example file(s) | Related docs | +| --------------------------------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | +| Interactive Streamable HTTP client | CLI client that exercises tools, resources, prompts, elicitation, and tasks. | [`simpleStreamableHttp.ts`](src/examples/client/simpleStreamableHttp.ts) | [`client.md`](docs/client.md) | +| Backwards-compatible client (Streamable HTTP → SSE) | Tries Streamable HTTP first, then falls back to SSE on 4xx responses. | [`streamableHttpWithSseFallbackClient.ts`](src/examples/client/streamableHttpWithSseFallbackClient.ts) | [`client.md`](docs/client.md), [`server.md`](docs/server.md) | +| SSE polling client | Polls a legacy SSE server and demonstrates notification handling. | [`ssePollingClient.ts`](src/examples/client/ssePollingClient.ts) | [`client.md`](docs/client.md) | +| Parallel tool calls client | Shows how to run multiple tool calls in parallel. | [`parallelToolCallsClient.ts`](src/examples/client/parallelToolCallsClient.ts) | [`client.md`](docs/client.md) | +| Multiple clients in parallel | Demonstrates connecting multiple clients concurrently to the same server. | [`multipleClientsParallel.ts`](src/examples/client/multipleClientsParallel.ts) | [`client.md`](docs/client.md) | +| OAuth clients | Examples of client_credentials (basic and private_key_jwt) and reusable providers. | [`simpleOAuthClient.ts`](src/examples/client/simpleOAuthClient.ts), [`simpleOAuthClientProvider.ts`](src/examples/client/simpleOAuthClientProvider.ts), [`simpleClientCredentials.ts`](src/examples/client/simpleClientCredentials.ts) | [`client.md`](docs/client.md) | +| URL elicitation client | Works with the URL elicitation server to drive secure browser flows. | [`elicitationUrlExample.ts`](src/examples/client/elicitationUrlExample.ts) | [`capabilities.md`](docs/capabilities.md#elicitation) | + +Shared utilities: + +- In-memory event store for resumability: [`inMemoryEventStore.ts`](src/examples/shared/inMemoryEventStore.ts) (see [`server.md`](docs/server.md)). + +For more details on how to run these examples (including recommended commands and deployment diagrams), see `src/examples/README.md`. ## Documentation - Local SDK docs: - - [docs/server.md](docs/server.md) – building MCP servers, transports, tools/resources/prompts, CORS, DNS rebinding, and deployment patterns. + - [docs/server.md](docs/server.md) – building and running MCP servers, transports, tools/resources/prompts, CORS, DNS rebinding, and multi-node deployment. - [docs/client.md](docs/client.md) – using the high-level client, transports, backwards compatibility, and OAuth helpers. - [docs/capabilities.md](docs/capabilities.md) – sampling, elicitation (form and URL), and experimental task-based execution. - [docs/faq.md](docs/faq.md) – environment and troubleshooting FAQs (including Node.js Web Crypto support). @@ -109,11 +160,6 @@ Next steps: - [MCP Specification](https://spec.modelcontextprotocol.io) - [Example Servers](https://github.com/modelcontextprotocol/servers) -## v1 (legacy) documentation and fixes - -If you are using the **v1** generation of the SDK, the **v1 documentation** (and any v1-specific fixes) live on the long-lived [`v1.x` branch](https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x). See: -[`https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x`](https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x). - ## Contributing Issues and pull requests are welcome on GitHub at . diff --git a/common/eslint-config/eslint.config.mjs b/common/eslint-config/eslint.config.mjs deleted file mode 100644 index 321f3f6fce..0000000000 --- a/common/eslint-config/eslint.config.mjs +++ /dev/null @@ -1,81 +0,0 @@ -// @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 -); diff --git a/common/eslint-config/package.json b/common/eslint-config/package.json deleted file mode 100644 index 30904a0fc2..0000000000 --- a/common/eslint-config/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "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" - } -} diff --git a/common/tsconfig/package.json b/common/tsconfig/package.json deleted file mode 100644 index 7c62db2c57..0000000000 --- a/common/tsconfig/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@modelcontextprotocol/tsconfig", - "private": true, - "main": "tsconfig.json", - "type": "module", - "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/ts-config", - "publishConfig": { - "registry": "https://npm.pkg.github.com/" - }, - "version": "2.0.0" -} diff --git a/common/vitest-config/package.json b/common/vitest-config/package.json deleted file mode 100644 index 3ae59937eb..0000000000 --- a/common/vitest-config/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@modelcontextprotocol/vitest-config", - "private": true, - "main": "vitest.config.mjs", - "type": "module", - "exports": { - ".": "./vitest.config.js" - }, - "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/vitest-config", - "publishConfig": { - "registry": "https://npm.pkg.github.com/" - }, - "version": "2.0.0", - "devDependencies": { - "@modelcontextprotocol/tsconfig": "workspace:^", - "vite-tsconfig-paths": "catalog:devTools" - } -} diff --git a/common/vitest-config/tsconfig.json b/common/vitest-config/tsconfig.json deleted file mode 100644 index 6e58368d27..0000000000 --- a/common/vitest-config/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "include": ["./"], - "extends": "@modelcontextprotocol/tsconfig", - "compilerOptions": { - "noEmit": true, - "allowJs": true - } -} diff --git a/common/vitest-config/vitest.config.js b/common/vitest-config/vitest.config.js deleted file mode 100644 index 9d1a094e7e..0000000000 --- a/common/vitest-config/vitest.config.js +++ /dev/null @@ -1,25 +0,0 @@ -import { defineConfig } from 'vitest/config'; -import tsconfigPaths from 'vite-tsconfig-paths'; -import path from 'node:path'; -import url from 'node:url'; - -const ignorePatterns = ['**/dist/**']; -const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); - -export default defineConfig({ - test: { - globals: true, - environment: 'node', - include: ['test/**/*.test.ts'], - exclude: ignorePatterns, - deps: { - moduleDirectories: ['node_modules', path.resolve(__dirname, '../../packages'), path.resolve(__dirname, '../../common')] - }, - poolOptions: { - threads: { - useAtomics: true - } - } - }, - plugins: [tsconfigPaths()] -}); diff --git a/docs/capabilities.md b/docs/capabilities.md index 21e309bc15..301e850fe8 100644 --- a/docs/capabilities.md +++ b/docs/capabilities.md @@ -4,7 +4,7 @@ MCP servers can request LLM completions from connected clients that support the For a runnable server that combines tools, logging and tasks, see: -- [`toolWithSampleServer.ts`](../examples/server/src/toolWithSampleServer.ts) +- [`toolWithSampleServer.ts`](../src/examples/server/toolWithSampleServer.ts) In practice you will: @@ -22,8 +22,8 @@ Form elicitation lets a tool ask the user for additional, **non‑sensitive** in Runnable example: -- Server: [`elicitationFormExample.ts`](../examples/server/src/elicitationFormExample.ts) -- Client‑side handling: [`simpleStreamableHttp.ts`](../examples/client/src/simpleStreamableHttp.ts) +- Server: [`elicitationFormExample.ts`](../src/examples/server/elicitationFormExample.ts) +- Client‑side handling: [`simpleStreamableHttp.ts`](../src/examples/client/simpleStreamableHttp.ts) The `simpleStreamableHttp` server also includes a `collect-user-info` tool that demonstrates how to drive elicitation from a tool and handle the response. @@ -33,8 +33,8 @@ URL elicitation is designed for sensitive data and secure web‑based flows (e.g Runnable example: -- Server: [`elicitationUrlExample.ts`](../examples/server/src/elicitationUrlExample.ts) -- Client: [`elicitationUrlExample.ts`](../examples/client/src/elicitationUrlExample.ts) +- Server: [`elicitationUrlExample.ts`](../src/examples/server/elicitationUrlExample.ts) +- Client: [`elicitationUrlExample.ts`](../src/examples/client/elicitationUrlExample.ts) Key points: @@ -62,8 +62,8 @@ On the server you will: For a runnable example that uses the in-memory store shipped with the SDK, see: -- [`toolWithSampleServer.ts`](../examples/server/src/toolWithSampleServer.ts) -- `packages/core/src/experimental/tasks/stores/in-memory.ts` +- [`toolWithSampleServer.ts`](../src/examples/server/toolWithSampleServer.ts) +- `src/experimental/tasks/stores/in-memory.ts` ### Client-side usage @@ -74,7 +74,7 @@ On the client, you use: The interactive client in: -- [`simpleStreamableHttp.ts`](../examples/client/src/simpleStreamableHttp.ts) +- [`simpleStreamableHttp.ts`](../src/examples/client/simpleStreamableHttp.ts) includes commands to demonstrate calling tools that support tasks and handling their lifecycle. diff --git a/docs/client.md b/docs/client.md index 52cb4caf08..d28765fd03 100644 --- a/docs/client.md +++ b/docs/client.md @@ -8,11 +8,11 @@ The SDK provides a high-level `Client` class that connects to MCP servers over d Runnable client examples live under: -- [`simpleStreamableHttp.ts`](../examples/client/src/simpleStreamableHttp.ts) -- [`streamableHttpWithSseFallbackClient.ts`](../examples/client/src/streamableHttpWithSseFallbackClient.ts) -- [`ssePollingClient.ts`](../examples/client/src/ssePollingClient.ts) -- [`multipleClientsParallel.ts`](../examples/client/src/multipleClientsParallel.ts) -- [`parallelToolCallsClient.ts`](../examples/client/src/parallelToolCallsClient.ts) +- [`simpleStreamableHttp.ts`](../src/examples/client/simpleStreamableHttp.ts) +- [`streamableHttpWithSseFallbackClient.ts`](../src/examples/client/streamableHttpWithSseFallbackClient.ts) +- [`ssePollingClient.ts`](../src/examples/client/ssePollingClient.ts) +- [`multipleClientsParallel.ts`](../src/examples/client/multipleClientsParallel.ts) +- [`parallelToolCallsClient.ts`](../src/examples/client/parallelToolCallsClient.ts) ## Connecting and basic operations @@ -25,7 +25,7 @@ A typical flow: - `listPrompts`, `getPrompt` - `listResources`, `readResource` -See [`simpleStreamableHttp.ts`](../examples/client/src/simpleStreamableHttp.ts) for an interactive CLI client that exercises these methods and shows how to handle notifications, elicitation and tasks. +See [`simpleStreamableHttp.ts`](../src/examples/client/simpleStreamableHttp.ts) for an interactive CLI client that exercises these methods and shows how to handle notifications, elicitation and tasks. ## Transports and backwards compatibility @@ -36,7 +36,7 @@ To support both modern Streamable HTTP and legacy SSE servers, use a client that Runnable example: -- [`streamableHttpWithSseFallbackClient.ts`](../examples/client/src/streamableHttpWithSseFallbackClient.ts) +- [`streamableHttpWithSseFallbackClient.ts`](../src/examples/client/streamableHttpWithSseFallbackClient.ts) ## OAuth client authentication helpers @@ -48,10 +48,10 @@ For OAuth-secured MCP servers, the client `auth` module exposes: Examples: -- [`simpleOAuthClient.ts`](../examples/client/src/simpleOAuthClient.ts) -- [`simpleOAuthClientProvider.ts`](../examples/client/src/simpleOAuthClientProvider.ts) -- [`simpleClientCredentials.ts`](../examples/client/src/simpleClientCredentials.ts) -- Server-side auth demo: [`demoInMemoryOAuthProvider.ts`](../examples/shared/src/demoInMemoryOAuthProvider.ts) (tests live under `examples/shared/test/demoInMemoryOAuthProvider.test.ts`) +- [`simpleOAuthClient.ts`](../src/examples/client/simpleOAuthClient.ts) +- [`simpleOAuthClientProvider.ts`](../src/examples/client/simpleOAuthClientProvider.ts) +- [`simpleClientCredentials.ts`](../src/examples/client/simpleClientCredentials.ts) +- Server-side auth demo: [`demoInMemoryOAuthProvider.ts`](../src/examples/server/demoInMemoryOAuthProvider.ts) (tests live under `test/examples/server/demoInMemoryOAuthProvider.test.ts`) These examples show how to: diff --git a/docs/faq.md b/docs/faq.md index 1afe1d10b9..6de0ecaae8 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -6,7 +6,6 @@ - [General](#general) - [Clients](#clients) - [Servers](#servers) -- [v1 (legacy)](#v1-legacy)
@@ -14,8 +13,7 @@ ### Why do I see `TS2589: Type instantiation is excessively deep and possibly infinite` after upgrading the SDK? -This TypeScript error can appear when upgrading to newer SDK versions that support Zod v4 (for example, from older `@modelcontextprotocol/sdk` releases to newer `@modelcontextprotocol/client` / `@modelcontextprotocol/server` releases) **and** your project ends up with multiple -`zod` versions in the dependency tree. +This TypeScript error can appear when upgrading to newer SDK versions that support Zod v4 (for example, from `@modelcontextprotocol/sdk` `1.22.0` to `1.23.0`) **and** your project ends up with multiple `zod` versions in the dependency tree. When there are multiple copies or versions of `zod`, TypeScript may try to instantiate very complex, cross-version types and hit its recursion limits, resulting in `TS2589`. This scenario is discussed in GitHub issue [#1180](https://github.com/modelcontextprotocol/typescript-sdk/issues/1180#event-21236550401). @@ -36,12 +34,12 @@ Once your project is using a single, compatible `zod` version, the `TS2589` erro ### How do I enable Web Crypto (`globalThis.crypto`) for client authentication in older Node.js versions? -The SDK’s OAuth client authentication helpers (for example, those in `packages/client/src/client/auth-extensions.ts` that use `jose`) rely on the Web Crypto API exposed as `globalThis.crypto`. This is especially important for **client credentials** and **JWT-based** -authentication flows used by MCP clients. +The SDK’s OAuth client authentication helpers (for example, those in `src/client/auth-extensions.ts` that use `jose`) rely on the Web Crypto API exposed as `globalThis.crypto`. This is especially important for **client credentials** and **JWT-based** authentication flows used by +MCP clients. - **Node.js v19.0.0 and later**: `globalThis.crypto` is available by default. -- **Node.js v18.x**: `globalThis.crypto` may not be defined by default. In this repository we polyfill it for tests (see `packages/client/vitest.setup.js`), and you should do the same in your app if it is missing – or alternatively, run Node with `--experimental-global-webcrypto` - as per your Node version documentation. (See https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#crypto ) +- **Node.js v18.x**: `globalThis.crypto` may not be defined by default. In this repository we polyfill it for tests (see `vitest.setup.ts`), and you should do the same in your app if it is missing – or alternatively, run Node with `--experimental-global-webcrypto` as per your + Node version documentation. (See https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#crypto ) If you run clients on Node.js versions where `globalThis.crypto` is missing, you can polyfill it using the built-in `node:crypto` module, similar to the SDK's own `vitest.setup.ts`: @@ -63,10 +61,5 @@ For production use, you can either: ### Where can I find runnable server examples? -The SDK ships several runnable server examples under `examples/server/src`. Start from the server examples index in [`examples/server/README.md`](../examples/server/README.md) and the entry-point quick start in the root [`README.md`](../README.md). - -## v1 (legacy) - -### Where do v1 documentation and v1-specific fixes live? - -The v1 generation of this SDK is maintained on the long-lived [`v1.x` branch](https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x). If you’re using v1, refer to that branch for documentation and any v1-specific fixes. +The SDK ships several runnable server examples under `src/examples/server`. The root `README.md` contains a curated **Server examples** table that links to each scenario (stateful/stateless Streamable HTTP, JSON-only mode, SSE/backwards compatibility, elicitation, sampling, +tasks, and OAuth demos), and `src/examples/README.md` includes commands and deployment diagrams for running them. diff --git a/docs/server.md b/docs/server.md index 4d5138e84a..bfb8dad218 100644 --- a/docs/server.md +++ b/docs/server.md @@ -1,6 +1,6 @@ ## Server overview -This SDK lets you build MCP servers in TypeScript and connect them to different transports. For most use cases you will use `McpServer` from `@modelcontextprotocol/server` and choose one of: +This SDK lets you build MCP servers in TypeScript and connect them to different transports. For most use cases you will use `McpServer` from `@modelcontextprotocol/sdk/server/mcp.js` and choose one of: - **Streamable HTTP** (recommended for remote servers) - **HTTP + SSE** (deprecated, for backwards compatibility only) @@ -8,11 +8,11 @@ This SDK lets you build MCP servers in TypeScript and connect them to different For a complete, runnable example server, see: -- [`simpleStreamableHttp.ts`](../examples/server/src/simpleStreamableHttp.ts) – feature‑rich Streamable HTTP server -- [`jsonResponseStreamableHttp.ts`](../examples/server/src/jsonResponseStreamableHttp.ts) – Streamable HTTP with JSON response mode -- [`simpleStatelessStreamableHttp.ts`](../examples/server/src/simpleStatelessStreamableHttp.ts) – stateless Streamable HTTP server -- [`simpleSseServer.ts`](../examples/server/src/simpleSseServer.ts) – deprecated HTTP+SSE transport -- [`sseAndStreamableHttpCompatibleServer.ts`](../examples/server/src/sseAndStreamableHttpCompatibleServer.ts) – backwards‑compatible server for old and new clients +- [`simpleStreamableHttp.ts`](../src/examples/server/simpleStreamableHttp.ts) – feature‑rich Streamable HTTP server +- [`jsonResponseStreamableHttp.ts`](../src/examples/server/jsonResponseStreamableHttp.ts) – Streamable HTTP with JSON response mode +- [`simpleStatelessStreamableHttp.ts`](../src/examples/server/simpleStatelessStreamableHttp.ts) – stateless Streamable HTTP server +- [`simpleSseServer.ts`](../src/examples/server/simpleSseServer.ts) – deprecated HTTP+SSE transport +- [`sseAndStreamableHttpCompatibleServer.ts`](../src/examples/server/sseAndStreamableHttpCompatibleServer.ts) – backwards‑compatible server for old and new clients ## Transports @@ -27,11 +27,12 @@ Streamable HTTP is the modern, fully featured transport. It supports: Key examples: -- [`simpleStreamableHttp.ts`](../examples/server/src/simpleStreamableHttp.ts) – sessions, logging, tasks, elicitation, auth hooks -- [`jsonResponseStreamableHttp.ts`](../examples/server/src/jsonResponseStreamableHttp.ts) – `enableJsonResponse: true`, no SSE -- [`standaloneSseWithGetStreamableHttp.ts`](../examples/server/src/standaloneSseWithGetStreamableHttp.ts) – notifications with Streamable HTTP GET + SSE +- [`simpleStreamableHttp.ts`](../src/examples/server/simpleStreamableHttp.ts) – sessions, logging, tasks, elicitation, auth hooks +- [`jsonResponseStreamableHttp.ts`](../src/examples/server/jsonResponseStreamableHttp.ts) – `enableJsonResponse: true`, no SSE +- [`standaloneSseWithGetStreamableHttp.ts`](../src/examples/server/standaloneSseWithGetStreamableHttp.ts) – notifications with Streamable HTTP GET + SSE -See the MCP spec for full transport details: `https://modelcontextprotocol.io/specification/2025-11-25/basic/transports` +See the MCP spec for full transport details: +`https://modelcontextprotocol.io/specification/2025-03-26/basic/transports` ### Stateless vs stateful sessions @@ -42,8 +43,8 @@ Streamable HTTP can run: Examples: -- Stateless Streamable HTTP: [`simpleStatelessStreamableHttp.ts`](../examples/server/src/simpleStatelessStreamableHttp.ts) -- Stateful with resumability: [`simpleStreamableHttp.ts`](../examples/server/src/simpleStreamableHttp.ts) +- Stateless Streamable HTTP: [`simpleStatelessStreamableHttp.ts`](../src/examples/server/simpleStatelessStreamableHttp.ts) +- Stateful with resumability: [`simpleStreamableHttp.ts`](../src/examples/server/simpleStreamableHttp.ts) ### Deprecated HTTP + SSE @@ -51,15 +52,15 @@ The older HTTP+SSE transport (protocol version 2024‑11‑05) is supported only Examples: -- Legacy SSE server: [`simpleSseServer.ts`](../examples/server/src/simpleSseServer.ts) +- Legacy SSE server: [`simpleSseServer.ts`](../src/examples/server/simpleSseServer.ts) - Backwards‑compatible server (Streamable HTTP + SSE): - [`sseAndStreamableHttpCompatibleServer.ts`](../examples/server/src/sseAndStreamableHttpCompatibleServer.ts) + [`sseAndStreamableHttpCompatibleServer.ts`](../src/examples/server/sseAndStreamableHttpCompatibleServer.ts) ## Running your server For a minimal “getting started” experience: -1. Start from [`simpleStreamableHttp.ts`](../examples/server/src/simpleStreamableHttp.ts). +1. Start from [`simpleStreamableHttp.ts`](../src/examples/server/simpleStreamableHttp.ts). 2. Remove features you do not need (tasks, advanced logging, OAuth, etc.). 3. Register your own tools, resources and prompts. @@ -70,7 +71,7 @@ For more detailed patterns (stateless vs stateful, JSON response mode, CORS, DNS MCP servers running on localhost are vulnerable to DNS rebinding attacks. Use `createMcpExpressApp()` to create an Express app with DNS rebinding protection enabled by default: ```typescript -import { createMcpExpressApp } from '@modelcontextprotocol/server'; +import { createMcpExpressApp } from '@modelcontextprotocol/sdk/server/express.js'; // Protection auto-enabled (default host is 127.0.0.1) const app = createMcpExpressApp(); @@ -78,19 +79,19 @@ const app = createMcpExpressApp(); // Protection auto-enabled for localhost const app = createMcpExpressApp({ host: 'localhost' }); -// No auto protection when binding to all interfaces, unless you provide allowedHosts +// No auto protection when binding to all interfaces const app = createMcpExpressApp({ host: '0.0.0.0' }); ``` -When binding to `0.0.0.0` / `::`, provide an allow-list of hosts: +For custom host validation, use the middleware directly: ```typescript -import { createMcpExpressApp } from '@modelcontextprotocol/server'; +import express from 'express'; +import { hostHeaderValidation } from '@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js'; -const app = createMcpExpressApp({ - host: '0.0.0.0', - allowedHosts: ['localhost', '127.0.0.1', 'myhost.local'] -}); +const app = express(); +app.use(express.json()); +app.use(hostHeaderValidation(['localhost', '127.0.0.1', 'myhost.local'])); ``` ## Tools, resources, and prompts @@ -125,14 +126,14 @@ server.registerTool( This snippet is illustrative only; for runnable servers that expose tools, see: -- [`simpleStreamableHttp.ts`](../examples/server/src/simpleStreamableHttp.ts) -- [`toolWithSampleServer.ts`](../examples/server/src/toolWithSampleServer.ts) +- [`simpleStreamableHttp.ts`](../src/examples/server/simpleStreamableHttp.ts) +- [`toolWithSampleServer.ts`](../src/examples/server/toolWithSampleServer.ts) #### ResourceLink outputs Tools can return `resource_link` content items to reference large resources without embedding them directly, allowing clients to fetch only what they need. -The README’s `list-files` example shows the pattern conceptually; for concrete usage, see the Streamable HTTP examples in `examples/server/src`. +The README’s `list-files` example shows the pattern conceptually; for concrete usage, see the Streamable HTTP examples in `src/examples/server`. ### Resources @@ -157,7 +158,7 @@ server.registerResource( Dynamic resources use `ResourceTemplate` and can support completions on path parameters. For full runnable examples of resources: -- [`simpleStreamableHttp.ts`](../examples/server/src/simpleStreamableHttp.ts) +- [`simpleStreamableHttp.ts`](../src/examples/server/simpleStreamableHttp.ts) ### Prompts @@ -189,33 +190,37 @@ server.registerPrompt( For prompts integrated into a full server, see: -- [`simpleStreamableHttp.ts`](../examples/server/src/simpleStreamableHttp.ts) +- [`simpleStreamableHttp.ts`](../src/examples/server/simpleStreamableHttp.ts) ### Completions Both prompts and resources can support argument completions. On the client side, you use `client.complete()` with a reference to the prompt or resource and the partially‑typed argument. -See the MCP spec sections on prompts and resources for complete details, and [`simpleStreamableHttp.ts`](../examples/client/src/simpleStreamableHttp.ts) for client‑side usage patterns. +See the MCP spec sections on prompts and resources for complete details, and [`simpleStreamableHttp.ts`](../src/examples/client/simpleStreamableHttp.ts) for client‑side usage patterns. ### Display names and metadata Tools, resources and prompts support a `title` field for human‑readable names. Older APIs can also attach `annotations.title`. To compute the correct display name on the client, use: -- `getDisplayName` from `@modelcontextprotocol/client` +- `getDisplayName` from `@modelcontextprotocol/sdk/shared/metadataUtils.js` ## Multi‑node deployment patterns -The SDK supports multi‑node deployments using Streamable HTTP. The high‑level patterns and diagrams live with the runnable server examples: +The SDK supports multi‑node deployments using Streamable HTTP. The high‑level patterns are documented in [`README.md`](../src/examples/README.md): -- [`examples/server/README.md`](../examples/server/README.md#multi-node-deployment-patterns) +- Stateless mode (any node can handle any request) +- Persistent storage mode (shared database for session state) +- Local state with message routing (message queue + pub/sub) + +Those deployment diagrams are kept in [`README.md`](../src/examples/README.md) so the examples and documentation stay aligned. ## Backwards compatibility To handle both modern and legacy clients: - Run a backwards‑compatible server: - - [`sseAndStreamableHttpCompatibleServer.ts`](../examples/server/src/sseAndStreamableHttpCompatibleServer.ts) + - [`sseAndStreamableHttpCompatibleServer.ts`](../src/examples/server/sseAndStreamableHttpCompatibleServer.ts) - Use a client that falls back from Streamable HTTP to SSE: - - [`streamableHttpWithSseFallbackClient.ts`](../examples/client/src/streamableHttpWithSseFallbackClient.ts) + - [`streamableHttpWithSseFallbackClient.ts`](../src/examples/client/streamableHttpWithSseFallbackClient.ts) For the detailed protocol rules, see the “Backwards compatibility” section of the MCP spec. diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..fdfab80e28 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,34 @@ +// @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'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + { + linterOptions: { + reportUnusedDisableDirectives: false + }, + plugins: { + n: nodePlugin + }, + rules: { + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + 'n/prefer-node-protocol': 'error' + } + }, + { + ignores: ['src/spec.types.ts'] + }, + { + files: ['src/client/**/*.ts', 'src/server/**/*.ts'], + ignores: ['**/*.test.ts'], + rules: { + 'no-console': 'error' + } + }, + eslintConfigPrettier +); diff --git a/examples/client/README.md b/examples/client/README.md deleted file mode 100644 index 12a2b0d68b..0000000000 --- a/examples/client/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# MCP TypeScript SDK Examples (Client) - -This directory contains runnable MCP **client** examples built with `@modelcontextprotocol/client`. - -For server examples, see [`../server/README.md`](../server/README.md). For guided docs, see [`../../docs/client.md`](../../docs/client.md). - -## Running examples - -From the repo root: - -```bash -pnpm install -pnpm --filter @modelcontextprotocol/examples-client exec tsx src/simpleStreamableHttp.ts -``` - -Or, from within this package: - -```bash -cd examples/client -pnpm tsx src/simpleStreamableHttp.ts -``` - -Most clients expect a server to be running. Start one from [`../server/README.md`](../server/README.md) (for example `src/simpleStreamableHttp.ts` in `examples/server`). - -## Example index - -| Scenario | Description | File | -| --------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | -| Interactive Streamable HTTP client | CLI client that exercises tools/resources/prompts, notifications, elicitation, and tasks. | [`src/simpleStreamableHttp.ts`](src/simpleStreamableHttp.ts) | -| Backwards-compatible client (Streamable HTTP → SSE) | Tries Streamable HTTP first, falls back to legacy SSE on 4xx responses. | [`src/streamableHttpWithSseFallbackClient.ts`](src/streamableHttpWithSseFallbackClient.ts) | -| SSE polling client (legacy) | Polls a legacy HTTP+SSE server and demonstrates notification handling. | [`src/ssePollingClient.ts`](src/ssePollingClient.ts) | -| Parallel tool calls | Runs multiple tool calls in parallel. | [`src/parallelToolCallsClient.ts`](src/parallelToolCallsClient.ts) | -| Multiple clients in parallel | Connects multiple clients concurrently to the same server. | [`src/multipleClientsParallel.ts`](src/multipleClientsParallel.ts) | -| OAuth client (interactive) | OAuth-enabled client (dynamic registration, auth flow). | [`src/simpleOAuthClient.ts`](src/simpleOAuthClient.ts) | -| OAuth provider helper | Demonstrates reusable OAuth providers. | [`src/simpleOAuthClientProvider.ts`](src/simpleOAuthClientProvider.ts) | -| Client credentials (M2M) | Machine-to-machine OAuth client credentials example. | [`src/simpleClientCredentials.ts`](src/simpleClientCredentials.ts) | -| URL elicitation client | Drives URL-mode elicitation flows (sensitive input in a browser). | [`src/elicitationUrlExample.ts`](src/elicitationUrlExample.ts) | -| Task interactive client | Demonstrates task-based execution + interactive server→client requests. | [`src/simpleTaskInteractiveClient.ts`](src/simpleTaskInteractiveClient.ts) | - -## URL elicitation example (server + client) - -Run the server first: - -```bash -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/elicitationUrlExample.ts -``` - -Then run the client: - -```bash -pnpm --filter @modelcontextprotocol/examples-client exec tsx src/elicitationUrlExample.ts -``` diff --git a/examples/client/eslint.config.mjs b/examples/client/eslint.config.mjs deleted file mode 100644 index 83b79879f6..0000000000 --- a/examples/client/eslint.config.mjs +++ /dev/null @@ -1,14 +0,0 @@ -// @ts-check - -import baseConfig from '@modelcontextprotocol/eslint-config'; - -export default [ - ...baseConfig, - { - files: ['src/**/*.{ts,tsx,js,jsx,mts,cts}'], - rules: { - // Allow console statements in examples only - 'no-console': 'off' - } - } -]; diff --git a/examples/client/package.json b/examples/client/package.json deleted file mode 100644 index d77d6faf26..0000000000 --- a/examples/client/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@modelcontextprotocol/examples-client", - "private": true, - "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": ">=20", - "pnpm": ">=10.24.0" - }, - "packageManager": "pnpm@10.24.0", - "keywords": [ - "modelcontextprotocol", - "mcp" - ], - "scripts": { - "typecheck": "tsgo -p tsconfig.json --noEmit", - "build": "tsdown", - "build:watch": "tsdown --watch", - "prepack": "npm run build:esm && npm run build:cjs", - "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", - "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "npm run typecheck && npm run lint", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" - }, - "dependencies": { - "@modelcontextprotocol/client": "workspace:^", - "ajv": "catalog:runtimeShared", - "zod": "catalog:runtimeShared" - }, - "devDependencies": { - "@modelcontextprotocol/examples-shared": "workspace:^", - "@modelcontextprotocol/tsconfig": "workspace:^", - "@modelcontextprotocol/eslint-config": "workspace:^", - "@modelcontextprotocol/vitest-config": "workspace:^", - "tsdown": "catalog:devTools" - } -} diff --git a/examples/client/tsconfig.json b/examples/client/tsconfig.json deleted file mode 100644 index 30a050fe74..0000000000 --- a/examples/client/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "@modelcontextprotocol/tsconfig", - "include": ["./"], - "exclude": ["node_modules", "dist"], - "compilerOptions": { - "paths": { - "*": ["./*"], - "@modelcontextprotocol/client": ["./node_modules/@modelcontextprotocol/client/src/index.ts"], - "@modelcontextprotocol/core": [ - "./node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/src/index.ts" - ], - "@modelcontextprotocol/eslint-config": ["./node_modules/@modelcontextprotocol/eslint-config/tsconfig.json"], - "@modelcontextprotocol/vitest-config": ["./node_modules/@modelcontextprotocol/vitest-config/tsconfig.json"], - "@modelcontextprotocol/examples-shared": ["./node_modules/@modelcontextprotocol/examples-shared/src/index.ts"] - } - } -} diff --git a/examples/client/tsdown.config.ts b/examples/client/tsdown.config.ts deleted file mode 100644 index efc4299d35..0000000000 --- a/examples/client/tsdown.config.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { defineConfig } from 'tsdown'; - -export default defineConfig({ - // 1. Entry Points - // Directly matches package.json include/exclude globs - entry: ['src/**/*.ts'], - - // 2. Output Configuration - format: ['esm'], - outDir: 'dist', - clean: true, // Recommended: Cleans 'dist' before building - sourcemap: true, - - // 3. Platform & Target - target: 'esnext', - platform: 'node', - shims: true, // Polyfills common Node.js shims (__dirname, etc.) - - // 4. Type Definitions - // Bundles d.ts files into a single output - dts: false, - // 5. Vendoring Strategy - Bundle the code for this specific package into the output, - // but treat all other dependencies as external (require/import). - noExternal: ['@modelcontextprotocol/examples-shared'] -}); diff --git a/examples/client/vitest.config.js b/examples/client/vitest.config.js deleted file mode 100644 index 496fca3200..0000000000 --- a/examples/client/vitest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import baseConfig from '@modelcontextprotocol/vitest-config'; - -export default baseConfig; diff --git a/examples/server/README.md b/examples/server/README.md deleted file mode 100644 index 310113e457..0000000000 --- a/examples/server/README.md +++ /dev/null @@ -1,173 +0,0 @@ -# MCP TypeScript SDK Examples (Server) - -This directory contains runnable MCP **server** examples built with `@modelcontextprotocol/server`. - -For client examples, see [`../client/README.md`](../client/README.md). For guided docs, see [`../../docs/server.md`](../../docs/server.md). - -## Running examples - -From anywhere in the SDK: - -```bash -pnpm install -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts -``` - -Or, from within this package: - -```bash -cd examples/server -pnpm tsx src/simpleStreamableHttp.ts -``` - -## Example index - -| Scenario | Description | File | -| --------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| Streamable HTTP server (stateful) | Feature-rich server with tools/resources/prompts, logging, tasks, sampling, and optional OAuth. | [`src/simpleStreamableHttp.ts`](src/simpleStreamableHttp.ts) | -| Streamable HTTP server (stateless) | No session tracking; good for simple API-style servers. | [`src/simpleStatelessStreamableHttp.ts`](src/simpleStatelessStreamableHttp.ts) | -| JSON response mode (no SSE) | Streamable HTTP with JSON-only responses and limited notifications. | [`src/jsonResponseStreamableHttp.ts`](src/jsonResponseStreamableHttp.ts) | -| Server notifications over Streamable HTTP | Demonstrates server-initiated notifications via GET+SSE. | [`src/standaloneSseWithGetStreamableHttp.ts`](src/standaloneSseWithGetStreamableHttp.ts) | -| Deprecated HTTP+SSE server (legacy) | Legacy HTTP+SSE transport for backwards-compatibility testing. | [`src/simpleSseServer.ts`](src/simpleSseServer.ts) | -| Backwards-compatible server (Streamable HTTP + SSE) | One server that supports both Streamable HTTP and legacy SSE clients. | [`src/sseAndStreamableHttpCompatibleServer.ts`](src/sseAndStreamableHttpCompatibleServer.ts) | -| Form elicitation server | Collects **non-sensitive** user input via schema-driven forms. | [`src/elicitationFormExample.ts`](src/elicitationFormExample.ts) | -| URL elicitation server | Secure browser-based flows for **sensitive** input (API keys, OAuth, payments). | [`src/elicitationUrlExample.ts`](src/elicitationUrlExample.ts) | -| Sampling + tasks server | Demonstrates sampling and experimental task-based execution. | [`src/toolWithSampleServer.ts`](src/toolWithSampleServer.ts) | -| Task interactive server | Task-based execution with interactive server→client requests. | [`src/simpleTaskInteractive.ts`](src/simpleTaskInteractive.ts) | -| Hono Streamable HTTP server | Streamable HTTP server built with Hono instead of Express. | [`src/honoWebStandardStreamableHttp.ts`](src/honoWebStandardStreamableHttp.ts) | -| SSE polling demo server | Legacy SSE server intended for polling demos. | [`src/ssePollingExample.ts`](src/ssePollingExample.ts) | - -## OAuth demo flags (Streamable HTTP server) - -```bash -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts --oauth -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts --oauth --oauth-strict -``` - -## URL elicitation example (server + client) - -Run the server: - -```bash -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/elicitationUrlExample.ts -``` - -Run the client in another terminal: - -```bash -pnpm --filter @modelcontextprotocol/examples-client exec tsx src/elicitationUrlExample.ts -``` - -## Multi-node deployment patterns - -When deploying MCP servers in a horizontally scaled environment (multiple server instances), there are a few different options that can be useful for different use cases: - -- **Stateless mode** - no need to maintain state between calls. -- **Persistent storage mode** - state stored in a database; any node can handle a session. -- **Local state with message routing** - stateful nodes + pub/sub routing for a session. - -### Stateless mode - -To enable stateless mode, configure the `StreamableHTTPServerTransport` with: - -```typescript -sessionIdGenerator: undefined; -``` - -``` -┌─────────────────────────────────────────────┐ -│ Client │ -└─────────────────────────────────────────────┘ - │ - ▼ -┌─────────────────────────────────────────────┐ -│ Load Balancer │ -└─────────────────────────────────────────────┘ - │ │ - ▼ ▼ -┌─────────────────┐ ┌─────────────────────┐ -│ MCP Server #1 │ │ MCP Server #2 │ -│ (Node.js) │ │ (Node.js) │ -└─────────────────┘ └─────────────────────┘ -``` - -### Persistent storage mode - -Configure the transport with session management, but use an external event store: - -```typescript -sessionIdGenerator: () => randomUUID(), -eventStore: databaseEventStore -``` - -``` -┌─────────────────────────────────────────────┐ -│ Client │ -└─────────────────────────────────────────────┘ - │ - ▼ -┌─────────────────────────────────────────────┐ -│ Load Balancer │ -└─────────────────────────────────────────────┘ - │ │ - ▼ ▼ -┌─────────────────┐ ┌─────────────────────┐ -│ MCP Server #1 │ │ MCP Server #2 │ -│ (Node.js) │ │ (Node.js) │ -└─────────────────┘ └─────────────────────┘ - │ │ - │ │ - ▼ ▼ -┌─────────────────────────────────────────────┐ -│ Database (PostgreSQL) │ -│ │ -│ • Session state │ -│ • Event storage for resumability │ -└─────────────────────────────────────────────┘ -``` - -### Streamable HTTP with distributed message routing - -For scenarios where local in-memory state must be maintained on specific nodes, combine Streamable HTTP with pub/sub routing so one node can terminate the client connection while another node owns the session state. - -``` -┌─────────────────────────────────────────────┐ -│ Client │ -└─────────────────────────────────────────────┘ - │ - ▼ -┌─────────────────────────────────────────────┐ -│ Load Balancer │ -└─────────────────────────────────────────────┘ - │ │ - ▼ ▼ -┌─────────────────┐ ┌─────────────────────┐ -│ MCP Server #1 │◄───►│ MCP Server #2 │ -│ (Has Session A) │ │ (Has Session B) │ -└─────────────────┘ └─────────────────────┘ - ▲│ ▲│ - │▼ │▼ -┌─────────────────────────────────────────────┐ -│ Message Queue / Pub-Sub │ -│ │ -│ • Session ownership registry │ -│ • Bidirectional message routing │ -│ • Request/response forwarding │ -└─────────────────────────────────────────────┘ -``` - -## Backwards compatibility (Streamable HTTP ↔ legacy SSE) - -Start one of the servers: - -```bash -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleSseServer.ts -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/sseAndStreamableHttpCompatibleServer.ts -``` - -Then run the backwards-compatible client: - -```bash -pnpm --filter @modelcontextprotocol/examples-client exec tsx src/streamableHttpWithSseFallbackClient.ts -``` diff --git a/examples/server/eslint.config.mjs b/examples/server/eslint.config.mjs deleted file mode 100644 index 83b79879f6..0000000000 --- a/examples/server/eslint.config.mjs +++ /dev/null @@ -1,14 +0,0 @@ -// @ts-check - -import baseConfig from '@modelcontextprotocol/eslint-config'; - -export default [ - ...baseConfig, - { - files: ['src/**/*.{ts,tsx,js,jsx,mts,cts}'], - rules: { - // Allow console statements in examples only - 'no-console': 'off' - } - } -]; diff --git a/examples/server/package.json b/examples/server/package.json deleted file mode 100644 index a3a3d14c76..0000000000 --- a/examples/server/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "@modelcontextprotocol/examples-server", - "private": true, - "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": ">=20", - "pnpm": ">=10.24.0" - }, - "packageManager": "pnpm@10.24.0", - "keywords": [ - "modelcontextprotocol", - "mcp" - ], - "scripts": { - "typecheck": "tsgo -p tsconfig.json --noEmit", - "build": "tsdown", - "build:watch": "tsdown --watch", - "prepack": "npm run build:esm && npm run build:cjs", - "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", - "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "npm run typecheck && npm run lint", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" - }, - "dependencies": { - "@hono/node-server": "catalog:runtimeServerOnly", - "hono": "catalog:runtimeServerOnly", - "@modelcontextprotocol/examples-shared": "workspace:^", - "@modelcontextprotocol/server": "workspace:^", - "cors": "catalog:runtimeServerOnly", - "express": "catalog:runtimeServerOnly", - "zod": "catalog:runtimeShared" - }, - "devDependencies": { - "@modelcontextprotocol/eslint-config": "workspace:^", - "@modelcontextprotocol/tsconfig": "workspace:^", - "@modelcontextprotocol/vitest-config": "workspace:^", - "@types/cors": "catalog:devTools", - "@types/express": "catalog:devTools", - "tsdown": "catalog:devTools" - } -} diff --git a/examples/server/src/honoWebStandardStreamableHttp.ts b/examples/server/src/honoWebStandardStreamableHttp.ts deleted file mode 100644 index aef1e99e2e..0000000000 --- a/examples/server/src/honoWebStandardStreamableHttp.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Example MCP server using Hono with WebStandardStreamableHTTPServerTransport - * - * This example demonstrates using the Web Standard transport directly with Hono, - * which works on any runtime: Node.js, Cloudflare Workers, Deno, Bun, etc. - * - * Run with: pnpm tsx src/honoWebStandardStreamableHttp.ts - */ - -import { serve } from '@hono/node-server'; -import type { CallToolResult } from '@modelcontextprotocol/server'; -import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/server'; -import { Hono } from 'hono'; -import { cors } from 'hono/cors'; -import * as z from 'zod/v4'; - -// Create the MCP server -const server = new McpServer({ - name: 'hono-webstandard-mcp-server', - version: '1.0.0' -}); - -// Register a simple greeting tool -server.registerTool( - 'greet', - { - title: 'Greeting Tool', - description: 'A simple greeting tool', - inputSchema: { name: z.string().describe('Name to greet') } - }, - async ({ name }): Promise => { - return { - content: [{ type: 'text', text: `Hello, ${name}! (from Hono + WebStandard transport)` }] - }; - } -); - -// Create a stateless transport (no options = no session management) -const transport = new WebStandardStreamableHTTPServerTransport(); - -// Create the Hono app -const app = new Hono(); - -// Enable CORS for all origins -app.use( - '*', - cors({ - origin: '*', - allowMethods: ['GET', 'POST', 'DELETE', 'OPTIONS'], - allowHeaders: ['Content-Type', 'mcp-session-id', 'Last-Event-ID', 'mcp-protocol-version'], - exposeHeaders: ['mcp-session-id', 'mcp-protocol-version'] - }) -); - -// Health check endpoint -app.get('/health', c => c.json({ status: 'ok' })); - -// MCP endpoint -app.all('/mcp', c => transport.handleRequest(c.req.raw)); - -// Start the server -const PORT = process.env.MCP_PORT ? parseInt(process.env.MCP_PORT, 10) : 3000; - -server.connect(transport).then(() => { - console.log(`Starting Hono MCP server on port ${PORT}`); - console.log(`Health check: http://localhost:${PORT}/health`); - console.log(`MCP endpoint: http://localhost:${PORT}/mcp`); - - serve({ - fetch: app.fetch, - port: PORT - }); -}); diff --git a/examples/server/tsconfig.json b/examples/server/tsconfig.json deleted file mode 100644 index 98d3a5b3fe..0000000000 --- a/examples/server/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "@modelcontextprotocol/tsconfig", - "include": ["./"], - "exclude": ["node_modules", "dist"], - "compilerOptions": { - "paths": { - "*": ["./*"], - "@modelcontextprotocol/server": ["./node_modules/@modelcontextprotocol/server/src/index.ts"], - "@modelcontextprotocol/core": [ - "./node_modules/@modelcontextprotocol/server/node_modules/@modelcontextprotocol/core/src/index.ts" - ], - "@modelcontextprotocol/examples-shared": ["./node_modules/@modelcontextprotocol/examples-shared/src/index.ts"], - "@modelcontextprotocol/eslint-config": ["./node_modules/@modelcontextprotocol/eslint-config/tsconfig.json"], - "@modelcontextprotocol/vitest-config": ["./node_modules/@modelcontextprotocol/vitest-config/tsconfig.json"] - } - } -} diff --git a/examples/server/tsdown.config.ts b/examples/server/tsdown.config.ts deleted file mode 100644 index efc4299d35..0000000000 --- a/examples/server/tsdown.config.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { defineConfig } from 'tsdown'; - -export default defineConfig({ - // 1. Entry Points - // Directly matches package.json include/exclude globs - entry: ['src/**/*.ts'], - - // 2. Output Configuration - format: ['esm'], - outDir: 'dist', - clean: true, // Recommended: Cleans 'dist' before building - sourcemap: true, - - // 3. Platform & Target - target: 'esnext', - platform: 'node', - shims: true, // Polyfills common Node.js shims (__dirname, etc.) - - // 4. Type Definitions - // Bundles d.ts files into a single output - dts: false, - // 5. Vendoring Strategy - Bundle the code for this specific package into the output, - // but treat all other dependencies as external (require/import). - noExternal: ['@modelcontextprotocol/examples-shared'] -}); diff --git a/examples/server/vitest.config.js b/examples/server/vitest.config.js deleted file mode 100644 index 496fca3200..0000000000 --- a/examples/server/vitest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import baseConfig from '@modelcontextprotocol/vitest-config'; - -export default baseConfig; diff --git a/examples/shared/eslint.config.mjs b/examples/shared/eslint.config.mjs deleted file mode 100644 index 83b79879f6..0000000000 --- a/examples/shared/eslint.config.mjs +++ /dev/null @@ -1,14 +0,0 @@ -// @ts-check - -import baseConfig from '@modelcontextprotocol/eslint-config'; - -export default [ - ...baseConfig, - { - files: ['src/**/*.{ts,tsx,js,jsx,mts,cts}'], - rules: { - // Allow console statements in examples only - 'no-console': 'off' - } - } -]; diff --git a/examples/shared/package.json b/examples/shared/package.json deleted file mode 100644 index 8287ca552a..0000000000 --- a/examples/shared/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@modelcontextprotocol/examples-shared", - "private": true, - "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": ">=20", - "pnpm": ">=10.24.0" - }, - "packageManager": "pnpm@10.24.0", - "keywords": [ - "modelcontextprotocol", - "mcp" - ], - "scripts": { - "typecheck": "tsgo -p tsconfig.json --noEmit", - "prepack": "npm run build:esm && npm run build:cjs", - "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", - "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --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/server": "workspace:^", - "express": "catalog:runtimeServerOnly" - }, - "devDependencies": { - "@modelcontextprotocol/tsconfig": "workspace:^", - "@modelcontextprotocol/eslint-config": "workspace:^", - "@modelcontextprotocol/vitest-config": "workspace:^", - "@modelcontextprotocol/test-helpers": "workspace:^", - "@types/express": "catalog:devTools", - "@typescript/native-preview": "catalog:devTools", - "@eslint/js": "catalog:devTools", - "eslint": "catalog:devTools", - "eslint-config-prettier": "catalog:devTools", - "eslint-plugin-n": "catalog:devTools", - "prettier": "catalog:devTools", - "tsx": "catalog:devTools", - "typescript": "catalog:devTools", - "typescript-eslint": "catalog:devTools", - "vitest": "catalog:devTools" - } -} diff --git a/examples/shared/src/index.ts b/examples/shared/src/index.ts deleted file mode 100644 index 1c31cf06e8..0000000000 --- a/examples/shared/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './demoInMemoryOAuthProvider.js'; diff --git a/examples/shared/tsconfig.json b/examples/shared/tsconfig.json deleted file mode 100644 index aa994f9394..0000000000 --- a/examples/shared/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "@modelcontextprotocol/tsconfig", - "include": ["./"], - "exclude": ["node_modules", "dist"], - "compilerOptions": { - "paths": { - "*": ["./*"], - "@modelcontextprotocol/server": ["./node_modules/@modelcontextprotocol/server/src/index.ts"], - "@modelcontextprotocol/core": [ - "./node_modules/@modelcontextprotocol/server/node_modules/@modelcontextprotocol/core/src/index.ts" - ], - "@modelcontextprotocol/eslint-config": ["./node_modules/@modelcontextprotocol/eslint-config/tsconfig.json"], - "@modelcontextprotocol/vitest-config": ["./node_modules/@modelcontextprotocol/vitest-config/tsconfig.json"], - "@modelcontextprotocol/test-helpers": ["./node_modules/@modelcontextprotocol/test-helpers/src/index.ts"], - "@modelcontextprotocol/client": [ - "./node_modules/@modelcontextprotocol/test-helpers/node_modules/@modelcontextprotocol/client/src/index.ts" - ] - } - } -} diff --git a/examples/shared/vitest.config.js b/examples/shared/vitest.config.js deleted file mode 100644 index 496fca3200..0000000000 --- a/examples/shared/vitest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import baseConfig from '@modelcontextprotocol/vitest-config'; - -export default baseConfig; diff --git a/package-lock.json b/package-lock.json index 64bc6f21dd..d32963a73d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,14 @@ { "name": "@modelcontextprotocol/sdk", - "version": "1.25.1", + "version": "1.24.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@modelcontextprotocol/sdk", - "version": "1.25.1", + "version": "1.24.3", "license": "MIT", "dependencies": { - "@hono/node-server": "^1.19.7", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", @@ -664,18 +663,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@hono/node-server": { - "version": "1.19.7", - "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.7.tgz", - "integrity": "sha512-vUcD0uauS7EU2caukW8z5lJKtoGMokxNbJtBiwHgpqxEXokaHCBkQUmCHhjFB1VUTWdqj25QoMkMKzgjq+uhrw==", - "license": "MIT", - "engines": { - "node": ">=18.14.1" - }, - "peerDependencies": { - "hono": "^4" - } - }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -1332,6 +1319,7 @@ "integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.48.1", "@typescript-eslint/types": "8.48.1", @@ -1763,6 +1751,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2305,6 +2294,7 @@ "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -2623,6 +2613,7 @@ "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", "license": "MIT", + "peer": true, "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.1", @@ -3036,16 +3027,6 @@ "node": ">= 0.4" } }, - "node_modules/hono": { - "version": "4.10.8", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.10.8.tgz", - "integrity": "sha512-DDT0A0r6wzhe8zCGoYOmMeuGu3dyTAE40HHjwUsWFTEy5WxK1x2WDSsBPlEXgPbRIFY6miDualuUDbasPogIww==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=16.9.0" - } - }, "node_modules/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", @@ -4090,6 +4071,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -4170,6 +4152,7 @@ "integrity": "sha512-4H8vUNGNjQ4V2EOoGw005+c+dGuPSnhpPBPHBtsZdGZBk/iJb4kguGlPWaZTZ3q5nMtFOEsY0nRDlh9PJyd6SQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "~0.25.0", "get-tsconfig": "^4.7.5" @@ -4215,6 +4198,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -4409,6 +4393,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -4422,6 +4407,7 @@ "integrity": "sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -4574,6 +4560,7 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index 2633d5ef26..bfbc73802e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@modelcontextprotocol/sdk", - "version": "1.25.1", + "version": "1.24.3", "description": "Model Context Protocol implementation for TypeScript", "license": "MIT", "author": "Anthropic, PBC (https://anthropic.com)", @@ -12,51 +12,131 @@ "url": "git+https://github.com/modelcontextprotocol/typescript-sdk.git" }, "engines": { - "node": ">=20", - "pnpm": ">=10.24.0" + "node": ">=18" }, - "packageManager": "pnpm@10.24.0", "keywords": [ "modelcontextprotocol", "mcp" ], + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "./client": { + "import": "./dist/esm/client/index.js", + "require": "./dist/cjs/client/index.js" + }, + "./server": { + "import": "./dist/esm/server/index.js", + "require": "./dist/cjs/server/index.js" + }, + "./validation": { + "import": "./dist/esm/validation/index.js", + "require": "./dist/cjs/validation/index.js" + }, + "./validation/ajv": { + "import": "./dist/esm/validation/ajv-provider.js", + "require": "./dist/cjs/validation/ajv-provider.js" + }, + "./validation/cfworker": { + "import": "./dist/esm/validation/cfworker-provider.js", + "require": "./dist/cjs/validation/cfworker-provider.js" + }, + "./experimental": { + "import": "./dist/esm/experimental/index.js", + "require": "./dist/cjs/experimental/index.js" + }, + "./experimental/tasks": { + "import": "./dist/esm/experimental/tasks/index.js", + "require": "./dist/cjs/experimental/tasks/index.js" + }, + "./*": { + "import": "./dist/esm/*", + "require": "./dist/cjs/*" + } + }, + "typesVersions": { + "*": { + "*": [ + "./dist/esm/*" + ] + } + }, + "files": [ + "dist" + ], "scripts": { "fetch:spec-types": "tsx scripts/fetch-spec-types.ts", - "examples:simple-server:w": "pnpm --filter @modelcontextprotocol/examples-server exec tsx --watch src/simpleStreamableHttp.ts --oauth", - "typecheck:all": "pnpm -r typecheck", - "build:all": "pnpm -r build", - "prepack:all": "pnpm -r prepack", - "lint:all": "pnpm -r lint", - "lint:fix:all": "pnpm -r lint:fix", - "check:all": "pnpm -r typecheck && pnpm -r lint", - "test:all": "pnpm -r test" + "typecheck": "tsgo --noEmit", + "build": "npm run build:esm && npm run build:cjs", + "build:esm": "mkdir -p dist/esm && echo '{\"type\": \"module\"}' > dist/esm/package.json && tsc -p tsconfig.prod.json", + "build:esm:w": "npm run build:esm -- -w", + "build:cjs": "mkdir -p dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json && tsc -p tsconfig.cjs.json", + "build:cjs:w": "npm run build:cjs -- -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": { + "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": { - "@cfworker/json-schema": "catalog:runtimeShared", - "@changesets/changelog-github": "^0.5.2", - "@changesets/cli": "^2.29.8", - "@eslint/js": "catalog:devTools", - "@types/content-type": "catalog:devTools", - "@types/cors": "catalog:devTools", - "@types/cross-spawn": "catalog:devTools", - "@types/eventsource": "catalog:devTools", - "@types/express": "catalog:devTools", - "@types/express-serve-static-core": "catalog:devTools", - "@types/node": "^24.10.1", - "@types/supertest": "catalog:devTools", - "@types/ws": "catalog:devTools", - "@typescript/native-preview": "catalog:devTools", - "eslint": "catalog:devTools", - "eslint-config-prettier": "catalog:devTools", - "eslint-plugin-n": "catalog:devTools", - "prettier": "catalog:devTools", - "supertest": "catalog:devTools", - "tsdown": "catalog:devTools", - "tsx": "catalog:devTools", - "typescript": "catalog:devTools", - "typescript-eslint": "catalog:devTools", - "vitest": "catalog:devTools", - "ws": "catalog:devTools" + "@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" }, "resolutions": { "strip-ansi": "6.0.1" diff --git a/packages/client/eslint.config.mjs b/packages/client/eslint.config.mjs deleted file mode 100644 index 4f034f2235..0000000000 --- a/packages/client/eslint.config.mjs +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-check - -import baseConfig from '@modelcontextprotocol/eslint-config'; - -export default [ - ...baseConfig, - { - settings: { - 'import/internal-regex': '^@modelcontextprotocol/core' - } - } -]; diff --git a/packages/client/package.json b/packages/client/package.json deleted file mode 100644 index e62a5bf160..0000000000 --- a/packages/client/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "@modelcontextprotocol/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": ">=20", - "pnpm": ">=10.24.0" - }, - "packageManager": "pnpm@10.24.0", - "keywords": [ - "modelcontextprotocol", - "mcp" - ], - "exports": { - ".": { - "types": "./dist/index.d.mts", - "import": "./dist/index.mjs" - } - }, - "files": [ - "dist" - ], - "scripts": { - "typecheck": "tsgo -p tsconfig.json --noEmit", - "build": "tsdown", - "build:watch": "tsdown --watch", - "prepack": "npm run build", - "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", - "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --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": { - "cross-spawn": "catalog:runtimeClientOnly", - "eventsource": "catalog:runtimeClientOnly", - "eventsource-parser": "catalog:runtimeClientOnly", - "jose": "catalog:runtimeClientOnly", - "pkce-challenge": "catalog:runtimeShared", - "zod": "catalog:runtimeShared" - }, - "peerDependencies": { - "@cfworker/json-schema": "catalog:runtimeShared", - "zod": "catalog:runtimeShared" - }, - "peerDependenciesMeta": { - "@cfworker/json-schema": { - "optional": true - }, - "zod": { - "optional": false - } - }, - "devDependencies": { - "@modelcontextprotocol/core": "workspace:^", - "@modelcontextprotocol/tsconfig": "workspace:^", - "@modelcontextprotocol/vitest-config": "workspace:^", - "@modelcontextprotocol/eslint-config": "workspace:^", - "@modelcontextprotocol/test-helpers": "workspace:^", - "@cfworker/json-schema": "catalog:runtimeShared", - "@types/content-type": "catalog:devTools", - "@types/cross-spawn": "catalog:devTools", - "@types/eventsource": "catalog:devTools", - "@typescript/native-preview": "catalog:devTools", - "@eslint/js": "catalog:devTools", - "eslint": "catalog:devTools", - "eslint-config-prettier": "catalog:devTools", - "eslint-plugin-n": "catalog:devTools", - "prettier": "catalog:devTools", - "tsx": "catalog:devTools", - "typescript": "catalog:devTools", - "typescript-eslint": "catalog:devTools", - "vitest": "catalog:devTools", - "tsdown": "catalog:devTools" - } -} diff --git a/packages/client/src/experimental/index.ts b/packages/client/src/experimental/index.ts deleted file mode 100644 index 926369f994..0000000000 --- a/packages/client/src/experimental/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Experimental MCP SDK features. - * WARNING: These APIs are experimental and may change without notice. - * - * Import experimental features from this module: - * ```typescript - * import { TaskStore, InMemoryTaskStore } from '@modelcontextprotocol/sdk/experimental'; - * ``` - * - * @experimental - */ - -export * from './tasks/client.js'; diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts deleted file mode 100644 index 0f802c4fb5..0000000000 --- a/packages/client/src/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -export * from './client/auth.js'; -export * from './client/auth-extensions.js'; -export * from './client/client.js'; -export * from './client/middleware.js'; -export * from './client/sse.js'; -export * from './client/stdio.js'; -export * from './client/streamableHttp.js'; -export * from './client/websocket.js'; - -// experimental exports -export * from './experimental/index.js'; - -// re-export shared types -export * from '@modelcontextprotocol/core'; diff --git a/packages/client/tsconfig.json b/packages/client/tsconfig.json deleted file mode 100644 index a16bfd7d9d..0000000000 --- a/packages/client/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "@modelcontextprotocol/tsconfig", - "include": ["./"], - "exclude": ["node_modules", "dist"], - "compilerOptions": { - "paths": { - "*": ["./*"], - "@modelcontextprotocol/core": ["./node_modules/@modelcontextprotocol/core/src/index.ts"], - "@modelcontextprotocol/test-helpers": ["./node_modules/@modelcontextprotocol/test-helpers/src/index.ts"] - } - } -} diff --git a/packages/client/tsdown.config.ts b/packages/client/tsdown.config.ts deleted file mode 100644 index c3d38817a6..0000000000 --- a/packages/client/tsdown.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig } from 'tsdown'; - -export default defineConfig({ - // 1. Entry Points - // Directly matches package.json include/exclude globs - entry: ['src/index.ts'], - - // 2. Output Configuration - format: ['esm'], - outDir: 'dist', - clean: true, // Recommended: Cleans 'dist' before building - sourcemap: true, - - // 3. Platform & Target - target: 'esnext', - platform: 'node', - shims: true, // Polyfills common Node.js shims (__dirname, etc.) - - // 4. Type Definitions - // Bundles d.ts files into a single output - dts: { - resolver: 'tsc', - // override just for DTS generation: - compilerOptions: { - baseUrl: '.', - paths: { - '@modelcontextprotocol/core': ['../core/src/index.ts'] - } - } - }, - // 5. Vendoring Strategy - Bundle the code for this specific package into the output, - // but treat all other dependencies as external (require/import). - noExternal: ['@modelcontextprotocol/core'] -}); diff --git a/packages/client/vitest.config.js b/packages/client/vitest.config.js deleted file mode 100644 index 2012fa59ea..0000000000 --- a/packages/client/vitest.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import baseConfig from '@modelcontextprotocol/vitest-config'; -import { mergeConfig } from 'vitest/config'; - -export default mergeConfig(baseConfig, { - test: { - setupFiles: ['./vitest.setup.js'] - } -}); diff --git a/packages/core/eslint.config.mjs b/packages/core/eslint.config.mjs deleted file mode 100644 index 951c9f3a91..0000000000 --- a/packages/core/eslint.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -// @ts-check - -import baseConfig from '@modelcontextprotocol/eslint-config'; - -export default baseConfig; diff --git a/packages/core/package.json b/packages/core/package.json deleted file mode 100644 index a7364d4dd0..0000000000 --- a/packages/core/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@modelcontextprotocol/core", - "private": true, - "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": ">=20", - "pnpm": ">=10.24.0" - }, - "packageManager": "pnpm@10.24.0", - "keywords": [ - "modelcontextprotocol", - "mcp" - ], - "scripts": { - "typecheck": "tsgo -p tsconfig.json --noEmit", - "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", - "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --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": { - "ajv": "catalog:runtimeShared", - "ajv-formats": "catalog:runtimeShared", - "json-schema-typed": "catalog:runtimeShared", - "zod": "catalog:runtimeShared", - "zod-to-json-schema": "catalog:runtimeShared" - }, - "peerDependencies": { - "@cfworker/json-schema": "catalog:runtimeShared", - "zod": "catalog:runtimeShared" - }, - "peerDependenciesMeta": { - "@cfworker/json-schema": { - "optional": true - }, - "zod": { - "optional": false - } - }, - "devDependencies": { - "@modelcontextprotocol/tsconfig": "workspace:^", - "@modelcontextprotocol/vitest-config": "workspace:^", - "@modelcontextprotocol/eslint-config": "workspace:^", - "@cfworker/json-schema": "catalog:runtimeShared", - "@eslint/js": "catalog:devTools", - "@types/content-type": "catalog:devTools", - "@types/cors": "catalog:devTools", - "@types/cross-spawn": "catalog:devTools", - "@types/eventsource": "catalog:devTools", - "@types/express": "catalog:devTools", - "@types/express-serve-static-core": "catalog:devTools", - "@typescript/native-preview": "catalog:devTools", - "eslint": "catalog:devTools", - "eslint-config-prettier": "catalog:devTools", - "eslint-plugin-n": "catalog:devTools", - "prettier": "catalog:devTools", - "tsx": "catalog:devTools", - "typescript": "catalog:devTools", - "typescript-eslint": "catalog:devTools", - "vitest": "catalog:devTools" - } -} diff --git a/packages/core/src/experimental/index.ts b/packages/core/src/experimental/index.ts deleted file mode 100644 index 1a641c25d7..0000000000 --- a/packages/core/src/experimental/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './tasks/helpers.js'; -export * from './tasks/interfaces.js'; -export * from './tasks/stores/in-memory.js'; diff --git a/packages/core/src/exports/types/index.ts b/packages/core/src/exports/types/index.ts deleted file mode 100644 index 47806ee8ba..0000000000 --- a/packages/core/src/exports/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type * from '../../types/types.js'; diff --git a/packages/core/src/types/spec.types.ts b/packages/core/src/types/spec.types.ts deleted file mode 100644 index aa298e63c4..0000000000 --- a/packages/core/src/types/spec.types.ts +++ /dev/null @@ -1,2552 +0,0 @@ -/** - * This file is automatically generated from the Model Context Protocol specification. - * - * Source: https://github.com/modelcontextprotocol/modelcontextprotocol - * Pulled from: https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/draft/schema.ts - * Last updated from commit: 35fa160caf287a9c48696e3ae452c0645c713669 - * - * DO NOT EDIT THIS FILE MANUALLY. Changes will be overwritten by automated updates. - * To update this file, run: npm run fetch:spec-types - */ /* JSON-RPC types */ - -/** - * Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent. - * - * @category JSON-RPC - */ -export type JSONRPCMessage = JSONRPCRequest | JSONRPCNotification | JSONRPCResponse; - -/** @internal */ -export const LATEST_PROTOCOL_VERSION = 'DRAFT-2026-v1'; -/** @internal */ -export const JSONRPC_VERSION = '2.0'; - -/** - * A progress token, used to associate progress notifications with the original request. - * - * @category Common Types - */ -export type ProgressToken = string | number; - -/** - * An opaque token used to represent a cursor for pagination. - * - * @category Common Types - */ -export type Cursor = string; - -/** - * Common params for any task-augmented request. - * - * @internal - */ -export interface TaskAugmentedRequestParams extends RequestParams { - /** - * If specified, the caller is requesting task-augmented execution for this request. - * The request will return a CreateTaskResult immediately, and the actual result can be - * retrieved later via tasks/result. - * - * Task augmentation is subject to capability negotiation - receivers MUST declare support - * for task augmentation of specific request types in their capabilities. - */ - task?: TaskMetadata; -} -/** - * Common params for any request. - * - * @internal - */ -export interface RequestParams { - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { - /** - * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. - */ - progressToken?: ProgressToken; - [key: string]: unknown; - }; -} - -/** @internal */ -export interface Request { - method: string; - // Allow unofficial extensions of `Request.params` without impacting `RequestParams`. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - params?: { [key: string]: any }; -} - -/** @internal */ -export interface NotificationParams { - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** @internal */ -export interface Notification { - method: string; - // Allow unofficial extensions of `Notification.params` without impacting `NotificationParams`. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - params?: { [key: string]: any }; -} - -/** - * @category Common Types - */ -export interface Result { - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; - [key: string]: unknown; -} - -/** - * @category Common Types - */ -export interface Error { - /** - * The error type that occurred. - */ - code: number; - /** - * A short description of the error. The message SHOULD be limited to a concise single sentence. - */ - message: string; - /** - * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.). - */ - data?: unknown; -} - -/** - * A uniquely identifying ID for a request in JSON-RPC. - * - * @category Common Types - */ -export type RequestId = string | number; - -/** - * A request that expects a response. - * - * @category JSON-RPC - */ -export interface JSONRPCRequest extends Request { - jsonrpc: typeof JSONRPC_VERSION; - id: RequestId; -} - -/** - * A notification which does not expect a response. - * - * @category JSON-RPC - */ -export interface JSONRPCNotification extends Notification { - jsonrpc: typeof JSONRPC_VERSION; -} - -/** - * A successful (non-error) response to a request. - * - * @category JSON-RPC - */ -export interface JSONRPCResultResponse { - jsonrpc: typeof JSONRPC_VERSION; - id: RequestId; - result: Result; -} - -/** - * A response to a request that indicates an error occurred. - * - * @category JSON-RPC - */ -export interface JSONRPCErrorResponse { - jsonrpc: typeof JSONRPC_VERSION; - id?: RequestId; - error: Error; -} - -/** - * A response to a request, containing either the result or error. - */ -export type JSONRPCResponse = JSONRPCResultResponse | JSONRPCErrorResponse; - -// Standard JSON-RPC error codes -export const PARSE_ERROR = -32700; -export const INVALID_REQUEST = -32600; -export const METHOD_NOT_FOUND = -32601; -export const INVALID_PARAMS = -32602; -export const INTERNAL_ERROR = -32603; - -// Implementation-specific JSON-RPC error codes [-32000, -32099] -/** @internal */ -export const URL_ELICITATION_REQUIRED = -32042; - -/** - * An error response that indicates that the server requires the client to provide additional information via an elicitation request. - * - * @internal - */ -export interface URLElicitationRequiredError extends Omit { - error: Error & { - code: typeof URL_ELICITATION_REQUIRED; - data: { - elicitations: ElicitRequestURLParams[]; - [key: string]: unknown; - }; - }; -} - -/* Empty result */ -/** - * A response that indicates success but carries no data. - * - * @category Common Types - */ -export type EmptyResult = Result; - -/* Cancellation */ -/** - * Parameters for a `notifications/cancelled` notification. - * - * @category `notifications/cancelled` - */ -export interface CancelledNotificationParams extends NotificationParams { - /** - * The ID of the request to cancel. - * - * This MUST correspond to the ID of a request previously issued in the same direction. - * This MUST be provided for cancelling non-task requests. - * This MUST NOT be used for cancelling tasks (use the `tasks/cancel` request instead). - */ - requestId?: RequestId; - - /** - * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user. - */ - reason?: string; -} - -/** - * This notification can be sent by either side to indicate that it is cancelling a previously-issued request. - * - * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished. - * - * This notification indicates that the result will be unused, so any associated processing SHOULD cease. - * - * A client MUST NOT attempt to cancel its `initialize` request. - * - * For task cancellation, use the `tasks/cancel` request instead of this notification. - * - * @category `notifications/cancelled` - */ -export interface CancelledNotification extends JSONRPCNotification { - method: 'notifications/cancelled'; - params: CancelledNotificationParams; -} - -/* Initialization */ -/** - * Parameters for an `initialize` request. - * - * @category `initialize` - */ -export interface InitializeRequestParams extends RequestParams { - /** - * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well. - */ - protocolVersion: string; - capabilities: ClientCapabilities; - clientInfo: Implementation; -} - -/** - * This request is sent from the client to the server when it first connects, asking it to begin initialization. - * - * @category `initialize` - */ -export interface InitializeRequest extends JSONRPCRequest { - method: 'initialize'; - params: InitializeRequestParams; -} - -/** - * After receiving an initialize request from the client, the server sends this response. - * - * @category `initialize` - */ -export interface InitializeResult extends Result { - /** - * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect. - */ - protocolVersion: string; - capabilities: ServerCapabilities; - serverInfo: Implementation; - - /** - * Instructions describing how to use the server and its features. - * - * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt. - */ - instructions?: string; -} - -/** - * This notification is sent from the client to the server after initialization has finished. - * - * @category `notifications/initialized` - */ -export interface InitializedNotification extends JSONRPCNotification { - method: 'notifications/initialized'; - params?: NotificationParams; -} - -/** - * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities. - * - * @category `initialize` - */ -export interface ClientCapabilities { - /** - * Experimental, non-standard capabilities that the client supports. - */ - experimental?: { [key: string]: object }; - /** - * Present if the client supports listing roots. - */ - roots?: { - /** - * Whether the client supports notifications for changes to the roots list. - */ - listChanged?: boolean; - }; - /** - * Present if the client supports sampling from an LLM. - */ - sampling?: { - /** - * Whether the client supports context inclusion via includeContext parameter. - * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it). - */ - context?: object; - /** - * Whether the client supports tool use via tools and toolChoice parameters. - */ - tools?: object; - }; - /** - * Present if the client supports elicitation from the server. - */ - elicitation?: { form?: object; url?: object }; - - /** - * Present if the client supports task-augmented requests. - */ - tasks?: { - /** - * Whether this client supports tasks/list. - */ - list?: object; - /** - * Whether this client supports tasks/cancel. - */ - cancel?: object; - /** - * Specifies which request types can be augmented with tasks. - */ - requests?: { - /** - * Task support for sampling-related requests. - */ - sampling?: { - /** - * Whether the client supports task-augmented sampling/createMessage requests. - */ - createMessage?: object; - }; - /** - * Task support for elicitation-related requests. - */ - elicitation?: { - /** - * Whether the client supports task-augmented elicitation/create requests. - */ - create?: object; - }; - }; - }; -} - -/** - * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities. - * - * @category `initialize` - */ -export interface ServerCapabilities { - /** - * Experimental, non-standard capabilities that the server supports. - */ - experimental?: { [key: string]: object }; - /** - * Present if the server supports sending log messages to the client. - */ - logging?: object; - /** - * Present if the server supports argument autocompletion suggestions. - */ - completions?: object; - /** - * Present if the server offers any prompt templates. - */ - prompts?: { - /** - * Whether this server supports notifications for changes to the prompt list. - */ - listChanged?: boolean; - }; - /** - * Present if the server offers any resources to read. - */ - resources?: { - /** - * Whether this server supports subscribing to resource updates. - */ - subscribe?: boolean; - /** - * Whether this server supports notifications for changes to the resource list. - */ - listChanged?: boolean; - }; - /** - * Present if the server offers any tools to call. - */ - tools?: { - /** - * Whether this server supports notifications for changes to the tool list. - */ - listChanged?: boolean; - }; - /** - * Present if the server supports task-augmented requests. - */ - tasks?: { - /** - * Whether this server supports tasks/list. - */ - list?: object; - /** - * Whether this server supports tasks/cancel. - */ - cancel?: object; - /** - * Specifies which request types can be augmented with tasks. - */ - requests?: { - /** - * Task support for tool-related requests. - */ - tools?: { - /** - * Whether the server supports task-augmented tools/call requests. - */ - call?: object; - }; - }; - }; -} - -/** - * An optionally-sized icon that can be displayed in a user interface. - * - * @category Common Types - */ -export interface Icon { - /** - * A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a - * `data:` URI with Base64-encoded image data. - * - * Consumers SHOULD takes steps to ensure URLs serving icons are from the - * same domain as the client/server or a trusted domain. - * - * Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain - * executable JavaScript. - * - * @format uri - */ - src: string; - - /** - * Optional MIME type override if the source MIME type is missing or generic. - * For example: `"image/png"`, `"image/jpeg"`, or `"image/svg+xml"`. - */ - mimeType?: string; - - /** - * Optional array of strings that specify sizes at which the icon can be used. - * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG. - * - * If not provided, the client should assume that the icon can be used at any size. - */ - sizes?: string[]; - - /** - * Optional specifier for the theme this icon is designed for. `light` indicates - * the icon is designed to be used with a light background, and `dark` indicates - * the icon is designed to be used with a dark background. - * - * If not provided, the client should assume the icon can be used with any theme. - */ - theme?: 'light' | 'dark'; -} - -/** - * Base interface to add `icons` property. - * - * @internal - */ -export interface Icons { - /** - * Optional set of sized icons that the client can display in a user interface. - * - * Clients that support rendering icons MUST support at least the following MIME types: - * - `image/png` - PNG images (safe, universal compatibility) - * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility) - * - * Clients that support rendering icons SHOULD also support: - * - `image/svg+xml` - SVG images (scalable but requires security precautions) - * - `image/webp` - WebP images (modern, efficient format) - */ - icons?: Icon[]; -} - -/** - * Base interface for metadata with name (identifier) and title (display name) properties. - * - * @internal - */ -export interface BaseMetadata { - /** - * Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present). - */ - name: string; - - /** - * Intended for UI and end-user contexts — optimized to be human-readable and easily understood, - * even by those unfamiliar with domain-specific terminology. - * - * If not provided, the name should be used for display (except for Tool, - * where `annotations.title` should be given precedence over using `name`, - * if present). - */ - title?: string; -} - -/** - * Describes the MCP implementation. - * - * @category `initialize` - */ -export interface Implementation extends BaseMetadata, Icons { - version: string; - - /** - * An optional human-readable description of what this implementation does. - * - * This can be used by clients or servers to provide context about their purpose - * and capabilities. For example, a server might describe the types of resources - * or tools it provides, while a client might describe its intended use case. - */ - description?: string; - - /** - * An optional URL of the website for this implementation. - * - * @format uri - */ - websiteUrl?: string; -} - -/* Ping */ -/** - * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected. - * - * @category `ping` - */ -export interface PingRequest extends JSONRPCRequest { - method: 'ping'; - params?: RequestParams; -} - -/* Progress notifications */ - -/** - * Parameters for a `notifications/progress` notification. - * - * @category `notifications/progress` - */ -export interface ProgressNotificationParams extends NotificationParams { - /** - * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding. - */ - progressToken: ProgressToken; - /** - * The progress thus far. This should increase every time progress is made, even if the total is unknown. - * - * @TJS-type number - */ - progress: number; - /** - * Total number of items to process (or total progress required), if known. - * - * @TJS-type number - */ - total?: number; - /** - * An optional message describing the current progress. - */ - message?: string; -} - -/** - * An out-of-band notification used to inform the receiver of a progress update for a long-running request. - * - * @category `notifications/progress` - */ -export interface ProgressNotification extends JSONRPCNotification { - method: 'notifications/progress'; - params: ProgressNotificationParams; -} - -/* Pagination */ -/** - * Common parameters for paginated requests. - * - * @internal - */ -export interface PaginatedRequestParams extends RequestParams { - /** - * An opaque token representing the current pagination position. - * If provided, the server should return results starting after this cursor. - */ - cursor?: Cursor; -} - -/** @internal */ -export interface PaginatedRequest extends JSONRPCRequest { - params?: PaginatedRequestParams; -} - -/** @internal */ -export interface PaginatedResult extends Result { - /** - * An opaque token representing the pagination position after the last returned result. - * If present, there may be more results available. - */ - nextCursor?: Cursor; -} - -/* Resources */ -/** - * Sent from the client to request a list of resources the server has. - * - * @category `resources/list` - */ -export interface ListResourcesRequest extends PaginatedRequest { - method: 'resources/list'; -} - -/** - * The server's response to a resources/list request from the client. - * - * @category `resources/list` - */ -export interface ListResourcesResult extends PaginatedResult { - resources: Resource[]; -} - -/** - * Sent from the client to request a list of resource templates the server has. - * - * @category `resources/templates/list` - */ -export interface ListResourceTemplatesRequest extends PaginatedRequest { - method: 'resources/templates/list'; -} - -/** - * The server's response to a resources/templates/list request from the client. - * - * @category `resources/templates/list` - */ -export interface ListResourceTemplatesResult extends PaginatedResult { - resourceTemplates: ResourceTemplate[]; -} - -/** - * Common parameters when working with resources. - * - * @internal - */ -export interface ResourceRequestParams extends RequestParams { - /** - * The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it. - * - * @format uri - */ - uri: string; -} - -/** - * Parameters for a `resources/read` request. - * - * @category `resources/read` - */ -// eslint-disable-next-line @typescript-eslint/no-empty-object-type -export interface ReadResourceRequestParams extends ResourceRequestParams {} - -/** - * Sent from the client to the server, to read a specific resource URI. - * - * @category `resources/read` - */ -export interface ReadResourceRequest extends JSONRPCRequest { - method: 'resources/read'; - params: ReadResourceRequestParams; -} - -/** - * The server's response to a resources/read request from the client. - * - * @category `resources/read` - */ -export interface ReadResourceResult extends Result { - contents: (TextResourceContents | BlobResourceContents)[]; -} - -/** - * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client. - * - * @category `notifications/resources/list_changed` - */ -export interface ResourceListChangedNotification extends JSONRPCNotification { - method: 'notifications/resources/list_changed'; - params?: NotificationParams; -} - -/** - * Parameters for a `resources/subscribe` request. - * - * @category `resources/subscribe` - */ -// eslint-disable-next-line @typescript-eslint/no-empty-object-type -export interface SubscribeRequestParams extends ResourceRequestParams {} - -/** - * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes. - * - * @category `resources/subscribe` - */ -export interface SubscribeRequest extends JSONRPCRequest { - method: 'resources/subscribe'; - params: SubscribeRequestParams; -} - -/** - * Parameters for a `resources/unsubscribe` request. - * - * @category `resources/unsubscribe` - */ -// eslint-disable-next-line @typescript-eslint/no-empty-object-type -export interface UnsubscribeRequestParams extends ResourceRequestParams {} - -/** - * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request. - * - * @category `resources/unsubscribe` - */ -export interface UnsubscribeRequest extends JSONRPCRequest { - method: 'resources/unsubscribe'; - params: UnsubscribeRequestParams; -} - -/** - * Parameters for a `notifications/resources/updated` notification. - * - * @category `notifications/resources/updated` - */ -export interface ResourceUpdatedNotificationParams extends NotificationParams { - /** - * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to. - * - * @format uri - */ - uri: string; -} - -/** - * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request. - * - * @category `notifications/resources/updated` - */ -export interface ResourceUpdatedNotification extends JSONRPCNotification { - method: 'notifications/resources/updated'; - params: ResourceUpdatedNotificationParams; -} - -/** - * A known resource that the server is capable of reading. - * - * @category `resources/list` - */ -export interface Resource extends BaseMetadata, Icons { - /** - * The URI of this resource. - * - * @format uri - */ - uri: string; - - /** - * A description of what this resource represents. - * - * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. - */ - description?: string; - - /** - * The MIME type of this resource, if known. - */ - mimeType?: string; - - /** - * Optional annotations for the client. - */ - annotations?: Annotations; - - /** - * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known. - * - * This can be used by Hosts to display file sizes and estimate context window usage. - */ - size?: number; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * A template description for resources available on the server. - * - * @category `resources/templates/list` - */ -export interface ResourceTemplate extends BaseMetadata, Icons { - /** - * A URI template (according to RFC 6570) that can be used to construct resource URIs. - * - * @format uri-template - */ - uriTemplate: string; - - /** - * A description of what this template is for. - * - * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. - */ - description?: string; - - /** - * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type. - */ - mimeType?: string; - - /** - * Optional annotations for the client. - */ - annotations?: Annotations; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * The contents of a specific resource or sub-resource. - * - * @internal - */ -export interface ResourceContents { - /** - * The URI of this resource. - * - * @format uri - */ - uri: string; - /** - * The MIME type of this resource, if known. - */ - mimeType?: string; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * @category Content - */ -export interface TextResourceContents extends ResourceContents { - /** - * The text of the item. This must only be set if the item can actually be represented as text (not binary data). - */ - text: string; -} - -/** - * @category Content - */ -export interface BlobResourceContents extends ResourceContents { - /** - * A base64-encoded string representing the binary data of the item. - * - * @format byte - */ - blob: string; -} - -/* Prompts */ -/** - * Sent from the client to request a list of prompts and prompt templates the server has. - * - * @category `prompts/list` - */ -export interface ListPromptsRequest extends PaginatedRequest { - method: 'prompts/list'; -} - -/** - * The server's response to a prompts/list request from the client. - * - * @category `prompts/list` - */ -export interface ListPromptsResult extends PaginatedResult { - prompts: Prompt[]; -} - -/** - * Parameters for a `prompts/get` request. - * - * @category `prompts/get` - */ -export interface GetPromptRequestParams extends RequestParams { - /** - * The name of the prompt or prompt template. - */ - name: string; - /** - * Arguments to use for templating the prompt. - */ - arguments?: { [key: string]: string }; -} - -/** - * Used by the client to get a prompt provided by the server. - * - * @category `prompts/get` - */ -export interface GetPromptRequest extends JSONRPCRequest { - method: 'prompts/get'; - params: GetPromptRequestParams; -} - -/** - * The server's response to a prompts/get request from the client. - * - * @category `prompts/get` - */ -export interface GetPromptResult extends Result { - /** - * An optional description for the prompt. - */ - description?: string; - messages: PromptMessage[]; -} - -/** - * A prompt or prompt template that the server offers. - * - * @category `prompts/list` - */ -export interface Prompt extends BaseMetadata, Icons { - /** - * An optional description of what this prompt provides - */ - description?: string; - - /** - * A list of arguments to use for templating the prompt. - */ - arguments?: PromptArgument[]; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * Describes an argument that a prompt can accept. - * - * @category `prompts/list` - */ -export interface PromptArgument extends BaseMetadata { - /** - * A human-readable description of the argument. - */ - description?: string; - /** - * Whether this argument must be provided. - */ - required?: boolean; -} - -/** - * The sender or recipient of messages and data in a conversation. - * - * @category Common Types - */ -export type Role = 'user' | 'assistant'; - -/** - * Describes a message returned as part of a prompt. - * - * This is similar to `SamplingMessage`, but also supports the embedding of - * resources from the MCP server. - * - * @category `prompts/get` - */ -export interface PromptMessage { - role: Role; - content: ContentBlock; -} - -/** - * A resource that the server is capable of reading, included in a prompt or tool call result. - * - * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests. - * - * @category Content - */ -export interface ResourceLink extends Resource { - type: 'resource_link'; -} - -/** - * The contents of a resource, embedded into a prompt or tool call result. - * - * It is up to the client how best to render embedded resources for the benefit - * of the LLM and/or the user. - * - * @category Content - */ -export interface EmbeddedResource { - type: 'resource'; - resource: TextResourceContents | BlobResourceContents; - - /** - * Optional annotations for the client. - */ - annotations?: Annotations; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} -/** - * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client. - * - * @category `notifications/prompts/list_changed` - */ -export interface PromptListChangedNotification extends JSONRPCNotification { - method: 'notifications/prompts/list_changed'; - params?: NotificationParams; -} - -/* Tools */ -/** - * Sent from the client to request a list of tools the server has. - * - * @category `tools/list` - */ -export interface ListToolsRequest extends PaginatedRequest { - method: 'tools/list'; -} - -/** - * The server's response to a tools/list request from the client. - * - * @category `tools/list` - */ -export interface ListToolsResult extends PaginatedResult { - tools: Tool[]; -} - -/** - * The server's response to a tool call. - * - * @category `tools/call` - */ -export interface CallToolResult extends Result { - /** - * A list of content objects that represent the unstructured result of the tool call. - */ - content: ContentBlock[]; - - /** - * An optional JSON object that represents the structured result of the tool call. - */ - structuredContent?: { [key: string]: unknown }; - - /** - * Whether the tool call ended in an error. - * - * If not set, this is assumed to be false (the call was successful). - * - * Any errors that originate from the tool SHOULD be reported inside the result - * object, with `isError` set to true, _not_ as an MCP protocol-level error - * response. Otherwise, the LLM would not be able to see that an error occurred - * and self-correct. - * - * However, any errors in _finding_ the tool, an error indicating that the - * server does not support tool calls, or any other exceptional conditions, - * should be reported as an MCP error response. - */ - isError?: boolean; -} - -/** - * Parameters for a `tools/call` request. - * - * @category `tools/call` - */ -export interface CallToolRequestParams extends TaskAugmentedRequestParams { - /** - * The name of the tool. - */ - name: string; - /** - * Arguments to use for the tool call. - */ - arguments?: { [key: string]: unknown }; -} - -/** - * Used by the client to invoke a tool provided by the server. - * - * @category `tools/call` - */ -export interface CallToolRequest extends JSONRPCRequest { - method: 'tools/call'; - params: CallToolRequestParams; -} - -/** - * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client. - * - * @category `notifications/tools/list_changed` - */ -export interface ToolListChangedNotification extends JSONRPCNotification { - method: 'notifications/tools/list_changed'; - params?: NotificationParams; -} - -/** - * Additional properties describing a Tool to clients. - * - * NOTE: all properties in ToolAnnotations are **hints**. - * They are not guaranteed to provide a faithful description of - * tool behavior (including descriptive properties like `title`). - * - * Clients should never make tool use decisions based on ToolAnnotations - * received from untrusted servers. - * - * @category `tools/list` - */ -export interface ToolAnnotations { - /** - * A human-readable title for the tool. - */ - title?: string; - - /** - * If true, the tool does not modify its environment. - * - * Default: false - */ - readOnlyHint?: boolean; - - /** - * If true, the tool may perform destructive updates to its environment. - * If false, the tool performs only additive updates. - * - * (This property is meaningful only when `readOnlyHint == false`) - * - * Default: true - */ - destructiveHint?: boolean; - - /** - * If true, calling the tool repeatedly with the same arguments - * will have no additional effect on its environment. - * - * (This property is meaningful only when `readOnlyHint == false`) - * - * Default: false - */ - idempotentHint?: boolean; - - /** - * If true, this tool may interact with an "open world" of external - * entities. If false, the tool's domain of interaction is closed. - * For example, the world of a web search tool is open, whereas that - * of a memory tool is not. - * - * Default: true - */ - openWorldHint?: boolean; -} - -/** - * Execution-related properties for a tool. - * - * @category `tools/list` - */ -export interface ToolExecution { - /** - * Indicates whether this tool supports task-augmented execution. - * This allows clients to handle long-running operations through polling - * the task system. - * - * - "forbidden": Tool does not support task-augmented execution (default when absent) - * - "optional": Tool may support task-augmented execution - * - "required": Tool requires task-augmented execution - * - * Default: "forbidden" - */ - taskSupport?: 'forbidden' | 'optional' | 'required'; -} - -/** - * Definition for a tool the client can call. - * - * @category `tools/list` - */ -export interface Tool extends BaseMetadata, Icons { - /** - * A human-readable description of the tool. - * - * This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model. - */ - description?: string; - - /** - * A JSON Schema object defining the expected parameters for the tool. - */ - inputSchema: { - $schema?: string; - type: 'object'; - properties?: { [key: string]: object }; - required?: string[]; - }; - - /** - * Execution-related properties for this tool. - */ - execution?: ToolExecution; - - /** - * An optional JSON Schema object defining the structure of the tool's output returned in - * the structuredContent field of a CallToolResult. - * - * Defaults to JSON Schema 2020-12 when no explicit $schema is provided. - * Currently restricted to type: "object" at the root level. - */ - outputSchema?: { - $schema?: string; - type: 'object'; - properties?: { [key: string]: object }; - required?: string[]; - }; - - /** - * Optional additional tool information. - * - * Display name precedence order is: title, annotations.title, then name. - */ - annotations?: ToolAnnotations; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/* Tasks */ - -/** - * The status of a task. - * - * @category `tasks` - */ -export type TaskStatus = - | 'working' // The request is currently being processed - | 'input_required' // The task is waiting for input (e.g., elicitation or sampling) - | 'completed' // The request completed successfully and results are available - | 'failed' // The associated request did not complete successfully. For tool calls specifically, this includes cases where the tool call result has `isError` set to true. - | 'cancelled'; // The request was cancelled before completion - -/** - * Metadata for augmenting a request with task execution. - * Include this in the `task` field of the request parameters. - * - * @category `tasks` - */ -export interface TaskMetadata { - /** - * Requested duration in milliseconds to retain task from creation. - */ - ttl?: number; -} - -/** - * Metadata for associating messages with a task. - * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`. - * - * @category `tasks` - */ -export interface RelatedTaskMetadata { - /** - * The task identifier this message is associated with. - */ - taskId: string; -} - -/** - * Data associated with a task. - * - * @category `tasks` - */ -export interface Task { - /** - * The task identifier. - */ - taskId: string; - - /** - * Current task state. - */ - status: TaskStatus; - - /** - * Optional human-readable message describing the current task state. - * This can provide context for any status, including: - * - Reasons for "cancelled" status - * - Summaries for "completed" status - * - Diagnostic information for "failed" status (e.g., error details, what went wrong) - */ - statusMessage?: string; - - /** - * ISO 8601 timestamp when the task was created. - */ - createdAt: string; - - /** - * ISO 8601 timestamp when the task was last updated. - */ - lastUpdatedAt: string; - - /** - * Actual retention duration from creation in milliseconds, null for unlimited. - */ - ttl: number | null; - - /** - * Suggested polling interval in milliseconds. - */ - pollInterval?: number; -} - -/** - * A response to a task-augmented request. - * - * @category `tasks` - */ -export interface CreateTaskResult extends Result { - task: Task; -} - -/** - * A request to retrieve the state of a task. - * - * @category `tasks/get` - */ -export interface GetTaskRequest extends JSONRPCRequest { - method: 'tasks/get'; - params: { - /** - * The task identifier to query. - */ - taskId: string; - }; -} - -/** - * The response to a tasks/get request. - * - * @category `tasks/get` - */ -export type GetTaskResult = Result & Task; - -/** - * A request to retrieve the result of a completed task. - * - * @category `tasks/result` - */ -export interface GetTaskPayloadRequest extends JSONRPCRequest { - method: 'tasks/result'; - params: { - /** - * The task identifier to retrieve results for. - */ - taskId: string; - }; -} - -/** - * The response to a tasks/result request. - * The structure matches the result type of the original request. - * For example, a tools/call task would return the CallToolResult structure. - * - * @category `tasks/result` - */ -export interface GetTaskPayloadResult extends Result { - [key: string]: unknown; -} - -/** - * A request to cancel a task. - * - * @category `tasks/cancel` - */ -export interface CancelTaskRequest extends JSONRPCRequest { - method: 'tasks/cancel'; - params: { - /** - * The task identifier to cancel. - */ - taskId: string; - }; -} - -/** - * The response to a tasks/cancel request. - * - * @category `tasks/cancel` - */ -export type CancelTaskResult = Result & Task; - -/** - * A request to retrieve a list of tasks. - * - * @category `tasks/list` - */ -export interface ListTasksRequest extends PaginatedRequest { - method: 'tasks/list'; -} - -/** - * The response to a tasks/list request. - * - * @category `tasks/list` - */ -export interface ListTasksResult extends PaginatedResult { - tasks: Task[]; -} - -/** - * Parameters for a `notifications/tasks/status` notification. - * - * @category `notifications/tasks/status` - */ -export type TaskStatusNotificationParams = NotificationParams & Task; - -/** - * An optional notification from the receiver to the requestor, informing them that a task's status has changed. Receivers are not required to send these notifications. - * - * @category `notifications/tasks/status` - */ -export interface TaskStatusNotification extends JSONRPCNotification { - method: 'notifications/tasks/status'; - params: TaskStatusNotificationParams; -} - -/* Logging */ - -/** - * Parameters for a `logging/setLevel` request. - * - * @category `logging/setLevel` - */ -export interface SetLevelRequestParams extends RequestParams { - /** - * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message. - */ - level: LoggingLevel; -} - -/** - * A request from the client to the server, to enable or adjust logging. - * - * @category `logging/setLevel` - */ -export interface SetLevelRequest extends JSONRPCRequest { - method: 'logging/setLevel'; - params: SetLevelRequestParams; -} - -/** - * Parameters for a `notifications/message` notification. - * - * @category `notifications/message` - */ -export interface LoggingMessageNotificationParams extends NotificationParams { - /** - * The severity of this log message. - */ - level: LoggingLevel; - /** - * An optional name of the logger issuing this message. - */ - logger?: string; - /** - * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. - */ - data: unknown; -} - -/** - * JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. - * - * @category `notifications/message` - */ -export interface LoggingMessageNotification extends JSONRPCNotification { - method: 'notifications/message'; - params: LoggingMessageNotificationParams; -} - -/** - * The severity of a log message. - * - * These map to syslog message severities, as specified in RFC-5424: - * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1 - * - * @category Common Types - */ -export type LoggingLevel = 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency'; - -/* Sampling */ -/** - * Parameters for a `sampling/createMessage` request. - * - * @category `sampling/createMessage` - */ -export interface CreateMessageRequestParams extends TaskAugmentedRequestParams { - messages: SamplingMessage[]; - /** - * The server's preferences for which model to select. The client MAY ignore these preferences. - */ - modelPreferences?: ModelPreferences; - /** - * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt. - */ - systemPrompt?: string; - /** - * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. - * The client MAY ignore this request. - * - * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client - * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases. - */ - includeContext?: 'none' | 'thisServer' | 'allServers'; - /** - * @TJS-type number - */ - temperature?: number; - /** - * The requested maximum number of tokens to sample (to prevent runaway completions). - * - * The client MAY choose to sample fewer tokens than the requested maximum. - */ - maxTokens: number; - stopSequences?: string[]; - /** - * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific. - */ - metadata?: object; - /** - * Tools that the model may use during generation. - * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. - */ - tools?: Tool[]; - /** - * Controls how the model uses tools. - * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. - * Default is `{ mode: "auto" }`. - */ - toolChoice?: ToolChoice; -} - -/** - * Controls tool selection behavior for sampling requests. - * - * @category `sampling/createMessage` - */ -export interface ToolChoice { - /** - * Controls the tool use ability of the model: - * - "auto": Model decides whether to use tools (default) - * - "required": Model MUST use at least one tool before completing - * - "none": Model MUST NOT use any tools - */ - mode?: 'auto' | 'required' | 'none'; -} - -/** - * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it. - * - * @category `sampling/createMessage` - */ -export interface CreateMessageRequest extends JSONRPCRequest { - method: 'sampling/createMessage'; - params: CreateMessageRequestParams; -} - -/** - * The client's response to a sampling/createMessage request from the server. - * The client should inform the user before returning the sampled message, to allow them - * to inspect the response (human in the loop) and decide whether to allow the server to see it. - * - * @category `sampling/createMessage` - */ -export interface CreateMessageResult extends Result, SamplingMessage { - /** - * The name of the model that generated the message. - */ - model: string; - - /** - * The reason why sampling stopped, if known. - * - * Standard values: - * - "endTurn": Natural end of the assistant's turn - * - "stopSequence": A stop sequence was encountered - * - "maxTokens": Maximum token limit was reached - * - "toolUse": The model wants to use one or more tools - * - * This field is an open string to allow for provider-specific stop reasons. - */ - stopReason?: 'endTurn' | 'stopSequence' | 'maxTokens' | 'toolUse' | string; -} - -/** - * Describes a message issued to or received from an LLM API. - * - * @category `sampling/createMessage` - */ -export interface SamplingMessage { - role: Role; - content: SamplingMessageContentBlock | SamplingMessageContentBlock[]; - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} -export type SamplingMessageContentBlock = TextContent | ImageContent | AudioContent | ToolUseContent | ToolResultContent; - -/** - * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed - * - * @category Common Types - */ -export interface Annotations { - /** - * Describes who the intended audience of this object or data is. - * - * It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`). - */ - audience?: Role[]; - - /** - * Describes how important this data is for operating the server. - * - * A value of 1 means "most important," and indicates that the data is - * effectively required, while 0 means "least important," and indicates that - * the data is entirely optional. - * - * @TJS-type number - * @minimum 0 - * @maximum 1 - */ - priority?: number; - - /** - * The moment the resource was last modified, as an ISO 8601 formatted string. - * - * Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z"). - * - * Examples: last activity timestamp in an open file, timestamp when the resource - * was attached, etc. - */ - lastModified?: string; -} - -/** - * @category Content - */ -export type ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource; - -/** - * Text provided to or from an LLM. - * - * @category Content - */ -export interface TextContent { - type: 'text'; - - /** - * The text content of the message. - */ - text: string; - - /** - * Optional annotations for the client. - */ - annotations?: Annotations; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * An image provided to or from an LLM. - * - * @category Content - */ -export interface ImageContent { - type: 'image'; - - /** - * The base64-encoded image data. - * - * @format byte - */ - data: string; - - /** - * The MIME type of the image. Different providers may support different image types. - */ - mimeType: string; - - /** - * Optional annotations for the client. - */ - annotations?: Annotations; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * Audio provided to or from an LLM. - * - * @category Content - */ -export interface AudioContent { - type: 'audio'; - - /** - * The base64-encoded audio data. - * - * @format byte - */ - data: string; - - /** - * The MIME type of the audio. Different providers may support different audio types. - */ - mimeType: string; - - /** - * Optional annotations for the client. - */ - annotations?: Annotations; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * A request from the assistant to call a tool. - * - * @category `sampling/createMessage` - */ -export interface ToolUseContent { - type: 'tool_use'; - - /** - * A unique identifier for this tool use. - * - * This ID is used to match tool results to their corresponding tool uses. - */ - id: string; - - /** - * The name of the tool to call. - */ - name: string; - - /** - * The arguments to pass to the tool, conforming to the tool's input schema. - */ - input: { [key: string]: unknown }; - - /** - * Optional metadata about the tool use. Clients SHOULD preserve this field when - * including tool uses in subsequent sampling requests to enable caching optimizations. - * - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * The result of a tool use, provided by the user back to the assistant. - * - * @category `sampling/createMessage` - */ -export interface ToolResultContent { - type: 'tool_result'; - - /** - * The ID of the tool use this result corresponds to. - * - * This MUST match the ID from a previous ToolUseContent. - */ - toolUseId: string; - - /** - * The unstructured result content of the tool use. - * - * This has the same format as CallToolResult.content and can include text, images, - * audio, resource links, and embedded resources. - */ - content: ContentBlock[]; - - /** - * An optional structured result object. - * - * If the tool defined an outputSchema, this SHOULD conform to that schema. - */ - structuredContent?: { [key: string]: unknown }; - - /** - * Whether the tool use resulted in an error. - * - * If true, the content typically describes the error that occurred. - * Default: false - */ - isError?: boolean; - - /** - * Optional metadata about the tool result. Clients SHOULD preserve this field when - * including tool results in subsequent sampling requests to enable caching optimizations. - * - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * The server's preferences for model selection, requested of the client during sampling. - * - * Because LLMs can vary along multiple dimensions, choosing the "best" model is - * rarely straightforward. Different models excel in different areas—some are - * faster but less capable, others are more capable but more expensive, and so - * on. This interface allows servers to express their priorities across multiple - * dimensions to help clients make an appropriate selection for their use case. - * - * These preferences are always advisory. The client MAY ignore them. It is also - * up to the client to decide how to interpret these preferences and how to - * balance them against other considerations. - * - * @category `sampling/createMessage` - */ -export interface ModelPreferences { - /** - * Optional hints to use for model selection. - * - * If multiple hints are specified, the client MUST evaluate them in order - * (such that the first match is taken). - * - * The client SHOULD prioritize these hints over the numeric priorities, but - * MAY still use the priorities to select from ambiguous matches. - */ - hints?: ModelHint[]; - - /** - * How much to prioritize cost when selecting a model. A value of 0 means cost - * is not important, while a value of 1 means cost is the most important - * factor. - * - * @TJS-type number - * @minimum 0 - * @maximum 1 - */ - costPriority?: number; - - /** - * How much to prioritize sampling speed (latency) when selecting a model. A - * value of 0 means speed is not important, while a value of 1 means speed is - * the most important factor. - * - * @TJS-type number - * @minimum 0 - * @maximum 1 - */ - speedPriority?: number; - - /** - * How much to prioritize intelligence and capabilities when selecting a - * model. A value of 0 means intelligence is not important, while a value of 1 - * means intelligence is the most important factor. - * - * @TJS-type number - * @minimum 0 - * @maximum 1 - */ - intelligencePriority?: number; -} - -/** - * Hints to use for model selection. - * - * Keys not declared here are currently left unspecified by the spec and are up - * to the client to interpret. - * - * @category `sampling/createMessage` - */ -export interface ModelHint { - /** - * A hint for a model name. - * - * The client SHOULD treat this as a substring of a model name; for example: - * - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022` - * - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc. - * - `claude` should match any Claude model - * - * The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example: - * - `gemini-1.5-flash` could match `claude-3-haiku-20240307` - */ - name?: string; -} - -/* Autocomplete */ -/** - * Parameters for a `completion/complete` request. - * - * @category `completion/complete` - */ -export interface CompleteRequestParams extends RequestParams { - ref: PromptReference | ResourceTemplateReference; - /** - * The argument's information - */ - argument: { - /** - * The name of the argument - */ - name: string; - /** - * The value of the argument to use for completion matching. - */ - value: string; - }; - - /** - * Additional, optional context for completions - */ - context?: { - /** - * Previously-resolved variables in a URI template or prompt. - */ - arguments?: { [key: string]: string }; - }; -} - -/** - * A request from the client to the server, to ask for completion options. - * - * @category `completion/complete` - */ -export interface CompleteRequest extends JSONRPCRequest { - method: 'completion/complete'; - params: CompleteRequestParams; -} - -/** - * The server's response to a completion/complete request - * - * @category `completion/complete` - */ -export interface CompleteResult extends Result { - completion: { - /** - * An array of completion values. Must not exceed 100 items. - */ - values: string[]; - /** - * The total number of completion options available. This can exceed the number of values actually sent in the response. - */ - total?: number; - /** - * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown. - */ - hasMore?: boolean; - }; -} - -/** - * A reference to a resource or resource template definition. - * - * @category `completion/complete` - */ -export interface ResourceTemplateReference { - type: 'ref/resource'; - /** - * The URI or URI template of the resource. - * - * @format uri-template - */ - uri: string; -} - -/** - * Identifies a prompt. - * - * @category `completion/complete` - */ -export interface PromptReference extends BaseMetadata { - type: 'ref/prompt'; -} - -/* Roots */ -/** - * Sent from the server to request a list of root URIs from the client. Roots allow - * servers to ask for specific directories or files to operate on. A common example - * for roots is providing a set of repositories or directories a server should operate - * on. - * - * This request is typically used when the server needs to understand the file system - * structure or access specific locations that the client has permission to read from. - * - * @category `roots/list` - */ -export interface ListRootsRequest extends JSONRPCRequest { - method: 'roots/list'; - params?: RequestParams; -} - -/** - * The client's response to a roots/list request from the server. - * This result contains an array of Root objects, each representing a root directory - * or file that the server can operate on. - * - * @category `roots/list` - */ -export interface ListRootsResult extends Result { - roots: Root[]; -} - -/** - * Represents a root directory or file that the server can operate on. - * - * @category `roots/list` - */ -export interface Root { - /** - * The URI identifying the root. This *must* start with file:// for now. - * This restriction may be relaxed in future versions of the protocol to allow - * other URI schemes. - * - * @format uri - */ - uri: string; - /** - * An optional name for the root. This can be used to provide a human-readable - * identifier for the root, which may be useful for display purposes or for - * referencing the root in other parts of the application. - */ - name?: string; - - /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. - */ - _meta?: { [key: string]: unknown }; -} - -/** - * A notification from the client to the server, informing it that the list of roots has changed. - * This notification should be sent whenever the client adds, removes, or modifies any root. - * The server should then request an updated list of roots using the ListRootsRequest. - * - * @category `notifications/roots/list_changed` - */ -export interface RootsListChangedNotification extends JSONRPCNotification { - method: 'notifications/roots/list_changed'; - params?: NotificationParams; -} - -/** - * The parameters for a request to elicit non-sensitive information from the user via a form in the client. - * - * @category `elicitation/create` - */ -export interface ElicitRequestFormParams extends TaskAugmentedRequestParams { - /** - * The elicitation mode. - */ - mode?: 'form'; - - /** - * The message to present to the user describing what information is being requested. - */ - message: string; - - /** - * A restricted subset of JSON Schema. - * Only top-level properties are allowed, without nesting. - */ - requestedSchema: { - $schema?: string; - type: 'object'; - properties: { - [key: string]: PrimitiveSchemaDefinition; - }; - required?: string[]; - }; -} - -/** - * The parameters for a request to elicit information from the user via a URL in the client. - * - * @category `elicitation/create` - */ -export interface ElicitRequestURLParams extends TaskAugmentedRequestParams { - /** - * The elicitation mode. - */ - mode: 'url'; - - /** - * The message to present to the user explaining why the interaction is needed. - */ - message: string; - - /** - * The ID of the elicitation, which must be unique within the context of the server. - * The client MUST treat this ID as an opaque value. - */ - elicitationId: string; - - /** - * The URL that the user should navigate to. - * - * @format uri - */ - url: string; -} - -/** - * The parameters for a request to elicit additional information from the user via the client. - * - * @category `elicitation/create` - */ -export type ElicitRequestParams = ElicitRequestFormParams | ElicitRequestURLParams; - -/** - * A request from the server to elicit additional information from the user via the client. - * - * @category `elicitation/create` - */ -export interface ElicitRequest extends JSONRPCRequest { - method: 'elicitation/create'; - params: ElicitRequestParams; -} - -/** - * Restricted schema definitions that only allow primitive types - * without nested objects or arrays. - * - * @category `elicitation/create` - */ -export type PrimitiveSchemaDefinition = StringSchema | NumberSchema | BooleanSchema | EnumSchema; - -/** - * @category `elicitation/create` - */ -export interface StringSchema { - type: 'string'; - title?: string; - description?: string; - minLength?: number; - maxLength?: number; - format?: 'email' | 'uri' | 'date' | 'date-time'; - default?: string; -} - -/** - * @category `elicitation/create` - */ -export interface NumberSchema { - type: 'number' | 'integer'; - title?: string; - description?: string; - minimum?: number; - maximum?: number; - default?: number; -} - -/** - * @category `elicitation/create` - */ -export interface BooleanSchema { - type: 'boolean'; - title?: string; - description?: string; - default?: boolean; -} - -/** - * Schema for single-selection enumeration without display titles for options. - * - * @category `elicitation/create` - */ -export interface UntitledSingleSelectEnumSchema { - type: 'string'; - /** - * Optional title for the enum field. - */ - title?: string; - /** - * Optional description for the enum field. - */ - description?: string; - /** - * Array of enum values to choose from. - */ - enum: string[]; - /** - * Optional default value. - */ - default?: string; -} - -/** - * Schema for single-selection enumeration with display titles for each option. - * - * @category `elicitation/create` - */ -export interface TitledSingleSelectEnumSchema { - type: 'string'; - /** - * Optional title for the enum field. - */ - title?: string; - /** - * Optional description for the enum field. - */ - description?: string; - /** - * Array of enum options with values and display labels. - */ - oneOf: Array<{ - /** - * The enum value. - */ - const: string; - /** - * Display label for this option. - */ - title: string; - }>; - /** - * Optional default value. - */ - default?: string; -} - -/** - * @category `elicitation/create` - */ -// Combined single selection enumeration -export type SingleSelectEnumSchema = UntitledSingleSelectEnumSchema | TitledSingleSelectEnumSchema; - -/** - * Schema for multiple-selection enumeration without display titles for options. - * - * @category `elicitation/create` - */ -export interface UntitledMultiSelectEnumSchema { - type: 'array'; - /** - * Optional title for the enum field. - */ - title?: string; - /** - * Optional description for the enum field. - */ - description?: string; - /** - * Minimum number of items to select. - */ - minItems?: number; - /** - * Maximum number of items to select. - */ - maxItems?: number; - /** - * Schema for the array items. - */ - items: { - type: 'string'; - /** - * Array of enum values to choose from. - */ - enum: string[]; - }; - /** - * Optional default value. - */ - default?: string[]; -} - -/** - * Schema for multiple-selection enumeration with display titles for each option. - * - * @category `elicitation/create` - */ -export interface TitledMultiSelectEnumSchema { - type: 'array'; - /** - * Optional title for the enum field. - */ - title?: string; - /** - * Optional description for the enum field. - */ - description?: string; - /** - * Minimum number of items to select. - */ - minItems?: number; - /** - * Maximum number of items to select. - */ - maxItems?: number; - /** - * Schema for array items with enum options and display labels. - */ - items: { - /** - * Array of enum options with values and display labels. - */ - anyOf: Array<{ - /** - * The constant enum value. - */ - const: string; - /** - * Display title for this option. - */ - title: string; - }>; - }; - /** - * Optional default value. - */ - default?: string[]; -} - -/** - * @category `elicitation/create` - */ -// Combined multiple selection enumeration -export type MultiSelectEnumSchema = UntitledMultiSelectEnumSchema | TitledMultiSelectEnumSchema; - -/** - * Use TitledSingleSelectEnumSchema instead. - * This interface will be removed in a future version. - * - * @category `elicitation/create` - */ -export interface LegacyTitledEnumSchema { - type: 'string'; - title?: string; - description?: string; - enum: string[]; - /** - * (Legacy) Display names for enum values. - * Non-standard according to JSON schema 2020-12. - */ - enumNames?: string[]; - default?: string; -} - -/** - * @category `elicitation/create` - */ -// Union type for all enum schemas -export type EnumSchema = SingleSelectEnumSchema | MultiSelectEnumSchema | LegacyTitledEnumSchema; - -/** - * The client's response to an elicitation request. - * - * @category `elicitation/create` - */ -export interface ElicitResult extends Result { - /** - * The user action in response to the elicitation. - * - "accept": User submitted the form/confirmed the action - * - "decline": User explicitly decline the action - * - "cancel": User dismissed without making an explicit choice - */ - action: 'accept' | 'decline' | 'cancel'; - - /** - * The submitted form data, only present when action is "accept" and mode was "form". - * Contains values matching the requested schema. - * Omitted for out-of-band mode responses. - */ - content?: { [key: string]: string | number | boolean | string[] }; -} - -/** - * An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request. - * - * @category `notifications/elicitation/complete` - */ -export interface ElicitationCompleteNotification extends JSONRPCNotification { - method: 'notifications/elicitation/complete'; - params: { - /** - * The ID of the elicitation that completed. - */ - elicitationId: string; - }; -} - -/* Client messages */ -/** @internal */ -export type ClientRequest = - | PingRequest - | InitializeRequest - | CompleteRequest - | SetLevelRequest - | GetPromptRequest - | ListPromptsRequest - | ListResourcesRequest - | ListResourceTemplatesRequest - | ReadResourceRequest - | SubscribeRequest - | UnsubscribeRequest - | CallToolRequest - | ListToolsRequest - | GetTaskRequest - | GetTaskPayloadRequest - | ListTasksRequest - | CancelTaskRequest; - -/** @internal */ -export type ClientNotification = - | CancelledNotification - | ProgressNotification - | InitializedNotification - | RootsListChangedNotification - | TaskStatusNotification; - -/** @internal */ -export type ClientResult = - | EmptyResult - | CreateMessageResult - | ListRootsResult - | ElicitResult - | GetTaskResult - | GetTaskPayloadResult - | ListTasksResult - | CancelTaskResult; - -/* Server messages */ -/** @internal */ -export type ServerRequest = - | PingRequest - | CreateMessageRequest - | ListRootsRequest - | ElicitRequest - | GetTaskRequest - | GetTaskPayloadRequest - | ListTasksRequest - | CancelTaskRequest; - -/** @internal */ -export type ServerNotification = - | CancelledNotification - | ProgressNotification - | LoggingMessageNotification - | ResourceUpdatedNotification - | ResourceListChangedNotification - | ToolListChangedNotification - | PromptListChangedNotification - | ElicitationCompleteNotification - | TaskStatusNotification; - -/** @internal */ -export type ServerResult = - | EmptyResult - | InitializeResult - | CompleteResult - | GetPromptResult - | ListPromptsResult - | ListResourceTemplatesResult - | ListResourcesResult - | ReadResourceResult - | CallToolResult - | ListToolsResult - | GetTaskResult - | GetTaskPayloadResult - | ListTasksResult - | CancelTaskResult; diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json deleted file mode 100644 index a6838303e4..0000000000 --- a/packages/core/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "@modelcontextprotocol/tsconfig", - "include": ["./"], - "exclude": ["node_modules", "dist"], - "compilerOptions": { - "paths": { - "*": ["./*"], - "@modelcontextprotocol/eslint-config": ["./node_modules/@modelcontextprotocol/eslint-config/tsconfig.json"], - "@modelcontextprotocol/vitest-config": ["./node_modules/@modelcontextprotocol/vitest-config/tsconfig.json"] - } - } -} diff --git a/packages/core/vitest.config.js b/packages/core/vitest.config.js deleted file mode 100644 index 496fca3200..0000000000 --- a/packages/core/vitest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import baseConfig from '@modelcontextprotocol/vitest-config'; - -export default baseConfig; diff --git a/packages/server/eslint.config.mjs b/packages/server/eslint.config.mjs deleted file mode 100644 index 4f034f2235..0000000000 --- a/packages/server/eslint.config.mjs +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-check - -import baseConfig from '@modelcontextprotocol/eslint-config'; - -export default [ - ...baseConfig, - { - settings: { - 'import/internal-regex': '^@modelcontextprotocol/core' - } - } -]; diff --git a/packages/server/package.json b/packages/server/package.json deleted file mode 100644 index b039751f61..0000000000 --- a/packages/server/package.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "name": "@modelcontextprotocol/server", - "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": ">=20", - "pnpm": ">=10.24.0" - }, - "packageManager": "pnpm@10.24.0", - "keywords": [ - "modelcontextprotocol", - "mcp" - ], - "exports": { - ".": { - "types": "./dist/index.d.mts", - "import": "./dist/index.mjs" - } - }, - "files": [ - "dist" - ], - "scripts": { - "typecheck": "tsgo -p tsconfig.json --noEmit", - "build": "tsdown", - "build:watch": "tsdown --watch", - "prepack": "npm run build", - "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", - "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --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": { - "content-type": "catalog:runtimeServerOnly", - "cors": "catalog:runtimeServerOnly", - "@hono/node-server": "catalog:runtimeServerOnly", - "hono": "catalog:runtimeServerOnly", - "express": "catalog:runtimeServerOnly", - "express-rate-limit": "catalog:runtimeServerOnly", - "raw-body": "catalog:runtimeServerOnly", - "pkce-challenge": "catalog:runtimeShared", - "zod": "catalog:runtimeShared", - "zod-to-json-schema": "catalog:runtimeShared" - }, - "peerDependencies": { - "@cfworker/json-schema": "catalog:runtimeShared", - "zod": "catalog:runtimeShared" - }, - "peerDependenciesMeta": { - "@cfworker/json-schema": { - "optional": true - }, - "zod": { - "optional": false - } - }, - "devDependencies": { - "@modelcontextprotocol/core": "workspace:^", - "@modelcontextprotocol/tsconfig": "workspace:^", - "@modelcontextprotocol/vitest-config": "workspace:^", - "@modelcontextprotocol/eslint-config": "workspace:^", - "@modelcontextprotocol/test-helpers": "workspace:^", - "@cfworker/json-schema": "catalog:runtimeShared", - "@eslint/js": "catalog:devTools", - "@types/content-type": "catalog:devTools", - "@types/cors": "catalog:devTools", - "@types/cross-spawn": "catalog:devTools", - "@types/eventsource": "catalog:devTools", - "@types/express": "catalog:devTools", - "@types/express-serve-static-core": "catalog:devTools", - "@types/supertest": "catalog:devTools", - "@typescript/native-preview": "catalog:devTools", - "eslint": "catalog:devTools", - "eslint-config-prettier": "catalog:devTools", - "eslint-plugin-n": "catalog:devTools", - "prettier": "catalog:devTools", - "supertest": "catalog:devTools", - "tsdown": "catalog:devTools", - "tsx": "catalog:devTools", - "typescript": "catalog:devTools", - "typescript-eslint": "catalog:devTools", - "vitest": "catalog:devTools" - } -} diff --git a/packages/server/src/experimental/tasks/index.ts b/packages/server/src/experimental/tasks/index.ts deleted file mode 100644 index 51ebd7fec5..0000000000 --- a/packages/server/src/experimental/tasks/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Experimental task features for MCP SDK. - * WARNING: These APIs are experimental and may change without notice. - * - * @experimental - */ - -// SDK implementation interfaces -export * from './interfaces.js'; - -// Wrapper classes -export * from './mcp-server.js'; -export * from './server.js'; diff --git a/packages/server/src/experimental/tasks/interfaces.ts b/packages/server/src/experimental/tasks/interfaces.ts deleted file mode 100644 index 0b32be2130..0000000000 --- a/packages/server/src/experimental/tasks/interfaces.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Experimental task interfaces for MCP SDK. - * WARNING: These APIs are experimental and may change without notice. - */ - -import type { - AnySchema, - CallToolResult, - CreateTaskRequestHandlerExtra, - CreateTaskResult, - GetTaskResult, - Result, - TaskRequestHandlerExtra, - ZodRawShapeCompat -} from '@modelcontextprotocol/core'; - -import type { BaseToolCallback } from '../../server/mcp.js'; - -// ============================================================================ -// Task Handler Types (for registerToolTask) -// ============================================================================ - -/** - * Handler for creating a task. - * @experimental - */ -export type CreateTaskRequestHandler< - SendResultT extends Result, - Args extends undefined | ZodRawShapeCompat | AnySchema = undefined -> = BaseToolCallback; - -/** - * Handler for task operations (get, getResult). - * @experimental - */ -export type TaskRequestHandler< - SendResultT extends Result, - Args extends undefined | ZodRawShapeCompat | AnySchema = undefined -> = BaseToolCallback; - -/** - * Interface for task-based tool handlers. - * @experimental - */ -export interface ToolTaskHandler { - createTask: CreateTaskRequestHandler; - getTask: TaskRequestHandler; - getTaskResult: TaskRequestHandler; -} diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts deleted file mode 100644 index 4b0c420538..0000000000 --- a/packages/server/src/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -export * from './server/completable.js'; -export * from './server/express.js'; -export * from './server/mcp.js'; -export * from './server/server.js'; -export * from './server/sse.js'; -export * from './server/stdio.js'; -export * from './server/streamableHttp.js'; -export * from './server/webStandardStreamableHttp.js'; - -// auth exports -export * from './server/auth/index.js'; - -// experimental exports -export * from './experimental/index.js'; - -// re-export shared types -export * from '@modelcontextprotocol/core'; diff --git a/packages/server/src/server/auth/index.ts b/packages/server/src/server/auth/index.ts deleted file mode 100644 index 5369224cfc..0000000000 --- a/packages/server/src/server/auth/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export * from './clients.js'; -export * from './handlers/authorize.js'; -export * from './handlers/metadata.js'; -export * from './handlers/register.js'; -export * from './handlers/revoke.js'; -export * from './handlers/token.js'; -export * from './middleware/allowedMethods.js'; -export * from './middleware/bearerAuth.js'; -export * from './middleware/clientAuth.js'; -export * from './provider.js'; -export * from './providers/proxyProvider.js'; -export * from './router.js'; diff --git a/packages/server/src/server/streamableHttp.ts b/packages/server/src/server/streamableHttp.ts deleted file mode 100644 index f9ee07ca88..0000000000 --- a/packages/server/src/server/streamableHttp.ts +++ /dev/null @@ -1,189 +0,0 @@ -/** - * Node.js HTTP Streamable HTTP Server Transport - * - * This is a thin wrapper around `WebStandardStreamableHTTPServerTransport` that provides - * compatibility with Node.js HTTP server (IncomingMessage/ServerResponse). - * - * For web-standard environments (Cloudflare Workers, Deno, Bun), use `WebStandardStreamableHTTPServerTransport` directly. - */ - -import type { IncomingMessage, ServerResponse } from 'node:http'; - -import { getRequestListener } from '@hono/node-server'; -import type { AuthInfo, JSONRPCMessage, MessageExtraInfo, RequestId, Transport } from '@modelcontextprotocol/core'; - -import type { WebStandardStreamableHTTPServerTransportOptions } from './webStandardStreamableHttp.js'; -import { WebStandardStreamableHTTPServerTransport } from './webStandardStreamableHttp.js'; - -/** - * Configuration options for StreamableHTTPServerTransport - * - * This is an alias for WebStandardStreamableHTTPServerTransportOptions for backward compatibility. - */ -export type StreamableHTTPServerTransportOptions = WebStandardStreamableHTTPServerTransportOptions; - -/** - * Server transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification. - * It supports both SSE streaming and direct HTTP responses. - * - * This is a wrapper around `WebStandardStreamableHTTPServerTransport` that provides Node.js HTTP compatibility. - * It uses the `@hono/node-server` library to convert between Node.js HTTP and Web Standard APIs. - * - * Usage example: - * - * ```typescript - * // Stateful mode - server sets the session ID - * const statefulTransport = new StreamableHTTPServerTransport({ - * sessionIdGenerator: () => randomUUID(), - * }); - * - * // Stateless mode - explicitly set session ID to undefined - * const statelessTransport = new StreamableHTTPServerTransport({ - * sessionIdGenerator: undefined, - * }); - * - * // Using with pre-parsed request body - * app.post('/mcp', (req, res) => { - * transport.handleRequest(req, res, req.body); - * }); - * ``` - * - * In stateful mode: - * - Session ID is generated and included in response headers - * - Session ID is always included in initialization responses - * - Requests with invalid session IDs are rejected with 404 Not Found - * - Non-initialization requests without a session ID are rejected with 400 Bad Request - * - State is maintained in-memory (connections, message history) - * - * In stateless mode: - * - No Session ID is included in any responses - * - No session validation is performed - */ -export class StreamableHTTPServerTransport implements Transport { - private _webStandardTransport: WebStandardStreamableHTTPServerTransport; - private _requestListener: ReturnType; - // Store auth and parsedBody per request for passing through to handleRequest - private _requestContext: WeakMap = new WeakMap(); - - constructor(options: StreamableHTTPServerTransportOptions = {}) { - this._webStandardTransport = new WebStandardStreamableHTTPServerTransport(options); - - // Create a request listener that wraps the web standard transport - // getRequestListener converts Node.js HTTP to Web Standard and properly handles SSE streaming - this._requestListener = getRequestListener(async (webRequest: Request) => { - // Get context if available (set during handleRequest) - const context = this._requestContext.get(webRequest); - return this._webStandardTransport.handleRequest(webRequest, { - authInfo: context?.authInfo, - parsedBody: context?.parsedBody - }); - }); - } - - /** - * Gets the session ID for this transport instance. - */ - get sessionId(): string | undefined { - return this._webStandardTransport.sessionId; - } - - /** - * Sets callback for when the transport is closed. - */ - set onclose(handler: (() => void) | undefined) { - this._webStandardTransport.onclose = handler; - } - - get onclose(): (() => void) | undefined { - return this._webStandardTransport.onclose; - } - - /** - * Sets callback for transport errors. - */ - set onerror(handler: ((error: Error) => void) | undefined) { - this._webStandardTransport.onerror = handler; - } - - get onerror(): ((error: Error) => void) | undefined { - return this._webStandardTransport.onerror; - } - - /** - * Sets callback for incoming messages. - */ - set onmessage(handler: ((message: JSONRPCMessage, extra?: MessageExtraInfo) => void) | undefined) { - this._webStandardTransport.onmessage = handler; - } - - get onmessage(): ((message: JSONRPCMessage, extra?: MessageExtraInfo) => void) | undefined { - return this._webStandardTransport.onmessage; - } - - /** - * Starts the transport. This is required by the Transport interface but is a no-op - * for the Streamable HTTP transport as connections are managed per-request. - */ - async start(): Promise { - return this._webStandardTransport.start(); - } - - /** - * Closes the transport and all active connections. - */ - async close(): Promise { - return this._webStandardTransport.close(); - } - - /** - * Sends a JSON-RPC message through the transport. - */ - async send(message: JSONRPCMessage, options?: { relatedRequestId?: RequestId }): Promise { - return this._webStandardTransport.send(message, options); - } - - /** - * Handles an incoming HTTP request, whether GET or POST. - * - * This method converts Node.js HTTP objects to Web Standard Request/Response - * and delegates to the underlying WebStandardStreamableHTTPServerTransport. - * - * @param req - Node.js IncomingMessage, optionally with auth property from middleware - * @param res - Node.js ServerResponse - * @param parsedBody - Optional pre-parsed body from body-parser middleware - */ - async handleRequest(req: IncomingMessage & { auth?: AuthInfo }, res: ServerResponse, parsedBody?: unknown): Promise { - // Store context for this request to pass through auth and parsedBody - // We need to intercept the request creation to attach this context - const authInfo = req.auth; - - // Create a custom handler that includes our context - const handler = getRequestListener(async (webRequest: Request) => { - return this._webStandardTransport.handleRequest(webRequest, { - authInfo, - parsedBody - }); - }); - - // Delegate to the request listener which handles all the Node.js <-> Web Standard conversion - // including proper SSE streaming support - await handler(req, res); - } - - /** - * Close an SSE stream for a specific request, triggering client reconnection. - * Use this to implement polling behavior during long-running operations - - * client will reconnect after the retry interval specified in the priming event. - */ - closeSSEStream(requestId: RequestId): void { - this._webStandardTransport.closeSSEStream(requestId); - } - - /** - * Close the standalone GET SSE stream, triggering client reconnection. - * Use this to implement polling behavior for server-initiated notifications. - */ - closeStandaloneSSEStream(): void { - this._webStandardTransport.closeStandaloneSSEStream(); - } -} diff --git a/packages/server/src/server/webStandardStreamableHttp.ts b/packages/server/src/server/webStandardStreamableHttp.ts deleted file mode 100644 index 082c904e1c..0000000000 --- a/packages/server/src/server/webStandardStreamableHttp.ts +++ /dev/null @@ -1,994 +0,0 @@ -/** - * Web Standards Streamable HTTP Server Transport - * - * This is the core transport implementation using Web Standard APIs (Request, Response, ReadableStream). - * It can run on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc. - * - * For Node.js Express/HTTP compatibility, use `StreamableHTTPServerTransport` which wraps this transport. - */ - -import { TextEncoder } from 'node:util'; - -import type { AuthInfo, JSONRPCMessage, MessageExtraInfo, RequestId, RequestInfo, Transport } from '@modelcontextprotocol/core'; -import { - DEFAULT_NEGOTIATED_PROTOCOL_VERSION, - isInitializeRequest, - isJSONRPCErrorResponse, - isJSONRPCRequest, - isJSONRPCResultResponse, - JSONRPCMessageSchema, - SUPPORTED_PROTOCOL_VERSIONS -} from '@modelcontextprotocol/core'; - -export type StreamId = string; -export type EventId = string; - -/** - * Interface for resumability support via event storage - */ -export interface EventStore { - /** - * Stores an event for later retrieval - * @param streamId ID of the stream the event belongs to - * @param message The JSON-RPC message to store - * @returns The generated event ID for the stored event - */ - storeEvent(streamId: StreamId, message: JSONRPCMessage): Promise; - - /** - * Get the stream ID associated with a given event ID. - * @param eventId The event ID to look up - * @returns The stream ID, or undefined if not found - * - * Optional: If not provided, the SDK will use the streamId returned by - * replayEventsAfter for stream mapping. - */ - getStreamIdForEventId?(eventId: EventId): Promise; - - replayEventsAfter( - lastEventId: EventId, - { - send - }: { - send: (eventId: EventId, message: JSONRPCMessage) => Promise; - } - ): Promise; -} - -/** - * Internal stream mapping for managing SSE connections - */ -interface StreamMapping { - /** Stream controller for pushing SSE data - only used with ReadableStream approach */ - controller?: ReadableStreamDefaultController; - /** Text encoder for SSE formatting */ - encoder?: TextEncoder; - /** Promise resolver for JSON response mode */ - resolveJson?: (response: Response) => void; - /** Cleanup function to close stream and remove mapping */ - cleanup: () => void; -} - -/** - * Configuration options for WebStandardStreamableHTTPServerTransport - */ -export interface WebStandardStreamableHTTPServerTransportOptions { - /** - * Function that generates a session ID for the transport. - * The session ID SHOULD be globally unique and cryptographically secure (e.g., a securely generated UUID, a JWT, or a cryptographic hash) - * - * If not provided, session management is disabled (stateless mode). - */ - sessionIdGenerator?: () => string; - - /** - * A callback for session initialization events - * This is called when the server initializes a new session. - * Useful in cases when you need to register multiple mcp sessions - * and need to keep track of them. - * @param sessionId The generated session ID - */ - onsessioninitialized?: (sessionId: string) => void | Promise; - - /** - * A callback for session close events - * This is called when the server closes a session due to a DELETE request. - * Useful in cases when you need to clean up resources associated with the session. - * Note that this is different from the transport closing, if you are handling - * HTTP requests from multiple nodes you might want to close each - * WebStandardStreamableHTTPServerTransport after a request is completed while still keeping the - * session open/running. - * @param sessionId The session ID that was closed - */ - onsessionclosed?: (sessionId: string) => void | Promise; - - /** - * If true, the server will return JSON responses instead of starting an SSE stream. - * This can be useful for simple request/response scenarios without streaming. - * Default is false (SSE streams are preferred). - */ - enableJsonResponse?: boolean; - - /** - * Event store for resumability support - * If provided, resumability will be enabled, allowing clients to reconnect and resume messages - */ - eventStore?: EventStore; - - /** - * List of allowed host header values for DNS rebinding protection. - * If not specified, host validation is disabled. - * @deprecated Use external middleware for host validation instead. - */ - allowedHosts?: string[]; - - /** - * List of allowed origin header values for DNS rebinding protection. - * If not specified, origin validation is disabled. - * @deprecated Use external middleware for origin validation instead. - */ - allowedOrigins?: string[]; - - /** - * Enable DNS rebinding protection (requires allowedHosts and/or allowedOrigins to be configured). - * Default is false for backwards compatibility. - * @deprecated Use external middleware for DNS rebinding protection instead. - */ - enableDnsRebindingProtection?: boolean; - - /** - * Retry interval in milliseconds to suggest to clients in SSE retry field. - * When set, the server will send a retry field in SSE priming events to control - * client reconnection timing for polling behavior. - */ - retryInterval?: number; -} - -/** - * Options for handling a request - */ -export interface HandleRequestOptions { - /** - * Pre-parsed request body. If provided, the transport will use this instead of parsing req.json(). - * Useful when using body-parser middleware that has already parsed the body. - */ - parsedBody?: unknown; - - /** - * Authentication info from middleware. If provided, will be passed to message handlers. - */ - authInfo?: AuthInfo; -} - -/** - * Server transport for Web Standards Streamable HTTP: this implements the MCP Streamable HTTP transport specification - * using Web Standard APIs (Request, Response, ReadableStream). - * - * This transport works on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc. - * - * Usage example: - * - * ```typescript - * // Stateful mode - server sets the session ID - * const statefulTransport = new WebStandardStreamableHTTPServerTransport({ - * sessionIdGenerator: () => crypto.randomUUID(), - * }); - * - * // Stateless mode - explicitly set session ID to undefined - * const statelessTransport = new WebStandardStreamableHTTPServerTransport({ - * sessionIdGenerator: undefined, - * }); - * - * // Hono.js usage - * app.all('/mcp', async (c) => { - * return transport.handleRequest(c.req.raw); - * }); - * - * // Cloudflare Workers usage - * export default { - * async fetch(request: Request): Promise { - * return transport.handleRequest(request); - * } - * }; - * ``` - * - * In stateful mode: - * - Session ID is generated and included in response headers - * - Session ID is always included in initialization responses - * - Requests with invalid session IDs are rejected with 404 Not Found - * - Non-initialization requests without a session ID are rejected with 400 Bad Request - * - State is maintained in-memory (connections, message history) - * - * In stateless mode: - * - No Session ID is included in any responses - * - No session validation is performed - */ -export class WebStandardStreamableHTTPServerTransport implements Transport { - // when sessionId is not set (undefined), it means the transport is in stateless mode - private sessionIdGenerator: (() => string) | undefined; - private _started: boolean = false; - private _streamMapping: Map = new Map(); - private _requestToStreamMapping: Map = new Map(); - private _requestResponseMap: Map = new Map(); - private _initialized: boolean = false; - private _enableJsonResponse: boolean = false; - private _standaloneSseStreamId: string = '_GET_stream'; - private _eventStore?: EventStore; - private _onsessioninitialized?: (sessionId: string) => void | Promise; - private _onsessionclosed?: (sessionId: string) => void | Promise; - private _allowedHosts?: string[]; - private _allowedOrigins?: string[]; - private _enableDnsRebindingProtection: boolean; - private _retryInterval?: number; - - sessionId?: string; - onclose?: () => void; - onerror?: (error: Error) => void; - onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void; - - constructor(options: WebStandardStreamableHTTPServerTransportOptions = {}) { - this.sessionIdGenerator = options.sessionIdGenerator; - this._enableJsonResponse = options.enableJsonResponse ?? false; - this._eventStore = options.eventStore; - this._onsessioninitialized = options.onsessioninitialized; - this._onsessionclosed = options.onsessionclosed; - this._allowedHosts = options.allowedHosts; - this._allowedOrigins = options.allowedOrigins; - this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false; - this._retryInterval = options.retryInterval; - } - - /** - * Starts the transport. This is required by the Transport interface but is a no-op - * for the Streamable HTTP transport as connections are managed per-request. - */ - async start(): Promise { - if (this._started) { - throw new Error('Transport already started'); - } - this._started = true; - } - - /** - * Helper to create a JSON error response - */ - private createJsonErrorResponse( - status: number, - code: number, - message: string, - options?: { headers?: Record; data?: string } - ): Response { - const error: { code: number; message: string; data?: string } = { code, message }; - if (options?.data !== undefined) { - error.data = options.data; - } - return new Response( - JSON.stringify({ - jsonrpc: '2.0', - error, - id: null - }), - { - status, - headers: { - 'Content-Type': 'application/json', - ...options?.headers - } - } - ); - } - - /** - * Validates request headers for DNS rebinding protection. - * @returns Error response if validation fails, undefined if validation passes. - */ - private validateRequestHeaders(req: Request): Response | undefined { - // Skip validation if protection is not enabled - if (!this._enableDnsRebindingProtection) { - return undefined; - } - - // Validate Host header if allowedHosts is configured - if (this._allowedHosts && this._allowedHosts.length > 0) { - const hostHeader = req.headers.get('host'); - if (!hostHeader || !this._allowedHosts.includes(hostHeader)) { - const error = `Invalid Host header: ${hostHeader}`; - this.onerror?.(new Error(error)); - return this.createJsonErrorResponse(403, -32000, error); - } - } - - // Validate Origin header if allowedOrigins is configured - if (this._allowedOrigins && this._allowedOrigins.length > 0) { - const originHeader = req.headers.get('origin'); - if (originHeader && !this._allowedOrigins.includes(originHeader)) { - const error = `Invalid Origin header: ${originHeader}`; - this.onerror?.(new Error(error)); - return this.createJsonErrorResponse(403, -32000, error); - } - } - - return undefined; - } - - /** - * Handles an incoming HTTP request, whether GET, POST, or DELETE - * Returns a Response object (Web Standard) - */ - async handleRequest(req: Request, options?: HandleRequestOptions): Promise { - // Validate request headers for DNS rebinding protection - const validationError = this.validateRequestHeaders(req); - if (validationError) { - return validationError; - } - - switch (req.method) { - case 'POST': - return this.handlePostRequest(req, options); - case 'GET': - return this.handleGetRequest(req); - case 'DELETE': - return this.handleDeleteRequest(req); - default: - return this.handleUnsupportedRequest(); - } - } - - /** - * Writes a priming event to establish resumption capability. - * Only sends if eventStore is configured (opt-in for resumability) and - * the client's protocol version supports empty SSE data (>= 2025-11-25). - */ - private async writePrimingEvent( - controller: ReadableStreamDefaultController, - encoder: TextEncoder, - streamId: string, - protocolVersion: string - ): Promise { - if (!this._eventStore) { - return; - } - - // Priming events have empty data which older clients cannot handle. - // Only send priming events to clients with protocol version >= 2025-11-25 - // which includes the fix for handling empty SSE data. - if (protocolVersion < '2025-11-25') { - return; - } - - const primingEventId = await this._eventStore.storeEvent(streamId, {} as JSONRPCMessage); - - let primingEvent = `id: ${primingEventId}\ndata: \n\n`; - if (this._retryInterval !== undefined) { - primingEvent = `id: ${primingEventId}\nretry: ${this._retryInterval}\ndata: \n\n`; - } - controller.enqueue(encoder.encode(primingEvent)); - } - - /** - * Handles GET requests for SSE stream - */ - private async handleGetRequest(req: Request): Promise { - // The client MUST include an Accept header, listing text/event-stream as a supported content type. - const acceptHeader = req.headers.get('accept'); - if (!acceptHeader?.includes('text/event-stream')) { - return this.createJsonErrorResponse(406, -32000, 'Not Acceptable: Client must accept text/event-stream'); - } - - // If an Mcp-Session-Id is returned by the server during initialization, - // clients using the Streamable HTTP transport MUST include it - // in the Mcp-Session-Id header on all of their subsequent HTTP requests. - const sessionError = this.validateSession(req); - if (sessionError) { - return sessionError; - } - const protocolError = this.validateProtocolVersion(req); - if (protocolError) { - return protocolError; - } - - // Handle resumability: check for Last-Event-ID header - if (this._eventStore) { - const lastEventId = req.headers.get('last-event-id'); - if (lastEventId) { - return this.replayEvents(lastEventId); - } - } - - // Check if there's already an active standalone SSE stream for this session - if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) { - // Only one GET SSE stream is allowed per session - return this.createJsonErrorResponse(409, -32000, 'Conflict: Only one SSE stream is allowed per session'); - } - - const encoder = new TextEncoder(); - let streamController: ReadableStreamDefaultController; - - // Create a ReadableStream with a controller we can use to push SSE events - const readable = new ReadableStream({ - start: controller => { - streamController = controller; - }, - cancel: () => { - // Stream was cancelled by client - this._streamMapping.delete(this._standaloneSseStreamId); - } - }); - - const headers: Record = { - 'Content-Type': 'text/event-stream', - 'Cache-Control': 'no-cache, no-transform', - Connection: 'keep-alive' - }; - - // After initialization, always include the session ID if we have one - if (this.sessionId !== undefined) { - headers['mcp-session-id'] = this.sessionId; - } - - // Store the stream mapping with the controller for pushing data - this._streamMapping.set(this._standaloneSseStreamId, { - controller: streamController!, - encoder, - cleanup: () => { - this._streamMapping.delete(this._standaloneSseStreamId); - try { - streamController!.close(); - } catch { - // Controller might already be closed - } - } - }); - - return new Response(readable, { headers }); - } - - /** - * Replays events that would have been sent after the specified event ID - * Only used when resumability is enabled - */ - private async replayEvents(lastEventId: string): Promise { - if (!this._eventStore) { - return this.createJsonErrorResponse(400, -32000, 'Event store not configured'); - } - - try { - // If getStreamIdForEventId is available, use it for conflict checking - let streamId: string | undefined; - if (this._eventStore.getStreamIdForEventId) { - streamId = await this._eventStore.getStreamIdForEventId(lastEventId); - - if (!streamId) { - return this.createJsonErrorResponse(400, -32000, 'Invalid event ID format'); - } - - // Check conflict with the SAME streamId we'll use for mapping - if (this._streamMapping.get(streamId) !== undefined) { - return this.createJsonErrorResponse(409, -32000, 'Conflict: Stream already has an active connection'); - } - } - - const headers: Record = { - 'Content-Type': 'text/event-stream', - 'Cache-Control': 'no-cache, no-transform', - Connection: 'keep-alive' - }; - - if (this.sessionId !== undefined) { - headers['mcp-session-id'] = this.sessionId; - } - - // Create a ReadableStream with controller for SSE - const encoder = new TextEncoder(); - let streamController: ReadableStreamDefaultController; - - const readable = new ReadableStream({ - start: controller => { - streamController = controller; - }, - cancel: () => { - // Stream was cancelled by client - // Cleanup will be handled by the mapping - } - }); - - // Replay events - returns the streamId for backwards compatibility - const replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, { - send: async (eventId: string, message: JSONRPCMessage) => { - const success = this.writeSSEEvent(streamController!, encoder, message, eventId); - if (!success) { - this.onerror?.(new Error('Failed replay events')); - try { - streamController!.close(); - } catch { - // Controller might already be closed - } - } - } - }); - - this._streamMapping.set(replayedStreamId, { - controller: streamController!, - encoder, - cleanup: () => { - this._streamMapping.delete(replayedStreamId); - try { - streamController!.close(); - } catch { - // Controller might already be closed - } - } - }); - - return new Response(readable, { headers }); - } catch (error) { - this.onerror?.(error as Error); - return this.createJsonErrorResponse(500, -32000, 'Error replaying events'); - } - } - - /** - * Writes an event to an SSE stream via controller with proper formatting - */ - private writeSSEEvent( - controller: ReadableStreamDefaultController, - encoder: TextEncoder, - message: JSONRPCMessage, - eventId?: string - ): boolean { - try { - let eventData = `event: message\n`; - // Include event ID if provided - this is important for resumability - if (eventId) { - eventData += `id: ${eventId}\n`; - } - eventData += `data: ${JSON.stringify(message)}\n\n`; - controller.enqueue(encoder.encode(eventData)); - return true; - } catch { - return false; - } - } - - /** - * Handles unsupported requests (PUT, PATCH, etc.) - */ - private handleUnsupportedRequest(): Response { - return new Response( - JSON.stringify({ - jsonrpc: '2.0', - error: { - code: -32000, - message: 'Method not allowed.' - }, - id: null - }), - { - status: 405, - headers: { - Allow: 'GET, POST, DELETE', - 'Content-Type': 'application/json' - } - } - ); - } - - /** - * Handles POST requests containing JSON-RPC messages - */ - private async handlePostRequest(req: Request, options?: HandleRequestOptions): Promise { - try { - // Validate the Accept header - const acceptHeader = req.headers.get('accept'); - // The client MUST include an Accept header, listing both application/json and text/event-stream as supported content types. - if (!acceptHeader?.includes('application/json') || !acceptHeader.includes('text/event-stream')) { - return this.createJsonErrorResponse( - 406, - -32000, - 'Not Acceptable: Client must accept both application/json and text/event-stream' - ); - } - - const ct = req.headers.get('content-type'); - if (!ct || !ct.includes('application/json')) { - return this.createJsonErrorResponse(415, -32000, 'Unsupported Media Type: Content-Type must be application/json'); - } - - // Build request info from headers - const requestInfo: RequestInfo = { - headers: Object.fromEntries(req.headers.entries()) - }; - - let rawMessage; - if (options?.parsedBody !== undefined) { - rawMessage = options.parsedBody; - } else { - try { - rawMessage = await req.json(); - } catch { - return this.createJsonErrorResponse(400, -32700, 'Parse error: Invalid JSON'); - } - } - - let messages: JSONRPCMessage[]; - - // handle batch and single messages - try { - if (Array.isArray(rawMessage)) { - messages = rawMessage.map(msg => JSONRPCMessageSchema.parse(msg)); - } else { - messages = [JSONRPCMessageSchema.parse(rawMessage)]; - } - } catch { - return this.createJsonErrorResponse(400, -32700, 'Parse error: Invalid JSON-RPC message'); - } - - // Check if this is an initialization request - // https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle/ - const isInitializationRequest = messages.some(isInitializeRequest); - if (isInitializationRequest) { - // If it's a server with session management and the session ID is already set we should reject the request - // to avoid re-initialization. - if (this._initialized && this.sessionId !== undefined) { - return this.createJsonErrorResponse(400, -32600, 'Invalid Request: Server already initialized'); - } - if (messages.length > 1) { - return this.createJsonErrorResponse(400, -32600, 'Invalid Request: Only one initialization request is allowed'); - } - this.sessionId = this.sessionIdGenerator?.(); - this._initialized = true; - - // If we have a session ID and an onsessioninitialized handler, call it immediately - // This is needed in cases where the server needs to keep track of multiple sessions - if (this.sessionId && this._onsessioninitialized) { - await Promise.resolve(this._onsessioninitialized(this.sessionId)); - } - } - if (!isInitializationRequest) { - // If an Mcp-Session-Id is returned by the server during initialization, - // clients using the Streamable HTTP transport MUST include it - // in the Mcp-Session-Id header on all of their subsequent HTTP requests. - const sessionError = this.validateSession(req); - if (sessionError) { - return sessionError; - } - // Mcp-Protocol-Version header is required for all requests after initialization. - const protocolError = this.validateProtocolVersion(req); - if (protocolError) { - return protocolError; - } - } - - // check if it contains requests - const hasRequests = messages.some(isJSONRPCRequest); - - if (!hasRequests) { - // if it only contains notifications or responses, return 202 - for (const message of messages) { - this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo }); - } - return new Response(null, { status: 202 }); - } - - // The default behavior is to use SSE streaming - // but in some cases server will return JSON responses - const streamId = crypto.randomUUID(); - - // Extract protocol version for priming event decision. - // For initialize requests, get from request params. - // For other requests, get from header (already validated). - const initRequest = messages.find(m => isInitializeRequest(m)); - const clientProtocolVersion = initRequest - ? initRequest.params.protocolVersion - : (req.headers.get('mcp-protocol-version') ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION); - - if (this._enableJsonResponse) { - // For JSON response mode, return a Promise that resolves when all responses are ready - return new Promise(resolve => { - this._streamMapping.set(streamId, { - resolveJson: resolve, - cleanup: () => { - this._streamMapping.delete(streamId); - } - }); - - for (const message of messages) { - if (isJSONRPCRequest(message)) { - this._requestToStreamMapping.set(message.id, streamId); - } - } - - for (const message of messages) { - this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo }); - } - }); - } - - // SSE streaming mode - use ReadableStream with controller for more reliable data pushing - const encoder = new TextEncoder(); - let streamController: ReadableStreamDefaultController; - - const readable = new ReadableStream({ - start: controller => { - streamController = controller; - }, - cancel: () => { - // Stream was cancelled by client - this._streamMapping.delete(streamId); - } - }); - - const headers: Record = { - 'Content-Type': 'text/event-stream', - 'Cache-Control': 'no-cache', - Connection: 'keep-alive' - }; - - // After initialization, always include the session ID if we have one - if (this.sessionId !== undefined) { - headers['mcp-session-id'] = this.sessionId; - } - - // Store the response for this request to send messages back through this connection - // We need to track by request ID to maintain the connection - for (const message of messages) { - if (isJSONRPCRequest(message)) { - this._streamMapping.set(streamId, { - controller: streamController!, - encoder, - cleanup: () => { - this._streamMapping.delete(streamId); - try { - streamController!.close(); - } catch { - // Controller might already be closed - } - } - }); - this._requestToStreamMapping.set(message.id, streamId); - } - } - - // Write priming event if event store is configured (after mapping is set up) - await this.writePrimingEvent(streamController!, encoder, streamId, clientProtocolVersion); - - // handle each message - for (const message of messages) { - // Build closeSSEStream callback for requests when eventStore is configured - // AND client supports resumability (protocol version >= 2025-11-25). - // Old clients can't resume if the stream is closed early because they - // didn't receive a priming event with an event ID. - let closeSSEStream: (() => void) | undefined; - let closeStandaloneSSEStream: (() => void) | undefined; - if (isJSONRPCRequest(message) && this._eventStore && clientProtocolVersion >= '2025-11-25') { - closeSSEStream = () => { - this.closeSSEStream(message.id); - }; - closeStandaloneSSEStream = () => { - this.closeStandaloneSSEStream(); - }; - } - - this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream }); - } - // The server SHOULD NOT close the SSE stream before sending all JSON-RPC responses - // This will be handled by the send() method when responses are ready - - return new Response(readable, { status: 200, headers }); - } catch (error) { - // return JSON-RPC formatted error - this.onerror?.(error as Error); - return this.createJsonErrorResponse(400, -32700, 'Parse error', { data: String(error) }); - } - } - - /** - * Handles DELETE requests to terminate sessions - */ - private async handleDeleteRequest(req: Request): Promise { - const sessionError = this.validateSession(req); - if (sessionError) { - return sessionError; - } - const protocolError = this.validateProtocolVersion(req); - if (protocolError) { - return protocolError; - } - - await Promise.resolve(this._onsessionclosed?.(this.sessionId!)); - await this.close(); - return new Response(null, { status: 200 }); - } - - /** - * Validates session ID for non-initialization requests. - * Returns Response error if invalid, undefined otherwise - */ - private validateSession(req: Request): Response | undefined { - if (this.sessionIdGenerator === undefined) { - // If the sessionIdGenerator ID is not set, the session management is disabled - // and we don't need to validate the session ID - return undefined; - } - if (!this._initialized) { - // If the server has not been initialized yet, reject all requests - return this.createJsonErrorResponse(400, -32000, 'Bad Request: Server not initialized'); - } - - const sessionId = req.headers.get('mcp-session-id'); - - if (!sessionId) { - // Non-initialization requests without a session ID should return 400 Bad Request - return this.createJsonErrorResponse(400, -32000, 'Bad Request: Mcp-Session-Id header is required'); - } - - if (sessionId !== this.sessionId) { - // Reject requests with invalid session ID with 404 Not Found - return this.createJsonErrorResponse(404, -32001, 'Session not found'); - } - - return undefined; - } - - /** - * Validates the MCP-Protocol-Version header on incoming requests. - * - * For initialization: Version negotiation handles unknown versions gracefully - * (server responds with its supported version). - * - * For subsequent requests with MCP-Protocol-Version header: - * - Accept if in supported list - * - 400 if unsupported - * - * For HTTP requests without the MCP-Protocol-Version header: - * - Accept and default to the version negotiated at initialization - */ - private validateProtocolVersion(req: Request): Response | undefined { - const protocolVersion = req.headers.get('mcp-protocol-version'); - - if (protocolVersion !== null && !SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) { - return this.createJsonErrorResponse( - 400, - -32000, - `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(', ')})` - ); - } - return undefined; - } - - async close(): Promise { - // Close all SSE connections - this._streamMapping.forEach(({ cleanup }) => { - cleanup(); - }); - this._streamMapping.clear(); - - // Clear any pending responses - this._requestResponseMap.clear(); - this.onclose?.(); - } - - /** - * Close an SSE stream for a specific request, triggering client reconnection. - * Use this to implement polling behavior during long-running operations - - * client will reconnect after the retry interval specified in the priming event. - */ - closeSSEStream(requestId: RequestId): void { - const streamId = this._requestToStreamMapping.get(requestId); - if (!streamId) return; - - const stream = this._streamMapping.get(streamId); - if (stream) { - stream.cleanup(); - } - } - - /** - * Close the standalone GET SSE stream, triggering client reconnection. - * Use this to implement polling behavior for server-initiated notifications. - */ - closeStandaloneSSEStream(): void { - const stream = this._streamMapping.get(this._standaloneSseStreamId); - if (stream) { - stream.cleanup(); - } - } - - async send(message: JSONRPCMessage, options?: { relatedRequestId?: RequestId }): Promise { - let requestId = options?.relatedRequestId; - if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) { - // If the message is a response, use the request ID from the message - requestId = message.id; - } - - // Check if this message should be sent on the standalone SSE stream (no request ID) - // Ignore notifications from tools (which have relatedRequestId set) - // Those will be sent via dedicated response SSE streams - if (requestId === undefined) { - // For standalone SSE streams, we can only send requests and notifications - if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) { - throw new Error('Cannot send a response on a standalone SSE stream unless resuming a previous client request'); - } - - // Generate and store event ID if event store is provided - // Store even if stream is disconnected so events can be replayed on reconnect - let eventId: string | undefined; - if (this._eventStore) { - // Stores the event and gets the generated event ID - eventId = await this._eventStore.storeEvent(this._standaloneSseStreamId, message); - } - - const standaloneSse = this._streamMapping.get(this._standaloneSseStreamId); - if (standaloneSse === undefined) { - // Stream is disconnected - event is stored for replay, nothing more to do - return; - } - - // Send the message to the standalone SSE stream - if (standaloneSse.controller && standaloneSse.encoder) { - this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId); - } - return; - } - - // Get the response for this request - const streamId = this._requestToStreamMapping.get(requestId); - if (!streamId) { - throw new Error(`No connection established for request ID: ${String(requestId)}`); - } - - const stream = this._streamMapping.get(streamId); - - if (!this._enableJsonResponse && stream?.controller && stream?.encoder) { - // For SSE responses, generate event ID if event store is provided - let eventId: string | undefined; - - if (this._eventStore) { - eventId = await this._eventStore.storeEvent(streamId, message); - } - // Write the event to the response stream - this.writeSSEEvent(stream.controller, stream.encoder, message, eventId); - } - - if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) { - this._requestResponseMap.set(requestId, message); - const relatedIds = Array.from(this._requestToStreamMapping.entries()) - .filter(([_, sid]) => sid === streamId) - .map(([id]) => id); - - // Check if we have responses for all requests using this connection - const allResponsesReady = relatedIds.every(id => this._requestResponseMap.has(id)); - - if (allResponsesReady) { - if (!stream) { - throw new Error(`No connection established for request ID: ${String(requestId)}`); - } - if (this._enableJsonResponse && stream.resolveJson) { - // All responses ready, send as JSON - const headers: Record = { - 'Content-Type': 'application/json' - }; - if (this.sessionId !== undefined) { - headers['mcp-session-id'] = this.sessionId; - } - - const responses = relatedIds.map(id => this._requestResponseMap.get(id)!); - - if (responses.length === 1) { - stream.resolveJson(new Response(JSON.stringify(responses[0]), { status: 200, headers })); - } else { - stream.resolveJson(new Response(JSON.stringify(responses), { status: 200, headers })); - } - } else { - // End the SSE stream - stream.cleanup(); - } - // Clean up - for (const id of relatedIds) { - this._requestResponseMap.delete(id); - this._requestToStreamMapping.delete(id); - } - } - } - } -} diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json deleted file mode 100644 index a16bfd7d9d..0000000000 --- a/packages/server/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "@modelcontextprotocol/tsconfig", - "include": ["./"], - "exclude": ["node_modules", "dist"], - "compilerOptions": { - "paths": { - "*": ["./*"], - "@modelcontextprotocol/core": ["./node_modules/@modelcontextprotocol/core/src/index.ts"], - "@modelcontextprotocol/test-helpers": ["./node_modules/@modelcontextprotocol/test-helpers/src/index.ts"] - } - } -} diff --git a/packages/server/tsdown.config.ts b/packages/server/tsdown.config.ts deleted file mode 100644 index c3d38817a6..0000000000 --- a/packages/server/tsdown.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig } from 'tsdown'; - -export default defineConfig({ - // 1. Entry Points - // Directly matches package.json include/exclude globs - entry: ['src/index.ts'], - - // 2. Output Configuration - format: ['esm'], - outDir: 'dist', - clean: true, // Recommended: Cleans 'dist' before building - sourcemap: true, - - // 3. Platform & Target - target: 'esnext', - platform: 'node', - shims: true, // Polyfills common Node.js shims (__dirname, etc.) - - // 4. Type Definitions - // Bundles d.ts files into a single output - dts: { - resolver: 'tsc', - // override just for DTS generation: - compilerOptions: { - baseUrl: '.', - paths: { - '@modelcontextprotocol/core': ['../core/src/index.ts'] - } - } - }, - // 5. Vendoring Strategy - Bundle the code for this specific package into the output, - // but treat all other dependencies as external (require/import). - noExternal: ['@modelcontextprotocol/core'] -}); diff --git a/packages/server/vitest.config.js b/packages/server/vitest.config.js deleted file mode 100644 index 496fca3200..0000000000 --- a/packages/server/vitest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import baseConfig from '@modelcontextprotocol/vitest-config'; - -export default baseConfig; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml deleted file mode 100644 index 92dbf8253e..0000000000 --- a/pnpm-lock.yaml +++ /dev/null @@ -1,6136 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -catalogs: - devTools: - '@eslint/js': - specifier: ^9.39.1 - version: 9.39.1 - '@types/content-type': - specifier: ^1.1.8 - version: 1.1.9 - '@types/cors': - specifier: ^2.8.17 - version: 2.8.19 - '@types/cross-spawn': - specifier: ^6.0.6 - version: 6.0.6 - '@types/eventsource': - specifier: ^1.1.15 - version: 1.1.15 - '@types/express': - specifier: ^5.0.0 - version: 5.0.5 - '@types/express-serve-static-core': - specifier: ^5.1.0 - version: 5.1.0 - '@types/supertest': - specifier: ^6.0.2 - version: 6.0.3 - '@types/ws': - specifier: ^8.5.12 - version: 8.18.1 - '@typescript/native-preview': - specifier: ^7.0.0-dev.20251217.1 - version: 7.0.0-dev.20251218.3 - eslint: - specifier: ^9.8.0 - version: 9.39.1 - eslint-config-prettier: - specifier: ^10.1.8 - version: 10.1.8 - eslint-plugin-n: - specifier: ^17.23.1 - version: 17.23.1 - prettier: - specifier: 3.6.2 - version: 3.6.2 - supertest: - specifier: ^7.0.0 - version: 7.1.4 - tsdown: - specifier: ^0.18.0 - version: 0.18.0 - tsx: - specifier: ^4.16.5 - version: 4.20.6 - typescript: - specifier: ^5.9.3 - version: 5.9.3 - typescript-eslint: - specifier: ^8.48.1 - version: 8.49.0 - vite-tsconfig-paths: - specifier: ^5.1.4 - version: 5.1.4 - vitest: - specifier: ^4.0.8 - version: 4.0.9 - ws: - specifier: ^8.18.0 - version: 8.18.3 - runtimeClientOnly: - cross-spawn: - specifier: ^7.0.5 - version: 7.0.6 - eventsource: - specifier: ^3.0.2 - version: 3.0.7 - eventsource-parser: - specifier: ^3.0.0 - version: 3.0.6 - jose: - specifier: ^6.1.1 - version: 6.1.3 - runtimeServerOnly: - '@hono/node-server': - specifier: ^1.19.7 - version: 1.19.7 - content-type: - specifier: ^1.0.5 - version: 1.0.5 - cors: - specifier: ^2.8.5 - version: 2.8.5 - express: - specifier: ^5.0.1 - version: 5.1.0 - express-rate-limit: - specifier: ^7.5.0 - version: 7.5.1 - hono: - specifier: ^4.11.1 - version: 4.11.1 - raw-body: - specifier: ^3.0.0 - version: 3.0.1 - runtimeShared: - '@cfworker/json-schema': - specifier: ^4.1.1 - version: 4.1.1 - ajv: - specifier: ^8.17.1 - version: 8.17.1 - ajv-formats: - specifier: ^3.0.1 - version: 3.0.1 - json-schema-typed: - specifier: ^8.0.2 - version: 8.0.2 - pkce-challenge: - specifier: ^5.0.0 - version: 5.0.0 - zod: - specifier: ^3.25 || ^4.0 - version: 3.25.76 - zod-to-json-schema: - specifier: ^3.25.0 - version: 3.25.0 - -overrides: - strip-ansi: 6.0.1 - -importers: - - .: - devDependencies: - '@cfworker/json-schema': - specifier: catalog:runtimeShared - version: 4.1.1 - '@changesets/changelog-github': - specifier: ^0.5.2 - version: 0.5.2 - '@changesets/cli': - specifier: ^2.29.8 - version: 2.29.8(@types/node@24.10.3) - '@eslint/js': - specifier: catalog:devTools - version: 9.39.1 - '@types/content-type': - specifier: catalog:devTools - version: 1.1.9 - '@types/cors': - specifier: catalog:devTools - version: 2.8.19 - '@types/cross-spawn': - specifier: catalog:devTools - version: 6.0.6 - '@types/eventsource': - specifier: catalog:devTools - version: 1.1.15 - '@types/express': - specifier: catalog:devTools - version: 5.0.5 - '@types/express-serve-static-core': - specifier: catalog:devTools - version: 5.1.0 - '@types/node': - specifier: ^24.10.1 - version: 24.10.3 - '@types/supertest': - specifier: catalog:devTools - version: 6.0.3 - '@types/ws': - specifier: catalog:devTools - version: 8.18.1 - '@typescript/native-preview': - specifier: catalog:devTools - version: 7.0.0-dev.20251218.3 - eslint: - specifier: catalog:devTools - version: 9.39.1 - eslint-config-prettier: - specifier: catalog:devTools - version: 10.1.8(eslint@9.39.1) - eslint-plugin-n: - specifier: catalog:devTools - version: 17.23.1(eslint@9.39.1)(typescript@5.9.3) - prettier: - specifier: catalog:devTools - version: 3.6.2 - supertest: - specifier: catalog:devTools - version: 7.1.4 - tsdown: - specifier: catalog:devTools - version: 0.18.0(@typescript/native-preview@7.0.0-dev.20251218.3)(typescript@5.9.3) - tsx: - specifier: catalog:devTools - version: 4.20.6 - typescript: - specifier: catalog:devTools - version: 5.9.3 - typescript-eslint: - specifier: catalog:devTools - version: 8.49.0(eslint@9.39.1)(typescript@5.9.3) - vitest: - specifier: catalog:devTools - version: 4.0.9(@types/node@24.10.3)(tsx@4.20.6) - ws: - specifier: catalog:devTools - version: 8.18.3 - - common/eslint-config: - dependencies: - typescript: - specifier: catalog:devTools - version: 5.9.3 - devDependencies: - '@eslint/js': - specifier: catalog:devTools - version: 9.39.1 - eslint: - specifier: catalog:devTools - version: 9.39.1 - eslint-config-prettier: - specifier: catalog:devTools - version: 10.1.8(eslint@9.39.1) - eslint-import-resolver-typescript: - specifier: ^4.4.4 - version: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.39.1) - eslint-plugin-import: - specifier: ^2.32.0 - version: 2.32.0(@typescript-eslint/parser@8.49.0(eslint@9.39.1)(typescript@5.9.3))(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1) - eslint-plugin-n: - specifier: catalog:devTools - version: 17.23.1(eslint@9.39.1)(typescript@5.9.3) - eslint-plugin-simple-import-sort: - specifier: ^12.1.1 - version: 12.1.1(eslint@9.39.1) - prettier: - specifier: catalog:devTools - version: 3.6.2 - typescript-eslint: - specifier: catalog:devTools - version: 8.49.0(eslint@9.39.1)(typescript@5.9.3) - - common/tsconfig: - dependencies: - typescript: - specifier: catalog:devTools - version: 5.9.3 - - common/vitest-config: - dependencies: - typescript: - specifier: catalog:devTools - version: 5.9.3 - devDependencies: - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../tsconfig - vite-tsconfig-paths: - specifier: catalog:devTools - version: 5.1.4(typescript@5.9.3)(vite@7.2.2(@types/node@24.10.3)(tsx@4.20.6)) - - examples/client: - dependencies: - '@modelcontextprotocol/client': - specifier: workspace:^ - version: link:../../packages/client - ajv: - specifier: catalog:runtimeShared - version: 8.17.1 - zod: - specifier: catalog:runtimeShared - version: 3.25.76 - devDependencies: - '@modelcontextprotocol/eslint-config': - specifier: workspace:^ - version: link:../../common/eslint-config - '@modelcontextprotocol/examples-shared': - specifier: workspace:^ - version: link:../shared - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../../common/tsconfig - '@modelcontextprotocol/vitest-config': - specifier: workspace:^ - version: link:../../common/vitest-config - tsdown: - specifier: catalog:devTools - version: 0.18.0(@typescript/native-preview@7.0.0-dev.20251218.3)(typescript@5.9.3) - - examples/server: - dependencies: - '@hono/node-server': - specifier: catalog:runtimeServerOnly - version: 1.19.7(hono@4.11.1) - '@modelcontextprotocol/examples-shared': - specifier: workspace:^ - version: link:../shared - '@modelcontextprotocol/server': - specifier: workspace:^ - version: link:../../packages/server - cors: - specifier: catalog:runtimeServerOnly - version: 2.8.5 - express: - specifier: catalog:runtimeServerOnly - version: 5.1.0 - hono: - specifier: catalog:runtimeServerOnly - version: 4.11.1 - zod: - specifier: catalog:runtimeShared - version: 3.25.76 - devDependencies: - '@modelcontextprotocol/eslint-config': - specifier: workspace:^ - version: link:../../common/eslint-config - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../../common/tsconfig - '@modelcontextprotocol/vitest-config': - specifier: workspace:^ - version: link:../../common/vitest-config - '@types/cors': - specifier: catalog:devTools - version: 2.8.19 - '@types/express': - specifier: catalog:devTools - version: 5.0.5 - tsdown: - specifier: catalog:devTools - version: 0.18.0(@typescript/native-preview@7.0.0-dev.20251218.3)(typescript@5.9.3) - - examples/shared: - dependencies: - '@modelcontextprotocol/server': - specifier: workspace:^ - version: link:../../packages/server - express: - specifier: catalog:runtimeServerOnly - version: 5.1.0 - devDependencies: - '@eslint/js': - specifier: catalog:devTools - version: 9.39.1 - '@modelcontextprotocol/eslint-config': - specifier: workspace:^ - version: link:../../common/eslint-config - '@modelcontextprotocol/test-helpers': - specifier: workspace:^ - version: link:../../test/helpers - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../../common/tsconfig - '@modelcontextprotocol/vitest-config': - specifier: workspace:^ - version: link:../../common/vitest-config - '@types/express': - specifier: catalog:devTools - version: 5.0.5 - '@typescript/native-preview': - specifier: catalog:devTools - version: 7.0.0-dev.20251218.3 - eslint: - specifier: catalog:devTools - version: 9.39.1 - eslint-config-prettier: - specifier: catalog:devTools - version: 10.1.8(eslint@9.39.1) - eslint-plugin-n: - specifier: catalog:devTools - version: 17.23.1(eslint@9.39.1)(typescript@5.9.3) - prettier: - specifier: catalog:devTools - version: 3.6.2 - tsx: - specifier: catalog:devTools - version: 4.20.6 - typescript: - specifier: catalog:devTools - version: 5.9.3 - typescript-eslint: - specifier: catalog:devTools - version: 8.49.0(eslint@9.39.1)(typescript@5.9.3) - vitest: - specifier: catalog:devTools - version: 4.0.9(@types/node@24.10.3)(tsx@4.20.6) - - packages/client: - dependencies: - cross-spawn: - specifier: catalog:runtimeClientOnly - version: 7.0.6 - eventsource: - specifier: catalog:runtimeClientOnly - version: 3.0.7 - eventsource-parser: - specifier: catalog:runtimeClientOnly - version: 3.0.6 - jose: - specifier: catalog:runtimeClientOnly - version: 6.1.3 - pkce-challenge: - specifier: catalog:runtimeShared - version: 5.0.0 - zod: - specifier: catalog:runtimeShared - version: 3.25.76 - devDependencies: - '@cfworker/json-schema': - specifier: catalog:runtimeShared - version: 4.1.1 - '@eslint/js': - specifier: catalog:devTools - version: 9.39.1 - '@modelcontextprotocol/core': - specifier: workspace:^ - version: link:../core - '@modelcontextprotocol/eslint-config': - specifier: workspace:^ - version: link:../../common/eslint-config - '@modelcontextprotocol/test-helpers': - specifier: workspace:^ - version: link:../../test/helpers - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../../common/tsconfig - '@modelcontextprotocol/vitest-config': - specifier: workspace:^ - version: link:../../common/vitest-config - '@types/content-type': - specifier: catalog:devTools - version: 1.1.9 - '@types/cross-spawn': - specifier: catalog:devTools - version: 6.0.6 - '@types/eventsource': - specifier: catalog:devTools - version: 1.1.15 - '@typescript/native-preview': - specifier: catalog:devTools - version: 7.0.0-dev.20251218.3 - eslint: - specifier: catalog:devTools - version: 9.39.1 - eslint-config-prettier: - specifier: catalog:devTools - version: 10.1.8(eslint@9.39.1) - eslint-plugin-n: - specifier: catalog:devTools - version: 17.23.1(eslint@9.39.1)(typescript@5.9.3) - prettier: - specifier: catalog:devTools - version: 3.6.2 - tsdown: - specifier: catalog:devTools - version: 0.18.0(@typescript/native-preview@7.0.0-dev.20251218.3)(typescript@5.9.3) - tsx: - specifier: catalog:devTools - version: 4.20.6 - typescript: - specifier: catalog:devTools - version: 5.9.3 - typescript-eslint: - specifier: catalog:devTools - version: 8.49.0(eslint@9.39.1)(typescript@5.9.3) - vitest: - specifier: catalog:devTools - version: 4.0.9(@types/node@24.10.3)(tsx@4.20.6) - - packages/core: - dependencies: - ajv: - specifier: catalog:runtimeShared - version: 8.17.1 - ajv-formats: - specifier: catalog:runtimeShared - version: 3.0.1(ajv@8.17.1) - json-schema-typed: - specifier: catalog:runtimeShared - version: 8.0.2 - zod: - specifier: catalog:runtimeShared - version: 3.25.76 - zod-to-json-schema: - specifier: catalog:runtimeShared - version: 3.25.0(zod@3.25.76) - devDependencies: - '@cfworker/json-schema': - specifier: catalog:runtimeShared - version: 4.1.1 - '@eslint/js': - specifier: catalog:devTools - version: 9.39.1 - '@modelcontextprotocol/eslint-config': - specifier: workspace:^ - version: link:../../common/eslint-config - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../../common/tsconfig - '@modelcontextprotocol/vitest-config': - specifier: workspace:^ - version: link:../../common/vitest-config - '@types/content-type': - specifier: catalog:devTools - version: 1.1.9 - '@types/cors': - specifier: catalog:devTools - version: 2.8.19 - '@types/cross-spawn': - specifier: catalog:devTools - version: 6.0.6 - '@types/eventsource': - specifier: catalog:devTools - version: 1.1.15 - '@types/express': - specifier: catalog:devTools - version: 5.0.5 - '@types/express-serve-static-core': - specifier: catalog:devTools - version: 5.1.0 - '@typescript/native-preview': - specifier: catalog:devTools - version: 7.0.0-dev.20251218.3 - eslint: - specifier: catalog:devTools - version: 9.39.1 - eslint-config-prettier: - specifier: catalog:devTools - version: 10.1.8(eslint@9.39.1) - eslint-plugin-n: - specifier: catalog:devTools - version: 17.23.1(eslint@9.39.1)(typescript@5.9.3) - prettier: - specifier: catalog:devTools - version: 3.6.2 - tsx: - specifier: catalog:devTools - version: 4.20.6 - typescript: - specifier: catalog:devTools - version: 5.9.3 - typescript-eslint: - specifier: catalog:devTools - version: 8.49.0(eslint@9.39.1)(typescript@5.9.3) - vitest: - specifier: catalog:devTools - version: 4.0.9(@types/node@24.10.3)(tsx@4.20.6) - - packages/server: - dependencies: - '@hono/node-server': - specifier: catalog:runtimeServerOnly - version: 1.19.7(hono@4.11.1) - content-type: - specifier: catalog:runtimeServerOnly - version: 1.0.5 - cors: - specifier: catalog:runtimeServerOnly - version: 2.8.5 - express: - specifier: catalog:runtimeServerOnly - version: 5.1.0 - express-rate-limit: - specifier: catalog:runtimeServerOnly - version: 7.5.1(express@5.1.0) - hono: - specifier: catalog:runtimeServerOnly - version: 4.11.1 - pkce-challenge: - specifier: catalog:runtimeShared - version: 5.0.0 - raw-body: - specifier: catalog:runtimeServerOnly - version: 3.0.1 - zod: - specifier: catalog:runtimeShared - version: 3.25.76 - zod-to-json-schema: - specifier: catalog:runtimeShared - version: 3.25.0(zod@3.25.76) - devDependencies: - '@cfworker/json-schema': - specifier: catalog:runtimeShared - version: 4.1.1 - '@eslint/js': - specifier: catalog:devTools - version: 9.39.1 - '@modelcontextprotocol/core': - specifier: workspace:^ - version: link:../core - '@modelcontextprotocol/eslint-config': - specifier: workspace:^ - version: link:../../common/eslint-config - '@modelcontextprotocol/test-helpers': - specifier: workspace:^ - version: link:../../test/helpers - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../../common/tsconfig - '@modelcontextprotocol/vitest-config': - specifier: workspace:^ - version: link:../../common/vitest-config - '@types/content-type': - specifier: catalog:devTools - version: 1.1.9 - '@types/cors': - specifier: catalog:devTools - version: 2.8.19 - '@types/cross-spawn': - specifier: catalog:devTools - version: 6.0.6 - '@types/eventsource': - specifier: catalog:devTools - version: 1.1.15 - '@types/express': - specifier: catalog:devTools - version: 5.0.5 - '@types/express-serve-static-core': - specifier: catalog:devTools - version: 5.1.0 - '@types/supertest': - specifier: catalog:devTools - version: 6.0.3 - '@typescript/native-preview': - specifier: catalog:devTools - version: 7.0.0-dev.20251218.3 - eslint: - specifier: catalog:devTools - version: 9.39.1 - eslint-config-prettier: - specifier: catalog:devTools - version: 10.1.8(eslint@9.39.1) - eslint-plugin-n: - specifier: catalog:devTools - version: 17.23.1(eslint@9.39.1)(typescript@5.9.3) - prettier: - specifier: catalog:devTools - version: 3.6.2 - supertest: - specifier: catalog:devTools - version: 7.1.4 - tsdown: - specifier: catalog:devTools - version: 0.18.0(@typescript/native-preview@7.0.0-dev.20251218.3)(typescript@5.9.3) - tsx: - specifier: catalog:devTools - version: 4.20.6 - typescript: - specifier: catalog:devTools - version: 5.9.3 - typescript-eslint: - specifier: catalog:devTools - version: 8.49.0(eslint@9.39.1)(typescript@5.9.3) - vitest: - specifier: catalog:devTools - version: 4.0.9(@types/node@24.10.3)(tsx@4.20.6) - - test/helpers: - devDependencies: - '@modelcontextprotocol/client': - specifier: workspace:^ - version: link:../../packages/client - '@modelcontextprotocol/core': - specifier: workspace:^ - version: link:../../packages/core - '@modelcontextprotocol/eslint-config': - specifier: workspace:^ - version: link:../../common/eslint-config - '@modelcontextprotocol/server': - specifier: workspace:^ - version: link:../../packages/server - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../../common/tsconfig - '@modelcontextprotocol/vitest-config': - specifier: workspace:^ - version: link:../../common/vitest-config - vitest: - specifier: catalog:devTools - version: 4.0.9(@types/node@24.10.3)(tsx@4.20.6) - zod: - specifier: catalog:runtimeShared - version: 3.25.76 - - test/integration: - devDependencies: - '@modelcontextprotocol/client': - specifier: workspace:^ - version: link:../../packages/client - '@modelcontextprotocol/core': - specifier: workspace:^ - version: link:../../packages/core - '@modelcontextprotocol/eslint-config': - specifier: workspace:^ - version: link:../../common/eslint-config - '@modelcontextprotocol/server': - specifier: workspace:^ - version: link:../../packages/server - '@modelcontextprotocol/test-helpers': - specifier: workspace:^ - version: link:../helpers - '@modelcontextprotocol/tsconfig': - specifier: workspace:^ - version: link:../../common/tsconfig - '@modelcontextprotocol/vitest-config': - specifier: workspace:^ - version: link:../../common/vitest-config - supertest: - specifier: catalog:devTools - version: 7.1.4 - vitest: - specifier: catalog:devTools - version: 4.0.9(@types/node@24.10.3)(tsx@4.20.6) - zod: - specifier: catalog:runtimeShared - version: 3.25.76 - -packages: - - '@babel/generator@7.28.5': - resolution: {integrity: sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==} - engines: {node: '>=6.9.0'} - - '@babel/helper-string-parser@7.27.1': - resolution: {integrity: sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-validator-identifier@7.28.5': - resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==} - engines: {node: '>=6.9.0'} - - '@babel/parser@7.28.5': - resolution: {integrity: sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==} - engines: {node: '>=6.0.0'} - hasBin: true - - '@babel/runtime@7.28.4': - resolution: {integrity: sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==} - engines: {node: '>=6.9.0'} - - '@babel/types@7.28.5': - resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==} - engines: {node: '>=6.9.0'} - - '@cfworker/json-schema@4.1.1': - resolution: {integrity: sha512-gAmrUZSGtKc3AiBL71iNWxDsyUC5uMaKKGdvzYsBoTW/xi42JQHl7eKV2OYzCUqvc+D2RCcf7EXY2iCyFIk6og==} - - '@changesets/apply-release-plan@7.0.14': - resolution: {integrity: sha512-ddBvf9PHdy2YY0OUiEl3TV78mH9sckndJR14QAt87KLEbIov81XO0q0QAmvooBxXlqRRP8I9B7XOzZwQG7JkWA==} - - '@changesets/assemble-release-plan@6.0.9': - resolution: {integrity: sha512-tPgeeqCHIwNo8sypKlS3gOPmsS3wP0zHt67JDuL20P4QcXiw/O4Hl7oXiuLnP9yg+rXLQ2sScdV1Kkzde61iSQ==} - - '@changesets/changelog-git@0.2.1': - resolution: {integrity: sha512-x/xEleCFLH28c3bQeQIyeZf8lFXyDFVn1SgcBiR2Tw/r4IAWlk1fzxCEZ6NxQAjF2Nwtczoen3OA2qR+UawQ8Q==} - - '@changesets/changelog-github@0.5.2': - resolution: {integrity: sha512-HeGeDl8HaIGj9fQHo/tv5XKQ2SNEi9+9yl1Bss1jttPqeiASRXhfi0A2wv8yFKCp07kR1gpOI5ge6+CWNm1jPw==} - - '@changesets/cli@2.29.8': - resolution: {integrity: sha512-1weuGZpP63YWUYjay/E84qqwcnt5yJMM0tep10Up7Q5cS/DGe2IZ0Uj3HNMxGhCINZuR7aO9WBMdKnPit5ZDPA==} - hasBin: true - - '@changesets/config@3.1.2': - resolution: {integrity: sha512-CYiRhA4bWKemdYi/uwImjPxqWNpqGPNbEBdX1BdONALFIDK7MCUj6FPkzD+z9gJcvDFUQJn9aDVf4UG7OT6Kog==} - - '@changesets/errors@0.2.0': - resolution: {integrity: sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow==} - - '@changesets/get-dependents-graph@2.1.3': - resolution: {integrity: sha512-gphr+v0mv2I3Oxt19VdWRRUxq3sseyUpX9DaHpTUmLj92Y10AGy+XOtV+kbM6L/fDcpx7/ISDFK6T8A/P3lOdQ==} - - '@changesets/get-github-info@0.7.0': - resolution: {integrity: sha512-+i67Bmhfj9V4KfDeS1+Tz3iF32btKZB2AAx+cYMqDSRFP7r3/ZdGbjCo+c6qkyViN9ygDuBjzageuPGJtKGe5A==} - - '@changesets/get-release-plan@4.0.14': - resolution: {integrity: sha512-yjZMHpUHgl4Xl5gRlolVuxDkm4HgSJqT93Ri1Uz8kGrQb+5iJ8dkXJ20M2j/Y4iV5QzS2c5SeTxVSKX+2eMI0g==} - - '@changesets/get-version-range-type@0.4.0': - resolution: {integrity: sha512-hwawtob9DryoGTpixy1D3ZXbGgJu1Rhr+ySH2PvTLHvkZuQ7sRT4oQwMh0hbqZH1weAooedEjRsbrWcGLCeyVQ==} - - '@changesets/git@3.0.4': - resolution: {integrity: sha512-BXANzRFkX+XcC1q/d27NKvlJ1yf7PSAgi8JG6dt8EfbHFHi4neau7mufcSca5zRhwOL8j9s6EqsxmT+s+/E6Sw==} - - '@changesets/logger@0.1.1': - resolution: {integrity: sha512-OQtR36ZlnuTxKqoW4Sv6x5YIhOmClRd5pWsjZsddYxpWs517R0HkyiefQPIytCVh4ZcC5x9XaG8KTdd5iRQUfg==} - - '@changesets/parse@0.4.2': - resolution: {integrity: sha512-Uo5MC5mfg4OM0jU3up66fmSn6/NE9INK+8/Vn/7sMVcdWg46zfbvvUSjD9EMonVqPi9fbrJH9SXHn48Tr1f2yA==} - - '@changesets/pre@2.0.2': - resolution: {integrity: sha512-HaL/gEyFVvkf9KFg6484wR9s0qjAXlZ8qWPDkTyKF6+zqjBe/I2mygg3MbpZ++hdi0ToqNUF8cjj7fBy0dg8Ug==} - - '@changesets/read@0.6.6': - resolution: {integrity: sha512-P5QaN9hJSQQKJShzzpBT13FzOSPyHbqdoIBUd2DJdgvnECCyO6LmAOWSV+O8se2TaZJVwSXjL+v9yhb+a9JeJg==} - - '@changesets/should-skip-package@0.1.2': - resolution: {integrity: sha512-qAK/WrqWLNCP22UDdBTMPH5f41elVDlsNyat180A33dWxuUDyNpg6fPi/FyTZwRriVjg0L8gnjJn2F9XAoF0qw==} - - '@changesets/types@4.1.0': - resolution: {integrity: sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==} - - '@changesets/types@6.1.0': - resolution: {integrity: sha512-rKQcJ+o1nKNgeoYRHKOS07tAMNd3YSN0uHaJOZYjBAgxfV7TUE7JE+z4BzZdQwb5hKaYbayKN5KrYV7ODb2rAA==} - - '@changesets/write@0.4.0': - resolution: {integrity: sha512-CdTLvIOPiCNuH71pyDu3rA+Q0n65cmAbXnwWH84rKGiFumFzkmHNT8KHTMEchcxN+Kl8I54xGUhJ7l3E7X396Q==} - - '@emnapi/core@1.7.1': - resolution: {integrity: sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==} - - '@emnapi/runtime@1.7.1': - resolution: {integrity: sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA==} - - '@emnapi/wasi-threads@1.1.0': - resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==} - - '@esbuild/aix-ppc64@0.25.12': - resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [aix] - - '@esbuild/android-arm64@0.25.12': - resolution: {integrity: sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [android] - - '@esbuild/android-arm@0.25.12': - resolution: {integrity: sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==} - engines: {node: '>=18'} - cpu: [arm] - os: [android] - - '@esbuild/android-x64@0.25.12': - resolution: {integrity: sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==} - engines: {node: '>=18'} - cpu: [x64] - os: [android] - - '@esbuild/darwin-arm64@0.25.12': - resolution: {integrity: sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [darwin] - - '@esbuild/darwin-x64@0.25.12': - resolution: {integrity: sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==} - engines: {node: '>=18'} - cpu: [x64] - os: [darwin] - - '@esbuild/freebsd-arm64@0.25.12': - resolution: {integrity: sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [freebsd] - - '@esbuild/freebsd-x64@0.25.12': - resolution: {integrity: sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [freebsd] - - '@esbuild/linux-arm64@0.25.12': - resolution: {integrity: sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==} - engines: {node: '>=18'} - cpu: [arm64] - os: [linux] - - '@esbuild/linux-arm@0.25.12': - resolution: {integrity: sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==} - engines: {node: '>=18'} - cpu: [arm] - os: [linux] - - '@esbuild/linux-ia32@0.25.12': - resolution: {integrity: sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==} - engines: {node: '>=18'} - cpu: [ia32] - os: [linux] - - '@esbuild/linux-loong64@0.25.12': - resolution: {integrity: sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==} - engines: {node: '>=18'} - cpu: [loong64] - os: [linux] - - '@esbuild/linux-mips64el@0.25.12': - resolution: {integrity: sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==} - engines: {node: '>=18'} - cpu: [mips64el] - os: [linux] - - '@esbuild/linux-ppc64@0.25.12': - resolution: {integrity: sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [linux] - - '@esbuild/linux-riscv64@0.25.12': - resolution: {integrity: sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==} - engines: {node: '>=18'} - cpu: [riscv64] - os: [linux] - - '@esbuild/linux-s390x@0.25.12': - resolution: {integrity: sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==} - engines: {node: '>=18'} - cpu: [s390x] - os: [linux] - - '@esbuild/linux-x64@0.25.12': - resolution: {integrity: sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==} - engines: {node: '>=18'} - cpu: [x64] - os: [linux] - - '@esbuild/netbsd-arm64@0.25.12': - resolution: {integrity: sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [netbsd] - - '@esbuild/netbsd-x64@0.25.12': - resolution: {integrity: sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [netbsd] - - '@esbuild/openbsd-arm64@0.25.12': - resolution: {integrity: sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openbsd] - - '@esbuild/openbsd-x64@0.25.12': - resolution: {integrity: sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==} - engines: {node: '>=18'} - cpu: [x64] - os: [openbsd] - - '@esbuild/openharmony-arm64@0.25.12': - resolution: {integrity: sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openharmony] - - '@esbuild/sunos-x64@0.25.12': - resolution: {integrity: sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==} - engines: {node: '>=18'} - cpu: [x64] - os: [sunos] - - '@esbuild/win32-arm64@0.25.12': - resolution: {integrity: sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [win32] - - '@esbuild/win32-ia32@0.25.12': - resolution: {integrity: sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==} - engines: {node: '>=18'} - cpu: [ia32] - os: [win32] - - '@esbuild/win32-x64@0.25.12': - resolution: {integrity: sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==} - engines: {node: '>=18'} - cpu: [x64] - os: [win32] - - '@eslint-community/eslint-utils@4.9.0': - resolution: {integrity: sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - - '@eslint-community/regexpp@4.12.2': - resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} - engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - - '@eslint/config-array@0.21.1': - resolution: {integrity: sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/config-helpers@0.4.2': - resolution: {integrity: sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/core@0.17.0': - resolution: {integrity: sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/eslintrc@3.3.1': - resolution: {integrity: sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/js@9.39.1': - resolution: {integrity: sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/object-schema@2.1.7': - resolution: {integrity: sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/plugin-kit@0.4.1': - resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@hono/node-server@1.19.7': - resolution: {integrity: sha512-vUcD0uauS7EU2caukW8z5lJKtoGMokxNbJtBiwHgpqxEXokaHCBkQUmCHhjFB1VUTWdqj25QoMkMKzgjq+uhrw==} - engines: {node: '>=18.14.1'} - peerDependencies: - hono: ^4 - - '@humanfs/core@0.19.1': - resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} - engines: {node: '>=18.18.0'} - - '@humanfs/node@0.16.7': - resolution: {integrity: sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==} - engines: {node: '>=18.18.0'} - - '@humanwhocodes/module-importer@1.0.1': - resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} - engines: {node: '>=12.22'} - - '@humanwhocodes/retry@0.4.3': - resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} - engines: {node: '>=18.18'} - - '@inquirer/external-editor@1.0.3': - resolution: {integrity: sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA==} - engines: {node: '>=18'} - peerDependencies: - '@types/node': '>=18' - peerDependenciesMeta: - '@types/node': - optional: true - - '@jridgewell/gen-mapping@0.3.13': - resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} - - '@jridgewell/resolve-uri@3.1.2': - resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} - engines: {node: '>=6.0.0'} - - '@jridgewell/sourcemap-codec@1.5.5': - resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} - - '@jridgewell/trace-mapping@0.3.31': - resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} - - '@manypkg/find-root@1.1.0': - resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} - - '@manypkg/get-packages@1.1.3': - resolution: {integrity: sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==} - - '@napi-rs/wasm-runtime@0.2.12': - resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==} - - '@napi-rs/wasm-runtime@1.1.0': - resolution: {integrity: sha512-Fq6DJW+Bb5jaWE69/qOE0D1TUN9+6uWhCeZpdnSBk14pjLcCWR7Q8n49PTSPHazM37JqrsdpEthXy2xn6jWWiA==} - - '@noble/hashes@1.8.0': - resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} - engines: {node: ^14.21.3 || >=16} - - '@nodelib/fs.scandir@2.1.5': - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - - '@nodelib/fs.stat@2.0.5': - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - - '@nodelib/fs.walk@1.2.8': - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - - '@oxc-project/types@0.101.0': - resolution: {integrity: sha512-nuFhqlUzJX+gVIPPfuE6xurd4lST3mdcWOhyK/rZO0B9XWMKm79SuszIQEnSMmmDhq1DC8WWVYGVd+6F93o1gQ==} - - '@paralleldrive/cuid2@2.3.1': - resolution: {integrity: sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==} - - '@quansync/fs@1.0.0': - resolution: {integrity: sha512-4TJ3DFtlf1L5LDMaM6CanJ/0lckGNtJcMjQ1NAV6zDmA0tEHKZtxNKin8EgPaVX1YzljbxckyT2tJrpQKAtngQ==} - - '@rolldown/binding-android-arm64@1.0.0-beta.53': - resolution: {integrity: sha512-Ok9V8o7o6YfSdTTYA/uHH30r3YtOxLD6G3wih/U9DO0ucBBFq8WPt/DslU53OgfteLRHITZny9N/qCUxMf9kjQ==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [arm64] - os: [android] - - '@rolldown/binding-darwin-arm64@1.0.0-beta.53': - resolution: {integrity: sha512-yIsKqMz0CtRnVa6x3Pa+mzTihr4Ty+Z6HfPbZ7RVbk1Uxnco4+CUn7Qbm/5SBol1JD/7nvY8rphAgyAi7Lj6Vg==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [arm64] - os: [darwin] - - '@rolldown/binding-darwin-x64@1.0.0-beta.53': - resolution: {integrity: sha512-GTXe+mxsCGUnJOFMhfGWmefP7Q9TpYUseHvhAhr21nCTgdS8jPsvirb0tJwM3lN0/u/cg7bpFNa16fQrjKrCjQ==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [x64] - os: [darwin] - - '@rolldown/binding-freebsd-x64@1.0.0-beta.53': - resolution: {integrity: sha512-9Tmp7bBvKqyDkMcL4e089pH3RsjD3SUungjmqWtyhNOxoQMh0fSmINTyYV8KXtE+JkxYMPWvnEt+/mfpVCkk8w==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [x64] - os: [freebsd] - - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.53': - resolution: {integrity: sha512-a1y5fiB0iovuzdbjUxa7+Zcvgv+mTmlGGC4XydVIsyl48eoxgaYkA3l9079hyTyhECsPq+mbr0gVQsFU11OJAQ==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [arm] - os: [linux] - - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.53': - resolution: {integrity: sha512-bpIGX+ov9PhJYV+wHNXl9rzq4F0QvILiURn0y0oepbQx+7stmQsKA0DhPGwmhfvF856wq+gbM8L92SAa/CBcLg==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [arm64] - os: [linux] - - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.53': - resolution: {integrity: sha512-bGe5EBB8FVjHBR1mOLOPEFg1Lp3//7geqWkU5NIhxe+yH0W8FVrQ6WRYOap4SUTKdklD/dC4qPLREkMMQ855FA==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [arm64] - os: [linux] - - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.53': - resolution: {integrity: sha512-qL+63WKVQs1CMvFedlPt0U9PiEKJOAL/bsHMKUDS6Vp2Q+YAv/QLPu8rcvkfIMvQ0FPU2WL0aX4eWwF6e/GAnA==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [x64] - os: [linux] - - '@rolldown/binding-linux-x64-musl@1.0.0-beta.53': - resolution: {integrity: sha512-VGl9JIGjoJh3H8Mb+7xnVqODajBmrdOOb9lxWXdcmxyI+zjB2sux69br0hZJDTyLJfvBoYm439zPACYbCjGRmw==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [x64] - os: [linux] - - '@rolldown/binding-openharmony-arm64@1.0.0-beta.53': - resolution: {integrity: sha512-B4iIserJXuSnNzA5xBLFUIjTfhNy7d9sq4FUMQY3GhQWGVhS2RWWzzDnkSU6MUt7/aHUrep0CdQfXUJI9D3W7A==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [arm64] - os: [openharmony] - - '@rolldown/binding-wasm32-wasi@1.0.0-beta.53': - resolution: {integrity: sha512-BUjAEgpABEJXilGq/BPh7jeU3WAJ5o15c1ZEgHaDWSz3LB881LQZnbNJHmUiM4d1JQWMYYyR1Y490IBHi2FPJg==} - engines: {node: '>=14.0.0'} - cpu: [wasm32] - - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.53': - resolution: {integrity: sha512-s27uU7tpCWSjHBnxyVXHt3rMrQdJq5MHNv3BzsewCIroIw3DJFjMH1dzCPPMUFxnh1r52Nf9IJ/eWp6LDoyGcw==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [arm64] - os: [win32] - - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.53': - resolution: {integrity: sha512-cjWL/USPJ1g0en2htb4ssMjIycc36RvdQAx1WlXnS6DpULswiUTVXPDesTifSKYSyvx24E0YqQkEm0K/M2Z/AA==} - engines: {node: ^20.19.0 || >=22.12.0} - cpu: [x64] - os: [win32] - - '@rolldown/pluginutils@1.0.0-beta.53': - resolution: {integrity: sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==} - - '@rollup/rollup-android-arm-eabi@4.53.2': - resolution: {integrity: sha512-yDPzwsgiFO26RJA4nZo8I+xqzh7sJTZIWQOxn+/XOdPE31lAvLIYCKqjV+lNH/vxE2L2iH3plKxDCRK6i+CwhA==} - cpu: [arm] - os: [android] - - '@rollup/rollup-android-arm64@4.53.2': - resolution: {integrity: sha512-k8FontTxIE7b0/OGKeSN5B6j25EuppBcWM33Z19JoVT7UTXFSo3D9CdU39wGTeb29NO3XxpMNauh09B+Ibw+9g==} - cpu: [arm64] - os: [android] - - '@rollup/rollup-darwin-arm64@4.53.2': - resolution: {integrity: sha512-A6s4gJpomNBtJ2yioj8bflM2oogDwzUiMl2yNJ2v9E7++sHrSrsQ29fOfn5DM/iCzpWcebNYEdXpaK4tr2RhfQ==} - cpu: [arm64] - os: [darwin] - - '@rollup/rollup-darwin-x64@4.53.2': - resolution: {integrity: sha512-e6XqVmXlHrBlG56obu9gDRPW3O3hLxpwHpLsBJvuI8qqnsrtSZ9ERoWUXtPOkY8c78WghyPHZdmPhHLWNdAGEw==} - cpu: [x64] - os: [darwin] - - '@rollup/rollup-freebsd-arm64@4.53.2': - resolution: {integrity: sha512-v0E9lJW8VsrwPux5Qe5CwmH/CF/2mQs6xU1MF3nmUxmZUCHazCjLgYvToOk+YuuUqLQBio1qkkREhxhc656ViA==} - cpu: [arm64] - os: [freebsd] - - '@rollup/rollup-freebsd-x64@4.53.2': - resolution: {integrity: sha512-ClAmAPx3ZCHtp6ysl4XEhWU69GUB1D+s7G9YjHGhIGCSrsg00nEGRRZHmINYxkdoJehde8VIsDC5t9C0gb6yqA==} - cpu: [x64] - os: [freebsd] - - '@rollup/rollup-linux-arm-gnueabihf@4.53.2': - resolution: {integrity: sha512-EPlb95nUsz6Dd9Qy13fI5kUPXNSljaG9FiJ4YUGU1O/Q77i5DYFW5KR8g1OzTcdZUqQQ1KdDqsTohdFVwCwjqg==} - cpu: [arm] - os: [linux] - - '@rollup/rollup-linux-arm-musleabihf@4.53.2': - resolution: {integrity: sha512-BOmnVW+khAUX+YZvNfa0tGTEMVVEerOxN0pDk2E6N6DsEIa2Ctj48FOMfNDdrwinocKaC7YXUZ1pHlKpnkja/Q==} - cpu: [arm] - os: [linux] - - '@rollup/rollup-linux-arm64-gnu@4.53.2': - resolution: {integrity: sha512-Xt2byDZ+6OVNuREgBXr4+CZDJtrVso5woFtpKdGPhpTPHcNG7D8YXeQzpNbFRxzTVqJf7kvPMCub/pcGUWgBjA==} - cpu: [arm64] - os: [linux] - - '@rollup/rollup-linux-arm64-musl@4.53.2': - resolution: {integrity: sha512-+LdZSldy/I9N8+klim/Y1HsKbJ3BbInHav5qE9Iy77dtHC/pibw1SR/fXlWyAk0ThnpRKoODwnAuSjqxFRDHUQ==} - cpu: [arm64] - os: [linux] - - '@rollup/rollup-linux-loong64-gnu@4.53.2': - resolution: {integrity: sha512-8ms8sjmyc1jWJS6WdNSA23rEfdjWB30LH8Wqj0Cqvv7qSHnvw6kgMMXRdop6hkmGPlyYBdRPkjJnj3KCUHV/uQ==} - cpu: [loong64] - os: [linux] - - '@rollup/rollup-linux-ppc64-gnu@4.53.2': - resolution: {integrity: sha512-3HRQLUQbpBDMmzoxPJYd3W6vrVHOo2cVW8RUo87Xz0JPJcBLBr5kZ1pGcQAhdZgX9VV7NbGNipah1omKKe23/g==} - cpu: [ppc64] - os: [linux] - - '@rollup/rollup-linux-riscv64-gnu@4.53.2': - resolution: {integrity: sha512-fMjKi+ojnmIvhk34gZP94vjogXNNUKMEYs+EDaB/5TG/wUkoeua7p7VCHnE6T2Tx+iaghAqQX8teQzcvrYpaQA==} - cpu: [riscv64] - os: [linux] - - '@rollup/rollup-linux-riscv64-musl@4.53.2': - resolution: {integrity: sha512-XuGFGU+VwUUV5kLvoAdi0Wz5Xbh2SrjIxCtZj6Wq8MDp4bflb/+ThZsVxokM7n0pcbkEr2h5/pzqzDYI7cCgLQ==} - cpu: [riscv64] - os: [linux] - - '@rollup/rollup-linux-s390x-gnu@4.53.2': - resolution: {integrity: sha512-w6yjZF0P+NGzWR3AXWX9zc0DNEGdtvykB03uhonSHMRa+oWA6novflo2WaJr6JZakG2ucsyb+rvhrKac6NIy+w==} - cpu: [s390x] - os: [linux] - - '@rollup/rollup-linux-x64-gnu@4.53.2': - resolution: {integrity: sha512-yo8d6tdfdeBArzC7T/PnHd7OypfI9cbuZzPnzLJIyKYFhAQ8SvlkKtKBMbXDxe1h03Rcr7u++nFS7tqXz87Gtw==} - cpu: [x64] - os: [linux] - - '@rollup/rollup-linux-x64-musl@4.53.2': - resolution: {integrity: sha512-ah59c1YkCxKExPP8O9PwOvs+XRLKwh/mV+3YdKqQ5AMQ0r4M4ZDuOrpWkUaqO7fzAHdINzV9tEVu8vNw48z0lA==} - cpu: [x64] - os: [linux] - - '@rollup/rollup-openharmony-arm64@4.53.2': - resolution: {integrity: sha512-4VEd19Wmhr+Zy7hbUsFZ6YXEiP48hE//KPLCSVNY5RMGX2/7HZ+QkN55a3atM1C/BZCGIgqN+xrVgtdak2S9+A==} - cpu: [arm64] - os: [openharmony] - - '@rollup/rollup-win32-arm64-msvc@4.53.2': - resolution: {integrity: sha512-IlbHFYc/pQCgew/d5fslcy1KEaYVCJ44G8pajugd8VoOEI8ODhtb/j8XMhLpwHCMB3yk2J07ctup10gpw2nyMA==} - cpu: [arm64] - os: [win32] - - '@rollup/rollup-win32-ia32-msvc@4.53.2': - resolution: {integrity: sha512-lNlPEGgdUfSzdCWU176ku/dQRnA7W+Gp8d+cWv73jYrb8uT7HTVVxq62DUYxjbaByuf1Yk0RIIAbDzp+CnOTFg==} - cpu: [ia32] - os: [win32] - - '@rollup/rollup-win32-x64-gnu@4.53.2': - resolution: {integrity: sha512-S6YojNVrHybQis2lYov1sd+uj7K0Q05NxHcGktuMMdIQ2VixGwAfbJ23NnlvvVV1bdpR2m5MsNBViHJKcA4ADw==} - cpu: [x64] - os: [win32] - - '@rollup/rollup-win32-x64-msvc@4.53.2': - resolution: {integrity: sha512-k+/Rkcyx//P6fetPoLMb8pBeqJBNGx81uuf7iljX9++yNBVRDQgD04L+SVXmXmh5ZP4/WOp4mWF0kmi06PW2tA==} - cpu: [x64] - os: [win32] - - '@rtsao/scc@1.1.0': - resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} - - '@standard-schema/spec@1.0.0': - resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==} - - '@tybys/wasm-util@0.10.1': - resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} - - '@types/body-parser@1.19.6': - resolution: {integrity: sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==} - - '@types/chai@5.2.3': - resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} - - '@types/connect@3.4.38': - resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} - - '@types/content-type@1.1.9': - resolution: {integrity: sha512-Hq9IMnfekuOCsEmYl4QX2HBrT+XsfXiupfrLLY8Dcf3Puf4BkBOxSbWYTITSOQAhJoYPBez+b4MJRpIYL65z8A==} - - '@types/cookiejar@2.1.5': - resolution: {integrity: sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==} - - '@types/cors@2.8.19': - resolution: {integrity: sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==} - - '@types/cross-spawn@6.0.6': - resolution: {integrity: sha512-fXRhhUkG4H3TQk5dBhQ7m/JDdSNHKwR2BBia62lhwEIq9xGiQKLxd6LymNhn47SjXhsUEPmxi+PKw2OkW4LLjA==} - - '@types/deep-eql@4.0.2': - resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} - - '@types/estree@1.0.8': - resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} - - '@types/eventsource@1.1.15': - resolution: {integrity: sha512-XQmGcbnxUNa06HR3VBVkc9+A2Vpi9ZyLJcdS5dwaQQ/4ZMWFO+5c90FnMUpbtMZwB/FChoYHwuVg8TvkECacTA==} - - '@types/express-serve-static-core@5.1.0': - resolution: {integrity: sha512-jnHMsrd0Mwa9Cf4IdOzbz543y4XJepXrbia2T4b6+spXC2We3t1y6K44D3mR8XMFSXMCf3/l7rCgddfx7UNVBA==} - - '@types/express@5.0.5': - resolution: {integrity: sha512-LuIQOcb6UmnF7C1PCFmEU1u2hmiHL43fgFQX67sN3H4Z+0Yk0Neo++mFsBjhOAuLzvlQeqAAkeDOZrJs9rzumQ==} - - '@types/http-errors@2.0.5': - resolution: {integrity: sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==} - - '@types/json-schema@7.0.15': - resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - - '@types/json5@0.0.29': - resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - - '@types/methods@1.1.4': - resolution: {integrity: sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==} - - '@types/mime@1.3.5': - resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==} - - '@types/node@12.20.55': - resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - - '@types/node@24.10.3': - resolution: {integrity: sha512-gqkrWUsS8hcm0r44yn7/xZeV1ERva/nLgrLxFRUGb7aoNMIJfZJ3AC261zDQuOAKC7MiXai1WCpYc48jAHoShQ==} - - '@types/qs@6.14.0': - resolution: {integrity: sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==} - - '@types/range-parser@1.2.7': - resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==} - - '@types/send@0.17.6': - resolution: {integrity: sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==} - - '@types/send@1.2.1': - resolution: {integrity: sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==} - - '@types/serve-static@1.15.10': - resolution: {integrity: sha512-tRs1dB+g8Itk72rlSI2ZrW6vZg0YrLI81iQSTkMmOqnqCaNr/8Ek4VwWcN5vZgCYWbg/JJSGBlUaYGAOP73qBw==} - - '@types/superagent@8.1.9': - resolution: {integrity: sha512-pTVjI73witn+9ILmoJdajHGW2jkSaOzhiFYF1Rd3EQ94kymLqB9PjD9ISg7WaALC7+dCHT0FGe9T2LktLq/3GQ==} - - '@types/supertest@6.0.3': - resolution: {integrity: sha512-8WzXq62EXFhJ7QsH3Ocb/iKQ/Ty9ZVWnVzoTKc9tyyFRRF3a74Tk2+TLFgaFFw364Ere+npzHKEJ6ga2LzIL7w==} - - '@types/ws@8.18.1': - resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==} - - '@typescript-eslint/eslint-plugin@8.49.0': - resolution: {integrity: sha512-JXij0vzIaTtCwu6SxTh8qBc66kmf1xs7pI4UOiMDFVct6q86G0Zs7KRcEoJgY3Cav3x5Tq0MF5jwgpgLqgKG3A==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - '@typescript-eslint/parser': ^8.49.0 - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/parser@8.49.0': - resolution: {integrity: sha512-N9lBGA9o9aqb1hVMc9hzySbhKibHmB+N3IpoShyV6HyQYRGIhlrO5rQgttypi+yEeKsKI4idxC8Jw6gXKD4THA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/project-service@8.49.0': - resolution: {integrity: sha512-/wJN0/DKkmRUMXjZUXYZpD1NEQzQAAn9QWfGwo+Ai8gnzqH7tvqS7oNVdTjKqOcPyVIdZdyCMoqN66Ia789e7g==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/scope-manager@8.49.0': - resolution: {integrity: sha512-npgS3zi+/30KSOkXNs0LQXtsg9ekZ8OISAOLGWA/ZOEn0ZH74Ginfl7foziV8DT+D98WfQ5Kopwqb/PZOaIJGg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@typescript-eslint/tsconfig-utils@8.49.0': - resolution: {integrity: sha512-8prixNi1/6nawsRYxet4YOhnbW+W9FK/bQPxsGB1D3ZrDzbJ5FXw5XmzxZv82X3B+ZccuSxo/X8q9nQ+mFecWA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/type-utils@8.49.0': - resolution: {integrity: sha512-KTExJfQ+svY8I10P4HdxKzWsvtVnsuCifU5MvXrRwoP2KOlNZ9ADNEWWsQTJgMxLzS5VLQKDjkCT/YzgsnqmZg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/types@8.49.0': - resolution: {integrity: sha512-e9k/fneezorUo6WShlQpMxXh8/8wfyc+biu6tnAqA81oWrEic0k21RHzP9uqqpyBBeBKu4T+Bsjy9/b8u7obXQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@typescript-eslint/typescript-estree@8.49.0': - resolution: {integrity: sha512-jrLdRuAbPfPIdYNppHJ/D0wN+wwNfJ32YTAm10eJVsFmrVpXQnDWBn8niCSMlWjvml8jsce5E/O+86IQtTbJWA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/utils@8.49.0': - resolution: {integrity: sha512-N3W7rJw7Rw+z1tRsHZbK395TWSYvufBXumYtEGzypgMUthlg0/hmCImeA8hgO2d2G4pd7ftpxxul2J8OdtdaFA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/visitor-keys@8.49.0': - resolution: {integrity: sha512-LlKaciDe3GmZFphXIc79THF/YYBugZ7FS1pO581E/edlVVNbZKDy93evqmrfQ9/Y4uN0vVhX4iuchq26mK/iiA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@typescript/native-preview-darwin-arm64@7.0.0-dev.20251218.3': - resolution: {integrity: sha512-4Ew2waH0alZk3fuTIFJ7EsfjIqDj3mNYLa9aTQse6Xnfv16uFEwHbMs4RR1k6qPbPMnyKMC9fpY6f6p1WAPw4A==} - cpu: [arm64] - os: [darwin] - - '@typescript/native-preview-darwin-x64@7.0.0-dev.20251218.3': - resolution: {integrity: sha512-d+6aZW6ig5QdeZzGct6pm0/QoY+cDjUNggG34EefU8m13ThQUCYZ8xMxtSBJsPpFB7AX+iewE2DJtBdgoEbPdg==} - cpu: [x64] - os: [darwin] - - '@typescript/native-preview-linux-arm64@7.0.0-dev.20251218.3': - resolution: {integrity: sha512-0LY5RZTvShYYKyxy6ApDqpR0fMUaZUwpNYt9tRUoO4zfTLQdn38xMC4vgRZ3AtYSFX0Y185vLraa+tsdVJcvRw==} - cpu: [arm64] - os: [linux] - - '@typescript/native-preview-linux-arm@7.0.0-dev.20251218.3': - resolution: {integrity: sha512-V62lMa3P4Tqynh2qdIEg9MA43Q19YoVbiG+Am6+TL3JV1gkPNCKr17risKz2GXuNRDJvaxrOm6OTRkceoK8Wgg==} - cpu: [arm] - os: [linux] - - '@typescript/native-preview-linux-x64@7.0.0-dev.20251218.3': - resolution: {integrity: sha512-Qi51LQVNiyKcMUnmx2rwSSBWjcxZ+Ec0nkpmeimV0WT1LZJ7ZipJ7KvRRcqLHF2WRk14kknFqDAS83RjdSkPfQ==} - cpu: [x64] - os: [linux] - - '@typescript/native-preview-win32-arm64@7.0.0-dev.20251218.3': - resolution: {integrity: sha512-y2EQoWU9CfVY3qBUbv0JJqddwsUrz7sRx+08mFg3XZOAMPfq6nwmsGrjNeiYBVwIg7gkZO4BqHL0Ktn6PZ9unA==} - cpu: [arm64] - os: [win32] - - '@typescript/native-preview-win32-x64@7.0.0-dev.20251218.3': - resolution: {integrity: sha512-X1s/tIpHhJP3OL/1qAXnfl8XUoCpv5DmWZhLcFB6F7ZjtH4EmvorrCaeSxdb88/KiL8gcxwipdm69eJb0fZWvA==} - cpu: [x64] - os: [win32] - - '@typescript/native-preview@7.0.0-dev.20251218.3': - resolution: {integrity: sha512-FxHW0n7KFG3QhcwRDsP/EWzkvjQYnIqfuDn1y0w4pl6KNh2aK9CRvHjA7bwpft64Tm5eCtYTHM+Gts7MElo9fA==} - hasBin: true - - '@unrs/resolver-binding-android-arm-eabi@1.11.1': - resolution: {integrity: sha512-ppLRUgHVaGRWUx0R0Ut06Mjo9gBaBkg3v/8AxusGLhsIotbBLuRk51rAzqLC8gq6NyyAojEXglNjzf6R948DNw==} - cpu: [arm] - os: [android] - - '@unrs/resolver-binding-android-arm64@1.11.1': - resolution: {integrity: sha512-lCxkVtb4wp1v+EoN+HjIG9cIIzPkX5OtM03pQYkG+U5O/wL53LC4QbIeazgiKqluGeVEeBlZahHalCaBvU1a2g==} - cpu: [arm64] - os: [android] - - '@unrs/resolver-binding-darwin-arm64@1.11.1': - resolution: {integrity: sha512-gPVA1UjRu1Y/IsB/dQEsp2V1pm44Of6+LWvbLc9SDk1c2KhhDRDBUkQCYVWe6f26uJb3fOK8saWMgtX8IrMk3g==} - cpu: [arm64] - os: [darwin] - - '@unrs/resolver-binding-darwin-x64@1.11.1': - resolution: {integrity: sha512-cFzP7rWKd3lZaCsDze07QX1SC24lO8mPty9vdP+YVa3MGdVgPmFc59317b2ioXtgCMKGiCLxJ4HQs62oz6GfRQ==} - cpu: [x64] - os: [darwin] - - '@unrs/resolver-binding-freebsd-x64@1.11.1': - resolution: {integrity: sha512-fqtGgak3zX4DCB6PFpsH5+Kmt/8CIi4Bry4rb1ho6Av2QHTREM+47y282Uqiu3ZRF5IQioJQ5qWRV6jduA+iGw==} - cpu: [x64] - os: [freebsd] - - '@unrs/resolver-binding-linux-arm-gnueabihf@1.11.1': - resolution: {integrity: sha512-u92mvlcYtp9MRKmP+ZvMmtPN34+/3lMHlyMj7wXJDeXxuM0Vgzz0+PPJNsro1m3IZPYChIkn944wW8TYgGKFHw==} - cpu: [arm] - os: [linux] - - '@unrs/resolver-binding-linux-arm-musleabihf@1.11.1': - resolution: {integrity: sha512-cINaoY2z7LVCrfHkIcmvj7osTOtm6VVT16b5oQdS4beibX2SYBwgYLmqhBjA1t51CarSaBuX5YNsWLjsqfW5Cw==} - cpu: [arm] - os: [linux] - - '@unrs/resolver-binding-linux-arm64-gnu@1.11.1': - resolution: {integrity: sha512-34gw7PjDGB9JgePJEmhEqBhWvCiiWCuXsL9hYphDF7crW7UgI05gyBAi6MF58uGcMOiOqSJ2ybEeCvHcq0BCmQ==} - cpu: [arm64] - os: [linux] - - '@unrs/resolver-binding-linux-arm64-musl@1.11.1': - resolution: {integrity: sha512-RyMIx6Uf53hhOtJDIamSbTskA99sPHS96wxVE/bJtePJJtpdKGXO1wY90oRdXuYOGOTuqjT8ACccMc4K6QmT3w==} - cpu: [arm64] - os: [linux] - - '@unrs/resolver-binding-linux-ppc64-gnu@1.11.1': - resolution: {integrity: sha512-D8Vae74A4/a+mZH0FbOkFJL9DSK2R6TFPC9M+jCWYia/q2einCubX10pecpDiTmkJVUH+y8K3BZClycD8nCShA==} - cpu: [ppc64] - os: [linux] - - '@unrs/resolver-binding-linux-riscv64-gnu@1.11.1': - resolution: {integrity: sha512-frxL4OrzOWVVsOc96+V3aqTIQl1O2TjgExV4EKgRY09AJ9leZpEg8Ak9phadbuX0BA4k8U5qtvMSQQGGmaJqcQ==} - cpu: [riscv64] - os: [linux] - - '@unrs/resolver-binding-linux-riscv64-musl@1.11.1': - resolution: {integrity: sha512-mJ5vuDaIZ+l/acv01sHoXfpnyrNKOk/3aDoEdLO/Xtn9HuZlDD6jKxHlkN8ZhWyLJsRBxfv9GYM2utQ1SChKew==} - cpu: [riscv64] - os: [linux] - - '@unrs/resolver-binding-linux-s390x-gnu@1.11.1': - resolution: {integrity: sha512-kELo8ebBVtb9sA7rMe1Cph4QHreByhaZ2QEADd9NzIQsYNQpt9UkM9iqr2lhGr5afh885d/cB5QeTXSbZHTYPg==} - cpu: [s390x] - os: [linux] - - '@unrs/resolver-binding-linux-x64-gnu@1.11.1': - resolution: {integrity: sha512-C3ZAHugKgovV5YvAMsxhq0gtXuwESUKc5MhEtjBpLoHPLYM+iuwSj3lflFwK3DPm68660rZ7G8BMcwSro7hD5w==} - cpu: [x64] - os: [linux] - - '@unrs/resolver-binding-linux-x64-musl@1.11.1': - resolution: {integrity: sha512-rV0YSoyhK2nZ4vEswT/QwqzqQXw5I6CjoaYMOX0TqBlWhojUf8P94mvI7nuJTeaCkkds3QE4+zS8Ko+GdXuZtA==} - cpu: [x64] - os: [linux] - - '@unrs/resolver-binding-wasm32-wasi@1.11.1': - resolution: {integrity: sha512-5u4RkfxJm+Ng7IWgkzi3qrFOvLvQYnPBmjmZQ8+szTK/b31fQCnleNl1GgEt7nIsZRIf5PLhPwT0WM+q45x/UQ==} - engines: {node: '>=14.0.0'} - cpu: [wasm32] - - '@unrs/resolver-binding-win32-arm64-msvc@1.11.1': - resolution: {integrity: sha512-nRcz5Il4ln0kMhfL8S3hLkxI85BXs3o8EYoattsJNdsX4YUU89iOkVn7g0VHSRxFuVMdM4Q1jEpIId1Ihim/Uw==} - cpu: [arm64] - os: [win32] - - '@unrs/resolver-binding-win32-ia32-msvc@1.11.1': - resolution: {integrity: sha512-DCEI6t5i1NmAZp6pFonpD5m7i6aFrpofcp4LA2i8IIq60Jyo28hamKBxNrZcyOwVOZkgsRp9O2sXWBWP8MnvIQ==} - cpu: [ia32] - os: [win32] - - '@unrs/resolver-binding-win32-x64-msvc@1.11.1': - resolution: {integrity: sha512-lrW200hZdbfRtztbygyaq/6jP6AKE8qQN2KvPcJ+x7wiD038YtnYtZ82IMNJ69GJibV7bwL3y9FgK+5w/pYt6g==} - cpu: [x64] - os: [win32] - - '@vitest/expect@4.0.9': - resolution: {integrity: sha512-C2vyXf5/Jfj1vl4DQYxjib3jzyuswMi/KHHVN2z+H4v16hdJ7jMZ0OGe3uOVIt6LyJsAofDdaJNIFEpQcrSTFw==} - - '@vitest/mocker@4.0.9': - resolution: {integrity: sha512-PUyaowQFHW+9FKb4dsvvBM4o025rWMlEDXdWRxIOilGaHREYTi5Q2Rt9VCgXgPy/hHZu1LeuXtrA/GdzOatP2g==} - peerDependencies: - msw: ^2.4.9 - vite: ^6.0.0 || ^7.0.0-0 - peerDependenciesMeta: - msw: - optional: true - vite: - optional: true - - '@vitest/pretty-format@4.0.9': - resolution: {integrity: sha512-Hor0IBTwEi/uZqB7pvGepyElaM8J75pYjrrqbC8ZYMB9/4n5QA63KC15xhT+sqHpdGWfdnPo96E8lQUxs2YzSQ==} - - '@vitest/runner@4.0.9': - resolution: {integrity: sha512-aF77tsXdEvIJRkj9uJZnHtovsVIx22Ambft9HudC+XuG/on1NY/bf5dlDti1N35eJT+QZLb4RF/5dTIG18s98w==} - - '@vitest/snapshot@4.0.9': - resolution: {integrity: sha512-r1qR4oYstPbnOjg0Vgd3E8ADJbi4ditCzqr+Z9foUrRhIy778BleNyZMeAJ2EjV+r4ASAaDsdciC9ryMy8xMMg==} - - '@vitest/spy@4.0.9': - resolution: {integrity: sha512-J9Ttsq0hDXmxmT8CUOWUr1cqqAj2FJRGTdyEjSR+NjoOGKEqkEWj+09yC0HhI8t1W6t4Ctqawl1onHgipJve1A==} - - '@vitest/utils@4.0.9': - resolution: {integrity: sha512-cEol6ygTzY4rUPvNZM19sDf7zGa35IYTm9wfzkHoT/f5jX10IOY7QleWSOh5T0e3I3WVozwK5Asom79qW8DiuQ==} - - accepts@2.0.0: - resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} - engines: {node: '>= 0.6'} - - acorn-jsx@5.3.2: - resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} - peerDependencies: - acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - - acorn@8.15.0: - resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} - engines: {node: '>=0.4.0'} - hasBin: true - - ajv-formats@3.0.1: - resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} - peerDependencies: - ajv: ^8.0.0 - peerDependenciesMeta: - ajv: - optional: true - - ajv@6.12.6: - resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - - ajv@8.17.1: - resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} - - ansi-colors@4.1.3: - resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} - engines: {node: '>=6'} - - ansi-regex@5.0.1: - resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} - engines: {node: '>=8'} - - ansi-styles@4.3.0: - resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} - engines: {node: '>=8'} - - ansis@4.2.0: - resolution: {integrity: sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig==} - engines: {node: '>=14'} - - argparse@1.0.10: - resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} - - argparse@2.0.1: - resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - - array-buffer-byte-length@1.0.2: - resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==} - engines: {node: '>= 0.4'} - - array-includes@3.1.9: - resolution: {integrity: sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==} - engines: {node: '>= 0.4'} - - array-union@2.1.0: - resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} - engines: {node: '>=8'} - - array.prototype.findlastindex@1.2.6: - resolution: {integrity: sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==} - engines: {node: '>= 0.4'} - - array.prototype.flat@1.3.3: - resolution: {integrity: sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==} - engines: {node: '>= 0.4'} - - array.prototype.flatmap@1.3.3: - resolution: {integrity: sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==} - engines: {node: '>= 0.4'} - - arraybuffer.prototype.slice@1.0.4: - resolution: {integrity: sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==} - engines: {node: '>= 0.4'} - - asap@2.0.6: - resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} - - assertion-error@2.0.1: - resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} - engines: {node: '>=12'} - - ast-kit@2.2.0: - resolution: {integrity: sha512-m1Q/RaVOnTp9JxPX+F+Zn7IcLYMzM8kZofDImfsKZd8MbR+ikdOzTeztStWqfrqIxZnYWryyI9ePm3NGjnZgGw==} - engines: {node: '>=20.19.0'} - - async-function@1.0.0: - resolution: {integrity: sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==} - engines: {node: '>= 0.4'} - - asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - - available-typed-arrays@1.0.7: - resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} - engines: {node: '>= 0.4'} - - balanced-match@1.0.2: - resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - - better-path-resolve@1.0.0: - resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} - engines: {node: '>=4'} - - birpc@3.0.0: - resolution: {integrity: sha512-by+04pHuxpCEQcucAXqzopqfhyI8TLK5Qg5MST0cB6MP+JhHna9ollrtK9moVh27aq6Q6MEJgebD0cVm//yBkg==} - - body-parser@2.2.0: - resolution: {integrity: sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==} - engines: {node: '>=18'} - - brace-expansion@1.1.12: - resolution: {integrity: sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==} - - brace-expansion@2.0.2: - resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==} - - braces@3.0.3: - resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} - engines: {node: '>=8'} - - bytes@3.1.2: - resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} - engines: {node: '>= 0.8'} - - cac@6.7.14: - resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} - engines: {node: '>=8'} - - call-bind-apply-helpers@1.0.2: - resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} - engines: {node: '>= 0.4'} - - call-bind@1.0.8: - resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} - engines: {node: '>= 0.4'} - - call-bound@1.0.4: - resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} - engines: {node: '>= 0.4'} - - callsites@3.1.0: - resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} - engines: {node: '>=6'} - - chai@6.2.1: - resolution: {integrity: sha512-p4Z49OGG5W/WBCPSS/dH3jQ73kD6tiMmUM+bckNK6Jr5JHMG3k9bg/BvKR8lKmtVBKmOiuVaV2ws8s9oSbwysg==} - engines: {node: '>=18'} - - chalk@4.1.2: - resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} - engines: {node: '>=10'} - - chardet@2.1.1: - resolution: {integrity: sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==} - - ci-info@3.9.0: - resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} - engines: {node: '>=8'} - - color-convert@2.0.1: - resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} - engines: {node: '>=7.0.0'} - - color-name@1.1.4: - resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - - combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - - component-emitter@1.3.1: - resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} - - concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - - content-disposition@1.0.0: - resolution: {integrity: sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==} - engines: {node: '>= 0.6'} - - content-type@1.0.5: - resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} - engines: {node: '>= 0.6'} - - cookie-signature@1.2.2: - resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==} - engines: {node: '>=6.6.0'} - - cookie@0.7.2: - resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} - engines: {node: '>= 0.6'} - - cookiejar@2.1.4: - resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==} - - cors@2.8.5: - resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} - engines: {node: '>= 0.10'} - - cross-spawn@7.0.6: - resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} - engines: {node: '>= 8'} - - data-view-buffer@1.0.2: - resolution: {integrity: sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==} - engines: {node: '>= 0.4'} - - data-view-byte-length@1.0.2: - resolution: {integrity: sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==} - engines: {node: '>= 0.4'} - - data-view-byte-offset@1.0.1: - resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==} - engines: {node: '>= 0.4'} - - dataloader@1.4.0: - resolution: {integrity: sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==} - - debug@3.2.7: - resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - - debug@4.4.3: - resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - - deep-is@0.1.4: - resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} - - define-data-property@1.1.4: - resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} - engines: {node: '>= 0.4'} - - define-properties@1.2.1: - resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} - engines: {node: '>= 0.4'} - - defu@6.1.4: - resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} - - delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - - depd@2.0.0: - resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} - engines: {node: '>= 0.8'} - - detect-indent@6.1.0: - resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} - engines: {node: '>=8'} - - dezalgo@1.0.4: - resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==} - - dir-glob@3.0.1: - resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} - engines: {node: '>=8'} - - doctrine@2.1.0: - resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} - engines: {node: '>=0.10.0'} - - dotenv@8.6.0: - resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} - engines: {node: '>=10'} - - dts-resolver@2.1.3: - resolution: {integrity: sha512-bihc7jPC90VrosXNzK0LTE2cuLP6jr0Ro8jk+kMugHReJVLIpHz/xadeq3MhuwyO4TD4OA3L1Q8pBBFRc08Tsw==} - engines: {node: '>=20.19.0'} - peerDependencies: - oxc-resolver: '>=11.0.0' - peerDependenciesMeta: - oxc-resolver: - optional: true - - dunder-proto@1.0.1: - resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} - engines: {node: '>= 0.4'} - - ee-first@1.1.1: - resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - - empathic@2.0.0: - resolution: {integrity: sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA==} - engines: {node: '>=14'} - - encodeurl@2.0.0: - resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} - engines: {node: '>= 0.8'} - - enhanced-resolve@5.18.3: - resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==} - engines: {node: '>=10.13.0'} - - enquirer@2.4.1: - resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} - engines: {node: '>=8.6'} - - es-abstract@1.24.0: - resolution: {integrity: sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==} - engines: {node: '>= 0.4'} - - es-define-property@1.0.1: - resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} - engines: {node: '>= 0.4'} - - es-errors@1.3.0: - resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} - engines: {node: '>= 0.4'} - - es-module-lexer@1.7.0: - resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} - - es-object-atoms@1.1.1: - resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} - engines: {node: '>= 0.4'} - - es-set-tostringtag@2.1.0: - resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} - engines: {node: '>= 0.4'} - - es-shim-unscopables@1.1.0: - resolution: {integrity: sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==} - engines: {node: '>= 0.4'} - - es-to-primitive@1.3.0: - resolution: {integrity: sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==} - engines: {node: '>= 0.4'} - - esbuild@0.25.12: - resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==} - engines: {node: '>=18'} - hasBin: true - - escape-html@1.0.3: - resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} - - escape-string-regexp@4.0.0: - resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} - engines: {node: '>=10'} - - eslint-compat-utils@0.5.1: - resolution: {integrity: sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==} - engines: {node: '>=12'} - peerDependencies: - eslint: '>=6.0.0' - - eslint-config-prettier@10.1.8: - resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - - eslint-import-context@0.1.9: - resolution: {integrity: sha512-K9Hb+yRaGAGUbwjhFNHvSmmkZs9+zbuoe3kFQ4V1wYjrepUFYM2dZAfNtjbbj3qsPfUfsA68Bx/ICWQMi+C8Eg==} - engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - peerDependencies: - unrs-resolver: ^1.0.0 - peerDependenciesMeta: - unrs-resolver: - optional: true - - eslint-import-resolver-node@0.3.9: - resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} - - eslint-import-resolver-typescript@4.4.4: - resolution: {integrity: sha512-1iM2zeBvrYmUNTj2vSC/90JTHDth+dfOfiNKkxApWRsTJYNrc8rOdxxIf5vazX+BiAXTeOT0UvWpGI/7qIWQOw==} - engines: {node: ^16.17.0 || >=18.6.0} - peerDependencies: - eslint: '*' - eslint-plugin-import: '*' - eslint-plugin-import-x: '*' - peerDependenciesMeta: - eslint-plugin-import: - optional: true - eslint-plugin-import-x: - optional: true - - eslint-module-utils@2.12.1: - resolution: {integrity: sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==} - engines: {node: '>=4'} - peerDependencies: - '@typescript-eslint/parser': '*' - eslint: '*' - eslint-import-resolver-node: '*' - eslint-import-resolver-typescript: '*' - eslint-import-resolver-webpack: '*' - peerDependenciesMeta: - '@typescript-eslint/parser': - optional: true - eslint: - optional: true - eslint-import-resolver-node: - optional: true - eslint-import-resolver-typescript: - optional: true - eslint-import-resolver-webpack: - optional: true - - eslint-plugin-es-x@7.8.0: - resolution: {integrity: sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - eslint: '>=8' - - eslint-plugin-import@2.32.0: - resolution: {integrity: sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==} - engines: {node: '>=4'} - peerDependencies: - '@typescript-eslint/parser': '*' - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9 - peerDependenciesMeta: - '@typescript-eslint/parser': - optional: true - - eslint-plugin-n@17.23.1: - resolution: {integrity: sha512-68PealUpYoHOBh332JLLD9Sj7OQUDkFpmcfqt8R9sySfFSeuGJjMTJQvCRRB96zO3A/PELRLkPrzsHmzEFQQ5A==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: '>=8.23.0' - - eslint-plugin-simple-import-sort@12.1.1: - resolution: {integrity: sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==} - peerDependencies: - eslint: '>=5.0.0' - - eslint-scope@8.4.0: - resolution: {integrity: sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - eslint-visitor-keys@3.4.3: - resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - - eslint-visitor-keys@4.2.1: - resolution: {integrity: sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - eslint@9.39.1: - resolution: {integrity: sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - hasBin: true - peerDependencies: - jiti: '*' - peerDependenciesMeta: - jiti: - optional: true - - espree@10.4.0: - resolution: {integrity: sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - esprima@4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - - esquery@1.6.0: - resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} - engines: {node: '>=0.10'} - - esrecurse@4.3.0: - resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} - engines: {node: '>=4.0'} - - estraverse@5.3.0: - resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} - engines: {node: '>=4.0'} - - estree-walker@3.0.3: - resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} - - esutils@2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - - etag@1.8.1: - resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} - engines: {node: '>= 0.6'} - - eventsource-parser@3.0.6: - resolution: {integrity: sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==} - engines: {node: '>=18.0.0'} - - eventsource@3.0.7: - resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==} - engines: {node: '>=18.0.0'} - - expect-type@1.2.2: - resolution: {integrity: sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==} - engines: {node: '>=12.0.0'} - - express-rate-limit@7.5.1: - resolution: {integrity: sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==} - engines: {node: '>= 16'} - peerDependencies: - express: '>= 4.11' - - express@5.1.0: - resolution: {integrity: sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==} - engines: {node: '>= 18'} - - extendable-error@0.1.7: - resolution: {integrity: sha512-UOiS2in6/Q0FK0R0q6UY9vYpQ21mr/Qn1KOnte7vsACuNJf514WvCCUHSRCPcgjPT2bAhNIJdlE6bVap1GKmeg==} - - fast-deep-equal@3.1.3: - resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - - fast-glob@3.3.3: - resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} - engines: {node: '>=8.6.0'} - - fast-json-stable-stringify@2.1.0: - resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - - fast-levenshtein@2.0.6: - resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - - fast-safe-stringify@2.1.1: - resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} - - fast-uri@3.1.0: - resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==} - - fastq@1.19.1: - resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} - - fdir@6.5.0: - resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} - engines: {node: '>=12.0.0'} - peerDependencies: - picomatch: ^3 || ^4 - peerDependenciesMeta: - picomatch: - optional: true - - file-entry-cache@8.0.0: - resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} - engines: {node: '>=16.0.0'} - - fill-range@7.1.1: - resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} - engines: {node: '>=8'} - - finalhandler@2.1.0: - resolution: {integrity: sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==} - engines: {node: '>= 0.8'} - - find-up@4.1.0: - resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} - engines: {node: '>=8'} - - find-up@5.0.0: - resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} - engines: {node: '>=10'} - - flat-cache@4.0.1: - resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} - engines: {node: '>=16'} - - flatted@3.3.3: - resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==} - - for-each@0.3.5: - resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==} - engines: {node: '>= 0.4'} - - form-data@4.0.4: - resolution: {integrity: sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==} - engines: {node: '>= 6'} - - formidable@3.5.4: - resolution: {integrity: sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==} - engines: {node: '>=14.0.0'} - - forwarded@0.2.0: - resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} - engines: {node: '>= 0.6'} - - fresh@2.0.0: - resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} - engines: {node: '>= 0.8'} - - fs-extra@7.0.1: - resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} - engines: {node: '>=6 <7 || >=8'} - - fs-extra@8.1.0: - resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} - engines: {node: '>=6 <7 || >=8'} - - fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - - function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - - function.prototype.name@1.1.8: - resolution: {integrity: sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==} - engines: {node: '>= 0.4'} - - functions-have-names@1.2.3: - resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} - - generator-function@2.0.1: - resolution: {integrity: sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==} - engines: {node: '>= 0.4'} - - get-intrinsic@1.3.0: - resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} - engines: {node: '>= 0.4'} - - get-proto@1.0.1: - resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} - engines: {node: '>= 0.4'} - - get-symbol-description@1.1.0: - resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==} - engines: {node: '>= 0.4'} - - get-tsconfig@4.13.0: - resolution: {integrity: sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==} - - glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - - glob-parent@6.0.2: - resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} - engines: {node: '>=10.13.0'} - - globals@14.0.0: - resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} - engines: {node: '>=18'} - - globals@15.15.0: - resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==} - engines: {node: '>=18'} - - globalthis@1.0.4: - resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} - engines: {node: '>= 0.4'} - - globby@11.1.0: - resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} - engines: {node: '>=10'} - - globrex@0.1.2: - resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} - - gopd@1.2.0: - resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} - engines: {node: '>= 0.4'} - - graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - - has-bigints@1.1.0: - resolution: {integrity: sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==} - engines: {node: '>= 0.4'} - - has-flag@4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - - has-property-descriptors@1.0.2: - resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} - - has-proto@1.2.0: - resolution: {integrity: sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==} - engines: {node: '>= 0.4'} - - has-symbols@1.1.0: - resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} - engines: {node: '>= 0.4'} - - has-tostringtag@1.0.2: - resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} - engines: {node: '>= 0.4'} - - hasown@2.0.2: - resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} - engines: {node: '>= 0.4'} - - hono@4.11.1: - resolution: {integrity: sha512-KsFcH0xxHes0J4zaQgWbYwmz3UPOOskdqZmItstUG93+Wk1ePBLkLGwbP9zlmh1BFUiL8Qp+Xfu9P7feJWpGNg==} - engines: {node: '>=16.9.0'} - - hookable@5.5.3: - resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} - - http-errors@2.0.0: - resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} - engines: {node: '>= 0.8'} - - human-id@4.1.3: - resolution: {integrity: sha512-tsYlhAYpjCKa//8rXZ9DqKEawhPoSytweBC2eNvcaDK+57RZLHGqNs3PZTQO6yekLFSuvA6AlnAfrw1uBvtb+Q==} - hasBin: true - - iconv-lite@0.6.3: - resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} - engines: {node: '>=0.10.0'} - - iconv-lite@0.7.0: - resolution: {integrity: sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==} - engines: {node: '>=0.10.0'} - - ignore@5.3.2: - resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} - engines: {node: '>= 4'} - - ignore@7.0.5: - resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} - engines: {node: '>= 4'} - - import-fresh@3.3.1: - resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} - engines: {node: '>=6'} - - import-without-cache@0.2.3: - resolution: {integrity: sha512-roCvX171VqJ7+7pQt1kSRfwaJvFAC2zhThJWXal1rN8EqzPS3iapkAoNpHh4lM8Na1BDen+n9rVfo73RN+Y87g==} - engines: {node: '>=20.19.0'} - - imurmurhash@0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - - inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - - internal-slot@1.1.0: - resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} - engines: {node: '>= 0.4'} - - ipaddr.js@1.9.1: - resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} - engines: {node: '>= 0.10'} - - is-array-buffer@3.0.5: - resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==} - engines: {node: '>= 0.4'} - - is-async-function@2.1.1: - resolution: {integrity: sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==} - engines: {node: '>= 0.4'} - - is-bigint@1.1.0: - resolution: {integrity: sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==} - engines: {node: '>= 0.4'} - - is-boolean-object@1.2.2: - resolution: {integrity: sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==} - engines: {node: '>= 0.4'} - - is-bun-module@2.0.0: - resolution: {integrity: sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==} - - is-callable@1.2.7: - resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} - engines: {node: '>= 0.4'} - - is-core-module@2.16.1: - resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==} - engines: {node: '>= 0.4'} - - is-data-view@1.0.2: - resolution: {integrity: sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==} - engines: {node: '>= 0.4'} - - is-date-object@1.1.0: - resolution: {integrity: sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==} - engines: {node: '>= 0.4'} - - is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - - is-finalizationregistry@1.1.1: - resolution: {integrity: sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==} - engines: {node: '>= 0.4'} - - is-generator-function@1.1.2: - resolution: {integrity: sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==} - engines: {node: '>= 0.4'} - - is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - - is-map@2.0.3: - resolution: {integrity: sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==} - engines: {node: '>= 0.4'} - - is-negative-zero@2.0.3: - resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==} - engines: {node: '>= 0.4'} - - is-number-object@1.1.1: - resolution: {integrity: sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==} - engines: {node: '>= 0.4'} - - is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - - is-promise@4.0.0: - resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} - - is-regex@1.2.1: - resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} - engines: {node: '>= 0.4'} - - is-set@2.0.3: - resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} - engines: {node: '>= 0.4'} - - is-shared-array-buffer@1.0.4: - resolution: {integrity: sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==} - engines: {node: '>= 0.4'} - - is-string@1.1.1: - resolution: {integrity: sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==} - engines: {node: '>= 0.4'} - - is-subdir@1.2.0: - resolution: {integrity: sha512-2AT6j+gXe/1ueqbW6fLZJiIw3F8iXGJtt0yDrZaBhAZEG1raiTxKWU+IPqMCzQAXOUCKdA4UDMgacKH25XG2Cw==} - engines: {node: '>=4'} - - is-symbol@1.1.1: - resolution: {integrity: sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==} - engines: {node: '>= 0.4'} - - is-typed-array@1.1.15: - resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} - engines: {node: '>= 0.4'} - - is-weakmap@2.0.2: - resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==} - engines: {node: '>= 0.4'} - - is-weakref@1.1.1: - resolution: {integrity: sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==} - engines: {node: '>= 0.4'} - - is-weakset@2.0.4: - resolution: {integrity: sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==} - engines: {node: '>= 0.4'} - - is-windows@1.0.2: - resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} - engines: {node: '>=0.10.0'} - - isarray@2.0.5: - resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} - - isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - - jose@6.1.3: - resolution: {integrity: sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==} - - js-yaml@3.14.2: - resolution: {integrity: sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==} - hasBin: true - - js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} - hasBin: true - - js-yaml@4.1.1: - resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} - hasBin: true - - jsesc@3.1.0: - resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==} - engines: {node: '>=6'} - hasBin: true - - json-buffer@3.0.1: - resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} - - json-schema-traverse@0.4.1: - resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} - - json-schema-traverse@1.0.0: - resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - - json-schema-typed@8.0.2: - resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==} - - json-stable-stringify-without-jsonify@1.0.1: - resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} - - json5@1.0.2: - resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} - hasBin: true - - jsonfile@4.0.0: - resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} - - keyv@4.5.4: - resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} - - levn@0.4.1: - resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} - engines: {node: '>= 0.8.0'} - - locate-path@5.0.0: - resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} - engines: {node: '>=8'} - - locate-path@6.0.0: - resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} - engines: {node: '>=10'} - - lodash.merge@4.6.2: - resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - - lodash.startcase@4.4.0: - resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} - - magic-string@0.30.21: - resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} - - math-intrinsics@1.1.0: - resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} - engines: {node: '>= 0.4'} - - media-typer@1.1.0: - resolution: {integrity: sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==} - engines: {node: '>= 0.8'} - - merge-descriptors@2.0.0: - resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} - engines: {node: '>=18'} - - merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - - methods@1.1.2: - resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} - engines: {node: '>= 0.6'} - - micromatch@4.0.8: - resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} - engines: {node: '>=8.6'} - - mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - - mime-db@1.54.0: - resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} - engines: {node: '>= 0.6'} - - mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - - mime-types@3.0.1: - resolution: {integrity: sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==} - engines: {node: '>= 0.6'} - - mime@2.6.0: - resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} - engines: {node: '>=4.0.0'} - hasBin: true - - minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - - minimatch@9.0.5: - resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} - engines: {node: '>=16 || 14 >=14.17'} - - minimist@1.2.8: - resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - - mri@1.2.0: - resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} - engines: {node: '>=4'} - - ms@2.1.3: - resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - - nanoid@3.3.11: - resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - - napi-postinstall@0.3.4: - resolution: {integrity: sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==} - engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - hasBin: true - - natural-compare@1.4.0: - resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - - negotiator@1.0.0: - resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==} - engines: {node: '>= 0.6'} - - node-fetch@2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true - - object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} - - object-inspect@1.13.4: - resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} - engines: {node: '>= 0.4'} - - object-keys@1.1.1: - resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} - engines: {node: '>= 0.4'} - - object.assign@4.1.7: - resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} - engines: {node: '>= 0.4'} - - object.fromentries@2.0.8: - resolution: {integrity: sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==} - engines: {node: '>= 0.4'} - - object.groupby@1.0.3: - resolution: {integrity: sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==} - engines: {node: '>= 0.4'} - - object.values@1.2.1: - resolution: {integrity: sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==} - engines: {node: '>= 0.4'} - - obug@2.1.1: - resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==} - - on-finished@2.4.1: - resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} - engines: {node: '>= 0.8'} - - once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - - optionator@0.9.4: - resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} - engines: {node: '>= 0.8.0'} - - outdent@0.5.0: - resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} - - own-keys@1.0.1: - resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==} - engines: {node: '>= 0.4'} - - p-filter@2.1.0: - resolution: {integrity: sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==} - engines: {node: '>=8'} - - p-limit@2.3.0: - resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} - engines: {node: '>=6'} - - p-limit@3.1.0: - resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} - engines: {node: '>=10'} - - p-locate@4.1.0: - resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} - engines: {node: '>=8'} - - p-locate@5.0.0: - resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} - engines: {node: '>=10'} - - p-map@2.1.0: - resolution: {integrity: sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==} - engines: {node: '>=6'} - - p-try@2.2.0: - resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} - engines: {node: '>=6'} - - package-manager-detector@0.2.11: - resolution: {integrity: sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ==} - - parent-module@1.0.1: - resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} - engines: {node: '>=6'} - - parseurl@1.3.3: - resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} - engines: {node: '>= 0.8'} - - path-exists@4.0.0: - resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} - engines: {node: '>=8'} - - path-key@3.1.1: - resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} - engines: {node: '>=8'} - - path-parse@1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - - path-to-regexp@8.3.0: - resolution: {integrity: sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==} - - path-type@4.0.0: - resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} - engines: {node: '>=8'} - - pathe@2.0.3: - resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} - - picocolors@1.1.1: - resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} - - picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - - picomatch@4.0.3: - resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} - engines: {node: '>=12'} - - pify@4.0.1: - resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} - engines: {node: '>=6'} - - pkce-challenge@5.0.0: - resolution: {integrity: sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ==} - engines: {node: '>=16.20.0'} - - possible-typed-array-names@1.1.0: - resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} - engines: {node: '>= 0.4'} - - postcss@8.5.6: - resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} - engines: {node: ^10 || ^12 || >=14} - - prelude-ls@1.2.1: - resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} - engines: {node: '>= 0.8.0'} - - prettier@2.8.8: - resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} - engines: {node: '>=10.13.0'} - hasBin: true - - prettier@3.6.2: - resolution: {integrity: sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==} - engines: {node: '>=14'} - hasBin: true - - proxy-addr@2.0.7: - resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} - engines: {node: '>= 0.10'} - - punycode@2.3.1: - resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} - engines: {node: '>=6'} - - qs@6.14.0: - resolution: {integrity: sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==} - engines: {node: '>=0.6'} - - quansync@0.2.11: - resolution: {integrity: sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA==} - - quansync@1.0.0: - resolution: {integrity: sha512-5xZacEEufv3HSTPQuchrvV6soaiACMFnq1H8wkVioctoH3TRha9Sz66lOxRwPK/qZj7HPiSveih9yAyh98gvqA==} - - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - - range-parser@1.2.1: - resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} - engines: {node: '>= 0.6'} - - raw-body@3.0.1: - resolution: {integrity: sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA==} - engines: {node: '>= 0.10'} - - read-yaml-file@1.1.0: - resolution: {integrity: sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA==} - engines: {node: '>=6'} - - reflect.getprototypeof@1.0.10: - resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==} - engines: {node: '>= 0.4'} - - regexp.prototype.flags@1.5.4: - resolution: {integrity: sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==} - engines: {node: '>= 0.4'} - - require-from-string@2.0.2: - resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} - engines: {node: '>=0.10.0'} - - resolve-from@4.0.0: - resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} - engines: {node: '>=4'} - - resolve-from@5.0.0: - resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} - engines: {node: '>=8'} - - resolve-pkg-maps@1.0.0: - resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} - - resolve@1.22.11: - resolution: {integrity: sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==} - engines: {node: '>= 0.4'} - hasBin: true - - reusify@1.1.0: - resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - - rolldown-plugin-dts@0.18.3: - resolution: {integrity: sha512-rd1LZ0Awwfyn89UndUF/HoFF4oH9a5j+2ZeuKSJYM80vmeN/p0gslYMnHTQHBEXPhUlvAlqGA3tVgXB/1qFNDg==} - engines: {node: '>=20.19.0'} - peerDependencies: - '@ts-macro/tsc': ^0.3.6 - '@typescript/native-preview': '>=7.0.0-dev.20250601.1' - rolldown: ^1.0.0-beta.51 - typescript: ^5.0.0 - vue-tsc: ~3.1.0 - peerDependenciesMeta: - '@ts-macro/tsc': - optional: true - '@typescript/native-preview': - optional: true - typescript: - optional: true - vue-tsc: - optional: true - - rolldown@1.0.0-beta.53: - resolution: {integrity: sha512-Qd9c2p0XKZdgT5AYd+KgAMggJ8ZmCs3JnS9PTMWkyUfteKlfmKtxJbWTHkVakxwXs1Ub7jrRYVeFeF7N0sQxyw==} - engines: {node: ^20.19.0 || >=22.12.0} - hasBin: true - - rollup@4.53.2: - resolution: {integrity: sha512-MHngMYwGJVi6Fmnk6ISmnk7JAHRNF0UkuucA0CUW3N3a4KnONPEZz+vUanQP/ZC/iY1Qkf3bwPWzyY84wEks1g==} - engines: {node: '>=18.0.0', npm: '>=8.0.0'} - hasBin: true - - router@2.2.0: - resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==} - engines: {node: '>= 18'} - - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - - safe-array-concat@1.1.3: - resolution: {integrity: sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==} - engines: {node: '>=0.4'} - - safe-buffer@5.2.1: - resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - - safe-push-apply@1.0.0: - resolution: {integrity: sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==} - engines: {node: '>= 0.4'} - - safe-regex-test@1.1.0: - resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==} - engines: {node: '>= 0.4'} - - safer-buffer@2.1.2: - resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - - semver@6.3.1: - resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} - hasBin: true - - semver@7.7.3: - resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} - engines: {node: '>=10'} - hasBin: true - - send@1.2.0: - resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==} - engines: {node: '>= 18'} - - serve-static@2.2.0: - resolution: {integrity: sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==} - engines: {node: '>= 18'} - - set-function-length@1.2.2: - resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} - engines: {node: '>= 0.4'} - - set-function-name@2.0.2: - resolution: {integrity: sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==} - engines: {node: '>= 0.4'} - - set-proto@1.0.0: - resolution: {integrity: sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==} - engines: {node: '>= 0.4'} - - setprototypeof@1.2.0: - resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} - - shebang-command@2.0.0: - resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} - engines: {node: '>=8'} - - shebang-regex@3.0.0: - resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} - engines: {node: '>=8'} - - side-channel-list@1.0.0: - resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==} - engines: {node: '>= 0.4'} - - side-channel-map@1.0.1: - resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==} - engines: {node: '>= 0.4'} - - side-channel-weakmap@1.0.2: - resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==} - engines: {node: '>= 0.4'} - - side-channel@1.1.0: - resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==} - engines: {node: '>= 0.4'} - - siginfo@2.0.0: - resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} - - signal-exit@4.1.0: - resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} - engines: {node: '>=14'} - - slash@3.0.0: - resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} - engines: {node: '>=8'} - - source-map-js@1.2.1: - resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} - engines: {node: '>=0.10.0'} - - spawndamnit@3.0.1: - resolution: {integrity: sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==} - - sprintf-js@1.0.3: - resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - - stable-hash-x@0.2.0: - resolution: {integrity: sha512-o3yWv49B/o4QZk5ZcsALc6t0+eCelPc44zZsLtCQnZPDwFpDYSWcDnrv2TtMmMbQ7uKo3J0HTURCqckw23czNQ==} - engines: {node: '>=12.0.0'} - - stackback@0.0.2: - resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} - - statuses@2.0.1: - resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} - engines: {node: '>= 0.8'} - - statuses@2.0.2: - resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} - engines: {node: '>= 0.8'} - - std-env@3.10.0: - resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} - - stop-iteration-iterator@1.1.0: - resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} - engines: {node: '>= 0.4'} - - string.prototype.trim@1.2.10: - resolution: {integrity: sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==} - engines: {node: '>= 0.4'} - - string.prototype.trimend@1.0.9: - resolution: {integrity: sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==} - engines: {node: '>= 0.4'} - - string.prototype.trimstart@1.0.8: - resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} - engines: {node: '>= 0.4'} - - strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} - - strip-bom@3.0.0: - resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} - engines: {node: '>=4'} - - strip-json-comments@3.1.1: - resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} - engines: {node: '>=8'} - - superagent@10.2.3: - resolution: {integrity: sha512-y/hkYGeXAj7wUMjxRbB21g/l6aAEituGXM9Rwl4o20+SX3e8YOSV6BxFXl+dL3Uk0mjSL3kCbNkwURm8/gEDig==} - engines: {node: '>=14.18.0'} - - supertest@7.1.4: - resolution: {integrity: sha512-tjLPs7dVyqgItVFirHYqe2T+MfWc2VOBQ8QFKKbWTA3PU7liZR8zoSpAi/C1k1ilm9RsXIKYf197oap9wXGVYg==} - engines: {node: '>=14.18.0'} - - supports-color@7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} - - supports-preserve-symlinks-flag@1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - - tapable@2.3.0: - resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} - engines: {node: '>=6'} - - term-size@2.2.1: - resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} - engines: {node: '>=8'} - - tinybench@2.9.0: - resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} - - tinyexec@0.3.2: - resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} - - tinyexec@1.0.2: - resolution: {integrity: sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==} - engines: {node: '>=18'} - - tinyglobby@0.2.15: - resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} - engines: {node: '>=12.0.0'} - - tinyrainbow@3.0.3: - resolution: {integrity: sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==} - engines: {node: '>=14.0.0'} - - to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - - toidentifier@1.0.1: - resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} - engines: {node: '>=0.6'} - - tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - - tree-kill@1.2.2: - resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} - hasBin: true - - ts-api-utils@2.1.0: - resolution: {integrity: sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==} - engines: {node: '>=18.12'} - peerDependencies: - typescript: '>=4.8.4' - - ts-declaration-location@1.0.7: - resolution: {integrity: sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA==} - peerDependencies: - typescript: '>=4.0.0' - - tsconfck@3.1.6: - resolution: {integrity: sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==} - engines: {node: ^18 || >=20} - hasBin: true - peerDependencies: - typescript: ^5.0.0 - peerDependenciesMeta: - typescript: - optional: true - - tsconfig-paths@3.15.0: - resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} - - tsdown@0.18.0: - resolution: {integrity: sha512-Yotdh3NzizysnqR96xfpHFYtEntk1cZvSRHz8A+Pn3ZHNdTQa4fBQxh6HHzWZwfjdQv47xb7GCv6vEWMtxBirw==} - engines: {node: '>=20.19.0'} - hasBin: true - peerDependencies: - '@arethetypeswrong/core': ^0.18.1 - '@vitejs/devtools': ^0.0.0-alpha.19 - publint: ^0.3.0 - typescript: ^5.0.0 - unplugin-lightningcss: ^0.4.0 - unplugin-unused: ^0.5.0 - peerDependenciesMeta: - '@arethetypeswrong/core': - optional: true - '@vitejs/devtools': - optional: true - publint: - optional: true - typescript: - optional: true - unplugin-lightningcss: - optional: true - unplugin-unused: - optional: true - - tslib@2.8.1: - resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - - tsx@4.20.6: - resolution: {integrity: sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==} - engines: {node: '>=18.0.0'} - hasBin: true - - type-check@0.4.0: - resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} - engines: {node: '>= 0.8.0'} - - type-is@2.0.1: - resolution: {integrity: sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==} - engines: {node: '>= 0.6'} - - typed-array-buffer@1.0.3: - resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} - engines: {node: '>= 0.4'} - - typed-array-byte-length@1.0.3: - resolution: {integrity: sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==} - engines: {node: '>= 0.4'} - - typed-array-byte-offset@1.0.4: - resolution: {integrity: sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==} - engines: {node: '>= 0.4'} - - typed-array-length@1.0.7: - resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==} - engines: {node: '>= 0.4'} - - typescript-eslint@8.49.0: - resolution: {integrity: sha512-zRSVH1WXD0uXczCXw+nsdjGPUdx4dfrs5VQoHnUWmv1U3oNlAKv4FUNdLDhVUg+gYn+a5hUESqch//Rv5wVhrg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - typescript: '>=4.8.4 <6.0.0' - - typescript@5.9.3: - resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} - engines: {node: '>=14.17'} - hasBin: true - - unbox-primitive@1.1.0: - resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==} - engines: {node: '>= 0.4'} - - unconfig-core@7.4.2: - resolution: {integrity: sha512-VgPCvLWugINbXvMQDf8Jh0mlbvNjNC6eSUziHsBCMpxR05OPrNrvDnyatdMjRgcHaaNsCqz+wjNXxNw1kRLHUg==} - - undici-types@7.16.0: - resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} - - universalify@0.1.2: - resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} - engines: {node: '>= 4.0.0'} - - unpipe@1.0.0: - resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} - engines: {node: '>= 0.8'} - - unrs-resolver@1.11.1: - resolution: {integrity: sha512-bSjt9pjaEBnNiGgc9rUiHGKv5l4/TGzDmYw3RhnkJGtLhbnnA/5qJj7x3dNDCRx/PJxu774LlH8lCOlB4hEfKg==} - - unrun@0.2.19: - resolution: {integrity: sha512-DbwbJ9BvPEb3BeZnIpP9S5tGLO/JIgPQ3JrpMRFIfZMZfMG19f26OlLbC2ml8RRdrI2ZA7z2t+at5tsIHbh6Qw==} - engines: {node: '>=20.19.0'} - hasBin: true - peerDependencies: - synckit: ^0.11.11 - peerDependenciesMeta: - synckit: - optional: true - - uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - - vary@1.1.2: - resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} - engines: {node: '>= 0.8'} - - vite-tsconfig-paths@5.1.4: - resolution: {integrity: sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w==} - peerDependencies: - vite: '*' - peerDependenciesMeta: - vite: - optional: true - - vite@7.2.2: - resolution: {integrity: sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==} - engines: {node: ^20.19.0 || >=22.12.0} - hasBin: true - peerDependencies: - '@types/node': ^20.19.0 || >=22.12.0 - jiti: '>=1.21.0' - less: ^4.0.0 - lightningcss: ^1.21.0 - sass: ^1.70.0 - sass-embedded: ^1.70.0 - stylus: '>=0.54.8' - sugarss: ^5.0.0 - terser: ^5.16.0 - tsx: ^4.8.1 - yaml: ^2.4.2 - peerDependenciesMeta: - '@types/node': - optional: true - jiti: - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - sass-embedded: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - tsx: - optional: true - yaml: - optional: true - - vitest@4.0.9: - resolution: {integrity: sha512-E0Ja2AX4th+CG33yAFRC+d1wFx2pzU5r6HtG6LiPSE04flaE0qB6YyjSw9ZcpJAtVPfsvZGtJlKWZpuW7EHRxg==} - engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0} - hasBin: true - peerDependencies: - '@edge-runtime/vm': '*' - '@types/debug': ^4.1.12 - '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0 - '@vitest/browser-playwright': 4.0.9 - '@vitest/browser-preview': 4.0.9 - '@vitest/browser-webdriverio': 4.0.9 - '@vitest/ui': 4.0.9 - happy-dom: '*' - jsdom: '*' - peerDependenciesMeta: - '@edge-runtime/vm': - optional: true - '@types/debug': - optional: true - '@types/node': - optional: true - '@vitest/browser-playwright': - optional: true - '@vitest/browser-preview': - optional: true - '@vitest/browser-webdriverio': - optional: true - '@vitest/ui': - optional: true - happy-dom: - optional: true - jsdom: - optional: true - - webidl-conversions@3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - - whatwg-url@5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - - which-boxed-primitive@1.1.1: - resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==} - engines: {node: '>= 0.4'} - - which-builtin-type@1.2.1: - resolution: {integrity: sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==} - engines: {node: '>= 0.4'} - - which-collection@1.0.2: - resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==} - engines: {node: '>= 0.4'} - - which-typed-array@1.1.19: - resolution: {integrity: sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==} - engines: {node: '>= 0.4'} - - which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - - why-is-node-running@2.3.0: - resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} - engines: {node: '>=8'} - hasBin: true - - word-wrap@1.2.5: - resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} - engines: {node: '>=0.10.0'} - - wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - - ws@8.18.3: - resolution: {integrity: sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - - yocto-queue@0.1.0: - resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} - engines: {node: '>=10'} - - zod-to-json-schema@3.25.0: - resolution: {integrity: sha512-HvWtU2UG41LALjajJrML6uQejQhNJx+JBO9IflpSja4R03iNWfKXrj6W2h7ljuLyc1nKS+9yDyL/9tD1U/yBnQ==} - peerDependencies: - zod: ^3.25 || ^4 - - zod@3.25.76: - resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} - -snapshots: - - '@babel/generator@7.28.5': - dependencies: - '@babel/parser': 7.28.5 - '@babel/types': 7.28.5 - '@jridgewell/gen-mapping': 0.3.13 - '@jridgewell/trace-mapping': 0.3.31 - jsesc: 3.1.0 - - '@babel/helper-string-parser@7.27.1': {} - - '@babel/helper-validator-identifier@7.28.5': {} - - '@babel/parser@7.28.5': - dependencies: - '@babel/types': 7.28.5 - - '@babel/runtime@7.28.4': {} - - '@babel/types@7.28.5': - dependencies: - '@babel/helper-string-parser': 7.27.1 - '@babel/helper-validator-identifier': 7.28.5 - - '@cfworker/json-schema@4.1.1': {} - - '@changesets/apply-release-plan@7.0.14': - dependencies: - '@changesets/config': 3.1.2 - '@changesets/get-version-range-type': 0.4.0 - '@changesets/git': 3.0.4 - '@changesets/should-skip-package': 0.1.2 - '@changesets/types': 6.1.0 - '@manypkg/get-packages': 1.1.3 - detect-indent: 6.1.0 - fs-extra: 7.0.1 - lodash.startcase: 4.4.0 - outdent: 0.5.0 - prettier: 2.8.8 - resolve-from: 5.0.0 - semver: 7.7.3 - - '@changesets/assemble-release-plan@6.0.9': - dependencies: - '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.3 - '@changesets/should-skip-package': 0.1.2 - '@changesets/types': 6.1.0 - '@manypkg/get-packages': 1.1.3 - semver: 7.7.3 - - '@changesets/changelog-git@0.2.1': - dependencies: - '@changesets/types': 6.1.0 - - '@changesets/changelog-github@0.5.2': - dependencies: - '@changesets/get-github-info': 0.7.0 - '@changesets/types': 6.1.0 - dotenv: 8.6.0 - transitivePeerDependencies: - - encoding - - '@changesets/cli@2.29.8(@types/node@24.10.3)': - dependencies: - '@changesets/apply-release-plan': 7.0.14 - '@changesets/assemble-release-plan': 6.0.9 - '@changesets/changelog-git': 0.2.1 - '@changesets/config': 3.1.2 - '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.3 - '@changesets/get-release-plan': 4.0.14 - '@changesets/git': 3.0.4 - '@changesets/logger': 0.1.1 - '@changesets/pre': 2.0.2 - '@changesets/read': 0.6.6 - '@changesets/should-skip-package': 0.1.2 - '@changesets/types': 6.1.0 - '@changesets/write': 0.4.0 - '@inquirer/external-editor': 1.0.3(@types/node@24.10.3) - '@manypkg/get-packages': 1.1.3 - ansi-colors: 4.1.3 - ci-info: 3.9.0 - enquirer: 2.4.1 - fs-extra: 7.0.1 - mri: 1.2.0 - p-limit: 2.3.0 - package-manager-detector: 0.2.11 - picocolors: 1.1.1 - resolve-from: 5.0.0 - semver: 7.7.3 - spawndamnit: 3.0.1 - term-size: 2.2.1 - transitivePeerDependencies: - - '@types/node' - - '@changesets/config@3.1.2': - dependencies: - '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.3 - '@changesets/logger': 0.1.1 - '@changesets/types': 6.1.0 - '@manypkg/get-packages': 1.1.3 - fs-extra: 7.0.1 - micromatch: 4.0.8 - - '@changesets/errors@0.2.0': - dependencies: - extendable-error: 0.1.7 - - '@changesets/get-dependents-graph@2.1.3': - dependencies: - '@changesets/types': 6.1.0 - '@manypkg/get-packages': 1.1.3 - picocolors: 1.1.1 - semver: 7.7.3 - - '@changesets/get-github-info@0.7.0': - dependencies: - dataloader: 1.4.0 - node-fetch: 2.7.0 - transitivePeerDependencies: - - encoding - - '@changesets/get-release-plan@4.0.14': - dependencies: - '@changesets/assemble-release-plan': 6.0.9 - '@changesets/config': 3.1.2 - '@changesets/pre': 2.0.2 - '@changesets/read': 0.6.6 - '@changesets/types': 6.1.0 - '@manypkg/get-packages': 1.1.3 - - '@changesets/get-version-range-type@0.4.0': {} - - '@changesets/git@3.0.4': - dependencies: - '@changesets/errors': 0.2.0 - '@manypkg/get-packages': 1.1.3 - is-subdir: 1.2.0 - micromatch: 4.0.8 - spawndamnit: 3.0.1 - - '@changesets/logger@0.1.1': - dependencies: - picocolors: 1.1.1 - - '@changesets/parse@0.4.2': - dependencies: - '@changesets/types': 6.1.0 - js-yaml: 4.1.1 - - '@changesets/pre@2.0.2': - dependencies: - '@changesets/errors': 0.2.0 - '@changesets/types': 6.1.0 - '@manypkg/get-packages': 1.1.3 - fs-extra: 7.0.1 - - '@changesets/read@0.6.6': - dependencies: - '@changesets/git': 3.0.4 - '@changesets/logger': 0.1.1 - '@changesets/parse': 0.4.2 - '@changesets/types': 6.1.0 - fs-extra: 7.0.1 - p-filter: 2.1.0 - picocolors: 1.1.1 - - '@changesets/should-skip-package@0.1.2': - dependencies: - '@changesets/types': 6.1.0 - '@manypkg/get-packages': 1.1.3 - - '@changesets/types@4.1.0': {} - - '@changesets/types@6.1.0': {} - - '@changesets/write@0.4.0': - dependencies: - '@changesets/types': 6.1.0 - fs-extra: 7.0.1 - human-id: 4.1.3 - prettier: 2.8.8 - - '@emnapi/core@1.7.1': - dependencies: - '@emnapi/wasi-threads': 1.1.0 - tslib: 2.8.1 - optional: true - - '@emnapi/runtime@1.7.1': - dependencies: - tslib: 2.8.1 - optional: true - - '@emnapi/wasi-threads@1.1.0': - dependencies: - tslib: 2.8.1 - optional: true - - '@esbuild/aix-ppc64@0.25.12': - optional: true - - '@esbuild/android-arm64@0.25.12': - optional: true - - '@esbuild/android-arm@0.25.12': - optional: true - - '@esbuild/android-x64@0.25.12': - optional: true - - '@esbuild/darwin-arm64@0.25.12': - optional: true - - '@esbuild/darwin-x64@0.25.12': - optional: true - - '@esbuild/freebsd-arm64@0.25.12': - optional: true - - '@esbuild/freebsd-x64@0.25.12': - optional: true - - '@esbuild/linux-arm64@0.25.12': - optional: true - - '@esbuild/linux-arm@0.25.12': - optional: true - - '@esbuild/linux-ia32@0.25.12': - optional: true - - '@esbuild/linux-loong64@0.25.12': - optional: true - - '@esbuild/linux-mips64el@0.25.12': - optional: true - - '@esbuild/linux-ppc64@0.25.12': - optional: true - - '@esbuild/linux-riscv64@0.25.12': - optional: true - - '@esbuild/linux-s390x@0.25.12': - optional: true - - '@esbuild/linux-x64@0.25.12': - optional: true - - '@esbuild/netbsd-arm64@0.25.12': - optional: true - - '@esbuild/netbsd-x64@0.25.12': - optional: true - - '@esbuild/openbsd-arm64@0.25.12': - optional: true - - '@esbuild/openbsd-x64@0.25.12': - optional: true - - '@esbuild/openharmony-arm64@0.25.12': - optional: true - - '@esbuild/sunos-x64@0.25.12': - optional: true - - '@esbuild/win32-arm64@0.25.12': - optional: true - - '@esbuild/win32-ia32@0.25.12': - optional: true - - '@esbuild/win32-x64@0.25.12': - optional: true - - '@eslint-community/eslint-utils@4.9.0(eslint@9.39.1)': - dependencies: - eslint: 9.39.1 - eslint-visitor-keys: 3.4.3 - - '@eslint-community/regexpp@4.12.2': {} - - '@eslint/config-array@0.21.1': - dependencies: - '@eslint/object-schema': 2.1.7 - debug: 4.4.3 - minimatch: 3.1.2 - transitivePeerDependencies: - - supports-color - - '@eslint/config-helpers@0.4.2': - dependencies: - '@eslint/core': 0.17.0 - - '@eslint/core@0.17.0': - dependencies: - '@types/json-schema': 7.0.15 - - '@eslint/eslintrc@3.3.1': - dependencies: - ajv: 6.12.6 - debug: 4.4.3 - espree: 10.4.0 - globals: 14.0.0 - ignore: 5.3.2 - import-fresh: 3.3.1 - js-yaml: 4.1.0 - minimatch: 3.1.2 - strip-json-comments: 3.1.1 - transitivePeerDependencies: - - supports-color - - '@eslint/js@9.39.1': {} - - '@eslint/object-schema@2.1.7': {} - - '@eslint/plugin-kit@0.4.1': - dependencies: - '@eslint/core': 0.17.0 - levn: 0.4.1 - - '@hono/node-server@1.19.7(hono@4.11.1)': - dependencies: - hono: 4.11.1 - - '@humanfs/core@0.19.1': {} - - '@humanfs/node@0.16.7': - dependencies: - '@humanfs/core': 0.19.1 - '@humanwhocodes/retry': 0.4.3 - - '@humanwhocodes/module-importer@1.0.1': {} - - '@humanwhocodes/retry@0.4.3': {} - - '@inquirer/external-editor@1.0.3(@types/node@24.10.3)': - dependencies: - chardet: 2.1.1 - iconv-lite: 0.7.0 - optionalDependencies: - '@types/node': 24.10.3 - - '@jridgewell/gen-mapping@0.3.13': - dependencies: - '@jridgewell/sourcemap-codec': 1.5.5 - '@jridgewell/trace-mapping': 0.3.31 - - '@jridgewell/resolve-uri@3.1.2': {} - - '@jridgewell/sourcemap-codec@1.5.5': {} - - '@jridgewell/trace-mapping@0.3.31': - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.5 - - '@manypkg/find-root@1.1.0': - dependencies: - '@babel/runtime': 7.28.4 - '@types/node': 12.20.55 - find-up: 4.1.0 - fs-extra: 8.1.0 - - '@manypkg/get-packages@1.1.3': - dependencies: - '@babel/runtime': 7.28.4 - '@changesets/types': 4.1.0 - '@manypkg/find-root': 1.1.0 - fs-extra: 8.1.0 - globby: 11.1.0 - read-yaml-file: 1.1.0 - - '@napi-rs/wasm-runtime@0.2.12': - dependencies: - '@emnapi/core': 1.7.1 - '@emnapi/runtime': 1.7.1 - '@tybys/wasm-util': 0.10.1 - optional: true - - '@napi-rs/wasm-runtime@1.1.0': - dependencies: - '@emnapi/core': 1.7.1 - '@emnapi/runtime': 1.7.1 - '@tybys/wasm-util': 0.10.1 - optional: true - - '@noble/hashes@1.8.0': {} - - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - - '@nodelib/fs.stat@2.0.5': {} - - '@nodelib/fs.walk@1.2.8': - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.19.1 - - '@oxc-project/types@0.101.0': {} - - '@paralleldrive/cuid2@2.3.1': - dependencies: - '@noble/hashes': 1.8.0 - - '@quansync/fs@1.0.0': - dependencies: - quansync: 1.0.0 - - '@rolldown/binding-android-arm64@1.0.0-beta.53': - optional: true - - '@rolldown/binding-darwin-arm64@1.0.0-beta.53': - optional: true - - '@rolldown/binding-darwin-x64@1.0.0-beta.53': - optional: true - - '@rolldown/binding-freebsd-x64@1.0.0-beta.53': - optional: true - - '@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.53': - optional: true - - '@rolldown/binding-linux-arm64-gnu@1.0.0-beta.53': - optional: true - - '@rolldown/binding-linux-arm64-musl@1.0.0-beta.53': - optional: true - - '@rolldown/binding-linux-x64-gnu@1.0.0-beta.53': - optional: true - - '@rolldown/binding-linux-x64-musl@1.0.0-beta.53': - optional: true - - '@rolldown/binding-openharmony-arm64@1.0.0-beta.53': - optional: true - - '@rolldown/binding-wasm32-wasi@1.0.0-beta.53': - dependencies: - '@napi-rs/wasm-runtime': 1.1.0 - optional: true - - '@rolldown/binding-win32-arm64-msvc@1.0.0-beta.53': - optional: true - - '@rolldown/binding-win32-x64-msvc@1.0.0-beta.53': - optional: true - - '@rolldown/pluginutils@1.0.0-beta.53': {} - - '@rollup/rollup-android-arm-eabi@4.53.2': - optional: true - - '@rollup/rollup-android-arm64@4.53.2': - optional: true - - '@rollup/rollup-darwin-arm64@4.53.2': - optional: true - - '@rollup/rollup-darwin-x64@4.53.2': - optional: true - - '@rollup/rollup-freebsd-arm64@4.53.2': - optional: true - - '@rollup/rollup-freebsd-x64@4.53.2': - optional: true - - '@rollup/rollup-linux-arm-gnueabihf@4.53.2': - optional: true - - '@rollup/rollup-linux-arm-musleabihf@4.53.2': - optional: true - - '@rollup/rollup-linux-arm64-gnu@4.53.2': - optional: true - - '@rollup/rollup-linux-arm64-musl@4.53.2': - optional: true - - '@rollup/rollup-linux-loong64-gnu@4.53.2': - optional: true - - '@rollup/rollup-linux-ppc64-gnu@4.53.2': - optional: true - - '@rollup/rollup-linux-riscv64-gnu@4.53.2': - optional: true - - '@rollup/rollup-linux-riscv64-musl@4.53.2': - optional: true - - '@rollup/rollup-linux-s390x-gnu@4.53.2': - optional: true - - '@rollup/rollup-linux-x64-gnu@4.53.2': - optional: true - - '@rollup/rollup-linux-x64-musl@4.53.2': - optional: true - - '@rollup/rollup-openharmony-arm64@4.53.2': - optional: true - - '@rollup/rollup-win32-arm64-msvc@4.53.2': - optional: true - - '@rollup/rollup-win32-ia32-msvc@4.53.2': - optional: true - - '@rollup/rollup-win32-x64-gnu@4.53.2': - optional: true - - '@rollup/rollup-win32-x64-msvc@4.53.2': - optional: true - - '@rtsao/scc@1.1.0': {} - - '@standard-schema/spec@1.0.0': {} - - '@tybys/wasm-util@0.10.1': - dependencies: - tslib: 2.8.1 - optional: true - - '@types/body-parser@1.19.6': - dependencies: - '@types/connect': 3.4.38 - '@types/node': 24.10.3 - - '@types/chai@5.2.3': - dependencies: - '@types/deep-eql': 4.0.2 - assertion-error: 2.0.1 - - '@types/connect@3.4.38': - dependencies: - '@types/node': 24.10.3 - - '@types/content-type@1.1.9': {} - - '@types/cookiejar@2.1.5': {} - - '@types/cors@2.8.19': - dependencies: - '@types/node': 24.10.3 - - '@types/cross-spawn@6.0.6': - dependencies: - '@types/node': 24.10.3 - - '@types/deep-eql@4.0.2': {} - - '@types/estree@1.0.8': {} - - '@types/eventsource@1.1.15': {} - - '@types/express-serve-static-core@5.1.0': - dependencies: - '@types/node': 24.10.3 - '@types/qs': 6.14.0 - '@types/range-parser': 1.2.7 - '@types/send': 1.2.1 - - '@types/express@5.0.5': - dependencies: - '@types/body-parser': 1.19.6 - '@types/express-serve-static-core': 5.1.0 - '@types/serve-static': 1.15.10 - - '@types/http-errors@2.0.5': {} - - '@types/json-schema@7.0.15': {} - - '@types/json5@0.0.29': {} - - '@types/methods@1.1.4': {} - - '@types/mime@1.3.5': {} - - '@types/node@12.20.55': {} - - '@types/node@24.10.3': - dependencies: - undici-types: 7.16.0 - - '@types/qs@6.14.0': {} - - '@types/range-parser@1.2.7': {} - - '@types/send@0.17.6': - dependencies: - '@types/mime': 1.3.5 - '@types/node': 24.10.3 - - '@types/send@1.2.1': - dependencies: - '@types/node': 24.10.3 - - '@types/serve-static@1.15.10': - dependencies: - '@types/http-errors': 2.0.5 - '@types/node': 24.10.3 - '@types/send': 0.17.6 - - '@types/superagent@8.1.9': - dependencies: - '@types/cookiejar': 2.1.5 - '@types/methods': 1.1.4 - '@types/node': 24.10.3 - form-data: 4.0.4 - - '@types/supertest@6.0.3': - dependencies: - '@types/methods': 1.1.4 - '@types/superagent': 8.1.9 - - '@types/ws@8.18.1': - dependencies: - '@types/node': 24.10.3 - - '@typescript-eslint/eslint-plugin@8.49.0(@typescript-eslint/parser@8.49.0(eslint@9.39.1)(typescript@5.9.3))(eslint@9.39.1)(typescript@5.9.3)': - dependencies: - '@eslint-community/regexpp': 4.12.2 - '@typescript-eslint/parser': 8.49.0(eslint@9.39.1)(typescript@5.9.3) - '@typescript-eslint/scope-manager': 8.49.0 - '@typescript-eslint/type-utils': 8.49.0(eslint@9.39.1)(typescript@5.9.3) - '@typescript-eslint/utils': 8.49.0(eslint@9.39.1)(typescript@5.9.3) - '@typescript-eslint/visitor-keys': 8.49.0 - eslint: 9.39.1 - ignore: 7.0.5 - natural-compare: 1.4.0 - ts-api-utils: 2.1.0(typescript@5.9.3) - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/parser@8.49.0(eslint@9.39.1)(typescript@5.9.3)': - dependencies: - '@typescript-eslint/scope-manager': 8.49.0 - '@typescript-eslint/types': 8.49.0 - '@typescript-eslint/typescript-estree': 8.49.0(typescript@5.9.3) - '@typescript-eslint/visitor-keys': 8.49.0 - debug: 4.4.3 - eslint: 9.39.1 - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/project-service@8.49.0(typescript@5.9.3)': - dependencies: - '@typescript-eslint/tsconfig-utils': 8.49.0(typescript@5.9.3) - '@typescript-eslint/types': 8.49.0 - debug: 4.4.3 - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/scope-manager@8.49.0': - dependencies: - '@typescript-eslint/types': 8.49.0 - '@typescript-eslint/visitor-keys': 8.49.0 - - '@typescript-eslint/tsconfig-utils@8.49.0(typescript@5.9.3)': - dependencies: - typescript: 5.9.3 - - '@typescript-eslint/type-utils@8.49.0(eslint@9.39.1)(typescript@5.9.3)': - dependencies: - '@typescript-eslint/types': 8.49.0 - '@typescript-eslint/typescript-estree': 8.49.0(typescript@5.9.3) - '@typescript-eslint/utils': 8.49.0(eslint@9.39.1)(typescript@5.9.3) - debug: 4.4.3 - eslint: 9.39.1 - ts-api-utils: 2.1.0(typescript@5.9.3) - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/types@8.49.0': {} - - '@typescript-eslint/typescript-estree@8.49.0(typescript@5.9.3)': - dependencies: - '@typescript-eslint/project-service': 8.49.0(typescript@5.9.3) - '@typescript-eslint/tsconfig-utils': 8.49.0(typescript@5.9.3) - '@typescript-eslint/types': 8.49.0 - '@typescript-eslint/visitor-keys': 8.49.0 - debug: 4.4.3 - minimatch: 9.0.5 - semver: 7.7.3 - tinyglobby: 0.2.15 - ts-api-utils: 2.1.0(typescript@5.9.3) - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/utils@8.49.0(eslint@9.39.1)(typescript@5.9.3)': - dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) - '@typescript-eslint/scope-manager': 8.49.0 - '@typescript-eslint/types': 8.49.0 - '@typescript-eslint/typescript-estree': 8.49.0(typescript@5.9.3) - eslint: 9.39.1 - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/visitor-keys@8.49.0': - dependencies: - '@typescript-eslint/types': 8.49.0 - eslint-visitor-keys: 4.2.1 - - '@typescript/native-preview-darwin-arm64@7.0.0-dev.20251218.3': - optional: true - - '@typescript/native-preview-darwin-x64@7.0.0-dev.20251218.3': - optional: true - - '@typescript/native-preview-linux-arm64@7.0.0-dev.20251218.3': - optional: true - - '@typescript/native-preview-linux-arm@7.0.0-dev.20251218.3': - optional: true - - '@typescript/native-preview-linux-x64@7.0.0-dev.20251218.3': - optional: true - - '@typescript/native-preview-win32-arm64@7.0.0-dev.20251218.3': - optional: true - - '@typescript/native-preview-win32-x64@7.0.0-dev.20251218.3': - optional: true - - '@typescript/native-preview@7.0.0-dev.20251218.3': - optionalDependencies: - '@typescript/native-preview-darwin-arm64': 7.0.0-dev.20251218.3 - '@typescript/native-preview-darwin-x64': 7.0.0-dev.20251218.3 - '@typescript/native-preview-linux-arm': 7.0.0-dev.20251218.3 - '@typescript/native-preview-linux-arm64': 7.0.0-dev.20251218.3 - '@typescript/native-preview-linux-x64': 7.0.0-dev.20251218.3 - '@typescript/native-preview-win32-arm64': 7.0.0-dev.20251218.3 - '@typescript/native-preview-win32-x64': 7.0.0-dev.20251218.3 - - '@unrs/resolver-binding-android-arm-eabi@1.11.1': - optional: true - - '@unrs/resolver-binding-android-arm64@1.11.1': - optional: true - - '@unrs/resolver-binding-darwin-arm64@1.11.1': - optional: true - - '@unrs/resolver-binding-darwin-x64@1.11.1': - optional: true - - '@unrs/resolver-binding-freebsd-x64@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-arm-gnueabihf@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-arm-musleabihf@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-arm64-gnu@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-arm64-musl@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-ppc64-gnu@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-riscv64-gnu@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-riscv64-musl@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-s390x-gnu@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-x64-gnu@1.11.1': - optional: true - - '@unrs/resolver-binding-linux-x64-musl@1.11.1': - optional: true - - '@unrs/resolver-binding-wasm32-wasi@1.11.1': - dependencies: - '@napi-rs/wasm-runtime': 0.2.12 - optional: true - - '@unrs/resolver-binding-win32-arm64-msvc@1.11.1': - optional: true - - '@unrs/resolver-binding-win32-ia32-msvc@1.11.1': - optional: true - - '@unrs/resolver-binding-win32-x64-msvc@1.11.1': - optional: true - - '@vitest/expect@4.0.9': - dependencies: - '@standard-schema/spec': 1.0.0 - '@types/chai': 5.2.3 - '@vitest/spy': 4.0.9 - '@vitest/utils': 4.0.9 - chai: 6.2.1 - tinyrainbow: 3.0.3 - - '@vitest/mocker@4.0.9(vite@7.2.2(@types/node@24.10.3)(tsx@4.20.6))': - dependencies: - '@vitest/spy': 4.0.9 - estree-walker: 3.0.3 - magic-string: 0.30.21 - optionalDependencies: - vite: 7.2.2(@types/node@24.10.3)(tsx@4.20.6) - - '@vitest/pretty-format@4.0.9': - dependencies: - tinyrainbow: 3.0.3 - - '@vitest/runner@4.0.9': - dependencies: - '@vitest/utils': 4.0.9 - pathe: 2.0.3 - - '@vitest/snapshot@4.0.9': - dependencies: - '@vitest/pretty-format': 4.0.9 - magic-string: 0.30.21 - pathe: 2.0.3 - - '@vitest/spy@4.0.9': {} - - '@vitest/utils@4.0.9': - dependencies: - '@vitest/pretty-format': 4.0.9 - tinyrainbow: 3.0.3 - - accepts@2.0.0: - dependencies: - mime-types: 3.0.1 - negotiator: 1.0.0 - - acorn-jsx@5.3.2(acorn@8.15.0): - dependencies: - acorn: 8.15.0 - - acorn@8.15.0: {} - - ajv-formats@3.0.1(ajv@8.17.1): - optionalDependencies: - ajv: 8.17.1 - - ajv@6.12.6: - dependencies: - fast-deep-equal: 3.1.3 - fast-json-stable-stringify: 2.1.0 - json-schema-traverse: 0.4.1 - uri-js: 4.4.1 - - ajv@8.17.1: - dependencies: - fast-deep-equal: 3.1.3 - fast-uri: 3.1.0 - json-schema-traverse: 1.0.0 - require-from-string: 2.0.2 - - ansi-colors@4.1.3: {} - - ansi-regex@5.0.1: {} - - ansi-styles@4.3.0: - dependencies: - color-convert: 2.0.1 - - ansis@4.2.0: {} - - argparse@1.0.10: - dependencies: - sprintf-js: 1.0.3 - - argparse@2.0.1: {} - - array-buffer-byte-length@1.0.2: - dependencies: - call-bound: 1.0.4 - is-array-buffer: 3.0.5 - - array-includes@3.1.9: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - define-properties: 1.2.1 - es-abstract: 1.24.0 - es-object-atoms: 1.1.1 - get-intrinsic: 1.3.0 - is-string: 1.1.1 - math-intrinsics: 1.1.0 - - array-union@2.1.0: {} - - array.prototype.findlastindex@1.2.6: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - define-properties: 1.2.1 - es-abstract: 1.24.0 - es-errors: 1.3.0 - es-object-atoms: 1.1.1 - es-shim-unscopables: 1.1.0 - - array.prototype.flat@1.3.3: - dependencies: - call-bind: 1.0.8 - define-properties: 1.2.1 - es-abstract: 1.24.0 - es-shim-unscopables: 1.1.0 - - array.prototype.flatmap@1.3.3: - dependencies: - call-bind: 1.0.8 - define-properties: 1.2.1 - es-abstract: 1.24.0 - es-shim-unscopables: 1.1.0 - - arraybuffer.prototype.slice@1.0.4: - dependencies: - array-buffer-byte-length: 1.0.2 - call-bind: 1.0.8 - define-properties: 1.2.1 - es-abstract: 1.24.0 - es-errors: 1.3.0 - get-intrinsic: 1.3.0 - is-array-buffer: 3.0.5 - - asap@2.0.6: {} - - assertion-error@2.0.1: {} - - ast-kit@2.2.0: - dependencies: - '@babel/parser': 7.28.5 - pathe: 2.0.3 - - async-function@1.0.0: {} - - asynckit@0.4.0: {} - - available-typed-arrays@1.0.7: - dependencies: - possible-typed-array-names: 1.1.0 - - balanced-match@1.0.2: {} - - better-path-resolve@1.0.0: - dependencies: - is-windows: 1.0.2 - - birpc@3.0.0: {} - - body-parser@2.2.0: - dependencies: - bytes: 3.1.2 - content-type: 1.0.5 - debug: 4.4.3 - http-errors: 2.0.0 - iconv-lite: 0.6.3 - on-finished: 2.4.1 - qs: 6.14.0 - raw-body: 3.0.1 - type-is: 2.0.1 - transitivePeerDependencies: - - supports-color - - brace-expansion@1.1.12: - dependencies: - balanced-match: 1.0.2 - concat-map: 0.0.1 - - brace-expansion@2.0.2: - dependencies: - balanced-match: 1.0.2 - - braces@3.0.3: - dependencies: - fill-range: 7.1.1 - - bytes@3.1.2: {} - - cac@6.7.14: {} - - call-bind-apply-helpers@1.0.2: - dependencies: - es-errors: 1.3.0 - function-bind: 1.1.2 - - call-bind@1.0.8: - dependencies: - call-bind-apply-helpers: 1.0.2 - es-define-property: 1.0.1 - get-intrinsic: 1.3.0 - set-function-length: 1.2.2 - - call-bound@1.0.4: - dependencies: - call-bind-apply-helpers: 1.0.2 - get-intrinsic: 1.3.0 - - callsites@3.1.0: {} - - chai@6.2.1: {} - - chalk@4.1.2: - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - - chardet@2.1.1: {} - - ci-info@3.9.0: {} - - color-convert@2.0.1: - dependencies: - color-name: 1.1.4 - - color-name@1.1.4: {} - - combined-stream@1.0.8: - dependencies: - delayed-stream: 1.0.0 - - component-emitter@1.3.1: {} - - concat-map@0.0.1: {} - - content-disposition@1.0.0: - dependencies: - safe-buffer: 5.2.1 - - content-type@1.0.5: {} - - cookie-signature@1.2.2: {} - - cookie@0.7.2: {} - - cookiejar@2.1.4: {} - - cors@2.8.5: - dependencies: - object-assign: 4.1.1 - vary: 1.1.2 - - cross-spawn@7.0.6: - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 - - data-view-buffer@1.0.2: - dependencies: - call-bound: 1.0.4 - es-errors: 1.3.0 - is-data-view: 1.0.2 - - data-view-byte-length@1.0.2: - dependencies: - call-bound: 1.0.4 - es-errors: 1.3.0 - is-data-view: 1.0.2 - - data-view-byte-offset@1.0.1: - dependencies: - call-bound: 1.0.4 - es-errors: 1.3.0 - is-data-view: 1.0.2 - - dataloader@1.4.0: {} - - debug@3.2.7: - dependencies: - ms: 2.1.3 - - debug@4.4.3: - dependencies: - ms: 2.1.3 - - deep-is@0.1.4: {} - - define-data-property@1.1.4: - dependencies: - es-define-property: 1.0.1 - es-errors: 1.3.0 - gopd: 1.2.0 - - define-properties@1.2.1: - dependencies: - define-data-property: 1.1.4 - has-property-descriptors: 1.0.2 - object-keys: 1.1.1 - - defu@6.1.4: {} - - delayed-stream@1.0.0: {} - - depd@2.0.0: {} - - detect-indent@6.1.0: {} - - dezalgo@1.0.4: - dependencies: - asap: 2.0.6 - wrappy: 1.0.2 - - dir-glob@3.0.1: - dependencies: - path-type: 4.0.0 - - doctrine@2.1.0: - dependencies: - esutils: 2.0.3 - - dotenv@8.6.0: {} - - dts-resolver@2.1.3: {} - - dunder-proto@1.0.1: - dependencies: - call-bind-apply-helpers: 1.0.2 - es-errors: 1.3.0 - gopd: 1.2.0 - - ee-first@1.1.1: {} - - empathic@2.0.0: {} - - encodeurl@2.0.0: {} - - enhanced-resolve@5.18.3: - dependencies: - graceful-fs: 4.2.11 - tapable: 2.3.0 - - enquirer@2.4.1: - dependencies: - ansi-colors: 4.1.3 - strip-ansi: 6.0.1 - - es-abstract@1.24.0: - dependencies: - array-buffer-byte-length: 1.0.2 - arraybuffer.prototype.slice: 1.0.4 - available-typed-arrays: 1.0.7 - call-bind: 1.0.8 - call-bound: 1.0.4 - data-view-buffer: 1.0.2 - data-view-byte-length: 1.0.2 - data-view-byte-offset: 1.0.1 - es-define-property: 1.0.1 - es-errors: 1.3.0 - es-object-atoms: 1.1.1 - es-set-tostringtag: 2.1.0 - es-to-primitive: 1.3.0 - function.prototype.name: 1.1.8 - get-intrinsic: 1.3.0 - get-proto: 1.0.1 - get-symbol-description: 1.1.0 - globalthis: 1.0.4 - gopd: 1.2.0 - has-property-descriptors: 1.0.2 - has-proto: 1.2.0 - has-symbols: 1.1.0 - hasown: 2.0.2 - internal-slot: 1.1.0 - is-array-buffer: 3.0.5 - is-callable: 1.2.7 - is-data-view: 1.0.2 - is-negative-zero: 2.0.3 - is-regex: 1.2.1 - is-set: 2.0.3 - is-shared-array-buffer: 1.0.4 - is-string: 1.1.1 - is-typed-array: 1.1.15 - is-weakref: 1.1.1 - math-intrinsics: 1.1.0 - object-inspect: 1.13.4 - object-keys: 1.1.1 - object.assign: 4.1.7 - own-keys: 1.0.1 - regexp.prototype.flags: 1.5.4 - safe-array-concat: 1.1.3 - safe-push-apply: 1.0.0 - safe-regex-test: 1.1.0 - set-proto: 1.0.0 - stop-iteration-iterator: 1.1.0 - string.prototype.trim: 1.2.10 - string.prototype.trimend: 1.0.9 - string.prototype.trimstart: 1.0.8 - typed-array-buffer: 1.0.3 - typed-array-byte-length: 1.0.3 - typed-array-byte-offset: 1.0.4 - typed-array-length: 1.0.7 - unbox-primitive: 1.1.0 - which-typed-array: 1.1.19 - - es-define-property@1.0.1: {} - - es-errors@1.3.0: {} - - es-module-lexer@1.7.0: {} - - es-object-atoms@1.1.1: - dependencies: - es-errors: 1.3.0 - - es-set-tostringtag@2.1.0: - dependencies: - es-errors: 1.3.0 - get-intrinsic: 1.3.0 - has-tostringtag: 1.0.2 - hasown: 2.0.2 - - es-shim-unscopables@1.1.0: - dependencies: - hasown: 2.0.2 - - es-to-primitive@1.3.0: - dependencies: - is-callable: 1.2.7 - is-date-object: 1.1.0 - is-symbol: 1.1.1 - - esbuild@0.25.12: - optionalDependencies: - '@esbuild/aix-ppc64': 0.25.12 - '@esbuild/android-arm': 0.25.12 - '@esbuild/android-arm64': 0.25.12 - '@esbuild/android-x64': 0.25.12 - '@esbuild/darwin-arm64': 0.25.12 - '@esbuild/darwin-x64': 0.25.12 - '@esbuild/freebsd-arm64': 0.25.12 - '@esbuild/freebsd-x64': 0.25.12 - '@esbuild/linux-arm': 0.25.12 - '@esbuild/linux-arm64': 0.25.12 - '@esbuild/linux-ia32': 0.25.12 - '@esbuild/linux-loong64': 0.25.12 - '@esbuild/linux-mips64el': 0.25.12 - '@esbuild/linux-ppc64': 0.25.12 - '@esbuild/linux-riscv64': 0.25.12 - '@esbuild/linux-s390x': 0.25.12 - '@esbuild/linux-x64': 0.25.12 - '@esbuild/netbsd-arm64': 0.25.12 - '@esbuild/netbsd-x64': 0.25.12 - '@esbuild/openbsd-arm64': 0.25.12 - '@esbuild/openbsd-x64': 0.25.12 - '@esbuild/openharmony-arm64': 0.25.12 - '@esbuild/sunos-x64': 0.25.12 - '@esbuild/win32-arm64': 0.25.12 - '@esbuild/win32-ia32': 0.25.12 - '@esbuild/win32-x64': 0.25.12 - - escape-html@1.0.3: {} - - escape-string-regexp@4.0.0: {} - - eslint-compat-utils@0.5.1(eslint@9.39.1): - dependencies: - eslint: 9.39.1 - semver: 7.7.3 - - eslint-config-prettier@10.1.8(eslint@9.39.1): - dependencies: - eslint: 9.39.1 - - eslint-import-context@0.1.9(unrs-resolver@1.11.1): - dependencies: - get-tsconfig: 4.13.0 - stable-hash-x: 0.2.0 - optionalDependencies: - unrs-resolver: 1.11.1 - - eslint-import-resolver-node@0.3.9: - dependencies: - debug: 3.2.7 - is-core-module: 2.16.1 - resolve: 1.22.11 - transitivePeerDependencies: - - supports-color - - eslint-import-resolver-typescript@4.4.4(eslint-plugin-import@2.32.0)(eslint@9.39.1): - dependencies: - debug: 4.4.3 - eslint: 9.39.1 - eslint-import-context: 0.1.9(unrs-resolver@1.11.1) - get-tsconfig: 4.13.0 - is-bun-module: 2.0.0 - stable-hash-x: 0.2.0 - tinyglobby: 0.2.15 - unrs-resolver: 1.11.1 - optionalDependencies: - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.49.0(eslint@9.39.1)(typescript@5.9.3))(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1) - transitivePeerDependencies: - - supports-color - - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.49.0(eslint@9.39.1)(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1): - dependencies: - debug: 3.2.7 - optionalDependencies: - '@typescript-eslint/parser': 8.49.0(eslint@9.39.1)(typescript@5.9.3) - eslint: 9.39.1 - eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.39.1) - transitivePeerDependencies: - - supports-color - - eslint-plugin-es-x@7.8.0(eslint@9.39.1): - dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) - '@eslint-community/regexpp': 4.12.2 - eslint: 9.39.1 - eslint-compat-utils: 0.5.1(eslint@9.39.1) - - eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.49.0(eslint@9.39.1)(typescript@5.9.3))(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1): - dependencies: - '@rtsao/scc': 1.1.0 - array-includes: 3.1.9 - array.prototype.findlastindex: 1.2.6 - array.prototype.flat: 1.3.3 - array.prototype.flatmap: 1.3.3 - debug: 3.2.7 - doctrine: 2.1.0 - eslint: 9.39.1 - eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.49.0(eslint@9.39.1)(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1) - hasown: 2.0.2 - is-core-module: 2.16.1 - is-glob: 4.0.3 - minimatch: 3.1.2 - object.fromentries: 2.0.8 - object.groupby: 1.0.3 - object.values: 1.2.1 - semver: 6.3.1 - string.prototype.trimend: 1.0.9 - tsconfig-paths: 3.15.0 - optionalDependencies: - '@typescript-eslint/parser': 8.49.0(eslint@9.39.1)(typescript@5.9.3) - transitivePeerDependencies: - - eslint-import-resolver-typescript - - eslint-import-resolver-webpack - - supports-color - - eslint-plugin-n@17.23.1(eslint@9.39.1)(typescript@5.9.3): - dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) - enhanced-resolve: 5.18.3 - eslint: 9.39.1 - eslint-plugin-es-x: 7.8.0(eslint@9.39.1) - get-tsconfig: 4.13.0 - globals: 15.15.0 - globrex: 0.1.2 - ignore: 5.3.2 - semver: 7.7.3 - ts-declaration-location: 1.0.7(typescript@5.9.3) - transitivePeerDependencies: - - typescript - - eslint-plugin-simple-import-sort@12.1.1(eslint@9.39.1): - dependencies: - eslint: 9.39.1 - - eslint-scope@8.4.0: - dependencies: - esrecurse: 4.3.0 - estraverse: 5.3.0 - - eslint-visitor-keys@3.4.3: {} - - eslint-visitor-keys@4.2.1: {} - - eslint@9.39.1: - dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) - '@eslint-community/regexpp': 4.12.2 - '@eslint/config-array': 0.21.1 - '@eslint/config-helpers': 0.4.2 - '@eslint/core': 0.17.0 - '@eslint/eslintrc': 3.3.1 - '@eslint/js': 9.39.1 - '@eslint/plugin-kit': 0.4.1 - '@humanfs/node': 0.16.7 - '@humanwhocodes/module-importer': 1.0.1 - '@humanwhocodes/retry': 0.4.3 - '@types/estree': 1.0.8 - ajv: 6.12.6 - chalk: 4.1.2 - cross-spawn: 7.0.6 - debug: 4.4.3 - escape-string-regexp: 4.0.0 - eslint-scope: 8.4.0 - eslint-visitor-keys: 4.2.1 - espree: 10.4.0 - esquery: 1.6.0 - esutils: 2.0.3 - fast-deep-equal: 3.1.3 - file-entry-cache: 8.0.0 - find-up: 5.0.0 - glob-parent: 6.0.2 - ignore: 5.3.2 - imurmurhash: 0.1.4 - is-glob: 4.0.3 - json-stable-stringify-without-jsonify: 1.0.1 - lodash.merge: 4.6.2 - minimatch: 3.1.2 - natural-compare: 1.4.0 - optionator: 0.9.4 - transitivePeerDependencies: - - supports-color - - espree@10.4.0: - dependencies: - acorn: 8.15.0 - acorn-jsx: 5.3.2(acorn@8.15.0) - eslint-visitor-keys: 4.2.1 - - esprima@4.0.1: {} - - esquery@1.6.0: - dependencies: - estraverse: 5.3.0 - - esrecurse@4.3.0: - dependencies: - estraverse: 5.3.0 - - estraverse@5.3.0: {} - - estree-walker@3.0.3: - dependencies: - '@types/estree': 1.0.8 - - esutils@2.0.3: {} - - etag@1.8.1: {} - - eventsource-parser@3.0.6: {} - - eventsource@3.0.7: - dependencies: - eventsource-parser: 3.0.6 - - expect-type@1.2.2: {} - - express-rate-limit@7.5.1(express@5.1.0): - dependencies: - express: 5.1.0 - - express@5.1.0: - dependencies: - accepts: 2.0.0 - body-parser: 2.2.0 - content-disposition: 1.0.0 - content-type: 1.0.5 - cookie: 0.7.2 - cookie-signature: 1.2.2 - debug: 4.4.3 - encodeurl: 2.0.0 - escape-html: 1.0.3 - etag: 1.8.1 - finalhandler: 2.1.0 - fresh: 2.0.0 - http-errors: 2.0.0 - merge-descriptors: 2.0.0 - mime-types: 3.0.1 - on-finished: 2.4.1 - once: 1.4.0 - parseurl: 1.3.3 - proxy-addr: 2.0.7 - qs: 6.14.0 - range-parser: 1.2.1 - router: 2.2.0 - send: 1.2.0 - serve-static: 2.2.0 - statuses: 2.0.2 - type-is: 2.0.1 - vary: 1.1.2 - transitivePeerDependencies: - - supports-color - - extendable-error@0.1.7: {} - - fast-deep-equal@3.1.3: {} - - fast-glob@3.3.3: - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.8 - - fast-json-stable-stringify@2.1.0: {} - - fast-levenshtein@2.0.6: {} - - fast-safe-stringify@2.1.1: {} - - fast-uri@3.1.0: {} - - fastq@1.19.1: - dependencies: - reusify: 1.1.0 - - fdir@6.5.0(picomatch@4.0.3): - optionalDependencies: - picomatch: 4.0.3 - - file-entry-cache@8.0.0: - dependencies: - flat-cache: 4.0.1 - - fill-range@7.1.1: - dependencies: - to-regex-range: 5.0.1 - - finalhandler@2.1.0: - dependencies: - debug: 4.4.3 - encodeurl: 2.0.0 - escape-html: 1.0.3 - on-finished: 2.4.1 - parseurl: 1.3.3 - statuses: 2.0.2 - transitivePeerDependencies: - - supports-color - - find-up@4.1.0: - dependencies: - locate-path: 5.0.0 - path-exists: 4.0.0 - - find-up@5.0.0: - dependencies: - locate-path: 6.0.0 - path-exists: 4.0.0 - - flat-cache@4.0.1: - dependencies: - flatted: 3.3.3 - keyv: 4.5.4 - - flatted@3.3.3: {} - - for-each@0.3.5: - dependencies: - is-callable: 1.2.7 - - form-data@4.0.4: - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - es-set-tostringtag: 2.1.0 - hasown: 2.0.2 - mime-types: 2.1.35 - - formidable@3.5.4: - dependencies: - '@paralleldrive/cuid2': 2.3.1 - dezalgo: 1.0.4 - once: 1.4.0 - - forwarded@0.2.0: {} - - fresh@2.0.0: {} - - fs-extra@7.0.1: - dependencies: - graceful-fs: 4.2.11 - jsonfile: 4.0.0 - universalify: 0.1.2 - - fs-extra@8.1.0: - dependencies: - graceful-fs: 4.2.11 - jsonfile: 4.0.0 - universalify: 0.1.2 - - fsevents@2.3.3: - optional: true - - function-bind@1.1.2: {} - - function.prototype.name@1.1.8: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - define-properties: 1.2.1 - functions-have-names: 1.2.3 - hasown: 2.0.2 - is-callable: 1.2.7 - - functions-have-names@1.2.3: {} - - generator-function@2.0.1: {} - - get-intrinsic@1.3.0: - dependencies: - call-bind-apply-helpers: 1.0.2 - es-define-property: 1.0.1 - es-errors: 1.3.0 - es-object-atoms: 1.1.1 - function-bind: 1.1.2 - get-proto: 1.0.1 - gopd: 1.2.0 - has-symbols: 1.1.0 - hasown: 2.0.2 - math-intrinsics: 1.1.0 - - get-proto@1.0.1: - dependencies: - dunder-proto: 1.0.1 - es-object-atoms: 1.1.1 - - get-symbol-description@1.1.0: - dependencies: - call-bound: 1.0.4 - es-errors: 1.3.0 - get-intrinsic: 1.3.0 - - get-tsconfig@4.13.0: - dependencies: - resolve-pkg-maps: 1.0.0 - - glob-parent@5.1.2: - dependencies: - is-glob: 4.0.3 - - glob-parent@6.0.2: - dependencies: - is-glob: 4.0.3 - - globals@14.0.0: {} - - globals@15.15.0: {} - - globalthis@1.0.4: - dependencies: - define-properties: 1.2.1 - gopd: 1.2.0 - - globby@11.1.0: - dependencies: - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.3 - ignore: 5.3.2 - merge2: 1.4.1 - slash: 3.0.0 - - globrex@0.1.2: {} - - gopd@1.2.0: {} - - graceful-fs@4.2.11: {} - - has-bigints@1.1.0: {} - - has-flag@4.0.0: {} - - has-property-descriptors@1.0.2: - dependencies: - es-define-property: 1.0.1 - - has-proto@1.2.0: - dependencies: - dunder-proto: 1.0.1 - - has-symbols@1.1.0: {} - - has-tostringtag@1.0.2: - dependencies: - has-symbols: 1.1.0 - - hasown@2.0.2: - dependencies: - function-bind: 1.1.2 - - hono@4.11.1: {} - - hookable@5.5.3: {} - - http-errors@2.0.0: - dependencies: - depd: 2.0.0 - inherits: 2.0.4 - setprototypeof: 1.2.0 - statuses: 2.0.1 - toidentifier: 1.0.1 - - human-id@4.1.3: {} - - iconv-lite@0.6.3: - dependencies: - safer-buffer: 2.1.2 - - iconv-lite@0.7.0: - dependencies: - safer-buffer: 2.1.2 - - ignore@5.3.2: {} - - ignore@7.0.5: {} - - import-fresh@3.3.1: - dependencies: - parent-module: 1.0.1 - resolve-from: 4.0.0 - - import-without-cache@0.2.3: {} - - imurmurhash@0.1.4: {} - - inherits@2.0.4: {} - - internal-slot@1.1.0: - dependencies: - es-errors: 1.3.0 - hasown: 2.0.2 - side-channel: 1.1.0 - - ipaddr.js@1.9.1: {} - - is-array-buffer@3.0.5: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - get-intrinsic: 1.3.0 - - is-async-function@2.1.1: - dependencies: - async-function: 1.0.0 - call-bound: 1.0.4 - get-proto: 1.0.1 - has-tostringtag: 1.0.2 - safe-regex-test: 1.1.0 - - is-bigint@1.1.0: - dependencies: - has-bigints: 1.1.0 - - is-boolean-object@1.2.2: - dependencies: - call-bound: 1.0.4 - has-tostringtag: 1.0.2 - - is-bun-module@2.0.0: - dependencies: - semver: 7.7.3 - - is-callable@1.2.7: {} - - is-core-module@2.16.1: - dependencies: - hasown: 2.0.2 - - is-data-view@1.0.2: - dependencies: - call-bound: 1.0.4 - get-intrinsic: 1.3.0 - is-typed-array: 1.1.15 - - is-date-object@1.1.0: - dependencies: - call-bound: 1.0.4 - has-tostringtag: 1.0.2 - - is-extglob@2.1.1: {} - - is-finalizationregistry@1.1.1: - dependencies: - call-bound: 1.0.4 - - is-generator-function@1.1.2: - dependencies: - call-bound: 1.0.4 - generator-function: 2.0.1 - get-proto: 1.0.1 - has-tostringtag: 1.0.2 - safe-regex-test: 1.1.0 - - is-glob@4.0.3: - dependencies: - is-extglob: 2.1.1 - - is-map@2.0.3: {} - - is-negative-zero@2.0.3: {} - - is-number-object@1.1.1: - dependencies: - call-bound: 1.0.4 - has-tostringtag: 1.0.2 - - is-number@7.0.0: {} - - is-promise@4.0.0: {} - - is-regex@1.2.1: - dependencies: - call-bound: 1.0.4 - gopd: 1.2.0 - has-tostringtag: 1.0.2 - hasown: 2.0.2 - - is-set@2.0.3: {} - - is-shared-array-buffer@1.0.4: - dependencies: - call-bound: 1.0.4 - - is-string@1.1.1: - dependencies: - call-bound: 1.0.4 - has-tostringtag: 1.0.2 - - is-subdir@1.2.0: - dependencies: - better-path-resolve: 1.0.0 - - is-symbol@1.1.1: - dependencies: - call-bound: 1.0.4 - has-symbols: 1.1.0 - safe-regex-test: 1.1.0 - - is-typed-array@1.1.15: - dependencies: - which-typed-array: 1.1.19 - - is-weakmap@2.0.2: {} - - is-weakref@1.1.1: - dependencies: - call-bound: 1.0.4 - - is-weakset@2.0.4: - dependencies: - call-bound: 1.0.4 - get-intrinsic: 1.3.0 - - is-windows@1.0.2: {} - - isarray@2.0.5: {} - - isexe@2.0.0: {} - - jose@6.1.3: {} - - js-yaml@3.14.2: - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - - js-yaml@4.1.0: - dependencies: - argparse: 2.0.1 - - js-yaml@4.1.1: - dependencies: - argparse: 2.0.1 - - jsesc@3.1.0: {} - - json-buffer@3.0.1: {} - - json-schema-traverse@0.4.1: {} - - json-schema-traverse@1.0.0: {} - - json-schema-typed@8.0.2: {} - - json-stable-stringify-without-jsonify@1.0.1: {} - - json5@1.0.2: - dependencies: - minimist: 1.2.8 - - jsonfile@4.0.0: - optionalDependencies: - graceful-fs: 4.2.11 - - keyv@4.5.4: - dependencies: - json-buffer: 3.0.1 - - levn@0.4.1: - dependencies: - prelude-ls: 1.2.1 - type-check: 0.4.0 - - locate-path@5.0.0: - dependencies: - p-locate: 4.1.0 - - locate-path@6.0.0: - dependencies: - p-locate: 5.0.0 - - lodash.merge@4.6.2: {} - - lodash.startcase@4.4.0: {} - - magic-string@0.30.21: - dependencies: - '@jridgewell/sourcemap-codec': 1.5.5 - - math-intrinsics@1.1.0: {} - - media-typer@1.1.0: {} - - merge-descriptors@2.0.0: {} - - merge2@1.4.1: {} - - methods@1.1.2: {} - - micromatch@4.0.8: - dependencies: - braces: 3.0.3 - picomatch: 2.3.1 - - mime-db@1.52.0: {} - - mime-db@1.54.0: {} - - mime-types@2.1.35: - dependencies: - mime-db: 1.52.0 - - mime-types@3.0.1: - dependencies: - mime-db: 1.54.0 - - mime@2.6.0: {} - - minimatch@3.1.2: - dependencies: - brace-expansion: 1.1.12 - - minimatch@9.0.5: - dependencies: - brace-expansion: 2.0.2 - - minimist@1.2.8: {} - - mri@1.2.0: {} - - ms@2.1.3: {} - - nanoid@3.3.11: {} - - napi-postinstall@0.3.4: {} - - natural-compare@1.4.0: {} - - negotiator@1.0.0: {} - - node-fetch@2.7.0: - dependencies: - whatwg-url: 5.0.0 - - object-assign@4.1.1: {} - - object-inspect@1.13.4: {} - - object-keys@1.1.1: {} - - object.assign@4.1.7: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - define-properties: 1.2.1 - es-object-atoms: 1.1.1 - has-symbols: 1.1.0 - object-keys: 1.1.1 - - object.fromentries@2.0.8: - dependencies: - call-bind: 1.0.8 - define-properties: 1.2.1 - es-abstract: 1.24.0 - es-object-atoms: 1.1.1 - - object.groupby@1.0.3: - dependencies: - call-bind: 1.0.8 - define-properties: 1.2.1 - es-abstract: 1.24.0 - - object.values@1.2.1: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - define-properties: 1.2.1 - es-object-atoms: 1.1.1 - - obug@2.1.1: {} - - on-finished@2.4.1: - dependencies: - ee-first: 1.1.1 - - once@1.4.0: - dependencies: - wrappy: 1.0.2 - - optionator@0.9.4: - dependencies: - deep-is: 0.1.4 - fast-levenshtein: 2.0.6 - levn: 0.4.1 - prelude-ls: 1.2.1 - type-check: 0.4.0 - word-wrap: 1.2.5 - - outdent@0.5.0: {} - - own-keys@1.0.1: - dependencies: - get-intrinsic: 1.3.0 - object-keys: 1.1.1 - safe-push-apply: 1.0.0 - - p-filter@2.1.0: - dependencies: - p-map: 2.1.0 - - p-limit@2.3.0: - dependencies: - p-try: 2.2.0 - - p-limit@3.1.0: - dependencies: - yocto-queue: 0.1.0 - - p-locate@4.1.0: - dependencies: - p-limit: 2.3.0 - - p-locate@5.0.0: - dependencies: - p-limit: 3.1.0 - - p-map@2.1.0: {} - - p-try@2.2.0: {} - - package-manager-detector@0.2.11: - dependencies: - quansync: 0.2.11 - - parent-module@1.0.1: - dependencies: - callsites: 3.1.0 - - parseurl@1.3.3: {} - - path-exists@4.0.0: {} - - path-key@3.1.1: {} - - path-parse@1.0.7: {} - - path-to-regexp@8.3.0: {} - - path-type@4.0.0: {} - - pathe@2.0.3: {} - - picocolors@1.1.1: {} - - picomatch@2.3.1: {} - - picomatch@4.0.3: {} - - pify@4.0.1: {} - - pkce-challenge@5.0.0: {} - - possible-typed-array-names@1.1.0: {} - - postcss@8.5.6: - dependencies: - nanoid: 3.3.11 - picocolors: 1.1.1 - source-map-js: 1.2.1 - - prelude-ls@1.2.1: {} - - prettier@2.8.8: {} - - prettier@3.6.2: {} - - proxy-addr@2.0.7: - dependencies: - forwarded: 0.2.0 - ipaddr.js: 1.9.1 - - punycode@2.3.1: {} - - qs@6.14.0: - dependencies: - side-channel: 1.1.0 - - quansync@0.2.11: {} - - quansync@1.0.0: {} - - queue-microtask@1.2.3: {} - - range-parser@1.2.1: {} - - raw-body@3.0.1: - dependencies: - bytes: 3.1.2 - http-errors: 2.0.0 - iconv-lite: 0.7.0 - unpipe: 1.0.0 - - read-yaml-file@1.1.0: - dependencies: - graceful-fs: 4.2.11 - js-yaml: 3.14.2 - pify: 4.0.1 - strip-bom: 3.0.0 - - reflect.getprototypeof@1.0.10: - dependencies: - call-bind: 1.0.8 - define-properties: 1.2.1 - es-abstract: 1.24.0 - es-errors: 1.3.0 - es-object-atoms: 1.1.1 - get-intrinsic: 1.3.0 - get-proto: 1.0.1 - which-builtin-type: 1.2.1 - - regexp.prototype.flags@1.5.4: - dependencies: - call-bind: 1.0.8 - define-properties: 1.2.1 - es-errors: 1.3.0 - get-proto: 1.0.1 - gopd: 1.2.0 - set-function-name: 2.0.2 - - require-from-string@2.0.2: {} - - resolve-from@4.0.0: {} - - resolve-from@5.0.0: {} - - resolve-pkg-maps@1.0.0: {} - - resolve@1.22.11: - dependencies: - is-core-module: 2.16.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - - reusify@1.1.0: {} - - rolldown-plugin-dts@0.18.3(@typescript/native-preview@7.0.0-dev.20251218.3)(rolldown@1.0.0-beta.53)(typescript@5.9.3): - dependencies: - '@babel/generator': 7.28.5 - '@babel/parser': 7.28.5 - '@babel/types': 7.28.5 - ast-kit: 2.2.0 - birpc: 3.0.0 - dts-resolver: 2.1.3 - get-tsconfig: 4.13.0 - magic-string: 0.30.21 - obug: 2.1.1 - rolldown: 1.0.0-beta.53 - optionalDependencies: - '@typescript/native-preview': 7.0.0-dev.20251218.3 - typescript: 5.9.3 - transitivePeerDependencies: - - oxc-resolver - - rolldown@1.0.0-beta.53: - dependencies: - '@oxc-project/types': 0.101.0 - '@rolldown/pluginutils': 1.0.0-beta.53 - optionalDependencies: - '@rolldown/binding-android-arm64': 1.0.0-beta.53 - '@rolldown/binding-darwin-arm64': 1.0.0-beta.53 - '@rolldown/binding-darwin-x64': 1.0.0-beta.53 - '@rolldown/binding-freebsd-x64': 1.0.0-beta.53 - '@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.53 - '@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.53 - '@rolldown/binding-linux-arm64-musl': 1.0.0-beta.53 - '@rolldown/binding-linux-x64-gnu': 1.0.0-beta.53 - '@rolldown/binding-linux-x64-musl': 1.0.0-beta.53 - '@rolldown/binding-openharmony-arm64': 1.0.0-beta.53 - '@rolldown/binding-wasm32-wasi': 1.0.0-beta.53 - '@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.53 - '@rolldown/binding-win32-x64-msvc': 1.0.0-beta.53 - - rollup@4.53.2: - dependencies: - '@types/estree': 1.0.8 - optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.53.2 - '@rollup/rollup-android-arm64': 4.53.2 - '@rollup/rollup-darwin-arm64': 4.53.2 - '@rollup/rollup-darwin-x64': 4.53.2 - '@rollup/rollup-freebsd-arm64': 4.53.2 - '@rollup/rollup-freebsd-x64': 4.53.2 - '@rollup/rollup-linux-arm-gnueabihf': 4.53.2 - '@rollup/rollup-linux-arm-musleabihf': 4.53.2 - '@rollup/rollup-linux-arm64-gnu': 4.53.2 - '@rollup/rollup-linux-arm64-musl': 4.53.2 - '@rollup/rollup-linux-loong64-gnu': 4.53.2 - '@rollup/rollup-linux-ppc64-gnu': 4.53.2 - '@rollup/rollup-linux-riscv64-gnu': 4.53.2 - '@rollup/rollup-linux-riscv64-musl': 4.53.2 - '@rollup/rollup-linux-s390x-gnu': 4.53.2 - '@rollup/rollup-linux-x64-gnu': 4.53.2 - '@rollup/rollup-linux-x64-musl': 4.53.2 - '@rollup/rollup-openharmony-arm64': 4.53.2 - '@rollup/rollup-win32-arm64-msvc': 4.53.2 - '@rollup/rollup-win32-ia32-msvc': 4.53.2 - '@rollup/rollup-win32-x64-gnu': 4.53.2 - '@rollup/rollup-win32-x64-msvc': 4.53.2 - fsevents: 2.3.3 - - router@2.2.0: - dependencies: - debug: 4.4.3 - depd: 2.0.0 - is-promise: 4.0.0 - parseurl: 1.3.3 - path-to-regexp: 8.3.0 - transitivePeerDependencies: - - supports-color - - run-parallel@1.2.0: - dependencies: - queue-microtask: 1.2.3 - - safe-array-concat@1.1.3: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - get-intrinsic: 1.3.0 - has-symbols: 1.1.0 - isarray: 2.0.5 - - safe-buffer@5.2.1: {} - - safe-push-apply@1.0.0: - dependencies: - es-errors: 1.3.0 - isarray: 2.0.5 - - safe-regex-test@1.1.0: - dependencies: - call-bound: 1.0.4 - es-errors: 1.3.0 - is-regex: 1.2.1 - - safer-buffer@2.1.2: {} - - semver@6.3.1: {} - - semver@7.7.3: {} - - send@1.2.0: - dependencies: - debug: 4.4.3 - encodeurl: 2.0.0 - escape-html: 1.0.3 - etag: 1.8.1 - fresh: 2.0.0 - http-errors: 2.0.0 - mime-types: 3.0.1 - ms: 2.1.3 - on-finished: 2.4.1 - range-parser: 1.2.1 - statuses: 2.0.2 - transitivePeerDependencies: - - supports-color - - serve-static@2.2.0: - dependencies: - encodeurl: 2.0.0 - escape-html: 1.0.3 - parseurl: 1.3.3 - send: 1.2.0 - transitivePeerDependencies: - - supports-color - - set-function-length@1.2.2: - dependencies: - define-data-property: 1.1.4 - es-errors: 1.3.0 - function-bind: 1.1.2 - get-intrinsic: 1.3.0 - gopd: 1.2.0 - has-property-descriptors: 1.0.2 - - set-function-name@2.0.2: - dependencies: - define-data-property: 1.1.4 - es-errors: 1.3.0 - functions-have-names: 1.2.3 - has-property-descriptors: 1.0.2 - - set-proto@1.0.0: - dependencies: - dunder-proto: 1.0.1 - es-errors: 1.3.0 - es-object-atoms: 1.1.1 - - setprototypeof@1.2.0: {} - - shebang-command@2.0.0: - dependencies: - shebang-regex: 3.0.0 - - shebang-regex@3.0.0: {} - - side-channel-list@1.0.0: - dependencies: - es-errors: 1.3.0 - object-inspect: 1.13.4 - - side-channel-map@1.0.1: - dependencies: - call-bound: 1.0.4 - es-errors: 1.3.0 - get-intrinsic: 1.3.0 - object-inspect: 1.13.4 - - side-channel-weakmap@1.0.2: - dependencies: - call-bound: 1.0.4 - es-errors: 1.3.0 - get-intrinsic: 1.3.0 - object-inspect: 1.13.4 - side-channel-map: 1.0.1 - - side-channel@1.1.0: - dependencies: - es-errors: 1.3.0 - object-inspect: 1.13.4 - side-channel-list: 1.0.0 - side-channel-map: 1.0.1 - side-channel-weakmap: 1.0.2 - - siginfo@2.0.0: {} - - signal-exit@4.1.0: {} - - slash@3.0.0: {} - - source-map-js@1.2.1: {} - - spawndamnit@3.0.1: - dependencies: - cross-spawn: 7.0.6 - signal-exit: 4.1.0 - - sprintf-js@1.0.3: {} - - stable-hash-x@0.2.0: {} - - stackback@0.0.2: {} - - statuses@2.0.1: {} - - statuses@2.0.2: {} - - std-env@3.10.0: {} - - stop-iteration-iterator@1.1.0: - dependencies: - es-errors: 1.3.0 - internal-slot: 1.1.0 - - string.prototype.trim@1.2.10: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - define-data-property: 1.1.4 - define-properties: 1.2.1 - es-abstract: 1.24.0 - es-object-atoms: 1.1.1 - has-property-descriptors: 1.0.2 - - string.prototype.trimend@1.0.9: - dependencies: - call-bind: 1.0.8 - call-bound: 1.0.4 - define-properties: 1.2.1 - es-object-atoms: 1.1.1 - - string.prototype.trimstart@1.0.8: - dependencies: - call-bind: 1.0.8 - define-properties: 1.2.1 - es-object-atoms: 1.1.1 - - strip-ansi@6.0.1: - dependencies: - ansi-regex: 5.0.1 - - strip-bom@3.0.0: {} - - strip-json-comments@3.1.1: {} - - superagent@10.2.3: - dependencies: - component-emitter: 1.3.1 - cookiejar: 2.1.4 - debug: 4.4.3 - fast-safe-stringify: 2.1.1 - form-data: 4.0.4 - formidable: 3.5.4 - methods: 1.1.2 - mime: 2.6.0 - qs: 6.14.0 - transitivePeerDependencies: - - supports-color - - supertest@7.1.4: - dependencies: - methods: 1.1.2 - superagent: 10.2.3 - transitivePeerDependencies: - - supports-color - - supports-color@7.2.0: - dependencies: - has-flag: 4.0.0 - - supports-preserve-symlinks-flag@1.0.0: {} - - tapable@2.3.0: {} - - term-size@2.2.1: {} - - tinybench@2.9.0: {} - - tinyexec@0.3.2: {} - - tinyexec@1.0.2: {} - - tinyglobby@0.2.15: - dependencies: - fdir: 6.5.0(picomatch@4.0.3) - picomatch: 4.0.3 - - tinyrainbow@3.0.3: {} - - to-regex-range@5.0.1: - dependencies: - is-number: 7.0.0 - - toidentifier@1.0.1: {} - - tr46@0.0.3: {} - - tree-kill@1.2.2: {} - - ts-api-utils@2.1.0(typescript@5.9.3): - dependencies: - typescript: 5.9.3 - - ts-declaration-location@1.0.7(typescript@5.9.3): - dependencies: - picomatch: 4.0.3 - typescript: 5.9.3 - - tsconfck@3.1.6(typescript@5.9.3): - optionalDependencies: - typescript: 5.9.3 - - tsconfig-paths@3.15.0: - dependencies: - '@types/json5': 0.0.29 - json5: 1.0.2 - minimist: 1.2.8 - strip-bom: 3.0.0 - - tsdown@0.18.0(@typescript/native-preview@7.0.0-dev.20251218.3)(typescript@5.9.3): - dependencies: - ansis: 4.2.0 - cac: 6.7.14 - defu: 6.1.4 - empathic: 2.0.0 - hookable: 5.5.3 - import-without-cache: 0.2.3 - obug: 2.1.1 - rolldown: 1.0.0-beta.53 - rolldown-plugin-dts: 0.18.3(@typescript/native-preview@7.0.0-dev.20251218.3)(rolldown@1.0.0-beta.53)(typescript@5.9.3) - semver: 7.7.3 - tinyexec: 1.0.2 - tinyglobby: 0.2.15 - tree-kill: 1.2.2 - unconfig-core: 7.4.2 - unrun: 0.2.19 - optionalDependencies: - typescript: 5.9.3 - transitivePeerDependencies: - - '@ts-macro/tsc' - - '@typescript/native-preview' - - oxc-resolver - - synckit - - vue-tsc - - tslib@2.8.1: - optional: true - - tsx@4.20.6: - dependencies: - esbuild: 0.25.12 - get-tsconfig: 4.13.0 - optionalDependencies: - fsevents: 2.3.3 - - type-check@0.4.0: - dependencies: - prelude-ls: 1.2.1 - - type-is@2.0.1: - dependencies: - content-type: 1.0.5 - media-typer: 1.1.0 - mime-types: 3.0.1 - - typed-array-buffer@1.0.3: - dependencies: - call-bound: 1.0.4 - es-errors: 1.3.0 - is-typed-array: 1.1.15 - - typed-array-byte-length@1.0.3: - dependencies: - call-bind: 1.0.8 - for-each: 0.3.5 - gopd: 1.2.0 - has-proto: 1.2.0 - is-typed-array: 1.1.15 - - typed-array-byte-offset@1.0.4: - dependencies: - available-typed-arrays: 1.0.7 - call-bind: 1.0.8 - for-each: 0.3.5 - gopd: 1.2.0 - has-proto: 1.2.0 - is-typed-array: 1.1.15 - reflect.getprototypeof: 1.0.10 - - typed-array-length@1.0.7: - dependencies: - call-bind: 1.0.8 - for-each: 0.3.5 - gopd: 1.2.0 - is-typed-array: 1.1.15 - possible-typed-array-names: 1.1.0 - reflect.getprototypeof: 1.0.10 - - typescript-eslint@8.49.0(eslint@9.39.1)(typescript@5.9.3): - dependencies: - '@typescript-eslint/eslint-plugin': 8.49.0(@typescript-eslint/parser@8.49.0(eslint@9.39.1)(typescript@5.9.3))(eslint@9.39.1)(typescript@5.9.3) - '@typescript-eslint/parser': 8.49.0(eslint@9.39.1)(typescript@5.9.3) - '@typescript-eslint/typescript-estree': 8.49.0(typescript@5.9.3) - '@typescript-eslint/utils': 8.49.0(eslint@9.39.1)(typescript@5.9.3) - eslint: 9.39.1 - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - typescript@5.9.3: {} - - unbox-primitive@1.1.0: - dependencies: - call-bound: 1.0.4 - has-bigints: 1.1.0 - has-symbols: 1.1.0 - which-boxed-primitive: 1.1.1 - - unconfig-core@7.4.2: - dependencies: - '@quansync/fs': 1.0.0 - quansync: 1.0.0 - - undici-types@7.16.0: {} - - universalify@0.1.2: {} - - unpipe@1.0.0: {} - - unrs-resolver@1.11.1: - dependencies: - napi-postinstall: 0.3.4 - optionalDependencies: - '@unrs/resolver-binding-android-arm-eabi': 1.11.1 - '@unrs/resolver-binding-android-arm64': 1.11.1 - '@unrs/resolver-binding-darwin-arm64': 1.11.1 - '@unrs/resolver-binding-darwin-x64': 1.11.1 - '@unrs/resolver-binding-freebsd-x64': 1.11.1 - '@unrs/resolver-binding-linux-arm-gnueabihf': 1.11.1 - '@unrs/resolver-binding-linux-arm-musleabihf': 1.11.1 - '@unrs/resolver-binding-linux-arm64-gnu': 1.11.1 - '@unrs/resolver-binding-linux-arm64-musl': 1.11.1 - '@unrs/resolver-binding-linux-ppc64-gnu': 1.11.1 - '@unrs/resolver-binding-linux-riscv64-gnu': 1.11.1 - '@unrs/resolver-binding-linux-riscv64-musl': 1.11.1 - '@unrs/resolver-binding-linux-s390x-gnu': 1.11.1 - '@unrs/resolver-binding-linux-x64-gnu': 1.11.1 - '@unrs/resolver-binding-linux-x64-musl': 1.11.1 - '@unrs/resolver-binding-wasm32-wasi': 1.11.1 - '@unrs/resolver-binding-win32-arm64-msvc': 1.11.1 - '@unrs/resolver-binding-win32-ia32-msvc': 1.11.1 - '@unrs/resolver-binding-win32-x64-msvc': 1.11.1 - - unrun@0.2.19: - dependencies: - rolldown: 1.0.0-beta.53 - - uri-js@4.4.1: - dependencies: - punycode: 2.3.1 - - vary@1.1.2: {} - - vite-tsconfig-paths@5.1.4(typescript@5.9.3)(vite@7.2.2(@types/node@24.10.3)(tsx@4.20.6)): - dependencies: - debug: 4.4.3 - globrex: 0.1.2 - tsconfck: 3.1.6(typescript@5.9.3) - optionalDependencies: - vite: 7.2.2(@types/node@24.10.3)(tsx@4.20.6) - transitivePeerDependencies: - - supports-color - - typescript - - vite@7.2.2(@types/node@24.10.3)(tsx@4.20.6): - dependencies: - esbuild: 0.25.12 - fdir: 6.5.0(picomatch@4.0.3) - picomatch: 4.0.3 - postcss: 8.5.6 - rollup: 4.53.2 - tinyglobby: 0.2.15 - optionalDependencies: - '@types/node': 24.10.3 - fsevents: 2.3.3 - tsx: 4.20.6 - - vitest@4.0.9(@types/node@24.10.3)(tsx@4.20.6): - dependencies: - '@vitest/expect': 4.0.9 - '@vitest/mocker': 4.0.9(vite@7.2.2(@types/node@24.10.3)(tsx@4.20.6)) - '@vitest/pretty-format': 4.0.9 - '@vitest/runner': 4.0.9 - '@vitest/snapshot': 4.0.9 - '@vitest/spy': 4.0.9 - '@vitest/utils': 4.0.9 - debug: 4.4.3 - es-module-lexer: 1.7.0 - expect-type: 1.2.2 - magic-string: 0.30.21 - pathe: 2.0.3 - picomatch: 4.0.3 - std-env: 3.10.0 - tinybench: 2.9.0 - tinyexec: 0.3.2 - tinyglobby: 0.2.15 - tinyrainbow: 3.0.3 - vite: 7.2.2(@types/node@24.10.3)(tsx@4.20.6) - why-is-node-running: 2.3.0 - optionalDependencies: - '@types/node': 24.10.3 - transitivePeerDependencies: - - jiti - - less - - lightningcss - - msw - - sass - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - - tsx - - yaml - - webidl-conversions@3.0.1: {} - - whatwg-url@5.0.0: - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 - - which-boxed-primitive@1.1.1: - dependencies: - is-bigint: 1.1.0 - is-boolean-object: 1.2.2 - is-number-object: 1.1.1 - is-string: 1.1.1 - is-symbol: 1.1.1 - - which-builtin-type@1.2.1: - dependencies: - call-bound: 1.0.4 - function.prototype.name: 1.1.8 - has-tostringtag: 1.0.2 - is-async-function: 2.1.1 - is-date-object: 1.1.0 - is-finalizationregistry: 1.1.1 - is-generator-function: 1.1.2 - is-regex: 1.2.1 - is-weakref: 1.1.1 - isarray: 2.0.5 - which-boxed-primitive: 1.1.1 - which-collection: 1.0.2 - which-typed-array: 1.1.19 - - which-collection@1.0.2: - dependencies: - is-map: 2.0.3 - is-set: 2.0.3 - is-weakmap: 2.0.2 - is-weakset: 2.0.4 - - which-typed-array@1.1.19: - dependencies: - available-typed-arrays: 1.0.7 - call-bind: 1.0.8 - call-bound: 1.0.4 - for-each: 0.3.5 - get-proto: 1.0.1 - gopd: 1.2.0 - has-tostringtag: 1.0.2 - - which@2.0.2: - dependencies: - isexe: 2.0.0 - - why-is-node-running@2.3.0: - dependencies: - siginfo: 2.0.0 - stackback: 0.0.2 - - word-wrap@1.2.5: {} - - wrappy@1.0.2: {} - - ws@8.18.3: {} - - yocto-queue@0.1.0: {} - - zod-to-json-schema@3.25.0(zod@3.25.76): - dependencies: - zod: 3.25.76 - - zod@3.25.76: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml deleted file mode 100644 index 12bae83261..0000000000 --- a/pnpm-workspace.yaml +++ /dev/null @@ -1,55 +0,0 @@ -packages: - - packages/**/* - - common/**/* - - examples/**/* - - test/**/* - -catalogs: - runtimeShared: - ajv: ^8.17.1 - ajv-formats: ^3.0.1 - json-schema-typed: ^8.0.2 - pkce-challenge: ^5.0.0 - zod: ^3.25 || ^4.0 - zod-to-json-schema: ^3.25.0 - '@cfworker/json-schema': ^4.1.1 - runtimeServerOnly: - '@hono/node-server': ^1.19.7 - hono: ^4.11.1 - content-type: ^1.0.5 - cors: ^2.8.5 - express: ^5.0.1 - express-rate-limit: ^7.5.0 - raw-body: ^3.0.0 - runtimeClientOnly: - jose: ^6.1.1 - cross-spawn: ^7.0.5 - eventsource: ^3.0.2 - eventsource-parser: ^3.0.0 - devTools: - typescript: ^5.9.3 - vitest: ^4.0.8 - eslint: ^9.8.0 - '@eslint/js': ^9.39.1 - eslint-config-prettier: ^10.1.8 - eslint-plugin-n: ^17.23.1 - prettier: 3.6.2 - tsx: ^4.16.5 - 'typescript-eslint': ^8.48.1 - supertest: ^7.0.0 - ws: ^8.18.0 - vite-tsconfig-paths: ^5.1.4 - '@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/supertest': ^6.0.2 - '@types/ws': ^8.5.12 - '@typescript/native-preview': ^7.0.0-dev.20251217.1 - tsdown: ^0.18.0 - -enableGlobalVirtualStore: false - -linkWorkspacePackages: deep diff --git a/scripts/fetch-spec-types.ts b/scripts/fetch-spec-types.ts index e88902d67a..a64e0848e9 100644 --- a/scripts/fetch-spec-types.ts +++ b/scripts/fetch-spec-types.ts @@ -64,7 +64,7 @@ async function main() { * Last updated from commit: {SHA} * * DO NOT EDIT THIS FILE MANUALLY. Changes will be overwritten by automated updates. - * To update this file, run: pnpm run fetch:spec-types + * To update this file, run: npm run fetch:spec-types */`; const header = headerTemplate.replace('{SHA}', latestSHA); @@ -73,10 +73,10 @@ async function main() { const fullContent = header + specContent; // Write to file - const outputPath = join(PROJECT_ROOT, 'packages', 'core', 'src', 'types', 'spec.types.ts'); + const outputPath = join(PROJECT_ROOT, 'src', 'spec.types.ts'); writeFileSync(outputPath, fullContent, 'utf-8'); - console.log('Successfully updated packages/core/src/types/spec.types.ts'); + console.log('Successfully updated src/spec.types.ts'); } catch (error) { console.error('Error:', error instanceof Error ? error.message : String(error)); process.exit(1); diff --git a/test/integration/test/__fixtures__/serverThatHangs.ts b/src/__fixtures__/serverThatHangs.ts similarity index 90% rename from test/integration/test/__fixtures__/serverThatHangs.ts rename to src/__fixtures__/serverThatHangs.ts index 861c206873..82c244aa2d 100644 --- a/test/integration/test/__fixtures__/serverThatHangs.ts +++ b/src/__fixtures__/serverThatHangs.ts @@ -1,7 +1,7 @@ -import process from 'node:process'; import { setInterval } from 'node:timers'; - -import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server'; +import process from 'node:process'; +import { McpServer } from '../server/mcp.js'; +import { StdioServerTransport } from '../server/stdio.js'; const transport = new StdioServerTransport(); diff --git a/test/integration/test/__fixtures__/testServer.ts b/src/__fixtures__/testServer.ts similarity index 74% rename from test/integration/test/__fixtures__/testServer.ts rename to src/__fixtures__/testServer.ts index 41ef07e46d..6401d0f837 100644 --- a/test/integration/test/__fixtures__/testServer.ts +++ b/src/__fixtures__/testServer.ts @@ -1,4 +1,5 @@ -import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server'; +import { McpServer } from '../server/mcp.js'; +import { StdioServerTransport } from '../server/stdio.js'; const transport = new StdioServerTransport(); diff --git a/packages/server/test/server/__fixtures__/zodTestMatrix.ts b/src/__fixtures__/zodTestMatrix.ts similarity index 100% rename from packages/server/test/server/__fixtures__/zodTestMatrix.ts rename to src/__fixtures__/zodTestMatrix.ts diff --git a/src/__mocks__/pkce-challenge.ts b/src/__mocks__/pkce-challenge.ts new file mode 100644 index 0000000000..3dfec41f90 --- /dev/null +++ b/src/__mocks__/pkce-challenge.ts @@ -0,0 +1,6 @@ +export default function pkceChallenge() { + return { + code_verifier: 'test_verifier', + code_challenge: 'test_challenge' + }; +} diff --git a/packages/client/src/client/auth-extensions.ts b/src/client/auth-extensions.ts similarity index 98% rename from packages/client/src/client/auth-extensions.ts rename to src/client/auth-extensions.ts index 8dc444db67..f3908d2c22 100644 --- a/packages/client/src/client/auth-extensions.ts +++ b/src/client/auth-extensions.ts @@ -5,10 +5,9 @@ * for common machine-to-machine authentication scenarios. */ -import type { OAuthClientInformation, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/core'; -import type { CryptoKey, JWK } from 'jose'; - -import type { AddClientAuthentication, OAuthClientProvider } from './auth.js'; +import type { JWK } from 'jose'; +import { OAuthClientInformation, OAuthClientMetadata, OAuthTokens } from '../shared/auth.js'; +import { AddClientAuthentication, OAuthClientProvider } from './auth.js'; /** * Helper to produce a private_key_jwt client authentication function. diff --git a/packages/client/src/client/auth.ts b/src/client/auth.ts similarity index 98% rename from packages/client/src/client/auth.ts rename to src/client/auth.ts index 93048e4b36..4c82b51144 100644 --- a/packages/client/src/client/auth.ts +++ b/src/client/auth.ts @@ -1,33 +1,34 @@ -import type { - AuthorizationServerMetadata, - FetchLike, +import pkceChallenge from 'pkce-challenge'; +import { LATEST_PROTOCOL_VERSION } from '../types.js'; +import { + OAuthClientMetadata, OAuthClientInformation, - OAuthClientInformationFull, OAuthClientInformationMixed, - OAuthClientMetadata, + OAuthTokens, OAuthMetadata, + OAuthClientInformationFull, OAuthProtectedResourceMetadata, - OAuthTokens -} from '@modelcontextprotocol/core'; + OAuthErrorResponseSchema, + AuthorizationServerMetadata, + OpenIdProviderDiscoveryMetadataSchema +} from '../shared/auth.js'; +import { + OAuthClientInformationFullSchema, + OAuthMetadataSchema, + OAuthProtectedResourceMetadataSchema, + OAuthTokensSchema +} from '../shared/auth.js'; +import { checkResourceAllowed, resourceUrlFromServerUrl } from '../shared/auth-utils.js'; import { - checkResourceAllowed, InvalidClientError, InvalidClientMetadataError, InvalidGrantError, - LATEST_PROTOCOL_VERSION, OAUTH_ERRORS, - OAuthClientInformationFullSchema, OAuthError, - OAuthErrorResponseSchema, - OAuthMetadataSchema, - OAuthProtectedResourceMetadataSchema, - OAuthTokensSchema, - OpenIdProviderDiscoveryMetadataSchema, - resourceUrlFromServerUrl, ServerError, UnauthorizedClientError -} from '@modelcontextprotocol/core'; -import pkceChallenge from 'pkce-challenge'; +} from '../server/auth/errors.js'; +import { FetchLike } from '../shared/transport.js'; /** * Function type for adding client authentication to token requests. @@ -573,7 +574,7 @@ export function extractWWWAuthenticateParams(res: Response): { resourceMetadataU } const [type, scheme] = authenticateHeader.split(' '); - if (type?.toLowerCase() !== 'bearer' || !scheme) { + if (type.toLowerCase() !== 'bearer' || !scheme) { return {}; } @@ -616,10 +617,7 @@ function extractFieldFromWwwAuth(response: Response, fieldName: string): string if (match) { // Pattern matches: field_name="value" or field_name=value (unquoted) - const result = match[1] || match[2]; - if (result) { - return result; - } + return match[1] || match[2]; } return null; @@ -636,13 +634,13 @@ export function extractResourceMetadataUrl(res: Response): URL | undefined { } const [type, scheme] = authenticateHeader.split(' '); - if (type?.toLowerCase() !== 'bearer' || !scheme) { + if (type.toLowerCase() !== 'bearer' || !scheme) { return undefined; } const regex = /resource_metadata="([^"]*)"/; const match = regex.exec(authenticateHeader); - if (!match || !match[1]) { + if (!match) { return undefined; } diff --git a/packages/client/src/client/client.ts b/src/client/index.ts similarity index 95% rename from packages/client/src/client/client.ts rename to src/client/index.ts index 8d96ba0bca..eda412f672 100644 --- a/packages/client/src/client/client.ts +++ b/src/client/index.ts @@ -1,75 +1,69 @@ -import type { - AnyObjectSchema, - CallToolRequest, - ClientCapabilities, - ClientNotification, - ClientRequest, - ClientResult, - CompatibilityCallToolResultSchema, - CompleteRequest, - GetPromptRequest, - Implementation, - JsonSchemaType, - JsonSchemaValidator, - jsonSchemaValidator, - ListChangedHandlers, - ListChangedOptions, - ListPromptsRequest, - ListResourcesRequest, - ListResourceTemplatesRequest, - ListToolsRequest, - LoggingLevel, - Notification, - ProtocolOptions, - ReadResourceRequest, - Request, - RequestHandlerExtra, - RequestOptions, - Result, - SchemaOutput, - ServerCapabilities, - SubscribeRequest, - Tool, - Transport, - UnsubscribeRequest, - ZodV3Internal, - ZodV4Internal -} from '@modelcontextprotocol/core'; +import { mergeCapabilities, Protocol, type ProtocolOptions, type RequestOptions } from '../shared/protocol.js'; +import type { Transport } from '../shared/transport.js'; + import { - AjvJsonSchemaValidator, - assertClientRequestTaskCapability, - assertToolsCallTaskCapability, + type CallToolRequest, CallToolResultSchema, + type ClientCapabilities, + type ClientNotification, + type ClientRequest, + type ClientResult, + type CompatibilityCallToolResultSchema, + type CompleteRequest, CompleteResultSchema, - CreateMessageRequestSchema, - CreateMessageResultSchema, - CreateTaskResultSchema, - ElicitRequestSchema, - ElicitResultSchema, EmptyResultSchema, ErrorCode, - getObjectShape, + type GetPromptRequest, GetPromptResultSchema, + type Implementation, InitializeResultSchema, - isZ4Schema, LATEST_PROTOCOL_VERSION, - ListChangedOptionsBaseSchema, + type ListPromptsRequest, ListPromptsResultSchema, + type ListResourcesRequest, ListResourcesResultSchema, + type ListResourceTemplatesRequest, ListResourceTemplatesResultSchema, + type ListToolsRequest, ListToolsResultSchema, + type LoggingLevel, McpError, - mergeCapabilities, - PromptListChangedNotificationSchema, - Protocol, + type Notification, + type ReadResourceRequest, ReadResourceResultSchema, + type Request, + type Result, + type ServerCapabilities, + SUPPORTED_PROTOCOL_VERSIONS, + type SubscribeRequest, + type Tool, + type UnsubscribeRequest, + ElicitResultSchema, + ElicitRequestSchema, + CreateTaskResultSchema, + CreateMessageRequestSchema, + CreateMessageResultSchema, + ToolListChangedNotificationSchema, + PromptListChangedNotificationSchema, ResourceListChangedNotificationSchema, + ListChangedOptions, + ListChangedOptionsBaseSchema, + type ListChangedHandlers +} from '../types.js'; +import { AjvJsonSchemaValidator } from '../validation/ajv-provider.js'; +import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator } from '../validation/types.js'; +import { + AnyObjectSchema, + SchemaOutput, + getObjectShape, + isZ4Schema, safeParse, - SUPPORTED_PROTOCOL_VERSIONS, - ToolListChangedNotificationSchema -} from '@modelcontextprotocol/core'; - + type ZodV3Internal, + type ZodV4Internal +} from '../server/zod-compat.js'; +import type { RequestHandlerExtra } from '../shared/protocol.js'; import { ExperimentalClientTasks } from '../experimental/tasks/client.js'; +import { assertToolsCallTaskCapability, assertClientRequestTaskCapability } from '../experimental/tasks/helpers.js'; /** * Elicitation default application helper. Applies defaults to the data based on the schema. @@ -85,7 +79,7 @@ function applyElicitationDefaults(schema: JsonSchemaType | undefined, data: unkn const obj = data as Record; const props = schema.properties as Record; for (const key of Object.keys(props)) { - const propSchema = props[key]!; + const propSchema = props[key]; // If missing or explicitly undefined, apply default if present if (obj[key] === undefined && Object.prototype.hasOwnProperty.call(propSchema, 'default')) { obj[key] = propSchema.default; @@ -374,14 +368,14 @@ export class Client< } const { params } = validatedRequest.data; - params.mode = params.mode ?? 'form'; + const mode = params.mode ?? 'form'; const { supportsFormMode, supportsUrlMode } = getSupportedElicitationModes(this._capabilities.elicitation); - if (params.mode === 'form' && !supportsFormMode) { + if (mode === 'form' && !supportsFormMode) { throw new McpError(ErrorCode.InvalidParams, 'Client does not support form-mode elicitation requests'); } - if (params.mode === 'url' && !supportsUrlMode) { + if (mode === 'url' && !supportsUrlMode) { throw new McpError(ErrorCode.InvalidParams, 'Client does not support URL-mode elicitation requests'); } @@ -410,9 +404,9 @@ export class Client< } const validatedResult = validationResult.data; - const requestedSchema = params.mode === 'form' ? (params.requestedSchema as JsonSchemaType) : undefined; + const requestedSchema = mode === 'form' ? (params.requestedSchema as JsonSchemaType) : undefined; - if (params.mode === 'form' && validatedResult.action === 'accept' && validatedResult.content && requestedSchema) { + if (mode === 'form' && validatedResult.action === 'accept' && validatedResult.content && requestedSchema) { if (this._capabilities.elicitation?.form?.applyDefaults) { try { applyElicitationDefaults(requestedSchema, validatedResult.content); diff --git a/packages/client/src/client/middleware.ts b/src/client/middleware.ts similarity index 98% rename from packages/client/src/client/middleware.ts rename to src/client/middleware.ts index 331a920e25..c8f7fdd3d4 100644 --- a/packages/client/src/client/middleware.ts +++ b/src/client/middleware.ts @@ -1,7 +1,5 @@ -import type { FetchLike } from '@modelcontextprotocol/core'; - -import type { OAuthClientProvider } from './auth.js'; -import { auth, extractWWWAuthenticateParams, UnauthorizedError } from './auth.js'; +import { auth, extractWWWAuthenticateParams, OAuthClientProvider, UnauthorizedError } from './auth.js'; +import { FetchLike } from '../shared/transport.js'; /** * Middleware function that wraps and enhances fetch functionality. diff --git a/packages/client/src/client/sse.ts b/src/client/sse.ts similarity index 95% rename from packages/client/src/client/sse.ts rename to src/client/sse.ts index bff74986ea..f0e91ff258 100644 --- a/packages/client/src/client/sse.ts +++ b/src/client/sse.ts @@ -1,9 +1,7 @@ -import type { FetchLike, JSONRPCMessage, Transport } from '@modelcontextprotocol/core'; -import { createFetchWithInit, JSONRPCMessageSchema, normalizeHeaders } from '@modelcontextprotocol/core'; -import { type ErrorEvent, EventSource, type EventSourceInit } from 'eventsource'; - -import type { AuthResult, OAuthClientProvider } from './auth.js'; -import { auth, extractWWWAuthenticateParams, UnauthorizedError } from './auth.js'; +import { EventSource, type ErrorEvent, type EventSourceInit } from 'eventsource'; +import { Transport, FetchLike, createFetchWithInit, normalizeHeaders } from '../shared/transport.js'; +import { JSONRPCMessage, JSONRPCMessageSchema } from '../types.js'; +import { auth, AuthResult, extractWWWAuthenticateParams, OAuthClientProvider, UnauthorizedError } from './auth.js'; export class SseError extends Error { constructor( @@ -116,7 +114,7 @@ export class SSEClientTransport implements Transport { } private async _commonHeaders(): Promise { - const headers: RequestInit['headers'] & Record = {}; + const headers: HeadersInit & Record = {}; if (this._authProvider) { const tokens = await this._authProvider.tokens(); if (tokens) { diff --git a/packages/client/src/client/stdio.ts b/src/client/stdio.ts similarity index 96% rename from packages/client/src/client/stdio.ts rename to src/client/stdio.ts index 56d773a7bd..e488dcd241 100644 --- a/packages/client/src/client/stdio.ts +++ b/src/client/stdio.ts @@ -1,11 +1,10 @@ -import type { ChildProcess, IOType } from 'node:child_process'; -import process from 'node:process'; -import type { Stream } from 'node:stream'; -import { PassThrough } from 'node:stream'; - -import type { JSONRPCMessage, Transport } from '@modelcontextprotocol/core'; -import { ReadBuffer, serializeMessage } from '@modelcontextprotocol/core'; +import { ChildProcess, IOType } from 'node:child_process'; import spawn from 'cross-spawn'; +import process from 'node:process'; +import { Stream, PassThrough } from 'node:stream'; +import { ReadBuffer, serializeMessage } from '../shared/stdio.js'; +import { Transport } from '../shared/transport.js'; +import { JSONRPCMessage } from '../types.js'; export type StdioServerParameters = { /** diff --git a/packages/client/src/client/streamableHttp.ts b/src/client/streamableHttp.ts similarity index 97% rename from packages/client/src/client/streamableHttp.ts rename to src/client/streamableHttp.ts index 91709a9a6a..6473ca48f5 100644 --- a/packages/client/src/client/streamableHttp.ts +++ b/src/client/streamableHttp.ts @@ -1,19 +1,8 @@ -import type { ReadableWritablePair } from 'node:stream/web'; - -import type { FetchLike, JSONRPCMessage, Transport } from '@modelcontextprotocol/core'; -import { - createFetchWithInit, - isInitializedNotification, - isJSONRPCRequest, - isJSONRPCResultResponse, - JSONRPCMessageSchema, - normalizeHeaders -} from '@modelcontextprotocol/core'; +import { Transport, FetchLike, createFetchWithInit, normalizeHeaders } from '../shared/transport.js'; +import { isInitializedNotification, isJSONRPCRequest, isJSONRPCResponse, JSONRPCMessage, JSONRPCMessageSchema } from '../types.js'; +import { auth, AuthResult, extractWWWAuthenticateParams, OAuthClientProvider, UnauthorizedError } from './auth.js'; import { EventSourceParserStream } from 'eventsource-parser/stream'; -import type { AuthResult, OAuthClientProvider } from './auth.js'; -import { auth, extractWWWAuthenticateParams, UnauthorizedError } from './auth.js'; - // Default reconnection options for StreamableHTTP connections const DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS: StreamableHTTPReconnectionOptions = { initialReconnectionDelay: 1000, @@ -191,7 +180,7 @@ export class StreamableHTTPClientTransport implements Transport { } private async _commonHeaders(): Promise { - const headers: RequestInit['headers'] & Record = {}; + const headers: HeadersInit & Record = {}; if (this._authProvider) { const tokens = await this._authProvider.tokens(); if (tokens) { @@ -361,7 +350,7 @@ export class StreamableHTTPClientTransport implements Transport { if (!event.event || event.event === 'message') { try { const message = JSONRPCMessageSchema.parse(JSON.parse(event.data)); - if (isJSONRPCResultResponse(message)) { + if (isJSONRPCResponse(message)) { // Mark that we received a response - no need to reconnect for this request receivedResponse = true; if (replayMessageId !== undefined) { diff --git a/packages/client/src/client/websocket.ts b/src/client/websocket.ts similarity index 93% rename from packages/client/src/client/websocket.ts rename to src/client/websocket.ts index cb0c34687c..aed766cafc 100644 --- a/packages/client/src/client/websocket.ts +++ b/src/client/websocket.ts @@ -1,5 +1,5 @@ -import type { JSONRPCMessage, Transport } from '@modelcontextprotocol/core'; -import { JSONRPCMessageSchema } from '@modelcontextprotocol/core'; +import { Transport } from '../shared/transport.js'; +import { JSONRPCMessage, JSONRPCMessageSchema } from '../types.js'; const SUBPROTOCOL = 'mcp'; diff --git a/src/examples/README.md b/src/examples/README.md new file mode 100644 index 0000000000..0d98456a6b --- /dev/null +++ b/src/examples/README.md @@ -0,0 +1,352 @@ +# MCP TypeScript SDK Examples + +This directory contains example implementations of MCP clients and servers using the TypeScript SDK. For a high-level index of scenarios and where they live, see the **Examples** table in the root `README.md`. + +## Table of Contents + +- [Client Implementations](#client-implementations) + - [Streamable HTTP Client](#streamable-http-client) + - [Backwards Compatible Client](#backwards-compatible-client) + - [URL Elicitation Example Client](#url-elicitation-example-client) +- [Server Implementations](#server-implementations) + - [Single Node Deployment](#single-node-deployment) + - [Streamable HTTP Transport](#streamable-http-transport) + - [Deprecated SSE Transport](#deprecated-sse-transport) + - [Backwards Compatible Server](#streamable-http-backwards-compatible-server-with-sse) + - [Form Elicitation Example](#form-elicitation-example) + - [URL Elicitation Example](#url-elicitation-example) + - [Multi-Node Deployment](#multi-node-deployment) +- [Backwards Compatibility](#testing-streamable-http-backwards-compatibility-with-sse) + +## Client Implementations + +### Streamable HTTP Client + +A full-featured interactive client that connects to a Streamable HTTP server, demonstrating how to: + +- Establish and manage a connection to an MCP server +- List and call tools with arguments +- Handle notifications through the SSE stream +- List and get prompts with arguments +- List available resources +- Handle session termination and reconnection +- Support for resumability with Last-Event-ID tracking + +```bash +npx tsx src/examples/client/simpleStreamableHttp.ts +``` + +Example client with OAuth: + +```bash +npx tsx src/examples/client/simpleOAuthClient.ts +``` + +Client credentials (machine-to-machine) example: + +```bash +npx tsx src/examples/client/simpleClientCredentials.ts +``` + +### Backwards Compatible Client + +A client that implements backwards compatibility according to the [MCP specification](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#backwards-compatibility), allowing it to work with both new and legacy servers. This client demonstrates: + +- The client first POSTs an initialize request to the server URL: + - If successful, it uses the Streamable HTTP transport + - If it fails with a 4xx status, it attempts a GET request to establish an SSE stream + +```bash +npx tsx src/examples/client/streamableHttpWithSseFallbackClient.ts +``` + +### URL Elicitation Example Client + +A client that demonstrates how to use URL elicitation to securely collect _sensitive_ user input or perform secure third-party flows. + +```bash +# First, run the server: +npx tsx src/examples/server/elicitationUrlExample.ts + +# Then, run the client: +npx tsx src/examples/client/elicitationUrlExample.ts + +``` + +## Server Implementations + +### Single Node Deployment + +These examples demonstrate how to set up an MCP server on a single node with different transport options. + +#### Streamable HTTP Transport + +##### Simple Streamable HTTP Server + +A server that implements the Streamable HTTP transport (protocol version 2025-03-26). + +- Basic server setup with Express and the Streamable HTTP transport +- Session management with an in-memory event store for resumability +- Tool implementation with the `greet` and `multi-greet` tools +- Prompt implementation with the `greeting-template` prompt +- Static resource exposure +- Support for notifications via SSE stream established by GET requests +- Session termination via DELETE requests + +```bash +npx tsx src/examples/server/simpleStreamableHttp.ts + +# To add a demo of authentication to this example, use: +npx tsx src/examples/server/simpleStreamableHttp.ts --oauth + +# To mitigate impersonation risks, enable strict Resource Identifier verification: +npx tsx src/examples/server/simpleStreamableHttp.ts --oauth --oauth-strict +``` + +##### JSON Response Mode Server + +A server that uses Streamable HTTP transport with JSON response mode enabled (no SSE). + +- Streamable HTTP with JSON response mode, which returns responses directly in the response body +- Limited support for notifications (since SSE is disabled) +- Proper response handling according to the MCP specification for servers that don't support SSE +- Returning appropriate HTTP status codes for unsupported methods + +```bash +npx tsx src/examples/server/jsonResponseStreamableHttp.ts +``` + +##### Streamable HTTP with server notifications + +A server that demonstrates server notifications using Streamable HTTP. + +- Resource list change notifications with dynamically added resources +- Automatic resource creation on a timed interval + +```bash +npx tsx src/examples/server/standaloneSseWithGetStreamableHttp.ts +``` + +##### Form Elicitation Example + +A server that demonstrates using form elicitation to collect _non-sensitive_ user input. + +```bash +npx tsx src/examples/server/elicitationFormExample.ts +``` + +##### URL Elicitation Example + +A comprehensive example demonstrating URL mode elicitation in a server protected by MCP authorization. This example shows: + +- SSE-driven URL elicitation of an API Key on session initialization: obtain sensitive user input at session init +- Tools that require direct user interaction via URL elicitation (for payment confirmation and for third-party OAuth tokens) +- Completion notifications for URL elicitation + +To run this example: + +```bash +# Start the server +npx tsx src/examples/server/elicitationUrlExample.ts + +# In a separate terminal, start the client +npx tsx src/examples/client/elicitationUrlExample.ts +``` + +#### Deprecated SSE Transport + +A server that implements the deprecated HTTP+SSE transport (protocol version 2024-11-05). This example only used for testing backwards compatibility for clients. + +- Two separate endpoints: `/mcp` for the SSE stream (GET) and `/messages` for client messages (POST) +- Tool implementation with a `start-notification-stream` tool that demonstrates sending periodic notifications + +```bash +npx tsx src/examples/server/simpleSseServer.ts +``` + +#### Streamable Http Backwards Compatible Server with SSE + +A server that supports both Streamable HTTP and SSE transports, adhering to the [MCP specification for backwards compatibility](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#backwards-compatibility). + +- Single MCP server instance with multiple transport options +- Support for Streamable HTTP requests at `/mcp` endpoint (GET/POST/DELETE) +- Support for deprecated SSE transport with `/sse` (GET) and `/messages` (POST) +- Session type tracking to avoid mixing transport types +- Notifications and tool execution across both transport types + +```bash +npx tsx src/examples/server/sseAndStreamableHttpCompatibleServer.ts +``` + +### Multi-Node Deployment + +When deploying MCP servers in a horizontally scaled environment (multiple server instances), there are a few different options that can be useful for different use cases: + +- **Stateless mode** - No need to maintain state between calls to MCP servers. Useful for simple API wrapper servers. +- **Persistent storage mode** - No local state needed, but session data is stored in a database. Example: an MCP server for online ordering where the shopping cart is stored in a database. +- **Local state with message routing** - Local state is needed, and all requests for a session must be routed to the correct node. This can be done with a message queue and pub/sub system. + +#### Stateless Mode + +The Streamable HTTP transport can be configured to operate without tracking sessions. This is perfect for simple API proxies or when each request is completely independent. + +##### Implementation + +To enable stateless mode, configure the `StreamableHTTPServerTransport` with: + +```typescript +sessionIdGenerator: undefined; +``` + +This disables session management entirely, and the server won't generate or expect session IDs. + +- No session ID headers are sent or expected +- Any server node can process any request +- No state is preserved between requests +- Perfect for RESTful or stateless API scenarios +- Simplest deployment model with minimal infrastructure requirements + +``` +┌─────────────────────────────────────────────┐ +│ Client │ +└─────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────┐ +│ Load Balancer │ +└─────────────────────────────────────────────┘ + │ │ + ▼ ▼ +┌─────────────────┐ ┌─────────────────────┐ +│ MCP Server #1 │ │ MCP Server #2 │ +│ (Node.js) │ │ (Node.js) │ +└─────────────────┘ └─────────────────────┘ +``` + +#### Persistent Storage Mode + +For cases where you need session continuity but don't need to maintain in-memory state on specific nodes, you can use a database to persist session data while still allowing any node to handle requests. + +##### Implementation + +Configure the transport with session management, but retrieve and store all state in an external persistent storage: + +```typescript +sessionIdGenerator: () => randomUUID(), +eventStore: databaseEventStore +``` + +All session state is stored in the database, and any node can serve any client by retrieving the state when needed. + +- Maintains sessions with unique IDs +- Stores all session data in an external database +- Provides resumability through the database-backed EventStore +- Any node can handle any request for the same session +- No node-specific memory state means no need for message routing +- Good for applications where state can be fully externalized +- Somewhat higher latency due to database access for each request + +``` +┌─────────────────────────────────────────────┐ +│ Client │ +└─────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────┐ +│ Load Balancer │ +└─────────────────────────────────────────────┘ + │ │ + ▼ ▼ +┌─────────────────┐ ┌─────────────────────┐ +│ MCP Server #1 │ │ MCP Server #2 │ +│ (Node.js) │ │ (Node.js) │ +└─────────────────┘ └─────────────────────┘ + │ │ + │ │ + ▼ ▼ +┌─────────────────────────────────────────────┐ +│ Database (PostgreSQL) │ +│ │ +│ • Session state │ +│ • Event storage for resumability │ +└─────────────────────────────────────────────┘ +``` + +#### Streamable HTTP with Distributed Message Routing + +For scenarios where local in-memory state must be maintained on specific nodes (such as Computer Use or complex session state), the Streamable HTTP transport can be combined with a pub/sub system to route messages to the correct node handling each session. + +1. **Bidirectional Message Queue Integration**: + - All nodes both publish to and subscribe from the message queue + - Each node registers the sessions it's actively handling + - Messages are routed based on session ownership + +2. **Request Handling Flow**: + - When a client connects to Node A with an existing `mcp-session-id` + - If Node A doesn't own this session, it: + - Establishes and maintains the SSE connection with the client + - Publishes the request to the message queue with the session ID + - Node B (which owns the session) receives the request from the queue + - Node B processes the request with its local session state + - Node B publishes responses/notifications back to the queue + - Node A subscribes to the response channel and forwards to the client + +3. **Channel Identification**: + - Each message channel combines both `mcp-session-id` and `stream-id` + - This ensures responses are correctly routed back to the originating connection + +``` +┌─────────────────────────────────────────────┐ +│ Client │ +└─────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────┐ +│ Load Balancer │ +└─────────────────────────────────────────────┘ + │ │ + ▼ ▼ +┌─────────────────┐ ┌─────────────────────┐ +│ MCP Server #1 │◄───►│ MCP Server #2 │ +│ (Has Session A) │ │ (Has Session B) │ +└─────────────────┘ └─────────────────────┘ + ▲│ ▲│ + │▼ │▼ +┌─────────────────────────────────────────────┐ +│ Message Queue / Pub-Sub │ +│ │ +│ • Session ownership registry │ +│ • Bidirectional message routing │ +│ • Request/response forwarding │ +└─────────────────────────────────────────────┘ +``` + +- Maintains session affinity for stateful operations without client redirection +- Enables horizontal scaling while preserving complex in-memory state +- Provides fault tolerance through the message queue as intermediary + +## Backwards Compatibility + +### Testing Streamable HTTP Backwards Compatibility with SSE + +To test the backwards compatibility features: + +1. Start one of the server implementations: + + ```bash + # Legacy SSE server (protocol version 2024-11-05) + npx tsx src/examples/server/simpleSseServer.ts + + # Streamable HTTP server (protocol version 2025-03-26) + npx tsx src/examples/server/simpleStreamableHttp.ts + + # Backwards compatible server (supports both protocols) + npx tsx src/examples/server/sseAndStreamableHttpCompatibleServer.ts + ``` + +2. Then run the backwards compatible client: + ```bash + npx tsx src/examples/client/streamableHttpWithSseFallbackClient.ts + ``` + +This demonstrates how the MCP ecosystem ensures interoperability between clients and servers regardless of which protocol version they were built for. diff --git a/examples/client/src/elicitationUrlExample.ts b/src/examples/client/elicitationUrlExample.ts similarity index 98% rename from examples/client/src/elicitationUrlExample.ts rename to src/examples/client/elicitationUrlExample.ts index 9b59c5b11a..b57927e3fc 100644 --- a/examples/client/src/elicitationUrlExample.ts +++ b/src/examples/client/elicitationUrlExample.ts @@ -1,38 +1,34 @@ -// Run with: pnpm tsx src/elicitationUrlExample.ts +// Run with: npx tsx src/examples/client/elicitationUrlExample.ts // // This example demonstrates how to use URL elicitation to securely // collect user input in a remote (HTTP) server. // URL elicitation allows servers to prompt the end-user to open a URL in their browser // to collect sensitive information. -import { exec } from 'node:child_process'; -import { createServer } from 'node:http'; +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; import { createInterface } from 'node:readline'; - -import type { - CallToolRequest, - ElicitRequest, - ElicitRequestURLParams, - ElicitResult, - ListToolsRequest, - OAuthClientMetadata, - ResourceLink -} from '@modelcontextprotocol/client'; import { + ListToolsRequest, + ListToolsResultSchema, + CallToolRequest, CallToolResultSchema, - Client, - ElicitationCompleteNotificationSchema, ElicitRequestSchema, - ErrorCode, - getDisplayName, - ListToolsResultSchema, + ElicitRequest, + ElicitResult, + ResourceLink, + ElicitRequestURLParams, McpError, - StreamableHTTPClientTransport, - UnauthorizedError, - UrlElicitationRequiredError -} from '@modelcontextprotocol/client'; - + ErrorCode, + UrlElicitationRequiredError, + ElicitationCompleteNotificationSchema +} from '../../types.js'; +import { getDisplayName } from '../../shared/metadataUtils.js'; +import { OAuthClientMetadata } from '../../shared/auth.js'; +import { exec } from 'node:child_process'; import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider.js'; +import { UnauthorizedError } from '../../client/auth.js'; +import { createServer } from 'node:http'; // Set up OAuth (required for this example) const OAUTH_CALLBACK_PORT = 8090; // Use different port than auth server (3001) @@ -175,7 +171,7 @@ async function commandLoop(): Promise { if (args.length < 2) { console.log('Usage: call-tool [args]'); } else { - const toolName = args[1]!; + const toolName = args[1]; let toolArgs = {}; if (args.length > 2) { try { diff --git a/examples/client/src/multipleClientsParallel.ts b/src/examples/client/multipleClientsParallel.ts similarity index 95% rename from examples/client/src/multipleClientsParallel.ts rename to src/examples/client/multipleClientsParallel.ts index 95c72212ba..492235cdd7 100644 --- a/examples/client/src/multipleClientsParallel.ts +++ b/src/examples/client/multipleClientsParallel.ts @@ -1,10 +1,6 @@ -import type { CallToolRequest, CallToolResult } from '@modelcontextprotocol/client'; -import { - CallToolResultSchema, - Client, - LoggingMessageNotificationSchema, - StreamableHTTPClientTransport -} from '@modelcontextprotocol/client'; +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; +import { CallToolRequest, CallToolResultSchema, LoggingMessageNotificationSchema, CallToolResult } from '../../types.js'; /** * Multiple Clients MCP Example diff --git a/examples/client/src/parallelToolCallsClient.ts b/src/examples/client/parallelToolCallsClient.ts similarity index 97% rename from examples/client/src/parallelToolCallsClient.ts rename to src/examples/client/parallelToolCallsClient.ts index b692eba684..2ad249de71 100644 --- a/examples/client/src/parallelToolCallsClient.ts +++ b/src/examples/client/parallelToolCallsClient.ts @@ -1,11 +1,12 @@ -import type { CallToolResult, ListToolsRequest } from '@modelcontextprotocol/client'; +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; import { - CallToolResultSchema, - Client, + ListToolsRequest, ListToolsResultSchema, + CallToolResultSchema, LoggingMessageNotificationSchema, - StreamableHTTPClientTransport -} from '@modelcontextprotocol/client'; + CallToolResult +} from '../../types.js'; /** * Parallel Tool Calls MCP Client diff --git a/examples/client/src/simpleClientCredentials.ts b/src/examples/client/simpleClientCredentials.ts similarity index 89% rename from examples/client/src/simpleClientCredentials.ts rename to src/examples/client/simpleClientCredentials.ts index 141a72ab25..7defcc41f9 100644 --- a/examples/client/src/simpleClientCredentials.ts +++ b/src/examples/client/simpleClientCredentials.ts @@ -18,8 +18,10 @@ * MCP_SERVER_URL - Server URL (default: http://localhost:3000/mcp) */ -import type { OAuthClientProvider } from '@modelcontextprotocol/client'; -import { Client, ClientCredentialsProvider, PrivateKeyJwtProvider, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'; +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; +import { ClientCredentialsProvider, PrivateKeyJwtProvider } from '../../client/auth-extensions.js'; +import { OAuthClientProvider } from '../../client/auth.js'; const DEFAULT_SERVER_URL = process.env.MCP_SERVER_URL || 'http://localhost:3000/mcp'; diff --git a/examples/client/src/simpleOAuthClient.ts b/src/examples/client/simpleOAuthClient.ts similarity index 97% rename from examples/client/src/simpleOAuthClient.ts rename to src/examples/client/simpleOAuthClient.ts index 514d81d94a..8071e61acc 100644 --- a/examples/client/src/simpleOAuthClient.ts +++ b/src/examples/client/simpleOAuthClient.ts @@ -1,19 +1,14 @@ #!/usr/bin/env node -import { exec } from 'node:child_process'; import { createServer } from 'node:http'; import { createInterface } from 'node:readline'; import { URL } from 'node:url'; - -import type { CallToolRequest, ListToolsRequest, OAuthClientMetadata } from '@modelcontextprotocol/client'; -import { - CallToolResultSchema, - Client, - ListToolsResultSchema, - StreamableHTTPClientTransport, - UnauthorizedError -} from '@modelcontextprotocol/client'; - +import { exec } from 'node:child_process'; +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; +import { OAuthClientMetadata } from '../../shared/auth.js'; +import { CallToolRequest, ListToolsRequest, CallToolResultSchema, ListToolsResultSchema } from '../../types.js'; +import { UnauthorizedError } from '../../client/auth.js'; import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider.js'; // Configuration diff --git a/examples/client/src/simpleOAuthClientProvider.ts b/src/examples/client/simpleOAuthClientProvider.ts similarity index 91% rename from examples/client/src/simpleOAuthClientProvider.ts rename to src/examples/client/simpleOAuthClientProvider.ts index 96655c9f68..3f1932c3e5 100644 --- a/examples/client/src/simpleOAuthClientProvider.ts +++ b/src/examples/client/simpleOAuthClientProvider.ts @@ -1,4 +1,5 @@ -import type { OAuthClientInformationMixed, OAuthClientMetadata, OAuthClientProvider, OAuthTokens } from '@modelcontextprotocol/client'; +import { OAuthClientProvider } from '../../client/auth.js'; +import { OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from '../../shared/auth.js'; /** * In-memory OAuth client provider for demonstration purposes diff --git a/examples/client/src/simpleStreamableHttp.ts b/src/examples/client/simpleStreamableHttp.ts similarity index 98% rename from examples/client/src/simpleStreamableHttp.ts rename to src/examples/client/simpleStreamableHttp.ts index eaaa2cf50c..21ab4f5568 100644 --- a/examples/client/src/simpleStreamableHttp.ts +++ b/src/examples/client/simpleStreamableHttp.ts @@ -1,31 +1,28 @@ +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; import { createInterface } from 'node:readline'; - -import type { - CallToolRequest, - GetPromptRequest, - ListPromptsRequest, - ListResourcesRequest, - ListToolsRequest, - ReadResourceRequest, - ResourceLink -} from '@modelcontextprotocol/client'; import { + ListToolsRequest, + ListToolsResultSchema, + CallToolRequest, CallToolResultSchema, - Client, - ElicitRequestSchema, - ErrorCode, - getDisplayName, - GetPromptResultSchema, + ListPromptsRequest, ListPromptsResultSchema, + GetPromptRequest, + GetPromptResultSchema, + ListResourcesRequest, ListResourcesResultSchema, - ListToolsResultSchema, LoggingMessageNotificationSchema, - McpError, + ResourceListChangedNotificationSchema, + ElicitRequestSchema, + ResourceLink, + ReadResourceRequest, ReadResourceResultSchema, RELATED_TASK_META_KEY, - ResourceListChangedNotificationSchema, - StreamableHTTPClientTransport -} from '@modelcontextprotocol/client'; + ErrorCode, + McpError +} from '../../types.js'; +import { getDisplayName } from '../../shared/metadataUtils.js'; import { Ajv } from 'ajv'; // Create readline interface for user input @@ -109,7 +106,7 @@ function commandLoop(): void { if (args.length < 2) { console.log('Usage: call-tool [args]'); } else { - const toolName = args[1]!; + const toolName = args[1]; let toolArgs = {}; if (args.length > 2) { try { @@ -152,7 +149,7 @@ function commandLoop(): void { if (args.length < 2) { console.log('Usage: call-tool-task [args]'); } else { - const toolName = args[1]!; + const toolName = args[1]; let toolArgs = {}; if (args.length > 2) { try { @@ -173,7 +170,7 @@ function commandLoop(): void { if (args.length < 2) { console.log('Usage: get-prompt [args]'); } else { - const promptName = args[1]!; + const promptName = args[1]; let promptArgs = {}; if (args.length > 2) { try { @@ -194,7 +191,7 @@ function commandLoop(): void { if (args.length < 2) { console.log('Usage: read-resource '); } else { - await readResource(args[1]!); + await readResource(args[1]); } break; diff --git a/examples/client/src/simpleTaskInteractiveClient.ts b/src/examples/client/simpleTaskInteractiveClient.ts similarity index 95% rename from examples/client/src/simpleTaskInteractiveClient.ts rename to src/examples/client/simpleTaskInteractiveClient.ts index 882b2ccbf1..06ed0ead10 100644 --- a/examples/client/src/simpleTaskInteractiveClient.ts +++ b/src/examples/client/simpleTaskInteractiveClient.ts @@ -7,18 +7,19 @@ * - Using task-based tool execution with streaming */ +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; import { createInterface } from 'node:readline'; - -import type { CreateMessageRequest, CreateMessageResult, TextContent } from '@modelcontextprotocol/client'; import { CallToolResultSchema, - Client, - CreateMessageRequestSchema, + TextContent, ElicitRequestSchema, + CreateMessageRequestSchema, + CreateMessageRequest, + CreateMessageResult, ErrorCode, - McpError, - StreamableHTTPClientTransport -} from '@modelcontextprotocol/client'; + McpError +} from '../../types.js'; // Create readline interface for user input const readline = createInterface({ @@ -58,7 +59,7 @@ async function samplingCallback(params: CreateMessageRequest['params']): Promise // Get the prompt from the first message let prompt = 'unknown'; if (params.messages && params.messages.length > 0) { - const firstMessage = params.messages[0]!; + const firstMessage = params.messages[0]; const content = firstMessage.content; if (typeof content === 'object' && !Array.isArray(content) && content.type === 'text' && 'text' in content) { prompt = content.text; @@ -191,7 +192,7 @@ let url = 'http://localhost:8000/mcp'; for (let i = 0; i < args.length; i++) { if (args[i] === '--url' && args[i + 1]) { - url = args[i + 1]!; + url = args[i + 1]; i++; } } diff --git a/examples/client/src/ssePollingClient.ts b/src/examples/client/ssePollingClient.ts similarity index 92% rename from examples/client/src/ssePollingClient.ts rename to src/examples/client/ssePollingClient.ts index 60f322a3c2..ac7bba37d9 100644 --- a/examples/client/src/ssePollingClient.ts +++ b/src/examples/client/ssePollingClient.ts @@ -9,15 +9,12 @@ * - Event replay via Last-Event-ID header * - Resumption token tracking via onresumptiontoken callback * - * Run with: pnpm tsx src/ssePollingClient.ts + * Run with: npx tsx src/examples/client/ssePollingClient.ts * Requires: ssePollingExample.ts server running on port 3001 */ -import { - CallToolResultSchema, - Client, - LoggingMessageNotificationSchema, - StreamableHTTPClientTransport -} from '@modelcontextprotocol/client'; +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; +import { CallToolResultSchema, LoggingMessageNotificationSchema } from '../../types.js'; const SERVER_URL = 'http://localhost:3001/mcp'; diff --git a/examples/client/src/streamableHttpWithSseFallbackClient.ts b/src/examples/client/streamableHttpWithSseFallbackClient.ts similarity index 95% rename from examples/client/src/streamableHttpWithSseFallbackClient.ts rename to src/examples/client/streamableHttpWithSseFallbackClient.ts index 6bc75b091e..657f48953e 100644 --- a/examples/client/src/streamableHttpWithSseFallbackClient.ts +++ b/src/examples/client/streamableHttpWithSseFallbackClient.ts @@ -1,12 +1,13 @@ -import type { CallToolRequest, ListToolsRequest } from '@modelcontextprotocol/client'; +import { Client } from '../../client/index.js'; +import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js'; +import { SSEClientTransport } from '../../client/sse.js'; import { - CallToolResultSchema, - Client, + ListToolsRequest, ListToolsResultSchema, - LoggingMessageNotificationSchema, - SSEClientTransport, - StreamableHTTPClientTransport -} from '@modelcontextprotocol/client'; + CallToolRequest, + CallToolResultSchema, + LoggingMessageNotificationSchema +} from '../../types.js'; /** * Simplified Backwards Compatible MCP Client diff --git a/examples/server/src/README-simpleTaskInteractive.md b/src/examples/server/README-simpleTaskInteractive.md similarity index 79% rename from examples/server/src/README-simpleTaskInteractive.md rename to src/examples/server/README-simpleTaskInteractive.md index 5e9793d1a0..6e8cd345b9 100644 --- a/examples/server/src/README-simpleTaskInteractive.md +++ b/src/examples/server/README-simpleTaskInteractive.md @@ -44,21 +44,11 @@ The `TaskResultHandler` dequeues messages when the client calls `tasks/result` a ### Start the Server ```bash -# From anywhere in the SDK -pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleTaskInteractive.ts +# From the SDK root directory +npx tsx src/examples/server/simpleTaskInteractive.ts # Or with a custom port -PORT=9000 pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleTaskInteractive.ts -``` - -Or, from within the `examples/server` package: - -```bash -cd examples/server -pnpm tsx src/simpleTaskInteractive.ts - -# Or with a custom port -PORT=9000 pnpm tsx src/simpleTaskInteractive.ts +PORT=9000 npx tsx src/examples/server/simpleTaskInteractive.ts ``` The server will start on http://localhost:8000/mcp (or your custom port). @@ -66,21 +56,11 @@ The server will start on http://localhost:8000/mcp (or your custom port). ### Run the Client ```bash -# From anywhere in the SDK -pnpm --filter @modelcontextprotocol/examples-client exec tsx src/simpleTaskInteractiveClient.ts - -# Or connect to a different server -pnpm --filter @modelcontextprotocol/examples-client exec tsx src/simpleTaskInteractiveClient.ts --url http://localhost:9000/mcp -``` - -Or, from within the `examples/client` package: - -```bash -cd examples/client -pnpm tsx src/simpleTaskInteractiveClient.ts +# From the SDK root directory +npx tsx src/examples/client/simpleTaskInteractiveClient.ts # Or connect to a different server -pnpm tsx src/simpleTaskInteractiveClient.ts --url http://localhost:9000/mcp +npx tsx src/examples/client/simpleTaskInteractiveClient.ts --url http://localhost:9000/mcp ``` ## Expected Output @@ -176,6 +156,6 @@ This tells the server that the client can handle both form-based elicitation and ## Related Files -- `packages/core/src/experimental/tasks/interfaces.ts` - Core task interfaces (TaskStore, TaskMessageQueue) -- `packages/core/src/experimental/tasks/stores/in-memory.ts` - In-memory task store implementation -- `packages/core/src/types/types.ts` - Task-related types (Task, CreateTaskResult, GetTaskRequestSchema, etc.) +- `src/shared/task.ts` - Core task interfaces (TaskStore, TaskMessageQueue) +- `src/examples/shared/inMemoryTaskStore.ts` - In-memory implementations +- `src/types.ts` - Task-related types (Task, CreateTaskResult, GetTaskRequestSchema, etc.) diff --git a/examples/shared/src/demoInMemoryOAuthProvider.ts b/src/examples/server/demoInMemoryOAuthProvider.ts similarity index 93% rename from examples/shared/src/demoInMemoryOAuthProvider.ts rename to src/examples/server/demoInMemoryOAuthProvider.ts index bcf11dd0c6..1abc040ce0 100644 --- a/examples/shared/src/demoInMemoryOAuthProvider.ts +++ b/src/examples/server/demoInMemoryOAuthProvider.ts @@ -1,17 +1,12 @@ import { randomUUID } from 'node:crypto'; - -import type { - AuthInfo, - AuthorizationParams, - OAuthClientInformationFull, - OAuthMetadata, - OAuthRegisteredClientsStore, - OAuthServerProvider, - OAuthTokens -} from '@modelcontextprotocol/server'; -import { createOAuthMetadata, InvalidRequestError, mcpAuthRouter, resourceUrlFromServerUrl } from '@modelcontextprotocol/server'; -import type { Request, Response } from 'express'; -import express from 'express'; +import { AuthorizationParams, OAuthServerProvider } from '../../server/auth/provider.js'; +import { OAuthRegisteredClientsStore } from '../../server/auth/clients.js'; +import { OAuthClientInformationFull, OAuthMetadata, OAuthTokens } from '../../shared/auth.js'; +import express, { Request, Response } from 'express'; +import { AuthInfo } from '../../server/auth/types.js'; +import { createOAuthMetadata, mcpAuthRouter } from '../../server/auth/router.js'; +import { resourceUrlFromServerUrl } from '../../shared/auth-utils.js'; +import { InvalidRequestError } from '../../server/auth/errors.js'; export class DemoInMemoryClientsStore implements OAuthRegisteredClientsStore { private clients = new Map(); diff --git a/examples/server/src/elicitationFormExample.ts b/src/examples/server/elicitationFormExample.ts similarity index 97% rename from examples/server/src/elicitationFormExample.ts rename to src/examples/server/elicitationFormExample.ts index f8863c17bb..6c08009499 100644 --- a/examples/server/src/elicitationFormExample.ts +++ b/src/examples/server/elicitationFormExample.ts @@ -1,4 +1,4 @@ -// Run with: pnpm tsx src/elicitationFormExample.ts +// Run with: npx tsx src/examples/server/elicitationFormExample.ts // // This example demonstrates how to use form elicitation to collect structured user input // with JSON Schema validation via a local HTTP server with SSE streaming. @@ -8,9 +8,11 @@ // to collect *sensitive* user input via a browser. import { randomUUID } from 'node:crypto'; - -import { createMcpExpressApp, isInitializeRequest, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/server'; import { type Request, type Response } from 'express'; +import { McpServer } from '../../server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; +import { isInitializeRequest } from '../../types.js'; +import { createMcpExpressApp } from '../../server/express.js'; // Create MCP server - it will automatically use AjvJsonSchemaValidator with sensible defaults // The validator supports format validation (email, date, etc.) if ajv-formats is installed @@ -452,7 +454,7 @@ async function main() { for (const sessionId in transports) { try { console.log(`Closing transport for session ${sessionId}`); - await transports[sessionId]!.close(); + await transports[sessionId].close(); delete transports[sessionId]; } catch (error) { console.error(`Error closing transport for session ${sessionId}:`, error); diff --git a/examples/server/src/elicitationUrlExample.ts b/src/examples/server/elicitationUrlExample.ts similarity index 96% rename from examples/server/src/elicitationUrlExample.ts rename to src/examples/server/elicitationUrlExample.ts index 99f85d0795..5ddecc4e14 100644 --- a/examples/server/src/elicitationUrlExample.ts +++ b/src/examples/server/elicitationUrlExample.ts @@ -1,4 +1,4 @@ -// Run with: pnpm tsx src/elicitationUrlExample.ts +// Run with: npx tsx src/examples/server/elicitationUrlExample.ts // // This example demonstrates how to use URL elicitation to securely collect // *sensitive* user input in a remote (HTTP) server. @@ -7,27 +7,21 @@ // Note: See also elicitationFormExample.ts for an example of using form (not URL) elicitation // to collect *non-sensitive* user input with a structured schema. +import express, { Request, Response } from 'express'; import { randomUUID } from 'node:crypto'; - -import { setupAuthServer } from '@modelcontextprotocol/examples-shared'; -import type { CallToolResult, ElicitRequestURLParams, ElicitResult, OAuthMetadata } from '@modelcontextprotocol/server'; -import { - checkResourceAllowed, - createMcpExpressApp, - getOAuthProtectedResourceMetadataUrl, - isInitializeRequest, - mcpAuthMetadataRouter, - McpServer, - requireBearerAuth, - StreamableHTTPServerTransport, - UrlElicitationRequiredError -} from '@modelcontextprotocol/server'; -import cors from 'cors'; -import type { Request, Response } from 'express'; -import express from 'express'; import { z } from 'zod'; +import { McpServer } from '../../server/mcp.js'; +import { createMcpExpressApp } from '../../server/express.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; +import { getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter } from '../../server/auth/router.js'; +import { requireBearerAuth } from '../../server/auth/middleware/bearerAuth.js'; +import { CallToolResult, UrlElicitationRequiredError, ElicitRequestURLParams, ElicitResult, isInitializeRequest } from '../../types.js'; +import { InMemoryEventStore } from '../shared/inMemoryEventStore.js'; +import { setupAuthServer } from './demoInMemoryOAuthProvider.js'; +import { OAuthMetadata } from '../../shared/auth.js'; +import { checkResourceAllowed } from '../../shared/auth-utils.js'; -import { InMemoryEventStore } from './inMemoryEventStore.js'; +import cors from 'cors'; // Create an MCP server with implementation details const getServer = () => { @@ -263,7 +257,7 @@ const tokenVerifier = { throw new Error(`Invalid or expired token: ${text}`); } - const data = (await response.json()) as { aud: string; client_id: string; scope: string; exp: number }; + const data = await response.json(); if (!data.aud) { throw new Error(`Resource Indicator (RFC8707) missing`); @@ -765,7 +759,7 @@ process.on('SIGINT', async () => { for (const sessionId in transports) { try { console.log(`Closing transport for session ${sessionId}`); - await transports[sessionId]!.close(); + await transports[sessionId].close(); delete transports[sessionId]; delete sessionsNeedingElicitation[sessionId]; } catch (error) { diff --git a/examples/server/src/jsonResponseStreamableHttp.ts b/src/examples/server/jsonResponseStreamableHttp.ts similarity index 89% rename from examples/server/src/jsonResponseStreamableHttp.ts rename to src/examples/server/jsonResponseStreamableHttp.ts index 2199ebfbea..224955c460 100644 --- a/examples/server/src/jsonResponseStreamableHttp.ts +++ b/src/examples/server/jsonResponseStreamableHttp.ts @@ -1,9 +1,10 @@ +import { Request, Response } from 'express'; import { randomUUID } from 'node:crypto'; - -import type { CallToolResult } from '@modelcontextprotocol/server'; -import { createMcpExpressApp, isInitializeRequest, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/server'; -import type { Request, Response } from 'express'; +import { McpServer } from '../../server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; import * as z from 'zod/v4'; +import { CallToolResult, isInitializeRequest } from '../../types.js'; +import { createMcpExpressApp } from '../../server/express.js'; // Create an MCP server with implementation details const getServer = () => { @@ -20,13 +21,11 @@ const getServer = () => { ); // Register a simple tool that returns a greeting - server.registerTool( + server.tool( 'greet', + 'A simple greeting tool', { - description: 'A simple greeting tool', - inputSchema: { - name: z.string().describe('Name to greet') - } + name: z.string().describe('Name to greet') }, async ({ name }): Promise => { return { @@ -41,13 +40,11 @@ const getServer = () => { ); // Register a tool that sends multiple greetings with notifications - server.registerTool( + server.tool( 'multi-greet', + 'A tool that sends different greetings with delays between them', { - description: 'A tool that sends different greetings with delays between them', - inputSchema: { - name: z.string().describe('Name to greet') - } + name: z.string().describe('Name to greet') }, async ({ name }, extra): Promise => { const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/examples/server/src/mcpServerOutputSchema.ts b/src/examples/server/mcpServerOutputSchema.ts similarity index 95% rename from examples/server/src/mcpServerOutputSchema.ts rename to src/examples/server/mcpServerOutputSchema.ts index 52fa766678..7ef9f6227a 100644 --- a/examples/server/src/mcpServerOutputSchema.ts +++ b/src/examples/server/mcpServerOutputSchema.ts @@ -4,7 +4,8 @@ * This demonstrates how to easily create tools with structured output */ -import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server'; +import { McpServer } from '../../server/mcp.js'; +import { StdioServerTransport } from '../../server/stdio.js'; import * as z from 'zod/v4'; const server = new McpServer({ diff --git a/examples/server/src/simpleSseServer.ts b/src/examples/server/simpleSseServer.ts similarity index 89% rename from examples/server/src/simpleSseServer.ts rename to src/examples/server/simpleSseServer.ts index 90561c62f5..1cd10cd2da 100644 --- a/examples/server/src/simpleSseServer.ts +++ b/src/examples/server/simpleSseServer.ts @@ -1,7 +1,9 @@ -import type { CallToolResult } from '@modelcontextprotocol/server'; -import { createMcpExpressApp, McpServer, SSEServerTransport } from '@modelcontextprotocol/server'; -import type { Request, Response } from 'express'; +import { Request, Response } from 'express'; +import { McpServer } from '../../server/mcp.js'; +import { SSEServerTransport } from '../../server/sse.js'; import * as z from 'zod/v4'; +import { CallToolResult } from '../../types.js'; +import { createMcpExpressApp } from '../../server/express.js'; /** * This example server demonstrates the deprecated HTTP+SSE transport @@ -23,14 +25,12 @@ const getServer = () => { { capabilities: { logging: {} } } ); - server.registerTool( + server.tool( 'start-notification-stream', + 'Starts sending periodic notifications', { - description: 'Starts sending periodic notifications', - inputSchema: { - interval: z.number().describe('Interval in milliseconds between notifications').default(1000), - count: z.number().describe('Number of notifications to send').default(10) - } + interval: z.number().describe('Interval in milliseconds between notifications').default(1000), + count: z.number().describe('Number of notifications to send').default(10) }, async ({ interval, count }, extra): Promise => { const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); @@ -163,7 +163,7 @@ process.on('SIGINT', async () => { for (const sessionId in transports) { try { console.log(`Closing transport for session ${sessionId}`); - await transports[sessionId]!.close(); + await transports[sessionId].close(); delete transports[sessionId]; } catch (error) { console.error(`Error closing transport for session ${sessionId}:`, error); diff --git a/examples/server/src/simpleStatelessStreamableHttp.ts b/src/examples/server/simpleStatelessStreamableHttp.ts similarity index 83% rename from examples/server/src/simpleStatelessStreamableHttp.ts rename to src/examples/server/simpleStatelessStreamableHttp.ts index 3aee2c2123..748d82fdae 100644 --- a/examples/server/src/simpleStatelessStreamableHttp.ts +++ b/src/examples/server/simpleStatelessStreamableHttp.ts @@ -1,7 +1,9 @@ -import type { CallToolResult, GetPromptResult, ReadResourceResult } from '@modelcontextprotocol/server'; -import { createMcpExpressApp, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/server'; -import type { Request, Response } from 'express'; +import { Request, Response } from 'express'; +import { McpServer } from '../../server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; import * as z from 'zod/v4'; +import { CallToolResult, GetPromptResult, ReadResourceResult } from '../../types.js'; +import { createMcpExpressApp } from '../../server/express.js'; const getServer = () => { // Create an MCP server with implementation details @@ -14,13 +16,11 @@ const getServer = () => { ); // Register a simple prompt - server.registerPrompt( + server.prompt( 'greeting-template', + 'A simple greeting prompt template', { - description: 'A simple greeting prompt template', - argsSchema: { - name: z.string().describe('Name to include in greeting') - } + name: z.string().describe('Name to include in greeting') }, async ({ name }): Promise => { return { @@ -38,14 +38,12 @@ const getServer = () => { ); // Register a tool specifically for testing resumability - server.registerTool( + server.tool( 'start-notification-stream', + 'Starts sending periodic notifications for testing resumability', { - description: 'Starts sending periodic notifications for testing resumability', - inputSchema: { - interval: z.number().describe('Interval in milliseconds between notifications').default(100), - count: z.number().describe('Number of notifications to send (0 for 100)').default(10) - } + interval: z.number().describe('Interval in milliseconds between notifications').default(100), + count: z.number().describe('Number of notifications to send (0 for 100)').default(10) }, async ({ interval, count }, extra): Promise => { const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); @@ -80,7 +78,7 @@ const getServer = () => { ); // Create a simple resource at a fixed URI - server.registerResource( + server.resource( 'greeting-resource', 'https://example.com/greetings/default', { mimeType: 'text/plain' }, diff --git a/examples/server/src/simpleStreamableHttp.ts b/src/examples/server/simpleStreamableHttp.ts similarity index 93% rename from examples/server/src/simpleStreamableHttp.ts rename to src/examples/server/simpleStreamableHttp.ts index 7613e37868..ca13631982 100644 --- a/examples/server/src/simpleStreamableHttp.ts +++ b/src/examples/server/simpleStreamableHttp.ts @@ -1,31 +1,25 @@ +import { Request, Response } from 'express'; import { randomUUID } from 'node:crypto'; - -import { setupAuthServer } from '@modelcontextprotocol/examples-shared'; -import type { +import * as z from 'zod/v4'; +import { McpServer } from '../../server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; +import { getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter } from '../../server/auth/router.js'; +import { requireBearerAuth } from '../../server/auth/middleware/bearerAuth.js'; +import { createMcpExpressApp } from '../../server/express.js'; +import { CallToolResult, + ElicitResultSchema, GetPromptResult, - OAuthMetadata, + isInitializeRequest, PrimitiveSchemaDefinition, ReadResourceResult, ResourceLink -} from '@modelcontextprotocol/server'; -import { - checkResourceAllowed, - createMcpExpressApp, - ElicitResultSchema, - getOAuthProtectedResourceMetadataUrl, - InMemoryTaskMessageQueue, - InMemoryTaskStore, - isInitializeRequest, - mcpAuthMetadataRouter, - McpServer, - requireBearerAuth, - StreamableHTTPServerTransport -} from '@modelcontextprotocol/server'; -import type { Request, Response } from 'express'; -import * as z from 'zod/v4'; - -import { InMemoryEventStore } from './inMemoryEventStore.js'; +} from '../../types.js'; +import { InMemoryEventStore } from '../shared/inMemoryEventStore.js'; +import { InMemoryTaskStore, InMemoryTaskMessageQueue } from '../../experimental/tasks/stores/in-memory.js'; +import { setupAuthServer } from './demoInMemoryOAuthProvider.js'; +import { OAuthMetadata } from '../../shared/auth.js'; +import { checkResourceAllowed } from '../../shared/auth-utils.js'; // Check for OAuth flag const useOAuth = process.argv.includes('--oauth'); @@ -73,18 +67,16 @@ const getServer = () => { ); // Register a tool that sends multiple greetings with notifications (with annotations) - server.registerTool( + server.tool( 'multi-greet', + 'A tool that sends different greetings with delays between them', { - description: 'A tool that sends different greetings with delays between them', - inputSchema: { - name: z.string().describe('Name to greet') - }, - annotations: { - title: 'Multiple Greeting Tool', - readOnlyHint: true, - openWorldHint: false - } + name: z.string().describe('Name to greet') + }, + { + title: 'Multiple Greeting Tool', + readOnlyHint: true, + openWorldHint: false }, async ({ name }, extra): Promise => { const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); @@ -129,13 +121,11 @@ const getServer = () => { ); // Register a tool that demonstrates form elicitation (user input collection with a schema) // This creates a closure that captures the server instance - server.registerTool( + server.tool( 'collect-user-info', + 'A tool that collects user information through form elicitation', { - description: 'A tool that collects user information through form elicitation', - inputSchema: { - infoType: z.enum(['contact', 'preferences', 'feedback']).describe('Type of information to collect') - } + infoType: z.enum(['contact', 'preferences', 'feedback']).describe('Type of information to collect') }, async ({ infoType }, extra): Promise => { let message: string; @@ -312,14 +302,12 @@ const getServer = () => { ); // Register a tool specifically for testing resumability - server.registerTool( + server.tool( 'start-notification-stream', + 'Starts sending periodic notifications for testing resumability', { - description: 'Starts sending periodic notifications for testing resumability', - inputSchema: { - interval: z.number().describe('Interval in milliseconds between notifications').default(100), - count: z.number().describe('Number of notifications to send (0 for 100)').default(50) - } + interval: z.number().describe('Interval in milliseconds between notifications').default(100), + count: z.number().describe('Number of notifications to send (0 for 100)').default(50) }, async ({ interval, count }, extra): Promise => { const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); @@ -552,7 +540,7 @@ if (useOAuth) { throw new Error(`Invalid or expired token: ${text}`); } - const data = (await response.json()) as { aud: string; client_id: string; scope: string; exp: number }; + const data = await response.json(); if (strictOAuth) { if (!data.aud) { @@ -752,7 +740,7 @@ process.on('SIGINT', async () => { for (const sessionId in transports) { try { console.log(`Closing transport for session ${sessionId}`); - await transports[sessionId]!.close(); + await transports[sessionId].close(); delete transports[sessionId]; } catch (error) { console.error(`Error closing transport for session ${sessionId}:`, error); diff --git a/examples/server/src/simpleTaskInteractive.ts b/src/examples/server/simpleTaskInteractive.ts similarity index 96% rename from examples/server/src/simpleTaskInteractive.ts rename to src/examples/server/simpleTaskInteractive.ts index 956c33f8e3..c35126dc0b 100644 --- a/examples/server/src/simpleTaskInteractive.ts +++ b/src/examples/server/simpleTaskInteractive.ts @@ -9,43 +9,35 @@ * creates a task, and the result is fetched via tasks/result endpoint. */ +import { Request, Response } from 'express'; import { randomUUID } from 'node:crypto'; - -import type { +import { Server } from '../../server/index.js'; +import { createMcpExpressApp } from '../../server/express.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; +import { CallToolResult, - CreateMessageRequest, - CreateMessageResult, - CreateTaskOptions, CreateTaskResult, - ElicitRequestFormParams, - ElicitResult, - GetTaskPayloadResult, GetTaskResult, - JSONRPCRequest, - PrimitiveSchemaDefinition, - QueuedMessage, - QueuedRequest, - RequestId, + Tool, + TextContent, + RELATED_TASK_META_KEY, + Task, Result, + RequestId, + JSONRPCRequest, SamplingMessage, - Task, - TaskMessageQueue, - TextContent, - Tool -} from '@modelcontextprotocol/server'; -import { + ElicitRequestFormParams, + CreateMessageRequest, + ElicitResult, + CreateMessageResult, + PrimitiveSchemaDefinition, + ListToolsRequestSchema, CallToolRequestSchema, - createMcpExpressApp, - GetTaskPayloadRequestSchema, GetTaskRequestSchema, - InMemoryTaskStore, - isTerminal, - ListToolsRequestSchema, - RELATED_TASK_META_KEY, - Server, - StreamableHTTPServerTransport -} from '@modelcontextprotocol/server'; -import type { Request, Response } from 'express'; + GetTaskPayloadRequestSchema +} from '../../types.js'; +import { TaskMessageQueue, QueuedMessage, QueuedRequest, isTerminal, CreateTaskOptions } from '../../experimental/tasks/interfaces.js'; +import { InMemoryTaskStore } from '../../experimental/tasks/stores/in-memory.js'; // ============================================================================ // Resolver - Promise-like for passing results between async operations @@ -187,12 +179,12 @@ class TaskMessageQueueWithResolvers implements TaskMessageQueue { class TaskStoreWithNotifications extends InMemoryTaskStore { private updateResolvers = new Map void)[]>(); - override async updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string, sessionId?: string): Promise { + async updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string, sessionId?: string): Promise { await super.updateTaskStatus(taskId, status, statusMessage, sessionId); this.notifyUpdate(taskId); } - override async storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result, sessionId?: string): Promise { + async storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result, sessionId?: string): Promise { await super.storeTaskResult(taskId, status, result, sessionId); this.notifyUpdate(taskId); } @@ -626,7 +618,7 @@ const createServer = (): Server => { }); // Handle tasks/result - server.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra): Promise => { + server.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra): Promise => { const { taskId } = request.params; console.log(`[Server] tasks/result called for task ${taskId}`); return taskResultHandler.handle(taskId, server, extra.sessionId ?? ''); @@ -739,7 +731,7 @@ process.on('SIGINT', async () => { console.log('\nShutting down server...'); for (const sessionId of Object.keys(transports)) { try { - await transports[sessionId]!.close(); + await transports[sessionId].close(); delete transports[sessionId]; } catch (error) { console.error(`Error closing session ${sessionId}:`, error); diff --git a/examples/server/src/sseAndStreamableHttpCompatibleServer.ts b/src/examples/server/sseAndStreamableHttpCompatibleServer.ts similarity index 89% rename from examples/server/src/sseAndStreamableHttpCompatibleServer.ts rename to src/examples/server/sseAndStreamableHttpCompatibleServer.ts index 335802d0a4..5c91b7e336 100644 --- a/examples/server/src/sseAndStreamableHttpCompatibleServer.ts +++ b/src/examples/server/sseAndStreamableHttpCompatibleServer.ts @@ -1,22 +1,17 @@ +import { Request, Response } from 'express'; import { randomUUID } from 'node:crypto'; - -import type { CallToolResult } from '@modelcontextprotocol/server'; -import { - createMcpExpressApp, - isInitializeRequest, - McpServer, - SSEServerTransport, - StreamableHTTPServerTransport -} from '@modelcontextprotocol/server'; -import type { Request, Response } from 'express'; +import { McpServer } from '../../server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; +import { SSEServerTransport } from '../../server/sse.js'; import * as z from 'zod/v4'; - -import { InMemoryEventStore } from './inMemoryEventStore.js'; +import { CallToolResult, isInitializeRequest } from '../../types.js'; +import { InMemoryEventStore } from '../shared/inMemoryEventStore.js'; +import { createMcpExpressApp } from '../../server/express.js'; /** * This example server demonstrates backwards compatibility with both: * 1. The deprecated HTTP+SSE transport (protocol version 2024-11-05) - * 2. The Streamable HTTP transport (protocol version 2025-11-25) + * 2. The Streamable HTTP transport (protocol version 2025-03-26) * * It maintains a single MCP server instance but exposes two transport options: * - /mcp: The new Streamable HTTP endpoint (supports GET/POST/DELETE) @@ -34,14 +29,12 @@ const getServer = () => { ); // Register a simple tool that sends notifications over time - server.registerTool( + server.tool( 'start-notification-stream', + 'Starts sending periodic notifications for testing resumability', { - description: 'Starts sending periodic notifications for testing resumability', - inputSchema: { - interval: z.number().describe('Interval in milliseconds between notifications').default(100), - count: z.number().describe('Number of notifications to send (0 for 100)').default(50) - } + interval: z.number().describe('Interval in milliseconds between notifications').default(100), + count: z.number().describe('Number of notifications to send (0 for 100)').default(50) }, async ({ interval, count }, extra): Promise => { const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); @@ -84,7 +77,7 @@ const app = createMcpExpressApp(); const transports: Record = {}; //============================================================================= -// STREAMABLE HTTP TRANSPORT (PROTOCOL VERSION 2025-11-25) +// STREAMABLE HTTP TRANSPORT (PROTOCOL VERSION 2025-03-26) //============================================================================= // Handle all MCP Streamable HTTP requests (GET, POST, DELETE) on a single endpoint @@ -221,10 +214,10 @@ app.listen(PORT, error => { ============================================== SUPPORTED TRANSPORT OPTIONS: -1. Streamable Http(Protocol version: 2025-11-25) +1. Streamable Http(Protocol version: 2025-03-26) Endpoint: /mcp Methods: GET, POST, DELETE - Usage: + Usage: - Initialize with POST to /mcp - Establish SSE stream with GET to /mcp - Send requests with POST to /mcp @@ -247,7 +240,7 @@ process.on('SIGINT', async () => { for (const sessionId in transports) { try { console.log(`Closing transport for session ${sessionId}`); - await transports[sessionId]!.close(); + await transports[sessionId].close(); delete transports[sessionId]; } catch (error) { console.error(`Error closing transport for session ${sessionId}:`, error); diff --git a/examples/server/src/ssePollingExample.ts b/src/examples/server/ssePollingExample.ts similarity index 91% rename from examples/server/src/ssePollingExample.ts rename to src/examples/server/ssePollingExample.ts index 4e3d36328f..bbecf2fdbd 100644 --- a/examples/server/src/ssePollingExample.ts +++ b/src/examples/server/ssePollingExample.ts @@ -9,17 +9,17 @@ * - Uses `eventStore` to persist events for replay after reconnection * - Uses `extra.closeSSEStream()` callback to gracefully disconnect clients mid-operation * - * Run with: pnpm tsx src/ssePollingExample.ts + * Run with: npx tsx src/examples/server/ssePollingExample.ts * Test with: curl or the MCP Inspector */ +import { Request, Response } from 'express'; import { randomUUID } from 'node:crypto'; - -import type { CallToolResult } from '@modelcontextprotocol/server'; -import { createMcpExpressApp, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/server'; +import { McpServer } from '../../server/mcp.js'; +import { createMcpExpressApp } from '../../server/express.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; +import { CallToolResult } from '../../types.js'; +import { InMemoryEventStore } from '../shared/inMemoryEventStore.js'; import cors from 'cors'; -import type { Request, Response } from 'express'; - -import { InMemoryEventStore } from './inMemoryEventStore.js'; // Create the MCP server const server = new McpServer( diff --git a/examples/server/src/standaloneSseWithGetStreamableHttp.ts b/src/examples/server/standaloneSseWithGetStreamableHttp.ts similarity index 92% rename from examples/server/src/standaloneSseWithGetStreamableHttp.ts rename to src/examples/server/standaloneSseWithGetStreamableHttp.ts index cceb242992..546d35c70c 100644 --- a/examples/server/src/standaloneSseWithGetStreamableHttp.ts +++ b/src/examples/server/standaloneSseWithGetStreamableHttp.ts @@ -1,8 +1,9 @@ +import { Request, Response } from 'express'; import { randomUUID } from 'node:crypto'; - -import type { ReadResourceResult } from '@modelcontextprotocol/server'; -import { createMcpExpressApp, isInitializeRequest, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/server'; -import type { Request, Response } from 'express'; +import { McpServer } from '../../server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js'; +import { isInitializeRequest, ReadResourceResult } from '../../types.js'; +import { createMcpExpressApp } from '../../server/express.js'; // Create an MCP server with implementation details const server = new McpServer({ @@ -15,7 +16,7 @@ const transports: { [sessionId: string]: StreamableHTTPServerTransport } = {}; const addResource = (name: string, content: string) => { const uri = `https://mcp-example.com/dynamic/${encodeURIComponent(name)}`; - server.registerResource( + server.resource( name, uri, { mimeType: 'text/plain', description: `Dynamic resource: ${name}` }, diff --git a/examples/server/src/toolWithSampleServer.ts b/src/examples/server/toolWithSampleServer.ts similarity index 89% rename from examples/server/src/toolWithSampleServer.ts rename to src/examples/server/toolWithSampleServer.ts index 4d92031449..e6d7335986 100644 --- a/examples/server/src/toolWithSampleServer.ts +++ b/src/examples/server/toolWithSampleServer.ts @@ -1,6 +1,7 @@ -// Run with: pnpm tsx src/toolWithSampleServer.ts +// Run with: npx tsx src/examples/server/toolWithSampleServer.ts -import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server'; +import { McpServer } from '../../server/mcp.js'; +import { StdioServerTransport } from '../../server/stdio.js'; import * as z from 'zod/v4'; const mcpServer = new McpServer({ diff --git a/examples/server/src/inMemoryEventStore.ts b/src/examples/shared/inMemoryEventStore.ts similarity index 93% rename from examples/server/src/inMemoryEventStore.ts rename to src/examples/shared/inMemoryEventStore.ts index 001459ffa4..d4d02eb913 100644 --- a/examples/server/src/inMemoryEventStore.ts +++ b/src/examples/shared/inMemoryEventStore.ts @@ -1,4 +1,5 @@ -import type { EventStore, JSONRPCMessage } from '@modelcontextprotocol/server'; +import { JSONRPCMessage } from '../../types.js'; +import { EventStore } from '../../server/streamableHttp.js'; /** * Simple in-memory implementation of the EventStore interface for resumability @@ -20,7 +21,7 @@ export class InMemoryEventStore implements EventStore { */ private getStreamIdFromEventId(eventId: string): string { const parts = eventId.split('_'); - return parts.length > 0 ? parts[0]! : ''; + return parts.length > 0 ? parts[0] : ''; } /** diff --git a/packages/server/src/experimental/index.ts b/src/experimental/index.ts similarity index 100% rename from packages/server/src/experimental/index.ts rename to src/experimental/index.ts diff --git a/packages/client/src/experimental/tasks/client.ts b/src/experimental/tasks/client.ts similarity index 94% rename from packages/client/src/experimental/tasks/client.ts rename to src/experimental/tasks/client.ts index df57e91a4a..f62941dc8f 100644 --- a/packages/client/src/experimental/tasks/client.ts +++ b/src/experimental/tasks/client.ts @@ -5,24 +5,14 @@ * @experimental */ -import type { - AnyObjectSchema, - CallToolRequest, - CancelTaskResult, - ClientRequest, - CompatibilityCallToolResultSchema, - GetTaskResult, - ListTasksResult, - Notification, - Request, - RequestOptions, - ResponseMessage, - Result, - SchemaOutput -} from '@modelcontextprotocol/core'; -import { CallToolResultSchema, ErrorCode, McpError } from '@modelcontextprotocol/core'; +import type { Client } from '../../client/index.js'; +import type { RequestOptions } from '../../shared/protocol.js'; +import type { ResponseMessage } from '../../shared/responseMessage.js'; +import type { AnyObjectSchema, SchemaOutput } from '../../server/zod-compat.js'; +import type { CallToolRequest, ClientRequest, Notification, Request, Result } from '../../types.js'; +import { CallToolResultSchema, type CompatibilityCallToolResultSchema, McpError, ErrorCode } from '../../types.js'; -import type { Client } from '../../client/client.js'; +import type { GetTaskResult, ListTasksResult, CancelTaskResult } from './types.js'; /** * Internal interface for accessing Client's private methods. diff --git a/packages/core/src/experimental/tasks/helpers.ts b/src/experimental/tasks/helpers.ts similarity index 100% rename from packages/core/src/experimental/tasks/helpers.ts rename to src/experimental/tasks/helpers.ts diff --git a/src/experimental/tasks/index.ts b/src/experimental/tasks/index.ts new file mode 100644 index 0000000000..398d343932 --- /dev/null +++ b/src/experimental/tasks/index.ts @@ -0,0 +1,34 @@ +/** + * Experimental task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ + +// Re-export spec types for convenience +export * from './types.js'; + +// SDK implementation interfaces +export * from './interfaces.js'; + +// Assertion helpers +export * from './helpers.js'; + +// Wrapper classes +export * from './client.js'; +export * from './server.js'; +export * from './mcp-server.js'; + +// Store implementations +export * from './stores/in-memory.js'; + +// Re-export response message types for task streaming +export type { + ResponseMessage, + TaskStatusMessage, + TaskCreatedMessage, + ResultMessage, + ErrorMessage, + BaseResponseMessage +} from '../../shared/responseMessage.js'; +export { takeResult, toArrayAsync } from '../../shared/responseMessage.js'; diff --git a/packages/core/src/experimental/tasks/interfaces.ts b/src/experimental/tasks/interfaces.ts similarity index 83% rename from packages/core/src/experimental/tasks/interfaces.ts rename to src/experimental/tasks/interfaces.ts index c1901d70a6..4800e65dc1 100644 --- a/packages/core/src/experimental/tasks/interfaces.ts +++ b/src/experimental/tasks/interfaces.ts @@ -3,20 +3,24 @@ * WARNING: These APIs are experimental and may change without notice. */ -import type { RequestHandlerExtra, RequestTaskStore } from '../../shared/protocol.js'; -import type { - JSONRPCErrorResponse, - JSONRPCNotification, - JSONRPCRequest, - JSONRPCResultResponse, +import { + Task, Request, RequestId, Result, - ServerNotification, + JSONRPCRequest, + JSONRPCNotification, + JSONRPCResponse, + JSONRPCError, ServerRequest, - Task, + ServerNotification, + CallToolResult, + GetTaskResult, ToolExecution -} from '../../types/types.js'; +} from '../../types.js'; +import { CreateTaskResult } from './types.js'; +import type { RequestHandlerExtra, RequestTaskStore } from '../../shared/protocol.js'; +import type { ZodRawShapeCompat, AnySchema, ShapeOutput } from '../../server/zod-compat.js'; // ============================================================================ // Task Handler Types (for registerToolTask) @@ -39,6 +43,48 @@ export interface TaskRequestHandlerExtra extends RequestHandlerExtra, + Args extends undefined | ZodRawShapeCompat | AnySchema = undefined +> = Args extends ZodRawShapeCompat + ? (args: ShapeOutput, extra: ExtraT) => SendResultT | Promise + : Args extends AnySchema + ? (args: unknown, extra: ExtraT) => SendResultT | Promise + : (extra: ExtraT) => SendResultT | Promise; + +/** + * Handler for creating a task. + * @experimental + */ +export type CreateTaskRequestHandler< + SendResultT extends Result, + Args extends undefined | ZodRawShapeCompat | AnySchema = undefined +> = BaseToolCallback; + +/** + * Handler for task operations (get, getResult). + * @experimental + */ +export type TaskRequestHandler< + SendResultT extends Result, + Args extends undefined | ZodRawShapeCompat | AnySchema = undefined +> = BaseToolCallback; + +/** + * Interface for task-based tool handlers. + * @experimental + */ +export interface ToolTaskHandler { + createTask: CreateTaskRequestHandler; + getTask: TaskRequestHandler; + getTaskResult: TaskRequestHandler; +} + /** * Task-specific execution configuration. * taskSupport cannot be 'forbidden' for task-based tools. @@ -78,13 +124,13 @@ export interface QueuedNotification extends BaseQueuedMessage { export interface QueuedResponse extends BaseQueuedMessage { type: 'response'; /** The actual JSONRPC response */ - message: JSONRPCResultResponse; + message: JSONRPCResponse; } export interface QueuedError extends BaseQueuedMessage { type: 'error'; /** The actual JSONRPC error */ - message: JSONRPCErrorResponse; + message: JSONRPCError; } /** diff --git a/packages/server/src/experimental/tasks/mcp-server.ts b/src/experimental/tasks/mcp-server.ts similarity index 94% rename from packages/server/src/experimental/tasks/mcp-server.ts rename to src/experimental/tasks/mcp-server.ts index 6fd5a6cc5c..506f3d72b7 100644 --- a/packages/server/src/experimental/tasks/mcp-server.ts +++ b/src/experimental/tasks/mcp-server.ts @@ -5,10 +5,10 @@ * @experimental */ -import type { AnySchema, TaskToolExecution, ToolAnnotations, ToolExecution, ZodRawShapeCompat } from '@modelcontextprotocol/core'; - -import type { AnyToolHandler, McpServer, RegisteredTool } from '../../server/mcp.js'; -import type { ToolTaskHandler } from './interfaces.js'; +import type { McpServer, RegisteredTool, AnyToolHandler } from '../../server/mcp.js'; +import type { ZodRawShapeCompat, AnySchema } from '../../server/zod-compat.js'; +import type { ToolAnnotations, ToolExecution } from '../../types.js'; +import type { ToolTaskHandler, TaskToolExecution } from './interfaces.js'; /** * Internal interface for accessing McpServer's private _createRegisteredTool method. diff --git a/packages/server/src/experimental/tasks/server.ts b/src/experimental/tasks/server.ts similarity index 91% rename from packages/server/src/experimental/tasks/server.ts rename to src/experimental/tasks/server.ts index 33bde3298b..a4150a8d76 100644 --- a/packages/server/src/experimental/tasks/server.ts +++ b/src/experimental/tasks/server.ts @@ -5,21 +5,11 @@ * @experimental */ -import type { - AnySchema, - CancelTaskResult, - GetTaskResult, - ListTasksResult, - Notification, - Request, - RequestOptions, - ResponseMessage, - Result, - SchemaOutput, - ServerRequest -} from '@modelcontextprotocol/core'; - -import type { Server } from '../../server/server.js'; +import type { Server } from '../../server/index.js'; +import type { RequestOptions } from '../../shared/protocol.js'; +import type { ResponseMessage } from '../../shared/responseMessage.js'; +import type { AnySchema, SchemaOutput } from '../../server/zod-compat.js'; +import type { ServerRequest, Notification, Request, Result, GetTaskResult, ListTasksResult, CancelTaskResult } from '../../types.js'; /** * Experimental task features for low-level MCP servers. diff --git a/packages/core/src/experimental/tasks/stores/in-memory.ts b/src/experimental/tasks/stores/in-memory.ts similarity index 97% rename from packages/core/src/experimental/tasks/stores/in-memory.ts rename to src/experimental/tasks/stores/in-memory.ts index 42ddf5bf4a..4cc903606d 100644 --- a/packages/core/src/experimental/tasks/stores/in-memory.ts +++ b/src/experimental/tasks/stores/in-memory.ts @@ -5,12 +5,10 @@ * @experimental */ +import { Task, Request, RequestId, Result } from '../../../types.js'; +import { TaskStore, isTerminal, TaskMessageQueue, QueuedMessage, CreateTaskOptions } from '../interfaces.js'; import { randomBytes } from 'node:crypto'; -import type { Request, RequestId, Result, Task } from '../../../types/types.js'; -import type { CreateTaskOptions, QueuedMessage, TaskMessageQueue, TaskStore } from '../interfaces.js'; -import { isTerminal } from '../interfaces.js'; - interface StoredTask { task: Task; request: Request; diff --git a/src/experimental/tasks/types.ts b/src/experimental/tasks/types.ts new file mode 100644 index 0000000000..a3845bae1c --- /dev/null +++ b/src/experimental/tasks/types.ts @@ -0,0 +1,43 @@ +/** + * Re-exports of task-related types from the MCP protocol spec. + * WARNING: These APIs are experimental and may change without notice. + * + * These types are defined in types.ts (matching the protocol spec) and + * re-exported here for convenience when working with experimental task features. + */ + +// Task schemas (Zod) +export { + TaskCreationParamsSchema, + RelatedTaskMetadataSchema, + TaskSchema, + CreateTaskResultSchema, + TaskStatusNotificationParamsSchema, + TaskStatusNotificationSchema, + GetTaskRequestSchema, + GetTaskResultSchema, + GetTaskPayloadRequestSchema, + ListTasksRequestSchema, + ListTasksResultSchema, + CancelTaskRequestSchema, + CancelTaskResultSchema, + ClientTasksCapabilitySchema, + ServerTasksCapabilitySchema +} from '../../types.js'; + +// Task types (inferred from schemas) +export type { + Task, + TaskCreationParams, + RelatedTaskMetadata, + CreateTaskResult, + TaskStatusNotificationParams, + TaskStatusNotification, + GetTaskRequest, + GetTaskResult, + GetTaskPayloadRequest, + ListTasksRequest, + ListTasksResult, + CancelTaskRequest, + CancelTaskResult +} from '../../types.js'; diff --git a/packages/core/src/util/inMemory.ts b/src/inMemory.ts similarity index 93% rename from packages/core/src/util/inMemory.ts rename to src/inMemory.ts index 3f832b06b0..26062624d4 100644 --- a/packages/core/src/util/inMemory.ts +++ b/src/inMemory.ts @@ -1,5 +1,6 @@ -import type { Transport } from '../shared/transport.js'; -import type { AuthInfo, JSONRPCMessage, RequestId } from '../types/types.js'; +import { Transport } from './shared/transport.js'; +import { JSONRPCMessage, RequestId } from './types.js'; +import { AuthInfo } from './server/auth/types.js'; interface QueuedMessage { message: JSONRPCMessage; diff --git a/packages/server/src/server/auth/clients.ts b/src/server/auth/clients.ts similarity index 93% rename from packages/server/src/server/auth/clients.ts rename to src/server/auth/clients.ts index f6aca1be92..4e3f8e17ee 100644 --- a/packages/server/src/server/auth/clients.ts +++ b/src/server/auth/clients.ts @@ -1,4 +1,4 @@ -import type { OAuthClientInformationFull } from '@modelcontextprotocol/core'; +import { OAuthClientInformationFull } from '../../shared/auth.js'; /** * Stores information about registered OAuth clients for this server. diff --git a/packages/core/src/auth/errors.ts b/src/server/auth/errors.ts similarity index 84% rename from packages/core/src/auth/errors.ts rename to src/server/auth/errors.ts index d145b6296b..dff413e38a 100644 --- a/packages/core/src/auth/errors.ts +++ b/src/server/auth/errors.ts @@ -1,4 +1,4 @@ -import type { OAuthErrorResponse } from '../shared/auth.js'; +import { OAuthErrorResponse } from '../../shared/auth.js'; /** * Base class for all OAuth errors @@ -41,7 +41,7 @@ export class OAuthError extends Error { * or is otherwise malformed. */ export class InvalidRequestError extends OAuthError { - static override errorCode = 'invalid_request'; + static errorCode = 'invalid_request'; } /** @@ -49,7 +49,7 @@ export class InvalidRequestError extends OAuthError { * authentication included, or unsupported authentication method). */ export class InvalidClientError extends OAuthError { - static override errorCode = 'invalid_client'; + static errorCode = 'invalid_client'; } /** @@ -58,7 +58,7 @@ export class InvalidClientError extends OAuthError { * authorization request, or was issued to another client. */ export class InvalidGrantError extends OAuthError { - static override errorCode = 'invalid_grant'; + static errorCode = 'invalid_grant'; } /** @@ -66,7 +66,7 @@ export class InvalidGrantError extends OAuthError { * this authorization grant type. */ export class UnauthorizedClientError extends OAuthError { - static override errorCode = 'unauthorized_client'; + static errorCode = 'unauthorized_client'; } /** @@ -74,7 +74,7 @@ export class UnauthorizedClientError extends OAuthError { * by the authorization server. */ export class UnsupportedGrantTypeError extends OAuthError { - static override errorCode = 'unsupported_grant_type'; + static errorCode = 'unsupported_grant_type'; } /** @@ -82,14 +82,14 @@ export class UnsupportedGrantTypeError extends OAuthError { * exceeds the scope granted by the resource owner. */ export class InvalidScopeError extends OAuthError { - static override errorCode = 'invalid_scope'; + static errorCode = 'invalid_scope'; } /** * Access denied error - The resource owner or authorization server denied the request. */ export class AccessDeniedError extends OAuthError { - static override errorCode = 'access_denied'; + static errorCode = 'access_denied'; } /** @@ -97,7 +97,7 @@ export class AccessDeniedError extends OAuthError { * that prevented it from fulfilling the request. */ export class ServerError extends OAuthError { - static override errorCode = 'server_error'; + static errorCode = 'server_error'; } /** @@ -105,7 +105,7 @@ export class ServerError extends OAuthError { * handle the request due to a temporary overloading or maintenance of the server. */ export class TemporarilyUnavailableError extends OAuthError { - static override errorCode = 'temporarily_unavailable'; + static errorCode = 'temporarily_unavailable'; } /** @@ -113,7 +113,7 @@ export class TemporarilyUnavailableError extends OAuthError { * obtaining an authorization code using this method. */ export class UnsupportedResponseTypeError extends OAuthError { - static override errorCode = 'unsupported_response_type'; + static errorCode = 'unsupported_response_type'; } /** @@ -121,7 +121,7 @@ export class UnsupportedResponseTypeError extends OAuthError { * the requested token type. */ export class UnsupportedTokenTypeError extends OAuthError { - static override errorCode = 'unsupported_token_type'; + static errorCode = 'unsupported_token_type'; } /** @@ -129,7 +129,7 @@ export class UnsupportedTokenTypeError extends OAuthError { * or invalid for other reasons. */ export class InvalidTokenError extends OAuthError { - static override errorCode = 'invalid_token'; + static errorCode = 'invalid_token'; } /** @@ -137,7 +137,7 @@ export class InvalidTokenError extends OAuthError { * (Custom, non-standard error) */ export class MethodNotAllowedError extends OAuthError { - static override errorCode = 'method_not_allowed'; + static errorCode = 'method_not_allowed'; } /** @@ -145,7 +145,7 @@ export class MethodNotAllowedError extends OAuthError { * (Custom, non-standard error based on RFC 6585) */ export class TooManyRequestsError extends OAuthError { - static override errorCode = 'too_many_requests'; + static errorCode = 'too_many_requests'; } /** @@ -153,14 +153,14 @@ export class TooManyRequestsError extends OAuthError { * (Custom error for dynamic client registration - RFC 7591) */ export class InvalidClientMetadataError extends OAuthError { - static override errorCode = 'invalid_client_metadata'; + static errorCode = 'invalid_client_metadata'; } /** * Insufficient scope error - The request requires higher privileges than provided by the access token. */ export class InsufficientScopeError extends OAuthError { - static override errorCode = 'insufficient_scope'; + static errorCode = 'insufficient_scope'; } /** @@ -168,7 +168,7 @@ export class InsufficientScopeError extends OAuthError { * (Custom error for resource indicators - RFC 8707) */ export class InvalidTargetError extends OAuthError { - static override errorCode = 'invalid_target'; + static errorCode = 'invalid_target'; } /** @@ -183,7 +183,7 @@ export class CustomOAuthError extends OAuthError { super(message, errorUri); } - override get errorCode(): string { + get errorCode(): string { return this.customErrorCode; } } diff --git a/packages/server/src/server/auth/handlers/authorize.ts b/src/server/auth/handlers/authorize.ts similarity index 91% rename from packages/server/src/server/auth/handlers/authorize.ts rename to src/server/auth/handlers/authorize.ts index 65875529e5..dcb6c03ecf 100644 --- a/packages/server/src/server/auth/handlers/authorize.ts +++ b/src/server/auth/handlers/authorize.ts @@ -1,12 +1,10 @@ -import { InvalidClientError, InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '@modelcontextprotocol/core'; -import type { RequestHandler } from 'express'; -import express from 'express'; -import type { Options as RateLimitOptions } from 'express-rate-limit'; -import { rateLimit } from 'express-rate-limit'; +import { RequestHandler } from 'express'; import * as z from 'zod/v4'; - +import express from 'express'; +import { OAuthServerProvider } from '../provider.js'; +import { rateLimit, Options as RateLimitOptions } from 'express-rate-limit'; import { allowedMethods } from '../middleware/allowedMethods.js'; -import type { OAuthServerProvider } from '../provider.js'; +import { InvalidRequestError, InvalidClientError, ServerError, TooManyRequestsError, OAuthError } from '../errors.js'; export type AuthorizationHandlerOptions = { provider: OAuthServerProvider; @@ -130,7 +128,7 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A { state, scopes: requestedScopes, - redirectUri: redirect_uri!, // TODO: Someone to look at. Strict tsconfig showed this could be undefined, while the return type is string. + redirectUri: redirect_uri, codeChallenge: code_challenge, resource: resource ? new URL(resource) : undefined }, @@ -139,10 +137,10 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A } catch (error) { // Post-redirect errors - redirect with error parameters if (error instanceof OAuthError) { - res.redirect(302, createErrorRedirect(redirect_uri!, error, state)); + res.redirect(302, createErrorRedirect(redirect_uri, error, state)); } else { const serverError = new ServerError('Internal Server Error'); - res.redirect(302, createErrorRedirect(redirect_uri!, serverError, state)); + res.redirect(302, createErrorRedirect(redirect_uri, serverError, state)); } } }); diff --git a/packages/server/src/server/auth/handlers/metadata.ts b/src/server/auth/handlers/metadata.ts similarity index 76% rename from packages/server/src/server/auth/handlers/metadata.ts rename to src/server/auth/handlers/metadata.ts index 529a6e57a8..e0f07a99b8 100644 --- a/packages/server/src/server/auth/handlers/metadata.ts +++ b/src/server/auth/handlers/metadata.ts @@ -1,8 +1,6 @@ -import type { OAuthMetadata, OAuthProtectedResourceMetadata } from '@modelcontextprotocol/core'; +import express, { RequestHandler } from 'express'; +import { OAuthMetadata, OAuthProtectedResourceMetadata } from '../../../shared/auth.js'; import cors from 'cors'; -import type { RequestHandler } from 'express'; -import express from 'express'; - import { allowedMethods } from '../middleware/allowedMethods.js'; export function metadataHandler(metadata: OAuthMetadata | OAuthProtectedResourceMetadata): RequestHandler { diff --git a/packages/server/src/server/auth/handlers/register.ts b/src/server/auth/handlers/register.ts similarity index 89% rename from packages/server/src/server/auth/handlers/register.ts rename to src/server/auth/handlers/register.ts index a78154d482..1830619b4e 100644 --- a/packages/server/src/server/auth/handlers/register.ts +++ b/src/server/auth/handlers/register.ts @@ -1,21 +1,11 @@ +import express, { RequestHandler } from 'express'; +import { OAuthClientInformationFull, OAuthClientMetadataSchema } from '../../../shared/auth.js'; import crypto from 'node:crypto'; - -import type { OAuthClientInformationFull } from '@modelcontextprotocol/core'; -import { - InvalidClientMetadataError, - OAuthClientMetadataSchema, - OAuthError, - ServerError, - TooManyRequestsError -} from '@modelcontextprotocol/core'; import cors from 'cors'; -import type { RequestHandler } from 'express'; -import express from 'express'; -import type { Options as RateLimitOptions } from 'express-rate-limit'; -import { rateLimit } from 'express-rate-limit'; - -import type { OAuthRegisteredClientsStore } from '../clients.js'; +import { OAuthRegisteredClientsStore } from '../clients.js'; +import { rateLimit, Options as RateLimitOptions } from 'express-rate-limit'; import { allowedMethods } from '../middleware/allowedMethods.js'; +import { InvalidClientMetadataError, ServerError, TooManyRequestsError, OAuthError } from '../errors.js'; export type ClientRegistrationHandlerOptions = { /** diff --git a/packages/server/src/server/auth/handlers/revoke.ts b/src/server/auth/handlers/revoke.ts similarity index 86% rename from packages/server/src/server/auth/handlers/revoke.ts rename to src/server/auth/handlers/revoke.ts index c7c9f8a6af..da7ef04f81 100644 --- a/packages/server/src/server/auth/handlers/revoke.ts +++ b/src/server/auth/handlers/revoke.ts @@ -1,19 +1,11 @@ -import { - InvalidRequestError, - OAuthError, - OAuthTokenRevocationRequestSchema, - ServerError, - TooManyRequestsError -} from '@modelcontextprotocol/core'; +import { OAuthServerProvider } from '../provider.js'; +import express, { RequestHandler } from 'express'; import cors from 'cors'; -import type { RequestHandler } from 'express'; -import express from 'express'; -import type { Options as RateLimitOptions } from 'express-rate-limit'; -import { rateLimit } from 'express-rate-limit'; - -import { allowedMethods } from '../middleware/allowedMethods.js'; import { authenticateClient } from '../middleware/clientAuth.js'; -import type { OAuthServerProvider } from '../provider.js'; +import { OAuthTokenRevocationRequestSchema } from '../../../shared/auth.js'; +import { rateLimit, Options as RateLimitOptions } from 'express-rate-limit'; +import { allowedMethods } from '../middleware/allowedMethods.js'; +import { InvalidRequestError, ServerError, TooManyRequestsError, OAuthError } from '../errors.js'; export type RevocationHandlerOptions = { provider: OAuthServerProvider; diff --git a/packages/server/src/server/auth/handlers/token.ts b/src/server/auth/handlers/token.ts similarity index 94% rename from packages/server/src/server/auth/handlers/token.ts rename to src/server/auth/handlers/token.ts index 3b7941294c..4cc4e8ab8b 100644 --- a/packages/server/src/server/auth/handlers/token.ts +++ b/src/server/auth/handlers/token.ts @@ -1,22 +1,19 @@ +import * as z from 'zod/v4'; +import express, { RequestHandler } from 'express'; +import { OAuthServerProvider } from '../provider.js'; +import cors from 'cors'; +import { verifyChallenge } from 'pkce-challenge'; +import { authenticateClient } from '../middleware/clientAuth.js'; +import { rateLimit, Options as RateLimitOptions } from 'express-rate-limit'; +import { allowedMethods } from '../middleware/allowedMethods.js'; import { - InvalidGrantError, InvalidRequestError, - OAuthError, + InvalidGrantError, + UnsupportedGrantTypeError, ServerError, TooManyRequestsError, - UnsupportedGrantTypeError -} from '@modelcontextprotocol/core'; -import cors from 'cors'; -import type { RequestHandler } from 'express'; -import express from 'express'; -import type { Options as RateLimitOptions } from 'express-rate-limit'; -import { rateLimit } from 'express-rate-limit'; -import { verifyChallenge } from 'pkce-challenge'; -import * as z from 'zod/v4'; - -import { allowedMethods } from '../middleware/allowedMethods.js'; -import { authenticateClient } from '../middleware/clientAuth.js'; -import type { OAuthServerProvider } from '../provider.js'; + OAuthError +} from '../errors.js'; export type TokenHandlerOptions = { provider: OAuthServerProvider; diff --git a/packages/server/src/server/auth/middleware/allowedMethods.ts b/src/server/auth/middleware/allowedMethods.ts similarity index 86% rename from packages/server/src/server/auth/middleware/allowedMethods.ts rename to src/server/auth/middleware/allowedMethods.ts index 72c076ec4a..74633aa573 100644 --- a/packages/server/src/server/auth/middleware/allowedMethods.ts +++ b/src/server/auth/middleware/allowedMethods.ts @@ -1,5 +1,5 @@ -import { MethodNotAllowedError } from '@modelcontextprotocol/core'; -import type { RequestHandler } from 'express'; +import { RequestHandler } from 'express'; +import { MethodNotAllowedError } from '../errors.js'; /** * Middleware to handle unsupported HTTP methods with a 405 Method Not Allowed response. diff --git a/packages/server/src/server/auth/middleware/bearerAuth.ts b/src/server/auth/middleware/bearerAuth.ts similarity index 93% rename from packages/server/src/server/auth/middleware/bearerAuth.ts rename to src/server/auth/middleware/bearerAuth.ts index 1a16de1a93..dac6530865 100644 --- a/packages/server/src/server/auth/middleware/bearerAuth.ts +++ b/src/server/auth/middleware/bearerAuth.ts @@ -1,8 +1,7 @@ -import type { AuthInfo } from '@modelcontextprotocol/core'; -import { InsufficientScopeError, InvalidTokenError, OAuthError, ServerError } from '@modelcontextprotocol/core'; -import type { RequestHandler } from 'express'; - -import type { OAuthTokenVerifier } from '../provider.js'; +import { RequestHandler } from 'express'; +import { InsufficientScopeError, InvalidTokenError, OAuthError, ServerError } from '../errors.js'; +import { OAuthTokenVerifier } from '../provider.js'; +import { AuthInfo } from '../types.js'; export type BearerAuthMiddlewareOptions = { /** @@ -47,7 +46,7 @@ export function requireBearerAuth({ verifier, requiredScopes = [], resourceMetad } const [type, token] = authHeader.split(' '); - if (type!.toLowerCase() !== 'bearer' || !token) { + if (type.toLowerCase() !== 'bearer' || !token) { throw new InvalidTokenError("Invalid Authorization header format, expected 'Bearer TOKEN'"); } diff --git a/packages/server/src/server/auth/middleware/clientAuth.ts b/src/server/auth/middleware/clientAuth.ts similarity index 88% rename from packages/server/src/server/auth/middleware/clientAuth.ts rename to src/server/auth/middleware/clientAuth.ts index ac4bc8b795..6cc6a1923d 100644 --- a/packages/server/src/server/auth/middleware/clientAuth.ts +++ b/src/server/auth/middleware/clientAuth.ts @@ -1,9 +1,8 @@ -import type { OAuthClientInformationFull } from '@modelcontextprotocol/core'; -import { InvalidClientError, InvalidRequestError, OAuthError, ServerError } from '@modelcontextprotocol/core'; -import type { RequestHandler } from 'express'; import * as z from 'zod/v4'; - -import type { OAuthRegisteredClientsStore } from '../clients.js'; +import { RequestHandler } from 'express'; +import { OAuthRegisteredClientsStore } from '../clients.js'; +import { OAuthClientInformationFull } from '../../../shared/auth.js'; +import { InvalidRequestError, InvalidClientError, ServerError, OAuthError } from '../errors.js'; export type ClientAuthenticationMiddlewareOptions = { /** diff --git a/packages/server/src/server/auth/provider.ts b/src/server/auth/provider.ts similarity index 92% rename from packages/server/src/server/auth/provider.ts rename to src/server/auth/provider.ts index 6d27fb792b..cf1c306def 100644 --- a/packages/server/src/server/auth/provider.ts +++ b/src/server/auth/provider.ts @@ -1,7 +1,7 @@ -import type { AuthInfo, OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; -import type { Response } from 'express'; - -import type { OAuthRegisteredClientsStore } from './clients.js'; +import { Response } from 'express'; +import { OAuthRegisteredClientsStore } from './clients.js'; +import { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '../../shared/auth.js'; +import { AuthInfo } from './types.js'; export type AuthorizationParams = { state?: string; diff --git a/packages/server/src/server/auth/providers/proxyProvider.ts b/src/server/auth/providers/proxyProvider.ts similarity index 93% rename from packages/server/src/server/auth/providers/proxyProvider.ts rename to src/server/auth/providers/proxyProvider.ts index 0688754c09..855856c89e 100644 --- a/packages/server/src/server/auth/providers/proxyProvider.ts +++ b/src/server/auth/providers/proxyProvider.ts @@ -1,9 +1,16 @@ -import type { AuthInfo, FetchLike, OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; -import { OAuthClientInformationFullSchema, OAuthTokensSchema, ServerError } from '@modelcontextprotocol/core'; -import type { Response } from 'express'; - -import type { OAuthRegisteredClientsStore } from '../clients.js'; -import type { AuthorizationParams, OAuthServerProvider } from '../provider.js'; +import { Response } from 'express'; +import { OAuthRegisteredClientsStore } from '../clients.js'; +import { + OAuthClientInformationFull, + OAuthClientInformationFullSchema, + OAuthTokenRevocationRequest, + OAuthTokens, + OAuthTokensSchema +} from '../../../shared/auth.js'; +import { AuthInfo } from '../types.js'; +import { AuthorizationParams, OAuthServerProvider } from '../provider.js'; +import { ServerError } from '../errors.js'; +import { FetchLike } from '../../../shared/transport.js'; export type ProxyEndpoints = { authorizationUrl: string; diff --git a/packages/server/src/server/auth/router.ts b/src/server/auth/router.ts similarity index 91% rename from packages/server/src/server/auth/router.ts rename to src/server/auth/router.ts index ba8b030e08..1df0be091f 100644 --- a/packages/server/src/server/auth/router.ts +++ b/src/server/auth/router.ts @@ -1,17 +1,11 @@ -import type { OAuthMetadata, OAuthProtectedResourceMetadata } from '@modelcontextprotocol/core'; -import type { RequestHandler } from 'express'; -import express from 'express'; - -import type { AuthorizationHandlerOptions } from './handlers/authorize.js'; -import { authorizationHandler } from './handlers/authorize.js'; +import express, { RequestHandler } from 'express'; +import { clientRegistrationHandler, ClientRegistrationHandlerOptions } from './handlers/register.js'; +import { tokenHandler, TokenHandlerOptions } from './handlers/token.js'; +import { authorizationHandler, AuthorizationHandlerOptions } from './handlers/authorize.js'; +import { revocationHandler, RevocationHandlerOptions } from './handlers/revoke.js'; import { metadataHandler } from './handlers/metadata.js'; -import type { ClientRegistrationHandlerOptions } from './handlers/register.js'; -import { clientRegistrationHandler } from './handlers/register.js'; -import type { RevocationHandlerOptions } from './handlers/revoke.js'; -import { revocationHandler } from './handlers/revoke.js'; -import type { TokenHandlerOptions } from './handlers/token.js'; -import { tokenHandler } from './handlers/token.js'; -import type { OAuthServerProvider } from './provider.js'; +import { OAuthServerProvider } from './provider.js'; +import { OAuthMetadata, OAuthProtectedResourceMetadata } from '../../shared/auth.js'; // Check for dev mode flag that allows HTTP issuer URLs (for development/testing only) const allowInsecureIssuerUrl = diff --git a/src/server/auth/types.ts b/src/server/auth/types.ts new file mode 100644 index 0000000000..a38a7e7508 --- /dev/null +++ b/src/server/auth/types.ts @@ -0,0 +1,36 @@ +/** + * Information about a validated access token, provided to request handlers. + */ +export interface AuthInfo { + /** + * The access token. + */ + token: string; + + /** + * The client ID associated with this token. + */ + clientId: string; + + /** + * Scopes associated with this token. + */ + scopes: string[]; + + /** + * When the token expires (in seconds since epoch). + */ + expiresAt?: number; + + /** + * The RFC 8707 resource server identifier for which this token is valid. + * If set, this MUST match the MCP server's resource identifier (minus hash fragment). + */ + resource?: URL; + + /** + * Additional data associated with the token. + * This field should be used for any additional data that needs to be attached to the auth info. + */ + extra?: Record; +} diff --git a/packages/server/src/server/completable.ts b/src/server/completable.ts similarity index 96% rename from packages/server/src/server/completable.ts rename to src/server/completable.ts index 7174bff376..be067ac55a 100644 --- a/packages/server/src/server/completable.ts +++ b/src/server/completable.ts @@ -1,4 +1,4 @@ -import type { AnySchema, SchemaInput } from '@modelcontextprotocol/core'; +import { AnySchema, SchemaInput } from './zod-compat.js'; export const COMPLETABLE_SYMBOL: unique symbol = Symbol.for('mcp.completable'); diff --git a/packages/server/src/server/express.ts b/src/server/express.ts similarity index 97% rename from packages/server/src/server/express.ts rename to src/server/express.ts index ff23cde85d..a542acd7ac 100644 --- a/packages/server/src/server/express.ts +++ b/src/server/express.ts @@ -1,6 +1,4 @@ -import type { Express } from 'express'; -import express from 'express'; - +import express, { Express } from 'express'; import { hostHeaderValidation, localhostHostValidation } from './middleware/hostHeaderValidation.js'; /** diff --git a/packages/server/src/server/server.ts b/src/server/index.ts similarity index 94% rename from packages/server/src/server/server.ts rename to src/server/index.ts index 8132e342be..aa1a62d004 100644 --- a/packages/server/src/server/server.ts +++ b/src/server/index.ts @@ -1,68 +1,61 @@ -import type { - AnyObjectSchema, - ClientCapabilities, - CreateMessageRequest, - CreateMessageRequestParamsBase, - CreateMessageRequestParamsWithTools, - CreateMessageResult, - CreateMessageResultWithTools, - ElicitRequestFormParams, - ElicitRequestURLParams, - ElicitResult, - Implementation, - InitializeRequest, - InitializeResult, - JsonSchemaType, - jsonSchemaValidator, - ListRootsRequest, - LoggingLevel, - LoggingMessageNotification, - Notification, - NotificationOptions, - ProtocolOptions, - Request, - RequestHandlerExtra, - RequestOptions, - ResourceUpdatedNotification, - Result, - SchemaOutput, - ServerCapabilities, - ServerNotification, - ServerRequest, - ServerResult, - ToolResultContent, - ToolUseContent, - ZodV3Internal, - ZodV4Internal -} from '@modelcontextprotocol/core'; +import { mergeCapabilities, Protocol, type NotificationOptions, type ProtocolOptions, type RequestOptions } from '../shared/protocol.js'; import { - AjvJsonSchemaValidator, - assertClientRequestTaskCapability, - assertToolsCallTaskCapability, - CallToolRequestSchema, - CallToolResultSchema, + type ClientCapabilities, + type CreateMessageRequest, + type CreateMessageResult, CreateMessageResultSchema, + type CreateMessageResultWithTools, CreateMessageResultWithToolsSchema, - CreateTaskResultSchema, + type CreateMessageRequestParamsBase, + type CreateMessageRequestParamsWithTools, + type ElicitRequestFormParams, + type ElicitRequestURLParams, + type ElicitResult, ElicitResultSchema, EmptyResultSchema, ErrorCode, - getObjectShape, + type Implementation, InitializedNotificationSchema, + type InitializeRequest, InitializeRequestSchema, - isZ4Schema, + type InitializeResult, LATEST_PROTOCOL_VERSION, + type ListRootsRequest, ListRootsResultSchema, + type LoggingLevel, LoggingLevelSchema, + type LoggingMessageNotification, McpError, - mergeCapabilities, - Protocol, - safeParse, + type Notification, + type Request, + type ResourceUpdatedNotification, + type Result, + type ServerCapabilities, + type ServerNotification, + type ServerRequest, + type ServerResult, SetLevelRequestSchema, - SUPPORTED_PROTOCOL_VERSIONS -} from '@modelcontextprotocol/core'; - + SUPPORTED_PROTOCOL_VERSIONS, + type ToolResultContent, + type ToolUseContent, + CallToolRequestSchema, + CallToolResultSchema, + CreateTaskResultSchema +} from '../types.js'; +import { AjvJsonSchemaValidator } from '../validation/ajv-provider.js'; +import type { JsonSchemaType, jsonSchemaValidator } from '../validation/types.js'; +import { + AnyObjectSchema, + getObjectShape, + isZ4Schema, + safeParse, + SchemaOutput, + type ZodV3Internal, + type ZodV4Internal +} from './zod-compat.js'; +import { RequestHandlerExtra } from '../shared/protocol.js'; import { ExperimentalServerTasks } from '../experimental/tasks/server.js'; +import { assertToolsCallTaskCapability, assertClientRequestTaskCapability } from '../experimental/tasks/helpers.js'; export type ServerOptions = ProtocolOptions & { /** @@ -516,7 +509,7 @@ export class Server< // These may appear even without tools/toolChoice in the current request when // a previous sampling request returned tool_use and this is a follow-up with results. if (params.messages.length > 0) { - const lastMessage = params.messages[params.messages.length - 1]!; + const lastMessage = params.messages[params.messages.length - 1]; const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content]; const hasToolResults = lastContent.some(c => c.type === 'tool_result'); diff --git a/packages/server/src/server/mcp.ts b/src/server/mcp.ts similarity index 94% rename from packages/server/src/server/mcp.ts rename to src/server/mcp.ts index 8564212c1e..ed41e21a3e 100644 --- a/packages/server/src/server/mcp.ts +++ b/src/server/mcp.ts @@ -1,70 +1,69 @@ -import type { - AnyObjectSchema, +import { Server, ServerOptions } from './index.js'; +import { AnySchema, - BaseMetadata, - CallToolRequest, + AnyObjectSchema, + ZodRawShapeCompat, + SchemaOutput, + ShapeOutput, + normalizeObjectSchema, + safeParseAsync, + getObjectShape, + objectFromShape, + getParseErrorMessage, + getSchemaDescription, + isSchemaOptional, + getLiteralValue +} from './zod-compat.js'; +import { toJsonSchemaCompat } from './zod-json-schema-compat.js'; +import { + Implementation, + Tool, + ListToolsResult, CallToolResult, - CompleteRequestPrompt, - CompleteRequestResourceTemplate, + McpError, + ErrorCode, CompleteResult, - CreateTaskResult, - GetPromptResult, - Implementation, - ListPromptsResult, + PromptReference, + ResourceTemplateReference, + BaseMetadata, + Resource, ListResourcesResult, - ListToolsResult, - LoggingMessageNotification, + ListResourceTemplatesRequestSchema, + ReadResourceRequestSchema, + ListToolsRequestSchema, + CallToolRequestSchema, + ListResourcesRequestSchema, + ListPromptsRequestSchema, + GetPromptRequestSchema, + CompleteRequestSchema, + ListPromptsResult, Prompt, PromptArgument, - PromptReference, + GetPromptResult, ReadResourceResult, - RequestHandlerExtra, - Resource, - ResourceTemplateReference, - Result, - SchemaOutput, - ServerNotification, ServerRequest, - ShapeOutput, - Tool, + ServerNotification, ToolAnnotations, - ToolExecution, - Transport, - Variables, - ZodRawShapeCompat -} from '@modelcontextprotocol/core'; -import { + SecurityScheme, + LoggingMessageNotification, + CreateTaskResult, + Result, + CompleteRequestPrompt, + CompleteRequestResourceTemplate, assertCompleteRequestPrompt, assertCompleteRequestResourceTemplate, - CallToolRequestSchema, - CompleteRequestSchema, - ErrorCode, - getLiteralValue, - getObjectShape, - getParseErrorMessage, - GetPromptRequestSchema, - getSchemaDescription, - isSchemaOptional, - ListPromptsRequestSchema, - ListResourcesRequestSchema, - ListResourceTemplatesRequestSchema, - ListToolsRequestSchema, - McpError, - normalizeObjectSchema, - objectFromShape, - ReadResourceRequestSchema, - safeParseAsync, - toJsonSchemaCompat, - UriTemplate, - validateAndWarnToolName -} from '@modelcontextprotocol/core'; -import { ZodOptional } from 'zod'; - -import type { ToolTaskHandler } from '../experimental/tasks/interfaces.js'; + CallToolRequest, + ToolExecution +} from '../types.js'; +import { isCompletable, getCompleter } from './completable.js'; +import { UriTemplate, Variables } from '../shared/uriTemplate.js'; +import { RequestHandlerExtra } from '../shared/protocol.js'; +import { Transport } from '../shared/transport.js'; + +import { validateAndWarnToolName } from '../shared/toolNameValidation.js'; import { ExperimentalMcpServerTasks } from '../experimental/tasks/mcp-server.js'; -import { getCompleter, isCompletable } from './completable.js'; -import type { ServerOptions } from './server.js'; -import { Server } from './server.js'; +import type { ToolTaskHandler } from '../experimental/tasks/interfaces.js'; +import { ZodOptional } from 'zod'; /** * High-level MCP server that provides a simpler API for working with resources, tools, and prompts. @@ -139,41 +138,44 @@ export class McpServer { this.server.setRequestHandler( ListToolsRequestSchema, - (): ListToolsResult => ({ - tools: Object.entries(this._registeredTools) - .filter(([, tool]) => tool.enabled) - .map(([name, tool]): Tool => { - const toolDefinition: Tool = { - name, - title: tool.title, - description: tool.description, - inputSchema: (() => { - const obj = normalizeObjectSchema(tool.inputSchema); - return obj - ? (toJsonSchemaCompat(obj, { - strictUnions: true, - pipeStrategy: 'input' - }) as Tool['inputSchema']) - : EMPTY_OBJECT_JSON_SCHEMA; - })(), - annotations: tool.annotations, - execution: tool.execution, - _meta: tool._meta - }; - - if (tool.outputSchema) { - const obj = normalizeObjectSchema(tool.outputSchema); - if (obj) { - toolDefinition.outputSchema = toJsonSchemaCompat(obj, { - strictUnions: true, - pipeStrategy: 'output' - }) as Tool['outputSchema']; + (): ListToolsResult => { + return { + tools: Object.entries(this._registeredTools) + .filter(([, tool]) => tool.enabled) + .map(([name, tool]): Tool => { + const toolDefinition: Tool = { + name, + title: tool.title, + description: tool.description, + inputSchema: (() => { + const obj = normalizeObjectSchema(tool.inputSchema); + return obj + ? (toJsonSchemaCompat(obj, { + strictUnions: true, + pipeStrategy: 'input' + }) as Tool['inputSchema']) + : EMPTY_OBJECT_JSON_SCHEMA; + })(), + annotations: tool.annotations, + securitySchemes: tool.securitySchemes, + execution: tool.execution, + _meta: tool._meta + }; + + if (tool.outputSchema) { + const obj = normalizeObjectSchema(tool.outputSchema); + if (obj) { + toolDefinition.outputSchema = toJsonSchemaCompat(obj, { + strictUnions: true, + pipeStrategy: 'output' + }) as Tool['outputSchema']; + } } - } - return toolDefinition; - }) - }) + return toolDefinition; + }) + }; + } ); this.server.setRequestHandler(CallToolRequestSchema, async (request, extra): Promise => { @@ -260,10 +262,10 @@ export class McpServer { private async validateToolInput< Tool extends RegisteredTool, Args extends Tool['inputSchema'] extends infer InputSchema - ? InputSchema extends AnySchema - ? SchemaOutput - : undefined - : undefined + ? InputSchema extends AnySchema + ? SchemaOutput + : undefined + : undefined >(tool: Tool, args: Args, toolName: string): Promise { if (!tool.inputSchema) { return undefined as Args; @@ -379,7 +381,7 @@ export class McpServer { const createTaskResult: CreateTaskResult = args // undefined only if tool.inputSchema is undefined ? await Promise.resolve((handler as ToolTaskHandler).createTask(args, taskExtra)) : // eslint-disable-next-line @typescript-eslint/no-explicit-any - await Promise.resolve(((handler as ToolTaskHandler).createTask as any)(taskExtra)); + await Promise.resolve(((handler as ToolTaskHandler).createTask as any)(taskExtra)); // Poll until completion const taskId = createTaskResult.task.taskId; @@ -877,6 +879,7 @@ export class McpServer { inputSchema: ZodRawShapeCompat | AnySchema | undefined, outputSchema: ZodRawShapeCompat | AnySchema | undefined, annotations: ToolAnnotations | undefined, + securitySchemes: SecurityScheme[] | undefined, execution: ToolExecution | undefined, _meta: Record | undefined, handler: AnyToolHandler @@ -890,6 +893,7 @@ export class McpServer { inputSchema: getZodSchemaObject(inputSchema), outputSchema: getZodSchemaObject(outputSchema), annotations, + securitySchemes, execution, _meta, handler: handler, @@ -911,6 +915,7 @@ export class McpServer { if (typeof updates.outputSchema !== 'undefined') registeredTool.outputSchema = objectFromShape(updates.outputSchema); if (typeof updates.callback !== 'undefined') registeredTool.handler = updates.callback; if (typeof updates.annotations !== 'undefined') registeredTool.annotations = updates.annotations; + if (typeof updates.securitySchemes !== 'undefined') registeredTool.securitySchemes = updates.securitySchemes; if (typeof updates._meta !== 'undefined') registeredTool._meta = updates._meta; if (typeof updates.enabled !== 'undefined') registeredTool.enabled = updates.enabled; this.sendToolListChanged(); @@ -1041,6 +1046,7 @@ export class McpServer { inputSchema, outputSchema, annotations, + undefined, { taskSupport: 'forbidden' }, undefined, callback @@ -1058,6 +1064,7 @@ export class McpServer { inputSchema?: InputArgs; outputSchema?: OutputArgs; annotations?: ToolAnnotations; + securitySchemes?: SecurityScheme[]; _meta?: Record; }, cb: ToolCallback @@ -1066,7 +1073,7 @@ export class McpServer { throw new Error(`Tool ${name} is already registered`); } - const { title, description, inputSchema, outputSchema, annotations, _meta } = config; + const { title, description, inputSchema, outputSchema, annotations, securitySchemes, _meta } = config; return this._createRegisteredTool( name, @@ -1075,6 +1082,7 @@ export class McpServer { inputSchema, outputSchema, annotations, + securitySchemes, { taskSupport: 'forbidden' }, _meta, cb as ToolCallback @@ -1277,8 +1285,8 @@ export type BaseToolCallback< > = Args extends ZodRawShapeCompat ? (args: ShapeOutput, extra: Extra) => SendResultT | Promise : Args extends AnySchema - ? (args: SchemaOutput, extra: Extra) => SendResultT | Promise - : (extra: Extra) => SendResultT | Promise; + ? (args: SchemaOutput, extra: Extra) => SendResultT | Promise + : (extra: Extra) => SendResultT | Promise; /** * Callback for a tool handler registered with Server.tool(). @@ -1307,6 +1315,7 @@ export type RegisteredTool = { inputSchema?: AnySchema; outputSchema?: AnySchema; annotations?: ToolAnnotations; + securitySchemes?: SecurityScheme[]; execution?: ToolExecution; _meta?: Record; handler: AnyToolHandler; @@ -1320,6 +1329,7 @@ export type RegisteredTool = { paramsSchema?: InputArgs; outputSchema?: OutputArgs; annotations?: ToolAnnotations; + securitySchemes?: SecurityScheme[]; _meta?: Record; callback?: ToolCallback; enabled?: boolean; diff --git a/packages/server/src/server/middleware/hostHeaderValidation.ts b/src/server/middleware/hostHeaderValidation.ts similarity index 96% rename from packages/server/src/server/middleware/hostHeaderValidation.ts rename to src/server/middleware/hostHeaderValidation.ts index f46178db33..165003635b 100644 --- a/packages/server/src/server/middleware/hostHeaderValidation.ts +++ b/src/server/middleware/hostHeaderValidation.ts @@ -1,4 +1,4 @@ -import type { NextFunction, Request, RequestHandler, Response } from 'express'; +import { Request, Response, NextFunction, RequestHandler } from 'express'; /** * Express middleware for DNS rebinding protection. diff --git a/packages/server/src/server/sse.ts b/src/server/sse.ts similarity index 96% rename from packages/server/src/server/sse.ts rename to src/server/sse.ts index 4fd0fa1d6d..b7450a09ed 100644 --- a/packages/server/src/server/sse.ts +++ b/src/server/sse.ts @@ -1,11 +1,11 @@ import { randomUUID } from 'node:crypto'; -import type { IncomingMessage, ServerResponse } from 'node:http'; -import { URL } from 'node:url'; - -import type { AuthInfo, JSONRPCMessage, MessageExtraInfo, RequestInfo, Transport } from '@modelcontextprotocol/core'; -import { JSONRPCMessageSchema } from '@modelcontextprotocol/core'; -import contentType from 'content-type'; +import { IncomingMessage, ServerResponse } from 'node:http'; +import { Transport } from '../shared/transport.js'; +import { JSONRPCMessage, JSONRPCMessageSchema, MessageExtraInfo, RequestInfo } from '../types.js'; import getRawBody from 'raw-body'; +import contentType from 'content-type'; +import { AuthInfo } from './auth/types.js'; +import { URL } from 'node:url'; const MAXIMUM_MESSAGE_SIZE = '4mb'; diff --git a/packages/server/src/server/stdio.ts b/src/server/stdio.ts similarity index 92% rename from packages/server/src/server/stdio.ts rename to src/server/stdio.ts index b539632c15..e552af0fa1 100644 --- a/packages/server/src/server/stdio.ts +++ b/src/server/stdio.ts @@ -1,8 +1,8 @@ import process from 'node:process'; -import type { Readable, Writable } from 'node:stream'; - -import type { JSONRPCMessage, Transport } from '@modelcontextprotocol/core'; -import { ReadBuffer, serializeMessage } from '@modelcontextprotocol/core'; +import { Readable, Writable } from 'node:stream'; +import { ReadBuffer, serializeMessage } from '../shared/stdio.js'; +import { JSONRPCMessage } from '../types.js'; +import { Transport } from '../shared/transport.js'; /** * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout. diff --git a/src/server/streamableHttp.ts b/src/server/streamableHttp.ts new file mode 100644 index 0000000000..35e7f64e75 --- /dev/null +++ b/src/server/streamableHttp.ts @@ -0,0 +1,956 @@ +import { IncomingMessage, ServerResponse } from 'node:http'; +import { Transport } from '../shared/transport.js'; +import { + MessageExtraInfo, + RequestInfo, + isInitializeRequest, + isJSONRPCError, + isJSONRPCRequest, + isJSONRPCResponse, + JSONRPCMessage, + JSONRPCMessageSchema, + RequestId, + SUPPORTED_PROTOCOL_VERSIONS, + DEFAULT_NEGOTIATED_PROTOCOL_VERSION +} from '../types.js'; +import getRawBody from 'raw-body'; +import contentType from 'content-type'; +import { randomUUID } from 'node:crypto'; +import { AuthInfo } from './auth/types.js'; + +const MAXIMUM_MESSAGE_SIZE = '4mb'; + +export type StreamId = string; +export type EventId = string; + +/** + * Interface for resumability support via event storage + */ +export interface EventStore { + /** + * Stores an event for later retrieval + * @param streamId ID of the stream the event belongs to + * @param message The JSON-RPC message to store + * @returns The generated event ID for the stored event + */ + storeEvent(streamId: StreamId, message: JSONRPCMessage): Promise; + + /** + * Get the stream ID associated with a given event ID. + * @param eventId The event ID to look up + * @returns The stream ID, or undefined if not found + * + * Optional: If not provided, the SDK will use the streamId returned by + * replayEventsAfter for stream mapping. + */ + getStreamIdForEventId?(eventId: EventId): Promise; + + replayEventsAfter( + lastEventId: EventId, + { + send + }: { + send: (eventId: EventId, message: JSONRPCMessage) => Promise; + } + ): Promise; +} + +/** + * Configuration options for StreamableHTTPServerTransport + */ +export interface StreamableHTTPServerTransportOptions { + /** + * Function that generates a session ID for the transport. + * The session ID SHOULD be globally unique and cryptographically secure (e.g., a securely generated UUID, a JWT, or a cryptographic hash) + * + * Return undefined to disable session management. + */ + sessionIdGenerator: (() => string) | undefined; + + /** + * A callback for session initialization events + * This is called when the server initializes a new session. + * Useful in cases when you need to register multiple mcp sessions + * and need to keep track of them. + * @param sessionId The generated session ID + */ + onsessioninitialized?: (sessionId: string) => void | Promise; + + /** + * A callback for session close events + * This is called when the server closes a session due to a DELETE request. + * Useful in cases when you need to clean up resources associated with the session. + * Note that this is different from the transport closing, if you are handling + * HTTP requests from multiple nodes you might want to close each + * StreamableHTTPServerTransport after a request is completed while still keeping the + * session open/running. + * @param sessionId The session ID that was closed + */ + onsessionclosed?: (sessionId: string) => void | Promise; + + /** + * If true, the server will return JSON responses instead of starting an SSE stream. + * This can be useful for simple request/response scenarios without streaming. + * Default is false (SSE streams are preferred). + */ + enableJsonResponse?: boolean; + + /** + * Event store for resumability support + * If provided, resumability will be enabled, allowing clients to reconnect and resume messages + */ + eventStore?: EventStore; + + /** + * List of allowed host header values for DNS rebinding protection. + * If not specified, host validation is disabled. + * @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead, + * or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default. + */ + allowedHosts?: string[]; + + /** + * List of allowed origin header values for DNS rebinding protection. + * If not specified, origin validation is disabled. + * @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead, + * or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default. + */ + allowedOrigins?: string[]; + + /** + * Enable DNS rebinding protection (requires allowedHosts and/or allowedOrigins to be configured). + * Default is false for backwards compatibility. + * @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead, + * or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default. + */ + enableDnsRebindingProtection?: boolean; + + /** + * Retry interval in milliseconds to suggest to clients in SSE retry field. + * When set, the server will send a retry field in SSE priming events to control + * client reconnection timing for polling behavior. + */ + retryInterval?: number; +} + +/** + * Server transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification. + * It supports both SSE streaming and direct HTTP responses. + * + * Usage example: + * + * ```typescript + * // Stateful mode - server sets the session ID + * const statefulTransport = new StreamableHTTPServerTransport({ + * sessionIdGenerator: () => randomUUID(), + * }); + * + * // Stateless mode - explicitly set session ID to undefined + * const statelessTransport = new StreamableHTTPServerTransport({ + * sessionIdGenerator: undefined, + * }); + * + * // Using with pre-parsed request body + * app.post('/mcp', (req, res) => { + * transport.handleRequest(req, res, req.body); + * }); + * ``` + * + * In stateful mode: + * - Session ID is generated and included in response headers + * - Session ID is always included in initialization responses + * - Requests with invalid session IDs are rejected with 404 Not Found + * - Non-initialization requests without a session ID are rejected with 400 Bad Request + * - State is maintained in-memory (connections, message history) + * + * In stateless mode: + * - No Session ID is included in any responses + * - No session validation is performed + */ +export class StreamableHTTPServerTransport implements Transport { + // when sessionId is not set (undefined), it means the transport is in stateless mode + private sessionIdGenerator: (() => string) | undefined; + private _started: boolean = false; + private _streamMapping: Map = new Map(); + private _requestToStreamMapping: Map = new Map(); + private _requestResponseMap: Map = new Map(); + private _initialized: boolean = false; + private _enableJsonResponse: boolean = false; + private _standaloneSseStreamId: string = '_GET_stream'; + private _eventStore?: EventStore; + private _onsessioninitialized?: (sessionId: string) => void | Promise; + private _onsessionclosed?: (sessionId: string) => void | Promise; + private _allowedHosts?: string[]; + private _allowedOrigins?: string[]; + private _enableDnsRebindingProtection: boolean; + private _retryInterval?: number; + + sessionId?: string; + onclose?: () => void; + onerror?: (error: Error) => void; + onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void; + + constructor(options: StreamableHTTPServerTransportOptions) { + this.sessionIdGenerator = options.sessionIdGenerator; + this._enableJsonResponse = options.enableJsonResponse ?? false; + this._eventStore = options.eventStore; + this._onsessioninitialized = options.onsessioninitialized; + this._onsessionclosed = options.onsessionclosed; + this._allowedHosts = options.allowedHosts; + this._allowedOrigins = options.allowedOrigins; + this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false; + this._retryInterval = options.retryInterval; + } + + /** + * Starts the transport. This is required by the Transport interface but is a no-op + * for the Streamable HTTP transport as connections are managed per-request. + */ + async start(): Promise { + if (this._started) { + throw new Error('Transport already started'); + } + this._started = true; + } + + /** + * Validates request headers for DNS rebinding protection. + * @returns Error message if validation fails, undefined if validation passes. + */ + private validateRequestHeaders(req: IncomingMessage): string | undefined { + // Skip validation if protection is not enabled + if (!this._enableDnsRebindingProtection) { + return undefined; + } + + // Validate Host header if allowedHosts is configured + if (this._allowedHosts && this._allowedHosts.length > 0) { + const hostHeader = req.headers.host; + if (!hostHeader || !this._allowedHosts.includes(hostHeader)) { + return `Invalid Host header: ${hostHeader}`; + } + } + + // Validate Origin header if allowedOrigins is configured + if (this._allowedOrigins && this._allowedOrigins.length > 0) { + const originHeader = req.headers.origin; + if (originHeader && !this._allowedOrigins.includes(originHeader)) { + return `Invalid Origin header: ${originHeader}`; + } + } + + return undefined; + } + + /** + * Handles an incoming HTTP request, whether GET or POST + */ + async handleRequest(req: IncomingMessage & { auth?: AuthInfo }, res: ServerResponse, parsedBody?: unknown): Promise { + // Validate request headers for DNS rebinding protection + const validationError = this.validateRequestHeaders(req); + if (validationError) { + res.writeHead(403).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: validationError + }, + id: null + }) + ); + this.onerror?.(new Error(validationError)); + return; + } + + if (req.method === 'POST') { + await this.handlePostRequest(req, res, parsedBody); + } else if (req.method === 'GET') { + await this.handleGetRequest(req, res); + } else if (req.method === 'DELETE') { + await this.handleDeleteRequest(req, res); + } else { + await this.handleUnsupportedRequest(res); + } + } + + /** + * Writes a priming event to establish resumption capability. + * Only sends if eventStore is configured (opt-in for resumability) and + * the client's protocol version supports empty SSE data (>= 2025-11-25). + */ + private async _maybeWritePrimingEvent(res: ServerResponse, streamId: string, protocolVersion: string): Promise { + if (!this._eventStore) { + return; + } + + // Priming events have empty data which older clients cannot handle. + // Only send priming events to clients with protocol version >= 2025-11-25 + // which includes the fix for handling empty SSE data. + if (protocolVersion < '2025-11-25') { + return; + } + + const primingEventId = await this._eventStore.storeEvent(streamId, {} as JSONRPCMessage); + + let primingEvent = `id: ${primingEventId}\ndata: \n\n`; + if (this._retryInterval !== undefined) { + primingEvent = `id: ${primingEventId}\nretry: ${this._retryInterval}\ndata: \n\n`; + } + res.write(primingEvent); + } + + /** + * Handles GET requests for SSE stream + */ + private async handleGetRequest(req: IncomingMessage, res: ServerResponse): Promise { + // The client MUST include an Accept header, listing text/event-stream as a supported content type. + const acceptHeader = req.headers.accept; + if (!acceptHeader?.includes('text/event-stream')) { + res.writeHead(406).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Not Acceptable: Client must accept text/event-stream' + }, + id: null + }) + ); + return; + } + + // If an Mcp-Session-Id is returned by the server during initialization, + // clients using the Streamable HTTP transport MUST include it + // in the Mcp-Session-Id header on all of their subsequent HTTP requests. + if (!this.validateSession(req, res)) { + return; + } + if (!this.validateProtocolVersion(req, res)) { + return; + } + // Handle resumability: check for Last-Event-ID header + if (this._eventStore) { + const lastEventId = req.headers['last-event-id'] as string | undefined; + if (lastEventId) { + await this.replayEvents(lastEventId, res); + return; + } + } + + // The server MUST either return Content-Type: text/event-stream in response to this HTTP GET, + // or else return HTTP 405 Method Not Allowed + const headers: Record = { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache, no-transform', + Connection: 'keep-alive' + }; + + // After initialization, always include the session ID if we have one + if (this.sessionId !== undefined) { + headers['mcp-session-id'] = this.sessionId; + } + + // Check if there's already an active standalone SSE stream for this session + if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) { + // Only one GET SSE stream is allowed per session + res.writeHead(409).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Conflict: Only one SSE stream is allowed per session' + }, + id: null + }) + ); + return; + } + + // We need to send headers immediately as messages will arrive much later, + // otherwise the client will just wait for the first message + res.writeHead(200, headers).flushHeaders(); + + // Assign the response to the standalone SSE stream + this._streamMapping.set(this._standaloneSseStreamId, res); + // Set up close handler for client disconnects + res.on('close', () => { + this._streamMapping.delete(this._standaloneSseStreamId); + }); + + // Add error handler for standalone SSE stream + res.on('error', error => { + this.onerror?.(error as Error); + }); + } + + /** + * Replays events that would have been sent after the specified event ID + * Only used when resumability is enabled + */ + private async replayEvents(lastEventId: string, res: ServerResponse): Promise { + if (!this._eventStore) { + return; + } + try { + // If getStreamIdForEventId is available, use it for conflict checking + let streamId: string | undefined; + if (this._eventStore.getStreamIdForEventId) { + streamId = await this._eventStore.getStreamIdForEventId(lastEventId); + + if (!streamId) { + res.writeHead(400).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Invalid event ID format' + }, + id: null + }) + ); + return; + } + + // Check conflict with the SAME streamId we'll use for mapping + if (this._streamMapping.get(streamId) !== undefined) { + res.writeHead(409).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Conflict: Stream already has an active connection' + }, + id: null + }) + ); + return; + } + } + + const headers: Record = { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache, no-transform', + Connection: 'keep-alive' + }; + + if (this.sessionId !== undefined) { + headers['mcp-session-id'] = this.sessionId; + } + res.writeHead(200, headers).flushHeaders(); + + // Replay events - returns the streamId for backwards compatibility + const replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, { + send: async (eventId: string, message: JSONRPCMessage) => { + if (!this.writeSSEEvent(res, message, eventId)) { + this.onerror?.(new Error('Failed replay events')); + res.end(); + } + } + }); + + this._streamMapping.set(replayedStreamId, res); + + // Set up close handler for client disconnects + res.on('close', () => { + this._streamMapping.delete(replayedStreamId); + }); + + // Add error handler for replay stream + res.on('error', error => { + this.onerror?.(error as Error); + }); + } catch (error) { + this.onerror?.(error as Error); + } + } + + /** + * Writes an event to the SSE stream with proper formatting + */ + private writeSSEEvent(res: ServerResponse, message: JSONRPCMessage, eventId?: string): boolean { + let eventData = `event: message\n`; + // Include event ID if provided - this is important for resumability + if (eventId) { + eventData += `id: ${eventId}\n`; + } + eventData += `data: ${JSON.stringify(message)}\n\n`; + + return res.write(eventData); + } + + /** + * Handles unsupported requests (PUT, PATCH, etc.) + */ + private async handleUnsupportedRequest(res: ServerResponse): Promise { + res.writeHead(405, { + Allow: 'GET, POST, DELETE' + }).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Method not allowed.' + }, + id: null + }) + ); + } + + /** + * Handles POST requests containing JSON-RPC messages + */ + private async handlePostRequest(req: IncomingMessage & { auth?: AuthInfo }, res: ServerResponse, parsedBody?: unknown): Promise { + try { + // Validate the Accept header + const acceptHeader = req.headers.accept; + // The client MUST include an Accept header, listing both application/json and text/event-stream as supported content types. + if (!acceptHeader?.includes('application/json') || !acceptHeader.includes('text/event-stream')) { + res.writeHead(406).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Not Acceptable: Client must accept both application/json and text/event-stream' + }, + id: null + }) + ); + return; + } + + const ct = req.headers['content-type']; + if (!ct || !ct.includes('application/json')) { + res.writeHead(415).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Unsupported Media Type: Content-Type must be application/json' + }, + id: null + }) + ); + return; + } + + const authInfo: AuthInfo | undefined = req.auth; + const requestInfo: RequestInfo = { headers: req.headers }; + + let rawMessage; + if (parsedBody !== undefined) { + rawMessage = parsedBody; + } else { + const parsedCt = contentType.parse(ct); + const body = await getRawBody(req, { + limit: MAXIMUM_MESSAGE_SIZE, + encoding: parsedCt.parameters.charset ?? 'utf-8' + }); + rawMessage = JSON.parse(body.toString()); + } + + let messages: JSONRPCMessage[]; + + // handle batch and single messages + if (Array.isArray(rawMessage)) { + messages = rawMessage.map(msg => JSONRPCMessageSchema.parse(msg)); + } else { + messages = [JSONRPCMessageSchema.parse(rawMessage)]; + } + + // Check if this is an initialization request + // https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle/ + const isInitializationRequest = messages.some(isInitializeRequest); + if (isInitializationRequest) { + // If it's a server with session management and the session ID is already set we should reject the request + // to avoid re-initialization. + if (this._initialized && this.sessionId !== undefined) { + res.writeHead(400).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32600, + message: 'Invalid Request: Server already initialized' + }, + id: null + }) + ); + return; + } + if (messages.length > 1) { + res.writeHead(400).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32600, + message: 'Invalid Request: Only one initialization request is allowed' + }, + id: null + }) + ); + return; + } + this.sessionId = this.sessionIdGenerator?.(); + this._initialized = true; + + // If we have a session ID and an onsessioninitialized handler, call it immediately + // This is needed in cases where the server needs to keep track of multiple sessions + if (this.sessionId && this._onsessioninitialized) { + await Promise.resolve(this._onsessioninitialized(this.sessionId)); + } + } + if (!isInitializationRequest) { + // If an Mcp-Session-Id is returned by the server during initialization, + // clients using the Streamable HTTP transport MUST include it + // in the Mcp-Session-Id header on all of their subsequent HTTP requests. + if (!this.validateSession(req, res)) { + return; + } + // Mcp-Protocol-Version header is required for all requests after initialization. + if (!this.validateProtocolVersion(req, res)) { + return; + } + } + + // check if it contains requests + const hasRequests = messages.some(isJSONRPCRequest); + + if (!hasRequests) { + // if it only contains notifications or responses, return 202 + res.writeHead(202).end(); + + // handle each message + for (const message of messages) { + this.onmessage?.(message, { authInfo, requestInfo }); + } + } else if (hasRequests) { + // The default behavior is to use SSE streaming + // but in some cases server will return JSON responses + const streamId = randomUUID(); + + // Extract protocol version for priming event decision. + // For initialize requests, get from request params. + // For other requests, get from header (already validated). + const initRequest = messages.find(m => isInitializeRequest(m)); + const clientProtocolVersion = initRequest + ? initRequest.params.protocolVersion + : ((req.headers['mcp-protocol-version'] as string) ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION); + + if (!this._enableJsonResponse) { + const headers: Record = { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache', + Connection: 'keep-alive' + }; + + // After initialization, always include the session ID if we have one + if (this.sessionId !== undefined) { + headers['mcp-session-id'] = this.sessionId; + } + + res.writeHead(200, headers); + + await this._maybeWritePrimingEvent(res, streamId, clientProtocolVersion); + } + // Store the response for this request to send messages back through this connection + // We need to track by request ID to maintain the connection + for (const message of messages) { + if (isJSONRPCRequest(message)) { + this._streamMapping.set(streamId, res); + this._requestToStreamMapping.set(message.id, streamId); + } + } + // Set up close handler for client disconnects + res.on('close', () => { + this._streamMapping.delete(streamId); + }); + + // Add error handler for stream write errors + res.on('error', error => { + this.onerror?.(error as Error); + }); + + // handle each message + for (const message of messages) { + // Build closeSSEStream callback for requests when eventStore is configured + // AND client supports resumability (protocol version >= 2025-11-25). + // Old clients can't resume if the stream is closed early because they + // didn't receive a priming event with an event ID. + let closeSSEStream: (() => void) | undefined; + let closeStandaloneSSEStream: (() => void) | undefined; + if (isJSONRPCRequest(message) && this._eventStore && clientProtocolVersion >= '2025-11-25') { + closeSSEStream = () => { + this.closeSSEStream(message.id); + }; + closeStandaloneSSEStream = () => { + this.closeStandaloneSSEStream(); + }; + } + + this.onmessage?.(message, { authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream }); + } + // The server SHOULD NOT close the SSE stream before sending all JSON-RPC responses + // This will be handled by the send() method when responses are ready + } + } catch (error) { + // return JSON-RPC formatted error + res.writeHead(400).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32700, + message: 'Parse error', + data: String(error) + }, + id: null + }) + ); + this.onerror?.(error as Error); + } + } + + /** + * Handles DELETE requests to terminate sessions + */ + private async handleDeleteRequest(req: IncomingMessage, res: ServerResponse): Promise { + if (!this.validateSession(req, res)) { + return; + } + if (!this.validateProtocolVersion(req, res)) { + return; + } + await Promise.resolve(this._onsessionclosed?.(this.sessionId!)); + await this.close(); + res.writeHead(200).end(); + } + + /** + * Validates session ID for non-initialization requests + * Returns true if the session is valid, false otherwise + */ + private validateSession(req: IncomingMessage, res: ServerResponse): boolean { + if (this.sessionIdGenerator === undefined) { + // If the sessionIdGenerator ID is not set, the session management is disabled + // and we don't need to validate the session ID + return true; + } + if (!this._initialized) { + // If the server has not been initialized yet, reject all requests + res.writeHead(400).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Bad Request: Server not initialized' + }, + id: null + }) + ); + return false; + } + + const sessionId = req.headers['mcp-session-id']; + + if (!sessionId) { + // Non-initialization requests without a session ID should return 400 Bad Request + res.writeHead(400).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Bad Request: Mcp-Session-Id header is required' + }, + id: null + }) + ); + return false; + } else if (Array.isArray(sessionId)) { + res.writeHead(400).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Bad Request: Mcp-Session-Id header must be a single value' + }, + id: null + }) + ); + return false; + } else if (sessionId !== this.sessionId) { + // Reject requests with invalid session ID with 404 Not Found + res.writeHead(404).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32001, + message: 'Session not found' + }, + id: null + }) + ); + return false; + } + + return true; + } + + private validateProtocolVersion(req: IncomingMessage, res: ServerResponse): boolean { + let protocolVersion = req.headers['mcp-protocol-version'] ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION; + if (Array.isArray(protocolVersion)) { + protocolVersion = protocolVersion[protocolVersion.length - 1]; + } + + if (!SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) { + res.writeHead(400).end( + JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: `Bad Request: Unsupported protocol version (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(', ')})` + }, + id: null + }) + ); + return false; + } + return true; + } + + async close(): Promise { + // Close all SSE connections + this._streamMapping.forEach(response => { + response.end(); + }); + this._streamMapping.clear(); + + // Clear any pending responses + this._requestResponseMap.clear(); + this.onclose?.(); + } + + /** + * Close an SSE stream for a specific request, triggering client reconnection. + * Use this to implement polling behavior during long-running operations - + * client will reconnect after the retry interval specified in the priming event. + */ + closeSSEStream(requestId: RequestId): void { + const streamId = this._requestToStreamMapping.get(requestId); + if (!streamId) return; + + const stream = this._streamMapping.get(streamId); + if (stream) { + stream.end(); + this._streamMapping.delete(streamId); + } + } + + /** + * Close the standalone GET SSE stream, triggering client reconnection. + * Use this to implement polling behavior for server-initiated notifications. + */ + closeStandaloneSSEStream(): void { + const stream = this._streamMapping.get(this._standaloneSseStreamId); + if (stream) { + stream.end(); + this._streamMapping.delete(this._standaloneSseStreamId); + } + } + + async send(message: JSONRPCMessage, options?: { relatedRequestId?: RequestId }): Promise { + let requestId = options?.relatedRequestId; + if (isJSONRPCResponse(message) || isJSONRPCError(message)) { + // If the message is a response, use the request ID from the message + requestId = message.id; + } + + // Check if this message should be sent on the standalone SSE stream (no request ID) + // Ignore notifications from tools (which have relatedRequestId set) + // Those will be sent via dedicated response SSE streams + if (requestId === undefined) { + // For standalone SSE streams, we can only send requests and notifications + if (isJSONRPCResponse(message) || isJSONRPCError(message)) { + throw new Error('Cannot send a response on a standalone SSE stream unless resuming a previous client request'); + } + + // Generate and store event ID if event store is provided + // Store even if stream is disconnected so events can be replayed on reconnect + let eventId: string | undefined; + if (this._eventStore) { + // Stores the event and gets the generated event ID + eventId = await this._eventStore.storeEvent(this._standaloneSseStreamId, message); + } + + const standaloneSse = this._streamMapping.get(this._standaloneSseStreamId); + if (standaloneSse === undefined) { + // Stream is disconnected - event is stored for replay, nothing more to do + return; + } + + // Send the message to the standalone SSE stream + this.writeSSEEvent(standaloneSse, message, eventId); + return; + } + + // Get the response for this request + const streamId = this._requestToStreamMapping.get(requestId); + const response = this._streamMapping.get(streamId!); + if (!streamId) { + throw new Error(`No connection established for request ID: ${String(requestId)}`); + } + + if (!this._enableJsonResponse) { + // For SSE responses, generate event ID if event store is provided + let eventId: string | undefined; + + if (this._eventStore) { + eventId = await this._eventStore.storeEvent(streamId, message); + } + if (response) { + // Write the event to the response stream + this.writeSSEEvent(response, message, eventId); + } + } + + if (isJSONRPCResponse(message) || isJSONRPCError(message)) { + this._requestResponseMap.set(requestId, message); + const relatedIds = Array.from(this._requestToStreamMapping.entries()) + .filter(([_, streamId]) => this._streamMapping.get(streamId) === response) + .map(([id]) => id); + + // Check if we have responses for all requests using this connection + const allResponsesReady = relatedIds.every(id => this._requestResponseMap.has(id)); + + if (allResponsesReady) { + if (!response) { + throw new Error(`No connection established for request ID: ${String(requestId)}`); + } + if (this._enableJsonResponse) { + // All responses ready, send as JSON + const headers: Record = { + 'Content-Type': 'application/json' + }; + if (this.sessionId !== undefined) { + headers['mcp-session-id'] = this.sessionId; + } + + const responses = relatedIds.map(id => this._requestResponseMap.get(id)!); + + response.writeHead(200, headers); + if (responses.length === 1) { + response.end(JSON.stringify(responses[0])); + } else { + response.end(JSON.stringify(responses)); + } + } else { + // End the SSE stream + response.end(); + } + // Clean up + for (const id of relatedIds) { + this._requestResponseMap.delete(id); + this._requestToStreamMapping.delete(id); + } + } + } + } +} diff --git a/packages/core/src/util/zod-compat.ts b/src/server/zod-compat.ts similarity index 96% rename from packages/core/src/util/zod-compat.ts rename to src/server/zod-compat.ts index 65daae0698..04ee5361fe 100644 --- a/packages/core/src/util/zod-compat.ts +++ b/src/server/zod-compat.ts @@ -4,8 +4,9 @@ // ---------------------------------------------------- import type * as z3 from 'zod/v3'; -import * as z3rt from 'zod/v3'; import type * as z4 from 'zod/v4/core'; + +import * as z3rt from 'zod/v3'; import * as z4mini from 'zod/v4-mini'; // --- Unified schema types --- @@ -34,6 +35,7 @@ export interface ZodV4Internal { value?: unknown; values?: unknown[]; shape?: Record | (() => Record); + description?: string; }; }; value?: unknown; @@ -218,12 +220,15 @@ export function getParseErrorMessage(error: unknown): string { /** * Gets the description from a schema, if available. * Works with both Zod v3 and v4. - * - * Both versions expose a `.description` getter that returns the description - * from their respective internal storage (v3: _def, v4: globalRegistry). */ export function getSchemaDescription(schema: AnySchema): string | undefined { - return (schema as { description?: string }).description; + if (isZ4Schema(schema)) { + const v4Schema = schema as unknown as ZodV4Internal; + return v4Schema._zod?.def?.description; + } + const v3Schema = schema as unknown as ZodV3Internal; + // v3 may have description on the schema itself or in _def + return (schema as { description?: string }).description ?? v3Schema._def?.description; } /** diff --git a/packages/core/src/util/zod-json-schema-compat.ts b/src/server/zod-json-schema-compat.ts similarity index 93% rename from packages/core/src/util/zod-json-schema-compat.ts rename to src/server/zod-json-schema-compat.ts index cbb8b15e97..cde66b1772 100644 --- a/packages/core/src/util/zod-json-schema-compat.ts +++ b/src/server/zod-json-schema-compat.ts @@ -6,11 +6,11 @@ import type * as z3 from 'zod/v3'; import type * as z4c from 'zod/v4/core'; + import * as z4mini from 'zod/v4-mini'; -import { zodToJsonSchema } from 'zod-to-json-schema'; -import type { AnyObjectSchema, AnySchema } from './zod-compat.js'; -import { getLiteralValue, getObjectShape, isZ4Schema, safeParse } from './zod-compat.js'; +import { AnySchema, AnyObjectSchema, getObjectShape, safeParse, isZ4Schema, getLiteralValue } from './zod-compat.js'; +import { zodToJsonSchema } from 'zod-to-json-schema'; type JsonSchema = Record; diff --git a/packages/core/src/shared/auth-utils.ts b/src/shared/auth-utils.ts similarity index 100% rename from packages/core/src/shared/auth-utils.ts rename to src/shared/auth-utils.ts diff --git a/packages/core/src/shared/auth.ts b/src/shared/auth.ts similarity index 100% rename from packages/core/src/shared/auth.ts rename to src/shared/auth.ts diff --git a/packages/core/src/shared/metadataUtils.ts b/src/shared/metadataUtils.ts similarity index 94% rename from packages/core/src/shared/metadataUtils.ts rename to src/shared/metadataUtils.ts index 6cede430b5..18f84a4c95 100644 --- a/packages/core/src/shared/metadataUtils.ts +++ b/src/shared/metadataUtils.ts @@ -1,4 +1,4 @@ -import type { BaseMetadata } from '../types/types.js'; +import { BaseMetadata } from '../types.js'; /** * Utilities for working with BaseMetadata objects. diff --git a/packages/core/src/shared/protocol.ts b/src/shared/protocol.ts similarity index 97% rename from packages/core/src/shared/protocol.ts rename to src/shared/protocol.ts index 9c65015d14..e195478f27 100644 --- a/packages/core/src/shared/protocol.ts +++ b/src/shared/protocol.ts @@ -1,59 +1,53 @@ -import type { CreateTaskOptions, QueuedMessage, TaskMessageQueue, TaskStore } from '../experimental/tasks/interfaces.js'; -import { isTerminal } from '../experimental/tasks/interfaces.js'; -import type { - AuthInfo, - CancelledNotification, +import { AnySchema, AnyObjectSchema, SchemaOutput, safeParse } from '../server/zod-compat.js'; +import { + CancelledNotificationSchema, ClientCapabilities, - GetTaskPayloadRequest, + CreateTaskResultSchema, + ErrorCode, GetTaskRequest, - GetTaskResult, - JSONRPCErrorResponse, + GetTaskRequestSchema, + GetTaskResultSchema, + GetTaskPayloadRequest, + GetTaskPayloadRequestSchema, + ListTasksRequestSchema, + ListTasksResultSchema, + CancelTaskRequestSchema, + CancelTaskResultSchema, + isJSONRPCError, + isJSONRPCRequest, + isJSONRPCResponse, + isJSONRPCNotification, + JSONRPCError, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, - JSONRPCResultResponse, - MessageExtraInfo, + McpError, Notification, + PingRequestSchema, Progress, ProgressNotification, - RelatedTaskMetadata, + ProgressNotificationSchema, + RELATED_TASK_META_KEY, Request, RequestId, - RequestInfo, - RequestMeta, Result, ServerCapabilities, - Task, + RequestMeta, + MessageExtraInfo, + RequestInfo, + GetTaskResult, TaskCreationParams, - TaskStatusNotification -} from '../types/types.js'; -import { - CancelledNotificationSchema, - CancelTaskRequestSchema, - CancelTaskResultSchema, - CreateTaskResultSchema, - ErrorCode, - GetTaskPayloadRequestSchema, - GetTaskRequestSchema, - GetTaskResultSchema, - isJSONRPCErrorResponse, - isJSONRPCNotification, - isJSONRPCRequest, - isJSONRPCResultResponse, - isTaskAugmentedRequestParams, - ListTasksRequestSchema, - ListTasksResultSchema, - McpError, - PingRequestSchema, - ProgressNotificationSchema, - RELATED_TASK_META_KEY, + RelatedTaskMetadata, + CancelledNotification, + Task, + TaskStatusNotification, TaskStatusNotificationSchema -} from '../types/types.js'; -import type { AnyObjectSchema, AnySchema, SchemaOutput } from '../util/zod-compat.js'; -import { safeParse } from '../util/zod-compat.js'; -import { getMethodLiteral, parseWithCompat } from '../util/zod-json-schema-compat.js'; -import type { ResponseMessage } from './responseMessage.js'; -import type { Transport, TransportSendOptions } from './transport.js'; +} from '../types.js'; +import { Transport, TransportSendOptions } from './transport.js'; +import { AuthInfo } from '../server/auth/types.js'; +import { isTerminal, TaskStore, TaskMessageQueue, QueuedMessage, CreateTaskOptions } from '../experimental/tasks/interfaces.js'; +import { getMethodLiteral, parseWithCompat } from '../server/zod-json-schema-compat.js'; +import { ResponseMessage } from './responseMessage.js'; /** * Callback for progress notifications. @@ -330,7 +324,7 @@ export abstract class Protocol = new Map(); private _requestHandlerAbortControllers: Map = new Map(); private _notificationHandlers: Map Promise> = new Map(); - private _responseHandlers: Map void> = new Map(); + private _responseHandlers: Map void> = new Map(); private _progressHandlers: Map = new Map(); private _timeoutInfo: Map = new Map(); private _pendingDebouncedNotifications = new Set(); @@ -341,7 +335,7 @@ export abstract class Protocol void> = new Map(); + private _requestResolvers: Map void> = new Map(); /** * Callback for when the connection is closed for any reason. @@ -414,18 +408,18 @@ export abstract class Protocol { - if (!notification.params.requestId) { - return; - } // Handle request cancellation const controller = this._requestHandlerAbortControllers.get(notification.params.requestId); controller?.abort(notification.params.reason); @@ -625,7 +616,7 @@ export abstract class Protocol { _onmessage?.(message, extra); - if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) { + if (isJSONRPCResponse(message) || isJSONRPCError(message)) { this._onresponse(message); } else if (isJSONRPCRequest(message)) { this._onrequest(message, extra); @@ -684,7 +675,7 @@ export abstract class Protocol = { @@ -800,7 +791,7 @@ export abstract class Protocol; if (result.task && typeof result.task === 'object') { const task = result.task as Record; @@ -903,7 +894,7 @@ export abstract class Protocol { + const responseResolver = (response: JSONRPCResponse | Error) => { const handler = this._responseHandlers.get(messageId); if (handler) { handler(response); diff --git a/packages/core/src/shared/responseMessage.ts b/src/shared/responseMessage.ts similarity index 96% rename from packages/core/src/shared/responseMessage.ts rename to src/shared/responseMessage.ts index 8a0dcc2c22..6fefcf1f6c 100644 --- a/packages/core/src/shared/responseMessage.ts +++ b/src/shared/responseMessage.ts @@ -1,4 +1,4 @@ -import type { McpError, Result, Task } from '../types/types.js'; +import { Result, Task, McpError } from '../types.js'; /** * Base message type diff --git a/packages/core/src/shared/stdio.ts b/src/shared/stdio.ts similarity index 89% rename from packages/core/src/shared/stdio.ts rename to src/shared/stdio.ts index 49c658b969..fe14612bda 100644 --- a/packages/core/src/shared/stdio.ts +++ b/src/shared/stdio.ts @@ -1,5 +1,4 @@ -import type { JSONRPCMessage } from '../types/types.js'; -import { JSONRPCMessageSchema } from '../types/types.js'; +import { JSONRPCMessage, JSONRPCMessageSchema } from '../types.js'; /** * Buffers a continuous stdio stream into discrete JSON-RPC messages. diff --git a/packages/core/src/shared/toolNameValidation.ts b/src/shared/toolNameValidation.ts similarity index 100% rename from packages/core/src/shared/toolNameValidation.ts rename to src/shared/toolNameValidation.ts diff --git a/packages/core/src/shared/transport.ts b/src/shared/transport.ts similarity index 95% rename from packages/core/src/shared/transport.ts rename to src/shared/transport.ts index 87608f124b..f9b21bed32 100644 --- a/packages/core/src/shared/transport.ts +++ b/src/shared/transport.ts @@ -1,4 +1,4 @@ -import type { JSONRPCMessage, MessageExtraInfo, RequestId } from '../types/types.js'; +import { JSONRPCMessage, MessageExtraInfo, RequestId } from '../types.js'; export type FetchLike = (url: string | URL, init?: RequestInit) => Promise; @@ -6,7 +6,7 @@ export type FetchLike = (url: string | URL, init?: RequestInit) => Promise for manipulation. * Handles Headers objects, arrays of tuples, and plain objects. */ -export function normalizeHeaders(headers: RequestInit['headers'] | undefined): Record { +export function normalizeHeaders(headers: HeadersInit | undefined): Record { if (!headers) return {}; if (headers instanceof Headers) { diff --git a/packages/core/src/shared/uriTemplate.ts b/src/shared/uriTemplate.ts similarity index 98% rename from packages/core/src/shared/uriTemplate.ts rename to src/shared/uriTemplate.ts index 631b65cb01..1dd57f56f6 100644 --- a/packages/core/src/shared/uriTemplate.ts +++ b/src/shared/uriTemplate.ts @@ -65,7 +65,7 @@ export class UriTemplate { const operator = this.getOperator(expr); const exploded = expr.includes('*'); const names = this.getNames(expr); - const name = names[0]!; + const name = names[0]; // Validate variable name length for (const name of names) { @@ -210,7 +210,7 @@ export class UriTemplate { if (part.operator === '?' || part.operator === '&') { for (let i = 0; i < part.names.length; i++) { - const name = part.names[i]!; + const name = part.names[i]; const prefix = i === 0 ? '\\' + part.operator : '&'; patterns.push({ pattern: prefix + this.escapeRegExp(name) + '=([^&]+)', @@ -271,8 +271,8 @@ export class UriTemplate { const result: Variables = {}; for (let i = 0; i < names.length; i++) { - const { name, exploded } = names[i]!; - const value = match[i + 1]!; + const { name, exploded } = names[i]; + const value = match[i + 1]; const cleanName = name.replace('*', ''); if (exploded && value.includes(',')) { diff --git a/src/spec.types.ts b/src/spec.types.ts new file mode 100644 index 0000000000..34b83d518b --- /dev/null +++ b/src/spec.types.ts @@ -0,0 +1,2285 @@ +/** + * This file is automatically generated from the Model Context Protocol specification. + * + * Source: https://github.com/modelcontextprotocol/modelcontextprotocol + * Pulled from: https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/draft/schema.ts + * Last updated from commit: 7dcdd69262bd488ddec071bf4eefedabf1742023 + * + * DO NOT EDIT THIS FILE MANUALLY. Changes will be overwritten by automated updates. + * To update this file, run: npm run fetch:spec-types + *//* JSON-RPC types */ + +/** + * Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent. + * + * @category JSON-RPC + */ +export type JSONRPCMessage = + | JSONRPCRequest + | JSONRPCNotification + | JSONRPCResponse + | JSONRPCError; + +/** @internal */ +export const LATEST_PROTOCOL_VERSION = "DRAFT-2025-v3"; +/** @internal */ +export const JSONRPC_VERSION = "2.0"; + +/** + * A progress token, used to associate progress notifications with the original request. + * + * @category Common Types + */ +export type ProgressToken = string | number; + +/** + * An opaque token used to represent a cursor for pagination. + * + * @category Common Types + */ +export type Cursor = string; + +/** + * Common params for any request. + * + * @internal + */ +export interface RequestParams { + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + /** + * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. + */ + progressToken?: ProgressToken; + [key: string]: unknown; + }; +} + +/** @internal */ +export interface Request { + method: string; + // Allow unofficial extensions of `Request.params` without impacting `RequestParams`. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + params?: { [key: string]: any }; +} + +/** @internal */ +export interface NotificationParams { + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** @internal */ +export interface Notification { + method: string; + // Allow unofficial extensions of `Notification.params` without impacting `NotificationParams`. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + params?: { [key: string]: any }; +} + +/** + * @category Common Types + */ +export interface Result { + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; + [key: string]: unknown; +} + +/** + * @category Common Types + */ +export interface Error { + /** + * The error type that occurred. + */ + code: number; + /** + * A short description of the error. The message SHOULD be limited to a concise single sentence. + */ + message: string; + /** + * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.). + */ + data?: unknown; +} + +/** + * A uniquely identifying ID for a request in JSON-RPC. + * + * @category Common Types + */ +export type RequestId = string | number; + +/** + * A request that expects a response. + * + * @category JSON-RPC + */ +export interface JSONRPCRequest extends Request { + jsonrpc: typeof JSONRPC_VERSION; + id: RequestId; +} + +/** + * A notification which does not expect a response. + * + * @category JSON-RPC + */ +export interface JSONRPCNotification extends Notification { + jsonrpc: typeof JSONRPC_VERSION; +} + +/** + * A successful (non-error) response to a request. + * + * @category JSON-RPC + */ +export interface JSONRPCResponse { + jsonrpc: typeof JSONRPC_VERSION; + id: RequestId; + result: Result; +} + +// Standard JSON-RPC error codes +export const PARSE_ERROR = -32700; +export const INVALID_REQUEST = -32600; +export const METHOD_NOT_FOUND = -32601; +export const INVALID_PARAMS = -32602; +export const INTERNAL_ERROR = -32603; + +// Implementation-specific JSON-RPC error codes [-32000, -32099] +/** @internal */ +export const URL_ELICITATION_REQUIRED = -32042; + +/** + * A response to a request that indicates an error occurred. + * + * @category JSON-RPC + */ +export interface JSONRPCError { + jsonrpc: typeof JSONRPC_VERSION; + id: RequestId; + error: Error; +} + +/** + * An error response that indicates that the server requires the client to provide additional information via an elicitation request. + * + * @internal + */ +export interface URLElicitationRequiredError + extends Omit { + error: Error & { + code: typeof URL_ELICITATION_REQUIRED; + data: { + elicitations: ElicitRequestURLParams[]; + [key: string]: unknown; + }; + }; +} + +/* Empty result */ +/** + * A response that indicates success but carries no data. + * + * @category Common Types + */ +export type EmptyResult = Result; + +/* Cancellation */ +/** + * Parameters for a `notifications/cancelled` notification. + * + * @category `notifications/cancelled` + */ +export interface CancelledNotificationParams extends NotificationParams { + /** + * The ID of the request to cancel. + * + * This MUST correspond to the ID of a request previously issued in the same direction. + */ + requestId: RequestId; + + /** + * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user. + */ + reason?: string; +} + +/** + * This notification can be sent by either side to indicate that it is cancelling a previously-issued request. + * + * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished. + * + * This notification indicates that the result will be unused, so any associated processing SHOULD cease. + * + * A client MUST NOT attempt to cancel its `initialize` request. + * + * @category `notifications/cancelled` + */ +export interface CancelledNotification extends JSONRPCNotification { + method: "notifications/cancelled"; + params: CancelledNotificationParams; +} + +/* Initialization */ +/** + * Parameters for an `initialize` request. + * + * @category `initialize` + */ +export interface InitializeRequestParams extends RequestParams { + /** + * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well. + */ + protocolVersion: string; + capabilities: ClientCapabilities; + clientInfo: Implementation; +} + +/** + * This request is sent from the client to the server when it first connects, asking it to begin initialization. + * + * @category `initialize` + */ +export interface InitializeRequest extends JSONRPCRequest { + method: "initialize"; + params: InitializeRequestParams; +} + +/** + * After receiving an initialize request from the client, the server sends this response. + * + * @category `initialize` + */ +export interface InitializeResult extends Result { + /** + * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect. + */ + protocolVersion: string; + capabilities: ServerCapabilities; + serverInfo: Implementation; + + /** + * Instructions describing how to use the server and its features. + * + * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt. + */ + instructions?: string; +} + +/** + * This notification is sent from the client to the server after initialization has finished. + * + * @category `notifications/initialized` + */ +export interface InitializedNotification extends JSONRPCNotification { + method: "notifications/initialized"; + params?: NotificationParams; +} + +/** + * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities. + * + * @category `initialize` + */ +export interface ClientCapabilities { + /** + * Experimental, non-standard capabilities that the client supports. + */ + experimental?: { [key: string]: object }; + /** + * Present if the client supports listing roots. + */ + roots?: { + /** + * Whether the client supports notifications for changes to the roots list. + */ + listChanged?: boolean; + }; + /** + * Present if the client supports sampling from an LLM. + */ + sampling?: { + /** + * Whether the client supports context inclusion via includeContext parameter. + * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it). + */ + context?: object; + /** + * Whether the client supports tool use via tools and toolChoice parameters. + */ + tools?: object; + }; + /** + * Present if the client supports elicitation from the server. + */ + elicitation?: { form?: object; url?: object }; +} + +/** + * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities. + * + * @category `initialize` + */ +export interface ServerCapabilities { + /** + * Experimental, non-standard capabilities that the server supports. + */ + experimental?: { [key: string]: object }; + /** + * Present if the server supports sending log messages to the client. + */ + logging?: object; + /** + * Present if the server supports argument autocompletion suggestions. + */ + completions?: object; + /** + * Present if the server offers any prompt templates. + */ + prompts?: { + /** + * Whether this server supports notifications for changes to the prompt list. + */ + listChanged?: boolean; + }; + /** + * Present if the server offers any resources to read. + */ + resources?: { + /** + * Whether this server supports subscribing to resource updates. + */ + subscribe?: boolean; + /** + * Whether this server supports notifications for changes to the resource list. + */ + listChanged?: boolean; + }; + /** + * Present if the server offers any tools to call. + */ + tools?: { + /** + * Whether this server supports notifications for changes to the tool list. + */ + listChanged?: boolean; + }; +} + +/** + * An optionally-sized icon that can be displayed in a user interface. + * + * @category Common Types + */ +export interface Icon { + /** + * A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a + * `data:` URI with Base64-encoded image data. + * + * Consumers SHOULD takes steps to ensure URLs serving icons are from the + * same domain as the client/server or a trusted domain. + * + * Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain + * executable JavaScript. + * + * @format uri + */ + src: string; + + /** + * Optional MIME type override if the source MIME type is missing or generic. + * For example: `"image/png"`, `"image/jpeg"`, or `"image/svg+xml"`. + */ + mimeType?: string; + + /** + * Optional array of strings that specify sizes at which the icon can be used. + * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG. + * + * If not provided, the client should assume that the icon can be used at any size. + */ + sizes?: string[]; + + /** + * Optional specifier for the theme this icon is designed for. `light` indicates + * the icon is designed to be used with a light background, and `dark` indicates + * the icon is designed to be used with a dark background. + * + * If not provided, the client should assume the icon can be used with any theme. + */ + theme?: "light" | "dark"; +} + +/** + * Base interface to add `icons` property. + * + * @internal + */ +export interface Icons { + /** + * Optional set of sized icons that the client can display in a user interface. + * + * Clients that support rendering icons MUST support at least the following MIME types: + * - `image/png` - PNG images (safe, universal compatibility) + * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility) + * + * Clients that support rendering icons SHOULD also support: + * - `image/svg+xml` - SVG images (scalable but requires security precautions) + * - `image/webp` - WebP images (modern, efficient format) + */ + icons?: Icon[]; +} + +/** + * Base interface for metadata with name (identifier) and title (display name) properties. + * + * @internal + */ +export interface BaseMetadata { + /** + * Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present). + */ + name: string; + + /** + * Intended for UI and end-user contexts — optimized to be human-readable and easily understood, + * even by those unfamiliar with domain-specific terminology. + * + * If not provided, the name should be used for display (except for Tool, + * where `annotations.title` should be given precedence over using `name`, + * if present). + */ + title?: string; +} + +/** + * Describes the MCP implementation. + * + * @category `initialize` + */ +export interface Implementation extends BaseMetadata, Icons { + version: string; + + /** + * An optional human-readable description of what this implementation does. + * + * This can be used by clients or servers to provide context about their purpose + * and capabilities. For example, a server might describe the types of resources + * or tools it provides, while a client might describe its intended use case. + */ + description?: string; + + /** + * An optional URL of the website for this implementation. + * + * @format uri + */ + websiteUrl?: string; +} + +/* Ping */ +/** + * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected. + * + * @category `ping` + */ +export interface PingRequest extends JSONRPCRequest { + method: "ping"; + params?: RequestParams; +} + +/* Progress notifications */ + +/** + * Parameters for a `notifications/progress` notification. + * + * @category `notifications/progress` + */ +export interface ProgressNotificationParams extends NotificationParams { + /** + * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding. + */ + progressToken: ProgressToken; + /** + * The progress thus far. This should increase every time progress is made, even if the total is unknown. + * + * @TJS-type number + */ + progress: number; + /** + * Total number of items to process (or total progress required), if known. + * + * @TJS-type number + */ + total?: number; + /** + * An optional message describing the current progress. + */ + message?: string; +} + +/** + * An out-of-band notification used to inform the receiver of a progress update for a long-running request. + * + * @category `notifications/progress` + */ +export interface ProgressNotification extends JSONRPCNotification { + method: "notifications/progress"; + params: ProgressNotificationParams; +} + +/* Pagination */ +/** + * Common parameters for paginated requests. + * + * @internal + */ +export interface PaginatedRequestParams extends RequestParams { + /** + * An opaque token representing the current pagination position. + * If provided, the server should return results starting after this cursor. + */ + cursor?: Cursor; +} + +/** @internal */ +export interface PaginatedRequest extends JSONRPCRequest { + params?: PaginatedRequestParams; +} + +/** @internal */ +export interface PaginatedResult extends Result { + /** + * An opaque token representing the pagination position after the last returned result. + * If present, there may be more results available. + */ + nextCursor?: Cursor; +} + +/* Resources */ +/** + * Sent from the client to request a list of resources the server has. + * + * @category `resources/list` + */ +export interface ListResourcesRequest extends PaginatedRequest { + method: "resources/list"; +} + +/** + * The server's response to a resources/list request from the client. + * + * @category `resources/list` + */ +export interface ListResourcesResult extends PaginatedResult { + resources: Resource[]; +} + +/** + * Sent from the client to request a list of resource templates the server has. + * + * @category `resources/templates/list` + */ +export interface ListResourceTemplatesRequest extends PaginatedRequest { + method: "resources/templates/list"; +} + +/** + * The server's response to a resources/templates/list request from the client. + * + * @category `resources/templates/list` + */ +export interface ListResourceTemplatesResult extends PaginatedResult { + resourceTemplates: ResourceTemplate[]; +} + +/** + * Common parameters when working with resources. + * + * @internal + */ +export interface ResourceRequestParams extends RequestParams { + /** + * The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it. + * + * @format uri + */ + uri: string; +} + +/** + * Parameters for a `resources/read` request. + * + * @category `resources/read` + */ +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface ReadResourceRequestParams extends ResourceRequestParams { } + +/** + * Sent from the client to the server, to read a specific resource URI. + * + * @category `resources/read` + */ +export interface ReadResourceRequest extends JSONRPCRequest { + method: "resources/read"; + params: ReadResourceRequestParams; +} + +/** + * The server's response to a resources/read request from the client. + * + * @category `resources/read` + */ +export interface ReadResourceResult extends Result { + contents: (TextResourceContents | BlobResourceContents)[]; +} + +/** + * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client. + * + * @category `notifications/resources/list_changed` + */ +export interface ResourceListChangedNotification extends JSONRPCNotification { + method: "notifications/resources/list_changed"; + params?: NotificationParams; +} + +/** + * Parameters for a `resources/subscribe` request. + * + * @category `resources/subscribe` + */ +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface SubscribeRequestParams extends ResourceRequestParams { } + +/** + * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes. + * + * @category `resources/subscribe` + */ +export interface SubscribeRequest extends JSONRPCRequest { + method: "resources/subscribe"; + params: SubscribeRequestParams; +} + +/** + * Parameters for a `resources/unsubscribe` request. + * + * @category `resources/unsubscribe` + */ +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface UnsubscribeRequestParams extends ResourceRequestParams { } + +/** + * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request. + * + * @category `resources/unsubscribe` + */ +export interface UnsubscribeRequest extends JSONRPCRequest { + method: "resources/unsubscribe"; + params: UnsubscribeRequestParams; +} + +/** + * Parameters for a `notifications/resources/updated` notification. + * + * @category `notifications/resources/updated` + */ +export interface ResourceUpdatedNotificationParams extends NotificationParams { + /** + * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to. + * + * @format uri + */ + uri: string; +} + +/** + * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request. + * + * @category `notifications/resources/updated` + */ +export interface ResourceUpdatedNotification extends JSONRPCNotification { + method: "notifications/resources/updated"; + params: ResourceUpdatedNotificationParams; +} + +/** + * A known resource that the server is capable of reading. + * + * @category `resources/list` + */ +export interface Resource extends BaseMetadata, Icons { + /** + * The URI of this resource. + * + * @format uri + */ + uri: string; + + /** + * A description of what this resource represents. + * + * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. + */ + description?: string; + + /** + * The MIME type of this resource, if known. + */ + mimeType?: string; + + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + + /** + * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known. + * + * This can be used by Hosts to display file sizes and estimate context window usage. + */ + size?: number; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * A template description for resources available on the server. + * + * @category `resources/templates/list` + */ +export interface ResourceTemplate extends BaseMetadata, Icons { + /** + * A URI template (according to RFC 6570) that can be used to construct resource URIs. + * + * @format uri-template + */ + uriTemplate: string; + + /** + * A description of what this template is for. + * + * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. + */ + description?: string; + + /** + * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type. + */ + mimeType?: string; + + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * The contents of a specific resource or sub-resource. + * + * @internal + */ +export interface ResourceContents { + /** + * The URI of this resource. + * + * @format uri + */ + uri: string; + /** + * The MIME type of this resource, if known. + */ + mimeType?: string; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * @category Content + */ +export interface TextResourceContents extends ResourceContents { + /** + * The text of the item. This must only be set if the item can actually be represented as text (not binary data). + */ + text: string; +} + +/** + * @category Content + */ +export interface BlobResourceContents extends ResourceContents { + /** + * A base64-encoded string representing the binary data of the item. + * + * @format byte + */ + blob: string; +} + +/* Prompts */ +/** + * Sent from the client to request a list of prompts and prompt templates the server has. + * + * @category `prompts/list` + */ +export interface ListPromptsRequest extends PaginatedRequest { + method: "prompts/list"; +} + +/** + * The server's response to a prompts/list request from the client. + * + * @category `prompts/list` + */ +export interface ListPromptsResult extends PaginatedResult { + prompts: Prompt[]; +} + +/** + * Parameters for a `prompts/get` request. + * + * @category `prompts/get` + */ +export interface GetPromptRequestParams extends RequestParams { + /** + * The name of the prompt or prompt template. + */ + name: string; + /** + * Arguments to use for templating the prompt. + */ + arguments?: { [key: string]: string }; +} + +/** + * Used by the client to get a prompt provided by the server. + * + * @category `prompts/get` + */ +export interface GetPromptRequest extends JSONRPCRequest { + method: "prompts/get"; + params: GetPromptRequestParams; +} + +/** + * The server's response to a prompts/get request from the client. + * + * @category `prompts/get` + */ +export interface GetPromptResult extends Result { + /** + * An optional description for the prompt. + */ + description?: string; + messages: PromptMessage[]; +} + +/** + * A prompt or prompt template that the server offers. + * + * @category `prompts/list` + */ +export interface Prompt extends BaseMetadata, Icons { + /** + * An optional description of what this prompt provides + */ + description?: string; + + /** + * A list of arguments to use for templating the prompt. + */ + arguments?: PromptArgument[]; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * Describes an argument that a prompt can accept. + * + * @category `prompts/list` + */ +export interface PromptArgument extends BaseMetadata { + /** + * A human-readable description of the argument. + */ + description?: string; + /** + * Whether this argument must be provided. + */ + required?: boolean; +} + +/** + * The sender or recipient of messages and data in a conversation. + * + * @category Common Types + */ +export type Role = "user" | "assistant"; + +/** + * Describes a message returned as part of a prompt. + * + * This is similar to `SamplingMessage`, but also supports the embedding of + * resources from the MCP server. + * + * @category `prompts/get` + */ +export interface PromptMessage { + role: Role; + content: ContentBlock; +} + +/** + * A resource that the server is capable of reading, included in a prompt or tool call result. + * + * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests. + * + * @category Content + */ +export interface ResourceLink extends Resource { + type: "resource_link"; +} + +/** + * The contents of a resource, embedded into a prompt or tool call result. + * + * It is up to the client how best to render embedded resources for the benefit + * of the LLM and/or the user. + * + * @category Content + */ +export interface EmbeddedResource { + type: "resource"; + resource: TextResourceContents | BlobResourceContents; + + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} +/** + * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client. + * + * @category `notifications/prompts/list_changed` + */ +export interface PromptListChangedNotification extends JSONRPCNotification { + method: "notifications/prompts/list_changed"; + params?: NotificationParams; +} + +/* Tools */ +/** + * Sent from the client to request a list of tools the server has. + * + * @category `tools/list` + */ +export interface ListToolsRequest extends PaginatedRequest { + method: "tools/list"; +} + +/** + * The server's response to a tools/list request from the client. + * + * @category `tools/list` + */ +export interface ListToolsResult extends PaginatedResult { + tools: Tool[]; +} + +/** + * The server's response to a tool call. + * + * @category `tools/call` + */ +export interface CallToolResult extends Result { + /** + * A list of content objects that represent the unstructured result of the tool call. + */ + content: ContentBlock[]; + + /** + * An optional JSON object that represents the structured result of the tool call. + */ + structuredContent?: { [key: string]: unknown }; + + /** + * Whether the tool call ended in an error. + * + * If not set, this is assumed to be false (the call was successful). + * + * Any errors that originate from the tool SHOULD be reported inside the result + * object, with `isError` set to true, _not_ as an MCP protocol-level error + * response. Otherwise, the LLM would not be able to see that an error occurred + * and self-correct. + * + * However, any errors in _finding_ the tool, an error indicating that the + * server does not support tool calls, or any other exceptional conditions, + * should be reported as an MCP error response. + */ + isError?: boolean; +} + +/** + * Parameters for a `tools/call` request. + * + * @category `tools/call` + */ +export interface CallToolRequestParams extends RequestParams { + /** + * The name of the tool. + */ + name: string; + /** + * Arguments to use for the tool call. + */ + arguments?: { [key: string]: unknown }; +} + +/** + * Used by the client to invoke a tool provided by the server. + * + * @category `tools/call` + */ +export interface CallToolRequest extends JSONRPCRequest { + method: "tools/call"; + params: CallToolRequestParams; +} + +/** + * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client. + * + * @category `notifications/tools/list_changed` + */ +export interface ToolListChangedNotification extends JSONRPCNotification { + method: "notifications/tools/list_changed"; + params?: NotificationParams; +} + +/** + * Security scheme indicating no authentication is required. + * + * @category `tools/list` + */ +export interface NoAuthSecurityScheme { + type: "noauth"; +} + +/** + * Security scheme indicating OAuth 2.0 authentication is required. + * + * @category `tools/list` + */ +export interface OAuth2SecurityScheme { + type: "oauth2"; + /** + * Optional list of OAuth 2.0 scopes required for this tool. + */ + scopes?: string[]; +} + +/** + * A security scheme that can be used to authenticate tool calls. + * + * @category `tools/list` + */ +export type SecurityScheme = NoAuthSecurityScheme | OAuth2SecurityScheme; + +/** + * Additional properties describing a Tool to clients. + * + * NOTE: all properties in ToolAnnotations are **hints**. + * They are not guaranteed to provide a faithful description of + * tool behavior (including descriptive properties like `title`). + * + * Clients should never make tool use decisions based on ToolAnnotations + * received from untrusted servers. + * + * @category `tools/list` + */ +export interface ToolAnnotations { + /** + * A human-readable title for the tool. + */ + title?: string; + + /** + * If true, the tool does not modify its environment. + * + * Default: false + */ + readOnlyHint?: boolean; + + /** + * If true, the tool may perform destructive updates to its environment. + * If false, the tool performs only additive updates. + * + * (This property is meaningful only when `readOnlyHint == false`) + * + * Default: true + */ + destructiveHint?: boolean; + + /** + * If true, calling the tool repeatedly with the same arguments + * will have no additional effect on its environment. + * + * (This property is meaningful only when `readOnlyHint == false`) + * + * Default: false + */ + idempotentHint?: boolean; + + /** + * If true, this tool may interact with an "open world" of external + * entities. If false, the tool's domain of interaction is closed. + * For example, the world of a web search tool is open, whereas that + * of a memory tool is not. + * + * Default: true + */ + openWorldHint?: boolean; +} + +/** + * Definition for a tool the client can call. + * + * @category `tools/list` + */ +export interface Tool extends BaseMetadata, Icons { + /** + * A human-readable description of the tool. + * + * This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model. + */ + description?: string; + + /** + * A JSON Schema object defining the expected parameters for the tool. + */ + inputSchema: { + type: "object"; + properties?: { [key: string]: object }; + required?: string[]; + }; + + /** + * An optional JSON Schema object defining the structure of the tool's output returned in + * the structuredContent field of a CallToolResult. + */ + outputSchema?: { + type: "object"; + properties?: { [key: string]: object }; + required?: string[]; + }; + + /** + * Optional additional tool information. + * + * Display name precedence order is: title, annotations.title, then name. + */ + annotations?: ToolAnnotations; + + /** + * Optional list of security schemes supported by this tool. + * If missing, the tool follows the server's default authentication policy. + * If present, lists the supported authentication schemes (e.g., "noauth", "oauth2"). + */ + securitySchemes?: SecurityScheme[]; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/* Logging */ + +/** + * Parameters for a `logging/setLevel` request. + * + * @category `logging/setLevel` + */ +export interface SetLevelRequestParams extends RequestParams { + /** + * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message. + */ + level: LoggingLevel; +} + +/** + * A request from the client to the server, to enable or adjust logging. + * + * @category `logging/setLevel` + */ +export interface SetLevelRequest extends JSONRPCRequest { + method: "logging/setLevel"; + params: SetLevelRequestParams; +} + +/** + * Parameters for a `notifications/message` notification. + * + * @category `notifications/message` + */ +export interface LoggingMessageNotificationParams extends NotificationParams { + /** + * The severity of this log message. + */ + level: LoggingLevel; + /** + * An optional name of the logger issuing this message. + */ + logger?: string; + /** + * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. + */ + data: unknown; +} + +/** + * JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. + * + * @category `notifications/message` + */ +export interface LoggingMessageNotification extends JSONRPCNotification { + method: "notifications/message"; + params: LoggingMessageNotificationParams; +} + +/** + * The severity of a log message. + * + * These map to syslog message severities, as specified in RFC-5424: + * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1 + * + * @category Common Types + */ +export type LoggingLevel = + | "debug" + | "info" + | "notice" + | "warning" + | "error" + | "critical" + | "alert" + | "emergency"; + +/* Sampling */ +/** + * Parameters for a `sampling/createMessage` request. + * + * @category `sampling/createMessage` + */ +export interface CreateMessageRequestParams extends RequestParams { + messages: SamplingMessage[]; + /** + * The server's preferences for which model to select. The client MAY ignore these preferences. + */ + modelPreferences?: ModelPreferences; + /** + * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt. + */ + systemPrompt?: string; + /** + * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. + * The client MAY ignore this request. + * + * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client + * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases. + */ + includeContext?: "none" | "thisServer" | "allServers"; + /** + * @TJS-type number + */ + temperature?: number; + /** + * The requested maximum number of tokens to sample (to prevent runaway completions). + * + * The client MAY choose to sample fewer tokens than the requested maximum. + */ + maxTokens: number; + stopSequences?: string[]; + /** + * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific. + */ + metadata?: object; + /** + * Tools that the model may use during generation. + * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. + */ + tools?: Tool[]; + /** + * Controls how the model uses tools. + * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. + * Default is `{ mode: "auto" }`. + */ + toolChoice?: ToolChoice; +} + +/** + * Controls tool selection behavior for sampling requests. + * + * @category `sampling/createMessage` + */ +export interface ToolChoice { + /** + * Controls the tool use ability of the model: + * - "auto": Model decides whether to use tools (default) + * - "required": Model MUST use at least one tool before completing + * - "none": Model MUST NOT use any tools + */ + mode?: "auto" | "required" | "none"; +} + +/** + * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it. + * + * @category `sampling/createMessage` + */ +export interface CreateMessageRequest extends JSONRPCRequest { + method: "sampling/createMessage"; + params: CreateMessageRequestParams; +} + +/** + * The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it. + * + * @category `sampling/createMessage` + */ +export interface CreateMessageResult extends Result, SamplingMessage { + /** + * The name of the model that generated the message. + */ + model: string; + + /** + * The reason why sampling stopped, if known. + * + * Standard values: + * - "endTurn": Natural end of the assistant's turn + * - "stopSequence": A stop sequence was encountered + * - "maxTokens": Maximum token limit was reached + * - "toolUse": The model wants to use one or more tools + * + * This field is an open string to allow for provider-specific stop reasons. + */ + stopReason?: "endTurn" | "stopSequence" | "maxTokens" | "toolUse" | string; +} + +/** + * Describes a message issued to or received from an LLM API. + * + * @category `sampling/createMessage` + */ +export interface SamplingMessage { + role: Role; + content: SamplingMessageContentBlock | SamplingMessageContentBlock[]; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} +export type SamplingMessageContentBlock = + | TextContent + | ImageContent + | AudioContent + | ToolUseContent + | ToolResultContent; + +/** + * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed + * + * @category Common Types + */ +export interface Annotations { + /** + * Describes who the intended audience of this object or data is. + * + * It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`). + */ + audience?: Role[]; + + /** + * Describes how important this data is for operating the server. + * + * A value of 1 means "most important," and indicates that the data is + * effectively required, while 0 means "least important," and indicates that + * the data is entirely optional. + * + * @TJS-type number + * @minimum 0 + * @maximum 1 + */ + priority?: number; + + /** + * The moment the resource was last modified, as an ISO 8601 formatted string. + * + * Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z"). + * + * Examples: last activity timestamp in an open file, timestamp when the resource + * was attached, etc. + */ + lastModified?: string; +} + +/** + * @category Content + */ +export type ContentBlock = + | TextContent + | ImageContent + | AudioContent + | ResourceLink + | EmbeddedResource; + +/** + * Text provided to or from an LLM. + * + * @category Content + */ +export interface TextContent { + type: "text"; + + /** + * The text content of the message. + */ + text: string; + + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * An image provided to or from an LLM. + * + * @category Content + */ +export interface ImageContent { + type: "image"; + + /** + * The base64-encoded image data. + * + * @format byte + */ + data: string; + + /** + * The MIME type of the image. Different providers may support different image types. + */ + mimeType: string; + + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * Audio provided to or from an LLM. + * + * @category Content + */ +export interface AudioContent { + type: "audio"; + + /** + * The base64-encoded audio data. + * + * @format byte + */ + data: string; + + /** + * The MIME type of the audio. Different providers may support different audio types. + */ + mimeType: string; + + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * A request from the assistant to call a tool. + * + * @category `sampling/createMessage` + */ +export interface ToolUseContent { + type: "tool_use"; + + /** + * A unique identifier for this tool use. + * + * This ID is used to match tool results to their corresponding tool uses. + */ + id: string; + + /** + * The name of the tool to call. + */ + name: string; + + /** + * The arguments to pass to the tool, conforming to the tool's input schema. + */ + input: { [key: string]: unknown }; + + /** + * Optional metadata about the tool use. Clients SHOULD preserve this field when + * including tool uses in subsequent sampling requests to enable caching optimizations. + * + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * The result of a tool use, provided by the user back to the assistant. + * + * @category `sampling/createMessage` + */ +export interface ToolResultContent { + type: "tool_result"; + + /** + * The ID of the tool use this result corresponds to. + * + * This MUST match the ID from a previous ToolUseContent. + */ + toolUseId: string; + + /** + * The unstructured result content of the tool use. + * + * This has the same format as CallToolResult.content and can include text, images, + * audio, resource links, and embedded resources. + */ + content: ContentBlock[]; + + /** + * An optional structured result object. + * + * If the tool defined an outputSchema, this SHOULD conform to that schema. + */ + structuredContent?: { [key: string]: unknown }; + + /** + * Whether the tool use resulted in an error. + * + * If true, the content typically describes the error that occurred. + * Default: false + */ + isError?: boolean; + + /** + * Optional metadata about the tool result. Clients SHOULD preserve this field when + * including tool results in subsequent sampling requests to enable caching optimizations. + * + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * The server's preferences for model selection, requested of the client during sampling. + * + * Because LLMs can vary along multiple dimensions, choosing the "best" model is + * rarely straightforward. Different models excel in different areas—some are + * faster but less capable, others are more capable but more expensive, and so + * on. This interface allows servers to express their priorities across multiple + * dimensions to help clients make an appropriate selection for their use case. + * + * These preferences are always advisory. The client MAY ignore them. It is also + * up to the client to decide how to interpret these preferences and how to + * balance them against other considerations. + * + * @category `sampling/createMessage` + */ +export interface ModelPreferences { + /** + * Optional hints to use for model selection. + * + * If multiple hints are specified, the client MUST evaluate them in order + * (such that the first match is taken). + * + * The client SHOULD prioritize these hints over the numeric priorities, but + * MAY still use the priorities to select from ambiguous matches. + */ + hints?: ModelHint[]; + + /** + * How much to prioritize cost when selecting a model. A value of 0 means cost + * is not important, while a value of 1 means cost is the most important + * factor. + * + * @TJS-type number + * @minimum 0 + * @maximum 1 + */ + costPriority?: number; + + /** + * How much to prioritize sampling speed (latency) when selecting a model. A + * value of 0 means speed is not important, while a value of 1 means speed is + * the most important factor. + * + * @TJS-type number + * @minimum 0 + * @maximum 1 + */ + speedPriority?: number; + + /** + * How much to prioritize intelligence and capabilities when selecting a + * model. A value of 0 means intelligence is not important, while a value of 1 + * means intelligence is the most important factor. + * + * @TJS-type number + * @minimum 0 + * @maximum 1 + */ + intelligencePriority?: number; +} + +/** + * Hints to use for model selection. + * + * Keys not declared here are currently left unspecified by the spec and are up + * to the client to interpret. + * + * @category `sampling/createMessage` + */ +export interface ModelHint { + /** + * A hint for a model name. + * + * The client SHOULD treat this as a substring of a model name; for example: + * - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022` + * - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc. + * - `claude` should match any Claude model + * + * The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example: + * - `gemini-1.5-flash` could match `claude-3-haiku-20240307` + */ + name?: string; +} + +/* Autocomplete */ +/** + * Parameters for a `completion/complete` request. + * + * @category `completion/complete` + */ +export interface CompleteRequestParams extends RequestParams { + ref: PromptReference | ResourceTemplateReference; + /** + * The argument's information + */ + argument: { + /** + * The name of the argument + */ + name: string; + /** + * The value of the argument to use for completion matching. + */ + value: string; + }; + + /** + * Additional, optional context for completions + */ + context?: { + /** + * Previously-resolved variables in a URI template or prompt. + */ + arguments?: { [key: string]: string }; + }; +} + +/** + * A request from the client to the server, to ask for completion options. + * + * @category `completion/complete` + */ +export interface CompleteRequest extends JSONRPCRequest { + method: "completion/complete"; + params: CompleteRequestParams; +} + +/** + * The server's response to a completion/complete request + * + * @category `completion/complete` + */ +export interface CompleteResult extends Result { + completion: { + /** + * An array of completion values. Must not exceed 100 items. + */ + values: string[]; + /** + * The total number of completion options available. This can exceed the number of values actually sent in the response. + */ + total?: number; + /** + * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown. + */ + hasMore?: boolean; + }; +} + +/** + * A reference to a resource or resource template definition. + * + * @category `completion/complete` + */ +export interface ResourceTemplateReference { + type: "ref/resource"; + /** + * The URI or URI template of the resource. + * + * @format uri-template + */ + uri: string; +} + +/** + * Identifies a prompt. + * + * @category `completion/complete` + */ +export interface PromptReference extends BaseMetadata { + type: "ref/prompt"; +} + +/* Roots */ +/** + * Sent from the server to request a list of root URIs from the client. Roots allow + * servers to ask for specific directories or files to operate on. A common example + * for roots is providing a set of repositories or directories a server should operate + * on. + * + * This request is typically used when the server needs to understand the file system + * structure or access specific locations that the client has permission to read from. + * + * @category `roots/list` + */ +export interface ListRootsRequest extends JSONRPCRequest { + method: "roots/list"; + params?: RequestParams; +} + +/** + * The client's response to a roots/list request from the server. + * This result contains an array of Root objects, each representing a root directory + * or file that the server can operate on. + * + * @category `roots/list` + */ +export interface ListRootsResult extends Result { + roots: Root[]; +} + +/** + * Represents a root directory or file that the server can operate on. + * + * @category `roots/list` + */ +export interface Root { + /** + * The URI identifying the root. This *must* start with file:// for now. + * This restriction may be relaxed in future versions of the protocol to allow + * other URI schemes. + * + * @format uri + */ + uri: string; + /** + * An optional name for the root. This can be used to provide a human-readable + * identifier for the root, which may be useful for display purposes or for + * referencing the root in other parts of the application. + */ + name?: string; + + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { [key: string]: unknown }; +} + +/** + * A notification from the client to the server, informing it that the list of roots has changed. + * This notification should be sent whenever the client adds, removes, or modifies any root. + * The server should then request an updated list of roots using the ListRootsRequest. + * + * @category `notifications/roots/list_changed` + */ +export interface RootsListChangedNotification extends JSONRPCNotification { + method: "notifications/roots/list_changed"; + params?: NotificationParams; +} + +/** + * The parameters for a request to elicit non-sensitive information from the user via a form in the client. + * + * @category `elicitation/create` + */ +export interface ElicitRequestFormParams extends RequestParams { + /** + * The elicitation mode. + */ + mode?: "form"; + + /** + * The message to present to the user describing what information is being requested. + */ + message: string; + + /** + * A restricted subset of JSON Schema. + * Only top-level properties are allowed, without nesting. + */ + requestedSchema: { + $schema?: string; + type: "object"; + properties: { + [key: string]: PrimitiveSchemaDefinition; + }; + required?: string[]; + }; +} + +/** + * The parameters for a request to elicit information from the user via a URL in the client. + * + * @category `elicitation/create` + */ +export interface ElicitRequestURLParams extends RequestParams { + /** + * The elicitation mode. + */ + mode: "url"; + + /** + * The message to present to the user explaining why the interaction is needed. + */ + message: string; + + /** + * The ID of the elicitation, which must be unique within the context of the server. + * The client MUST treat this ID as an opaque value. + */ + elicitationId: string; + + /** + * The URL that the user should navigate to. + * + * @format uri + */ + url: string; +} + +/** + * The parameters for a request to elicit additional information from the user via the client. + * + * @category `elicitation/create` + */ +export type ElicitRequestParams = + | ElicitRequestFormParams + | ElicitRequestURLParams; + +/** + * A request from the server to elicit additional information from the user via the client. + * + * @category `elicitation/create` + */ +export interface ElicitRequest extends JSONRPCRequest { + method: "elicitation/create"; + params: ElicitRequestParams; +} + +/** + * Restricted schema definitions that only allow primitive types + * without nested objects or arrays. + * + * @category `elicitation/create` + */ +export type PrimitiveSchemaDefinition = + | StringSchema + | NumberSchema + | BooleanSchema + | EnumSchema; + +/** + * @category `elicitation/create` + */ +export interface StringSchema { + type: "string"; + title?: string; + description?: string; + minLength?: number; + maxLength?: number; + format?: "email" | "uri" | "date" | "date-time"; + default?: string; +} + +/** + * @category `elicitation/create` + */ +export interface NumberSchema { + type: "number" | "integer"; + title?: string; + description?: string; + minimum?: number; + maximum?: number; + default?: number; +} + +/** + * @category `elicitation/create` + */ +export interface BooleanSchema { + type: "boolean"; + title?: string; + description?: string; + default?: boolean; +} + +/** + * Schema for single-selection enumeration without display titles for options. + * + * @category `elicitation/create` + */ +export interface UntitledSingleSelectEnumSchema { + type: "string"; + /** + * Optional title for the enum field. + */ + title?: string; + /** + * Optional description for the enum field. + */ + description?: string; + /** + * Array of enum values to choose from. + */ + enum: string[]; + /** + * Optional default value. + */ + default?: string; +} + +/** + * Schema for single-selection enumeration with display titles for each option. + * + * @category `elicitation/create` + */ +export interface TitledSingleSelectEnumSchema { + type: "string"; + /** + * Optional title for the enum field. + */ + title?: string; + /** + * Optional description for the enum field. + */ + description?: string; + /** + * Array of enum options with values and display labels. + */ + oneOf: Array<{ + /** + * The enum value. + */ + const: string; + /** + * Display label for this option. + */ + title: string; + }>; + /** + * Optional default value. + */ + default?: string; +} + +/** + * @category `elicitation/create` + */ +// Combined single selection enumeration +export type SingleSelectEnumSchema = + | UntitledSingleSelectEnumSchema + | TitledSingleSelectEnumSchema; + +/** + * Schema for multiple-selection enumeration without display titles for options. + * + * @category `elicitation/create` + */ +export interface UntitledMultiSelectEnumSchema { + type: "array"; + /** + * Optional title for the enum field. + */ + title?: string; + /** + * Optional description for the enum field. + */ + description?: string; + /** + * Minimum number of items to select. + */ + minItems?: number; + /** + * Maximum number of items to select. + */ + maxItems?: number; + /** + * Schema for the array items. + */ + items: { + type: "string"; + /** + * Array of enum values to choose from. + */ + enum: string[]; + }; + /** + * Optional default value. + */ + default?: string[]; +} + +/** + * Schema for multiple-selection enumeration with display titles for each option. + * + * @category `elicitation/create` + */ +export interface TitledMultiSelectEnumSchema { + type: "array"; + /** + * Optional title for the enum field. + */ + title?: string; + /** + * Optional description for the enum field. + */ + description?: string; + /** + * Minimum number of items to select. + */ + minItems?: number; + /** + * Maximum number of items to select. + */ + maxItems?: number; + /** + * Schema for array items with enum options and display labels. + */ + items: { + /** + * Array of enum options with values and display labels. + */ + anyOf: Array<{ + /** + * The constant enum value. + */ + const: string; + /** + * Display title for this option. + */ + title: string; + }>; + }; + /** + * Optional default value. + */ + default?: string[]; +} + +/** + * @category `elicitation/create` + */ +// Combined multiple selection enumeration +export type MultiSelectEnumSchema = + | UntitledMultiSelectEnumSchema + | TitledMultiSelectEnumSchema; + +/** + * Use TitledSingleSelectEnumSchema instead. + * This interface will be removed in a future version. + * + * @category `elicitation/create` + */ +export interface LegacyTitledEnumSchema { + type: "string"; + title?: string; + description?: string; + enum: string[]; + /** + * (Legacy) Display names for enum values. + * Non-standard according to JSON schema 2020-12. + */ + enumNames?: string[]; + default?: string; +} + +/** + * @category `elicitation/create` + */ +// Union type for all enum schemas +export type EnumSchema = + | SingleSelectEnumSchema + | MultiSelectEnumSchema + | LegacyTitledEnumSchema; + +/** + * The client's response to an elicitation request. + * + * @category `elicitation/create` + */ +export interface ElicitResult extends Result { + /** + * The user action in response to the elicitation. + * - "accept": User submitted the form/confirmed the action + * - "decline": User explicitly decline the action + * - "cancel": User dismissed without making an explicit choice + */ + action: "accept" | "decline" | "cancel"; + + /** + * The submitted form data, only present when action is "accept" and mode was "form". + * Contains values matching the requested schema. + * Omitted for out-of-band mode responses. + */ + content?: { [key: string]: string | number | boolean | string[] }; +} + +/** + * An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request. + * + * @category `notifications/elicitation/complete` + */ +export interface ElicitationCompleteNotification extends JSONRPCNotification { + method: "notifications/elicitation/complete"; + params: { + /** + * The ID of the elicitation that completed. + */ + elicitationId: string; + }; +} + +/* Client messages */ +/** @internal */ +export type ClientRequest = + | PingRequest + | InitializeRequest + | CompleteRequest + | SetLevelRequest + | GetPromptRequest + | ListPromptsRequest + | ListResourcesRequest + | ListResourceTemplatesRequest + | ReadResourceRequest + | SubscribeRequest + | UnsubscribeRequest + | CallToolRequest + | ListToolsRequest; + +/** @internal */ +export type ClientNotification = + | CancelledNotification + | ProgressNotification + | InitializedNotification + | RootsListChangedNotification; + +/** @internal */ +export type ClientResult = + | EmptyResult + | CreateMessageResult + | ListRootsResult + | ElicitResult; + +/* Server messages */ +/** @internal */ +export type ServerRequest = + | PingRequest + | CreateMessageRequest + | ListRootsRequest + | ElicitRequest; + +/** @internal */ +export type ServerNotification = + | CancelledNotification + | ProgressNotification + | LoggingMessageNotification + | ResourceUpdatedNotification + | ResourceListChangedNotification + | ToolListChangedNotification + | PromptListChangedNotification + | ElicitationCompleteNotification; + +/** @internal */ +export type ServerResult = + | EmptyResult + | InitializeResult + | CompleteResult + | GetPromptResult + | ListPromptsResult + | ListResourceTemplatesResult + | ListResourcesResult + | ReadResourceResult + | CallToolResult + | ListToolsResult; diff --git a/packages/core/src/types/types.ts b/src/types.ts similarity index 85% rename from packages/core/src/types/types.ts rename to src/types.ts index 35b04745d4..21c24adb27 100644 --- a/packages/core/src/types/types.ts +++ b/src/types.ts @@ -1,4 +1,5 @@ import * as z from 'zod/v4'; +import { AuthInfo } from './server/auth/types.js'; export const LATEST_PROTOCOL_VERSION = '2025-11-25'; export const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26'; @@ -9,43 +10,6 @@ export const RELATED_TASK_META_KEY = 'io.modelcontextprotocol/related-task'; /* JSON-RPC types */ export const JSONRPC_VERSION = '2.0'; -/** - * Information about a validated access token, provided to request handlers. - */ -export interface AuthInfo { - /** - * The access token. - */ - token: string; - - /** - * The client ID associated with this token. - */ - clientId: string; - - /** - * Scopes associated with this token. - */ - scopes: string[]; - - /** - * When the token expires (in seconds since epoch). - */ - expiresAt?: number; - - /** - * The RFC 8707 resource server identifier for which this token is valid. - * If set, this MUST match the MCP server's resource identifier (minus hash fragment). - */ - resource?: URL; - - /** - * Additional data associated with the token. - * This field should be used for any additional data that needs to be attached to the auth info. - */ - extra?: Record; -} - /** * Utility types */ @@ -82,15 +46,10 @@ export const TaskCreationParamsSchema = z.looseObject({ pollInterval: z.number().optional() }); -export const TaskMetadataSchema = z.object({ - ttl: z.number().optional() -}); - /** - * Metadata for associating messages with a task. - * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`. + * Task association metadata, used to signal which task a message originated from. */ -export const RelatedTaskMetadataSchema = z.object({ +export const RelatedTaskMetadataSchema = z.looseObject({ taskId: z.string() }); @@ -108,53 +67,42 @@ const RequestMetaSchema = z.looseObject({ /** * Common params for any request. */ -const BaseRequestParamsSchema = z.object({ +const BaseRequestParamsSchema = z.looseObject({ /** - * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + * If specified, the caller is requesting that the receiver create a task to represent the request. + * Task creation parameters are now at the top level instead of in _meta. */ - _meta: RequestMetaSchema.optional() -}); - -/** - * Common params for any task-augmented request. - */ -export const TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({ + task: TaskCreationParamsSchema.optional(), /** - * If specified, the caller is requesting task-augmented execution for this request. - * The request will return a CreateTaskResult immediately, and the actual result can be - * retrieved later via tasks/result. - * - * Task augmentation is subject to capability negotiation - receivers MUST declare support - * for task augmentation of specific request types in their capabilities. + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. */ - task: TaskMetadataSchema.optional() + _meta: RequestMetaSchema.optional() }); -/** - * Checks if a value is a valid TaskAugmentedRequestParams. - * @param value - The value to check. - * - * @returns True if the value is a valid TaskAugmentedRequestParams, false otherwise. - */ -export const isTaskAugmentedRequestParams = (value: unknown): value is TaskAugmentedRequestParams => - TaskAugmentedRequestParamsSchema.safeParse(value).success; - export const RequestSchema = z.object({ method: z.string(), - params: BaseRequestParamsSchema.loose().optional() + params: BaseRequestParamsSchema.optional() }); -const NotificationsParamsSchema = z.object({ +const NotificationsParamsSchema = z.looseObject({ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: RequestMetaSchema.optional() + _meta: z + .object({ + /** + * If specified, this notification is related to the provided task. + */ + [RELATED_TASK_META_KEY]: z.optional(RelatedTaskMetadataSchema) + }) + .passthrough() + .optional() }); export const NotificationSchema = z.object({ method: z.string(), - params: NotificationsParamsSchema.loose().optional() + params: NotificationsParamsSchema.optional() }); export const ResultSchema = z.looseObject({ @@ -162,7 +110,14 @@ export const ResultSchema = z.looseObject({ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: RequestMetaSchema.optional() + _meta: z + .looseObject({ + /** + * If specified, this result is related to the provided task. + */ + [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional() + }) + .optional() }); /** @@ -198,7 +153,7 @@ export const isJSONRPCNotification = (value: unknown): value is JSONRPCNotificat /** * A successful (non-error) response to a request. */ -export const JSONRPCResultResponseSchema = z +export const JSONRPCResponseSchema = z .object({ jsonrpc: z.literal(JSONRPC_VERSION), id: RequestIdSchema, @@ -206,21 +161,7 @@ export const JSONRPCResultResponseSchema = z }) .strict(); -/** - * Checks if a value is a valid JSONRPCResultResponse. - * @param value - The value to check. - * - * @returns True if the value is a valid JSONRPCResultResponse, false otherwise. - */ -export const isJSONRPCResultResponse = (value: unknown): value is JSONRPCResultResponse => - JSONRPCResultResponseSchema.safeParse(value).success; - -/** - * @deprecated Use {@link isJSONRPCResultResponse} instead. - * - * Please note that {@link JSONRPCResponse} is a union of {@link JSONRPCResultResponse} and {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCResultResponse}) - */ -export const isJSONRPCResponse = isJSONRPCResultResponse; +export const isJSONRPCResponse = (value: unknown): value is JSONRPCResponse => JSONRPCResponseSchema.safeParse(value).success; /** * Error codes defined by the JSON-RPC specification. @@ -244,10 +185,10 @@ export enum ErrorCode { /** * A response to a request that indicates an error occurred. */ -export const JSONRPCErrorResponseSchema = z +export const JSONRPCErrorSchema = z .object({ jsonrpc: z.literal(JSONRPC_VERSION), - id: RequestIdSchema.optional(), + id: RequestIdSchema, error: z.object({ /** * The error type that occurred. @@ -260,38 +201,14 @@ export const JSONRPCErrorResponseSchema = z /** * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.). */ - data: z.unknown().optional() + data: z.optional(z.unknown()) }) }) .strict(); -/** - * @deprecated Use {@link JSONRPCErrorResponseSchema} instead. - */ -export const JSONRPCErrorSchema = JSONRPCErrorResponseSchema; - -/** - * Checks if a value is a valid JSONRPCErrorResponse. - * @param value - The value to check. - * - * @returns True if the value is a valid JSONRPCErrorResponse, false otherwise. - */ -export const isJSONRPCErrorResponse = (value: unknown): value is JSONRPCErrorResponse => - JSONRPCErrorResponseSchema.safeParse(value).success; +export const isJSONRPCError = (value: unknown): value is JSONRPCError => JSONRPCErrorSchema.safeParse(value).success; -/** - * @deprecated Use {@link isJSONRPCErrorResponse} instead. - */ -export const isJSONRPCError = isJSONRPCErrorResponse; - -export const JSONRPCMessageSchema = z.union([ - JSONRPCRequestSchema, - JSONRPCNotificationSchema, - JSONRPCResultResponseSchema, - JSONRPCErrorResponseSchema -]); - -export const JSONRPCResponseSchema = z.union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]); +export const JSONRPCMessageSchema = z.union([JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, JSONRPCErrorSchema]); /* Empty result */ /** @@ -305,7 +222,7 @@ export const CancelledNotificationParamsSchema = NotificationsParamsSchema.exten * * This MUST correspond to the ID of a request previously issued in the same direction. */ - requestId: RequestIdSchema.optional(), + requestId: RequestIdSchema, /** * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user. */ @@ -345,15 +262,7 @@ export const IconSchema = z.object({ * * If not provided, the client should assume that the icon can be used at any size. */ - sizes: z.array(z.string()).optional(), - /** - * Optional specifier for the theme this icon is designed for. `light` indicates - * the icon is designed to be used with a light background, and `dark` indicates - * the icon is designed to be used with a dark background. - * - * If not provided, the client should assume the icon can be used with any theme. - */ - theme: z.enum(['light', 'dark']).optional() + sizes: z.array(z.string()).optional() }); /** @@ -403,16 +312,7 @@ export const ImplementationSchema = BaseMetadataSchema.extend({ /** * An optional URL of the website for this implementation. */ - websiteUrl: z.string().optional(), - - /** - * An optional human-readable description of what this implementation does. - * - * This can be used by clients or servers to provide context about their purpose - * and capabilities. For example, a server might describe the types of resources - * or tools it provides, while a client might describe its intended use case. - */ - description: z.string().optional() + websiteUrl: z.string().optional() }); const FormElicitationCapabilitySchema = z.intersection( @@ -443,68 +343,82 @@ const ElicitationCapabilitySchema = z.preprocess( /** * Task capabilities for clients, indicating which request types support task creation. */ -export const ClientTasksCapabilitySchema = z.looseObject({ - /** - * Present if the client supports listing tasks. - */ - list: AssertObjectSchema.optional(), - /** - * Present if the client supports cancelling tasks. - */ - cancel: AssertObjectSchema.optional(), - /** - * Capabilities for task creation on specific request types. - */ - requests: z - .looseObject({ - /** - * Task support for sampling requests. - */ - sampling: z - .looseObject({ - createMessage: AssertObjectSchema.optional() - }) - .optional(), - /** - * Task support for elicitation requests. - */ - elicitation: z - .looseObject({ - create: AssertObjectSchema.optional() +export const ClientTasksCapabilitySchema = z + .object({ + /** + * Present if the client supports listing tasks. + */ + list: z.optional(z.object({}).passthrough()), + /** + * Present if the client supports cancelling tasks. + */ + cancel: z.optional(z.object({}).passthrough()), + /** + * Capabilities for task creation on specific request types. + */ + requests: z.optional( + z + .object({ + /** + * Task support for sampling requests. + */ + sampling: z.optional( + z + .object({ + createMessage: z.optional(z.object({}).passthrough()) + }) + .passthrough() + ), + /** + * Task support for elicitation requests. + */ + elicitation: z.optional( + z + .object({ + create: z.optional(z.object({}).passthrough()) + }) + .passthrough() + ) }) - .optional() - }) - .optional() -}); + .passthrough() + ) + }) + .passthrough(); /** * Task capabilities for servers, indicating which request types support task creation. */ -export const ServerTasksCapabilitySchema = z.looseObject({ - /** - * Present if the server supports listing tasks. - */ - list: AssertObjectSchema.optional(), - /** - * Present if the server supports cancelling tasks. - */ - cancel: AssertObjectSchema.optional(), - /** - * Capabilities for task creation on specific request types. - */ - requests: z - .looseObject({ - /** - * Task support for tool requests. - */ - tools: z - .looseObject({ - call: AssertObjectSchema.optional() +export const ServerTasksCapabilitySchema = z + .object({ + /** + * Present if the server supports listing tasks. + */ + list: z.optional(z.object({}).passthrough()), + /** + * Present if the server supports cancelling tasks. + */ + cancel: z.optional(z.object({}).passthrough()), + /** + * Capabilities for task creation on specific request types. + */ + requests: z.optional( + z + .object({ + /** + * Task support for tool requests. + */ + tools: z.optional( + z + .object({ + call: z.optional(z.object({}).passthrough()) + }) + .passthrough() + ) }) - .optional() - }) - .optional() -}); + .passthrough() + ) + }) + .passthrough(); /** * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities. @@ -548,7 +462,7 @@ export const ClientCapabilitiesSchema = z.object({ /** * Present if the client supports task creation. */ - tasks: ClientTasksCapabilitySchema.optional() + tasks: z.optional(ClientTasksCapabilitySchema) }); export const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({ @@ -572,62 +486,64 @@ export const isInitializeRequest = (value: unknown): value is InitializeRequest /** * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities. */ -export const ServerCapabilitiesSchema = z.object({ - /** - * Experimental, non-standard capabilities that the server supports. - */ - experimental: z.record(z.string(), AssertObjectSchema).optional(), - /** - * Present if the server supports sending log messages to the client. - */ - logging: AssertObjectSchema.optional(), - /** - * Present if the server supports sending completions to the client. - */ - completions: AssertObjectSchema.optional(), - /** - * Present if the server offers any prompt templates. - */ - prompts: z - .object({ - /** - * Whether this server supports issuing notifications for changes to the prompt list. - */ - listChanged: z.boolean().optional() - }) - .optional(), - /** - * Present if the server offers any resources to read. - */ - resources: z - .object({ - /** - * Whether this server supports clients subscribing to resource updates. - */ - subscribe: z.boolean().optional(), - - /** - * Whether this server supports issuing notifications for changes to the resource list. - */ - listChanged: z.boolean().optional() - }) - .optional(), - /** - * Present if the server offers any tools to call. - */ - tools: z - .object({ - /** - * Whether this server supports issuing notifications for changes to the tool list. - */ - listChanged: z.boolean().optional() - }) - .optional(), - /** - * Present if the server supports task creation. - */ - tasks: ServerTasksCapabilitySchema.optional() -}); +export const ServerCapabilitiesSchema = z + .object({ + /** + * Experimental, non-standard capabilities that the server supports. + */ + experimental: z.record(z.string(), AssertObjectSchema).optional(), + /** + * Present if the server supports sending log messages to the client. + */ + logging: AssertObjectSchema.optional(), + /** + * Present if the server supports sending completions to the client. + */ + completions: AssertObjectSchema.optional(), + /** + * Present if the server offers any prompt templates. + */ + prompts: z.optional( + z.object({ + /** + * Whether this server supports issuing notifications for changes to the prompt list. + */ + listChanged: z.optional(z.boolean()) + }) + ), + /** + * Present if the server offers any resources to read. + */ + resources: z + .object({ + /** + * Whether this server supports clients subscribing to resource updates. + */ + subscribe: z.boolean().optional(), + + /** + * Whether this server supports issuing notifications for changes to the resource list. + */ + listChanged: z.boolean().optional() + }) + .optional(), + /** + * Present if the server offers any tools to call. + */ + tools: z + .object({ + /** + * Whether this server supports issuing notifications for changes to the tool list. + */ + listChanged: z.boolean().optional() + }) + .optional(), + /** + * Present if the server supports task creation. + */ + tasks: z.optional(ServerTasksCapabilitySchema) + }) + .passthrough(); /** * After receiving an initialize request from the client, the server sends this response. @@ -651,8 +567,7 @@ export const InitializeResultSchema = ResultSchema.extend({ * This notification is sent from the client to the server after initialization has finished. */ export const InitializedNotificationSchema = NotificationSchema.extend({ - method: z.literal('notifications/initialized'), - params: NotificationsParamsSchema.optional() + method: z.literal('notifications/initialized') }); export const isInitializedNotification = (value: unknown): value is InitializedNotification => @@ -663,8 +578,7 @@ export const isInitializedNotification = (value: unknown): value is InitializedN * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected. */ export const PingRequestSchema = RequestSchema.extend({ - method: z.literal('ping'), - params: BaseRequestParamsSchema.optional() + method: z.literal('ping') }); /* Progress notifications */ @@ -719,21 +633,16 @@ export const PaginatedResultSchema = ResultSchema.extend({ * An opaque token representing the pagination position after the last returned result. * If present, there may be more results available. */ - nextCursor: CursorSchema.optional() + nextCursor: z.optional(CursorSchema) }); -/** - * The status of a task. - * */ -export const TaskStatusSchema = z.enum(['working', 'input_required', 'completed', 'failed', 'cancelled']); - /* Tasks */ /** * A pollable state object associated with a request. */ export const TaskSchema = z.object({ taskId: z.string(), - status: TaskStatusSchema, + status: z.enum(['working', 'input_required', 'completed', 'failed', 'cancelled']), /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. @@ -799,14 +708,6 @@ export const GetTaskPayloadRequestSchema = RequestSchema.extend({ }) }); -/** - * The response to a tasks/result request. - * The structure matches the result type of the original request. - * For example, a tools/call task would return the CallToolResult structure. - * - */ -export const GetTaskPayloadResultSchema = ResultSchema.loose(); - /** * A request to list tasks. */ @@ -1045,8 +946,7 @@ export const ReadResourceResultSchema = ResultSchema.extend({ * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client. */ export const ResourceListChangedNotificationSchema = NotificationSchema.extend({ - method: z.literal('notifications/resources/list_changed'), - params: NotificationsParamsSchema.optional() + method: z.literal('notifications/resources/list_changed') }); export const SubscribeRequestParamsSchema = ResourceRequestParamsSchema; @@ -1238,29 +1138,31 @@ export const AudioContentSchema = z.object({ * A tool call request from an assistant (LLM). * Represents the assistant's request to use a tool. */ -export const ToolUseContentSchema = z.object({ - type: z.literal('tool_use'), - /** - * The name of the tool to invoke. - * Must match a tool name from the request's tools array. - */ - name: z.string(), - /** - * Unique identifier for this tool call. - * Used to correlate with ToolResultContent in subsequent messages. - */ - id: z.string(), - /** - * Arguments to pass to the tool. - * Must conform to the tool's inputSchema. - */ - input: z.record(z.string(), z.unknown()), - /** - * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) - * for notes on _meta usage. - */ - _meta: z.record(z.string(), z.unknown()).optional() -}); +export const ToolUseContentSchema = z + .object({ + type: z.literal('tool_use'), + /** + * The name of the tool to invoke. + * Must match a tool name from the request's tools array. + */ + name: z.string(), + /** + * Unique identifier for this tool call. + * Used to correlate with ToolResultContent in subsequent messages. + */ + id: z.string(), + /** + * Arguments to pass to the tool. + * Must conform to the tool's inputSchema. + */ + input: z.object({}).passthrough(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.optional(z.object({}).passthrough()) + }) + .passthrough(); /** * The contents of a resource, embedded into a prompt or tool call result. @@ -1314,7 +1216,7 @@ export const GetPromptResultSchema = ResultSchema.extend({ /** * An optional description for the prompt. */ - description: z.string().optional(), + description: z.optional(z.string()), messages: z.array(PromptMessageSchema) }); @@ -1322,11 +1224,38 @@ export const GetPromptResultSchema = ResultSchema.extend({ * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client. */ export const PromptListChangedNotificationSchema = NotificationSchema.extend({ - method: z.literal('notifications/prompts/list_changed'), - params: NotificationsParamsSchema.optional() + method: z.literal('notifications/prompts/list_changed') }); /* Tools */ +/** + * Security scheme indicating no authentication is required. + */ +export const NoAuthSecuritySchemeSchema = z.object({ + type: z.literal('noauth') +}); + +/** + * Security scheme indicating OAuth 2.0 authentication is required. + */ +export const OAuth2SecuritySchemeSchema = z.object({ + type: z.literal('oauth2'), + /** + * Optional list of OAuth 2.0 scopes required for this tool. + */ + scopes: z + .array(z.string().min(1)) + .refine((arr) => new Set(arr).size === arr.length, { + message: 'Scopes must be unique' + }) + .optional() +}); + +/** + * A security scheme that can be used to authenticate tool calls. + */ +export const SecuritySchemeSchema = z.union([NoAuthSecuritySchemeSchema, OAuth2SecuritySchemeSchema]); + /** * Additional properties describing a Tool to clients. * @@ -1433,11 +1362,18 @@ export const ToolSchema = z.object({ /** * Optional additional tool information. */ - annotations: ToolAnnotationsSchema.optional(), + annotations: z.optional(ToolAnnotationsSchema), /** * Execution-related properties for this tool. */ - execution: ToolExecutionSchema.optional(), + execution: z.optional(ToolExecutionSchema), + + /** + * Optional list of security schemes supported by this tool. + * If missing, the tool follows the server's default authentication policy. + * If present, lists the supported authentication schemes (e.g., "noauth", "oauth2"). + */ + securitySchemes: z.array(SecuritySchemeSchema).optional(), /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) @@ -1493,7 +1429,7 @@ export const CallToolResultSchema = ResultSchema.extend({ * server does not support tool calls, or any other exceptional conditions, * should be reported as an MCP error response. */ - isError: z.boolean().optional() + isError: z.optional(z.boolean()) }); /** @@ -1508,7 +1444,7 @@ export const CompatibilityCallToolResultSchema = CallToolResultSchema.or( /** * Parameters for a `tools/call` request. */ -export const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ +export const CallToolRequestParamsSchema = BaseRequestParamsSchema.extend({ /** * The name of the tool to call. */ @@ -1516,7 +1452,7 @@ export const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.exte /** * Arguments to pass to the tool. */ - arguments: z.record(z.string(), z.unknown()).optional() + arguments: z.optional(z.record(z.string(), z.unknown())) }); /** @@ -1531,8 +1467,7 @@ export const CallToolRequestSchema = RequestSchema.extend({ * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client. */ export const ToolListChangedNotificationSchema = NotificationSchema.extend({ - method: z.literal('notifications/tools/list_changed'), - params: NotificationsParamsSchema.optional() + method: z.literal('notifications/tools/list_changed') }); /** @@ -1681,19 +1616,19 @@ export const ModelPreferencesSchema = z.object({ /** * Optional hints to use for model selection. */ - hints: z.array(ModelHintSchema).optional(), + hints: z.optional(z.array(ModelHintSchema)), /** * How much to prioritize cost when selecting a model. */ - costPriority: z.number().min(0).max(1).optional(), + costPriority: z.optional(z.number().min(0).max(1)), /** * How much to prioritize sampling speed (latency) when selecting a model. */ - speedPriority: z.number().min(0).max(1).optional(), + speedPriority: z.optional(z.number().min(0).max(1)), /** * How much to prioritize intelligence and capabilities when selecting a model. */ - intelligencePriority: z.number().min(0).max(1).optional() + intelligencePriority: z.optional(z.number().min(0).max(1)) }); /** @@ -1706,26 +1641,28 @@ export const ToolChoiceSchema = z.object({ * - "required": Model MUST use at least one tool before completing * - "none": Model MUST NOT use any tools */ - mode: z.enum(['auto', 'required', 'none']).optional() + mode: z.optional(z.enum(['auto', 'required', 'none'])) }); /** * The result of a tool execution, provided by the user (server). * Represents the outcome of invoking a tool requested via ToolUseContent. */ -export const ToolResultContentSchema = z.object({ - type: z.literal('tool_result'), - toolUseId: z.string().describe('The unique identifier for the corresponding tool call.'), - content: z.array(ContentBlockSchema).default([]), - structuredContent: z.object({}).loose().optional(), - isError: z.boolean().optional(), +export const ToolResultContentSchema = z + .object({ + type: z.literal('tool_result'), + toolUseId: z.string().describe('The unique identifier for the corresponding tool call.'), + content: z.array(ContentBlockSchema).default([]), + structuredContent: z.object({}).passthrough().optional(), + isError: z.optional(z.boolean()), - /** - * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) - * for notes on _meta usage. - */ - _meta: z.record(z.string(), z.unknown()).optional() -}); + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.optional(z.object({}).passthrough()) + }) + .passthrough(); /** * Basic content types for sampling responses (without tool use). @@ -1748,20 +1685,22 @@ export const SamplingMessageContentBlockSchema = z.discriminatedUnion('type', [ /** * Describes a message issued to or received from an LLM API. */ -export const SamplingMessageSchema = z.object({ - role: RoleSchema, - content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]), - /** - * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) - * for notes on _meta usage. - */ - _meta: z.record(z.string(), z.unknown()).optional() -}); +export const SamplingMessageSchema = z + .object({ + role: RoleSchema, + content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.optional(z.object({}).passthrough()) + }) + .passthrough(); /** * Parameters for a `sampling/createMessage` request. */ -export const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ +export const CreateMessageRequestParamsSchema = BaseRequestParamsSchema.extend({ messages: z.array(SamplingMessageSchema), /** * The server's preferences for which model to select. The client MAY modify or omit this request. @@ -1795,13 +1734,13 @@ export const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema * Tools that the model may use during generation. * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. */ - tools: z.array(ToolSchema).optional(), + tools: z.optional(z.array(ToolSchema)), /** * Controls how the model uses tools. * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. * Default is `{ mode: "auto" }`. */ - toolChoice: ToolChoiceSchema.optional() + toolChoice: z.optional(ToolChoiceSchema) }); /** * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it. @@ -2000,7 +1939,7 @@ export const PrimitiveSchemaDefinitionSchema = z.union([EnumSchemaSchema, Boolea /** * Parameters for an `elicitation/create` request for form-based elicitation. */ -export const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({ +export const ElicitRequestFormParamsSchema = BaseRequestParamsSchema.extend({ /** * The elicitation mode. * @@ -2025,7 +1964,7 @@ export const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.ex /** * Parameters for an `elicitation/create` request for URL-based elicitation. */ -export const ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({ +export const ElicitRequestURLParamsSchema = BaseRequestParamsSchema.extend({ /** * The elicitation mode. */ @@ -2227,8 +2166,7 @@ export const RootSchema = z.object({ * Sent from the server to request a list of root URIs from the client. */ export const ListRootsRequestSchema = RequestSchema.extend({ - method: z.literal('roots/list'), - params: BaseRequestParamsSchema.optional() + method: z.literal('roots/list') }); /** @@ -2242,8 +2180,7 @@ export const ListRootsResultSchema = ResultSchema.extend({ * A notification from the client to the server, informing it that the list of roots has changed. */ export const RootsListChangedNotificationSchema = NotificationSchema.extend({ - method: z.literal('notifications/roots/list_changed'), - params: NotificationsParamsSchema.optional() + method: z.literal('notifications/roots/list_changed') }); /* Client messages */ @@ -2263,8 +2200,7 @@ export const ClientRequestSchema = z.union([ ListToolsRequestSchema, GetTaskRequestSchema, GetTaskPayloadRequestSchema, - ListTasksRequestSchema, - CancelTaskRequestSchema + ListTasksRequestSchema ]); export const ClientNotificationSchema = z.union([ @@ -2294,8 +2230,7 @@ export const ServerRequestSchema = z.union([ ListRootsRequestSchema, GetTaskRequestSchema, GetTaskPayloadRequestSchema, - ListTasksRequestSchema, - CancelTaskRequestSchema + ListTasksRequestSchema ]); export const ServerNotificationSchema = z.union([ @@ -2430,7 +2365,6 @@ export interface MessageExtraInfo { export type ProgressToken = Infer; export type Cursor = Infer; export type Request = Infer; -export type TaskAugmentedRequestParams = Infer; export type RequestMeta = Infer; export type Notification = Infer; export type Result = Infer; @@ -2438,15 +2372,7 @@ export type RequestId = Infer; export type JSONRPCRequest = Infer; export type JSONRPCNotification = Infer; export type JSONRPCResponse = Infer; -export type JSONRPCErrorResponse = Infer; -/** - * @deprecated Use {@link JSONRPCErrorResponse} instead. - * - * Please note that spec types have renamed {@link JSONRPCError} to {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCError}) and future versions will remove {@link JSONRPCError}. - */ -export type JSONRPCError = JSONRPCErrorResponse; -export type JSONRPCResultResponse = Infer; - +export type JSONRPCError = Infer; export type JSONRPCMessage = Infer; export type RequestParams = Infer; export type NotificationParams = Infer; @@ -2484,9 +2410,7 @@ export type ProgressNotification = Infer; /* Tasks */ export type Task = Infer; -export type TaskStatus = Infer; export type TaskCreationParams = Infer; -export type TaskMetadata = Infer; export type RelatedTaskMetadata = Infer; export type CreateTaskResult = Infer; export type TaskStatusNotificationParams = Infer; @@ -2498,7 +2422,6 @@ export type ListTasksRequest = Infer; export type ListTasksResult = Infer; export type CancelTaskRequest = Infer; export type CancelTaskResult = Infer; -export type GetTaskPayloadResult = Infer; /* Pagination */ export type PaginatedRequestParams = Infer; @@ -2510,8 +2433,7 @@ export type ResourceContents = Infer; export type TextResourceContents = Infer; export type BlobResourceContents = Infer; export type Resource = Infer; -// TODO: Overlaps with exported `ResourceTemplate` class from `server`. -export type ResourceTemplateType = Infer; +export type ResourceTemplate = Infer; export type ListResourcesRequest = Infer; export type ListResourcesResult = Infer; export type ListResourceTemplatesRequest = Infer; @@ -2548,6 +2470,9 @@ export type GetPromptResult = Infer; export type PromptListChangedNotification = Infer; /* Tools */ +export type NoAuthSecurityScheme = Infer; +export type OAuth2SecurityScheme = Infer; +export type SecurityScheme = Infer; export type ToolAnnotations = Infer; export type ToolExecution = Infer; export type Tool = Infer; diff --git a/packages/core/src/validation/ajv-provider.ts b/src/validation/ajv-provider.ts similarity index 96% rename from packages/core/src/validation/ajv-provider.ts rename to src/validation/ajv-provider.ts index 4a9d572142..115a98521b 100644 --- a/packages/core/src/validation/ajv-provider.ts +++ b/src/validation/ajv-provider.ts @@ -4,8 +4,7 @@ import { Ajv } from 'ajv'; import _addFormats from 'ajv-formats'; - -import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './types.js'; +import type { JsonSchemaType, JsonSchemaValidator, JsonSchemaValidatorResult, jsonSchemaValidator } from './types.js'; function createDefaultAjvInstance(): Ajv { const ajv = new Ajv({ diff --git a/packages/core/src/validation/cfworker-provider.ts b/src/validation/cfworker-provider.ts similarity index 95% rename from packages/core/src/validation/cfworker-provider.ts rename to src/validation/cfworker-provider.ts index 460408d62e..7e6329d9d5 100644 --- a/packages/core/src/validation/cfworker-provider.ts +++ b/src/validation/cfworker-provider.ts @@ -7,8 +7,7 @@ */ import { Validator } from '@cfworker/json-schema'; - -import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './types.js'; +import type { JsonSchemaType, JsonSchemaValidator, JsonSchemaValidatorResult, jsonSchemaValidator } from './types.js'; /** * JSON Schema draft version supported by @cfworker/json-schema diff --git a/packages/core/src/index.ts b/src/validation/index.ts similarity index 54% rename from packages/core/src/index.ts rename to src/validation/index.ts index f4eaeabfca..a6df86d6a2 100644 --- a/packages/core/src/index.ts +++ b/src/validation/index.ts @@ -1,22 +1,3 @@ -export * from './auth/errors.js'; -export * from './shared/auth.js'; -export * from './shared/auth-utils.js'; -export * from './shared/metadataUtils.js'; -export * from './shared/protocol.js'; -export * from './shared/responseMessage.js'; -export * from './shared/stdio.js'; -export * from './shared/toolNameValidation.js'; -export * from './shared/transport.js'; -export * from './shared/uriTemplate.js'; -export * from './types/types.js'; -export * from './util/inMemory.js'; -export * from './util/zod-compat.js'; -export * from './util/zod-json-schema-compat.js'; - -// experimental exports -export * from './experimental/index.js'; -export * from './validation/ajv-provider.js'; -export * from './validation/cfworker-provider.js'; /** * JSON Schema validation * @@ -46,4 +27,4 @@ export * from './validation/cfworker-provider.js'; */ // Core types only - implementations are exported via separate entry points -export type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './validation/types.js'; +export type { JsonSchemaType, JsonSchemaValidator, JsonSchemaValidatorResult, jsonSchemaValidator } from './types.js'; diff --git a/packages/core/src/validation/types.ts b/src/validation/types.ts similarity index 100% rename from packages/core/src/validation/types.ts rename to src/validation/types.ts diff --git a/packages/client/test/client/auth-extensions.test.ts b/test/client/auth-extensions.test.ts similarity index 97% rename from packages/client/test/client/auth-extensions.test.ts rename to test/client/auth-extensions.test.ts index f7bde7f241..a7217307dc 100644 --- a/packages/client/test/client/auth-extensions.test.ts +++ b/test/client/auth-extensions.test.ts @@ -1,13 +1,12 @@ -import { createMockOAuthFetch } from '@modelcontextprotocol/test-helpers'; -import { describe, expect, it } from 'vitest'; - +import { describe, it, expect } from 'vitest'; import { auth } from '../../src/client/auth.js'; import { ClientCredentialsProvider, - createPrivateKeyJwtAuth, PrivateKeyJwtProvider, - StaticPrivateKeyJwtProvider + StaticPrivateKeyJwtProvider, + createPrivateKeyJwtAuth } from '../../src/client/auth-extensions.js'; +import { createMockOAuthFetch } from '../helpers/oauth.js'; const RESOURCE_SERVER_URL = 'https://resource.example.com/'; const AUTH_SERVER_URL = 'https://auth.example.com'; @@ -275,7 +274,7 @@ describe('createPrivateKeyJwtAuth', () => { const assertion = params.get('client_assertion')!; // Decode the payload to verify audience const [, payloadB64] = assertion.split('.'); - const payload = JSON.parse(Buffer.from(payloadB64!, 'base64url').toString()); + const payload = JSON.parse(Buffer.from(payloadB64, 'base64url').toString()); expect(payload.aud).toBe('https://issuer.example.com'); }); diff --git a/packages/client/test/client/auth.test.ts b/test/client/auth.test.ts similarity index 96% rename from packages/client/test/client/auth.test.ts rename to test/client/auth.test.ts index cb01d37d5e..d6e7e86845 100644 --- a/packages/client/test/client/auth.test.ts +++ b/test/client/auth.test.ts @@ -1,23 +1,23 @@ -import type { AuthorizationServerMetadata, OAuthTokens } from '@modelcontextprotocol/core'; -import { InvalidClientMetadataError, LATEST_PROTOCOL_VERSION, ServerError } from '@modelcontextprotocol/core'; -import { expect, type Mock, vi } from 'vitest'; - +import { LATEST_PROTOCOL_VERSION } from '../../src/types.js'; import { - auth, - buildDiscoveryUrls, - discoverAuthorizationServerMetadata, discoverOAuthMetadata, - discoverOAuthProtectedResourceMetadata, + discoverAuthorizationServerMetadata, + buildDiscoveryUrls, + startAuthorization, exchangeAuthorization, - extractWWWAuthenticateParams, - isHttpsUrl, - type OAuthClientProvider, refreshAuthorization, registerClient, + discoverOAuthProtectedResourceMetadata, + extractWWWAuthenticateParams, + auth, + type OAuthClientProvider, selectClientAuthMethod, - startAuthorization + isHttpsUrl } from '../../src/client/auth.js'; import { createPrivateKeyJwtAuth } from '../../src/client/auth-extensions.js'; +import { InvalidClientMetadataError, ServerError } from '../../src/server/auth/errors.js'; +import { AuthorizationServerMetadata, OAuthTokens } from '../../src/shared/auth.js'; +import { expect, vi, type Mock } from 'vitest'; // Mock pkce-challenge vi.mock('pkce-challenge', () => ({ @@ -125,7 +125,7 @@ describe('OAuth Authorization', () => { expect(metadata).toEqual(validMetadata); const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); - const [url] = calls[0]!; + const [url] = calls[0]; expect(url.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); }); @@ -159,7 +159,7 @@ describe('OAuth Authorization', () => { expect(mockFetch).toHaveBeenCalledTimes(2); // Verify first call had MCP header - expect(mockFetch.mock.calls[0]![1]?.headers).toHaveProperty('MCP-Protocol-Version'); + expect(mockFetch.mock.calls[0][1]?.headers).toHaveProperty('MCP-Protocol-Version'); }); it('throws an error when all fetch attempts fail', async () => { @@ -230,7 +230,7 @@ describe('OAuth Authorization', () => { expect(metadata).toEqual(validMetadata); const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); - const [url] = calls[0]!; + const [url] = calls[0]; expect(url.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource/path/name'); }); @@ -245,7 +245,7 @@ describe('OAuth Authorization', () => { expect(metadata).toEqual(validMetadata); const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); - const [url] = calls[0]!; + const [url] = calls[0]; expect(url.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource/path?param=value'); }); @@ -272,14 +272,14 @@ describe('OAuth Authorization', () => { expect(calls.length).toBe(2); // First call should be path-aware - const [firstUrl, firstOptions] = calls[0]!; + const [firstUrl, firstOptions] = calls[0]; expect(firstUrl.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource/path/name'); expect(firstOptions.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION }); // Second call should be root fallback - const [secondUrl, secondOptions] = calls[1]!; + const [secondUrl, secondOptions] = calls[1]; expect(secondUrl.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); expect(secondOptions.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION @@ -335,7 +335,7 @@ describe('OAuth Authorization', () => { const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); // Should not attempt fallback - const [url] = calls[0]!; + const [url] = calls[0]; expect(url.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); }); @@ -353,7 +353,7 @@ describe('OAuth Authorization', () => { const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); // Should not attempt fallback - const [url] = calls[0]!; + const [url] = calls[0]; expect(url.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); }); @@ -381,7 +381,7 @@ describe('OAuth Authorization', () => { expect(calls.length).toBe(3); // Final call should be root fallback - const [lastUrl, lastOptions] = calls[2]!; + const [lastUrl, lastOptions] = calls[2]; expect(lastUrl.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); expect(lastOptions.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION @@ -404,7 +404,7 @@ describe('OAuth Authorization', () => { const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); // Should not attempt fallback when explicit URL is provided - const [url] = calls[0]!; + const [url] = calls[0]; expect(url.toString()).toBe('https://custom.example.com/metadata'); }); @@ -426,7 +426,7 @@ describe('OAuth Authorization', () => { expect(customFetch).toHaveBeenCalledTimes(1); expect(mockFetch).not.toHaveBeenCalled(); - const [url, options] = customFetch.mock.calls[0]!; + const [url, options] = customFetch.mock.calls[0]; expect(url.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); expect(options.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION @@ -455,7 +455,7 @@ describe('OAuth Authorization', () => { expect(metadata).toEqual(validMetadata); const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); - const [url, options] = calls[0]!; + const [url, options] = calls[0]; expect(url.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server'); expect(options.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION @@ -473,7 +473,7 @@ describe('OAuth Authorization', () => { expect(metadata).toEqual(validMetadata); const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); - const [url, options] = calls[0]!; + const [url, options] = calls[0]; expect(url.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server/path/name'); expect(options.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION @@ -501,14 +501,14 @@ describe('OAuth Authorization', () => { expect(calls.length).toBe(2); // First call should be path-aware - const [firstUrl, firstOptions] = calls[0]!; + const [firstUrl, firstOptions] = calls[0]; expect(firstUrl.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server/path/name'); expect(firstOptions.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION }); // Second call should be root fallback - const [secondUrl, secondOptions] = calls[1]!; + const [secondUrl, secondOptions] = calls[1]; expect(secondUrl.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server'); expect(secondOptions.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION @@ -548,7 +548,7 @@ describe('OAuth Authorization', () => { const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); // Should not attempt fallback - const [url] = calls[0]!; + const [url] = calls[0]; expect(url.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server'); }); @@ -565,7 +565,7 @@ describe('OAuth Authorization', () => { const calls = mockFetch.mock.calls; expect(calls.length).toBe(1); // Should not attempt fallback - const [url] = calls[0]!; + const [url] = calls[0]; expect(url.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server'); }); @@ -593,7 +593,7 @@ describe('OAuth Authorization', () => { expect(calls.length).toBe(3); // Final call should be root fallback - const [lastUrl, lastOptions] = calls[2]!; + const [lastUrl, lastOptions] = calls[2]; expect(lastUrl.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server'); expect(lastOptions.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION @@ -630,7 +630,7 @@ describe('OAuth Authorization', () => { expect(mockFetch).toHaveBeenCalledTimes(2); // Verify first call had MCP header - expect(mockFetch.mock.calls[0]![1]?.headers).toHaveProperty('MCP-Protocol-Version'); + expect(mockFetch.mock.calls[0][1]?.headers).toHaveProperty('MCP-Protocol-Version'); }); it('throws an error when all fetch attempts fail', async () => { @@ -722,7 +722,7 @@ describe('OAuth Authorization', () => { expect(customFetch).toHaveBeenCalledTimes(1); expect(mockFetch).not.toHaveBeenCalled(); - const [url, options] = customFetch.mock.calls[0]!; + const [url, options] = customFetch.mock.calls[0]; expect(url.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server'); expect(options.headers).toEqual({ 'MCP-Protocol-Version': LATEST_PROTOCOL_VERSION @@ -771,7 +771,7 @@ describe('OAuth Authorization', () => { const urls = buildDiscoveryUrls(new URL('https://auth.example.com/tenant1')); expect(urls).toHaveLength(3); - expect(urls[0]!.url.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server/tenant1'); + expect(urls[0].url.toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server/tenant1'); }); }); @@ -817,8 +817,8 @@ describe('OAuth Authorization', () => { // Verify it tried the URLs in the correct order const calls = mockFetch.mock.calls; expect(calls.length).toBe(2); - expect(calls[0]![0].toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server/tenant1'); - expect(calls[1]![0].toString()).toBe('https://auth.example.com/.well-known/openid-configuration/tenant1'); + expect(calls[0][0].toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server/tenant1'); + expect(calls[1][0].toString()).toBe('https://auth.example.com/.well-known/openid-configuration/tenant1'); }); it('continues on 4xx errors', async () => { @@ -865,10 +865,10 @@ describe('OAuth Authorization', () => { expect(calls.length).toBe(2); // First call should have headers - expect(calls[0]![1]?.headers).toHaveProperty('MCP-Protocol-Version'); + expect(calls[0][1]?.headers).toHaveProperty('MCP-Protocol-Version'); // Second call should not have headers (CORS retry) - expect(calls[1]![1]?.headers).toBeUndefined(); + expect(calls[1][1]?.headers).toBeUndefined(); }); it('supports custom fetch function', async () => { @@ -896,7 +896,7 @@ describe('OAuth Authorization', () => { expect(metadata).toEqual(validOAuthMetadata); const calls = mockFetch.mock.calls; - const [, options] = calls[0]!; + const [, options] = calls[0]; expect(options.headers).toEqual({ 'MCP-Protocol-Version': '2025-01-01', Accept: 'application/json' @@ -1140,7 +1140,7 @@ describe('OAuth Authorization', () => { }) ); - const options = mockFetch.mock.calls[0]![1]; + const options = mockFetch.mock.calls[0][1]; expect(options.headers).toBeInstanceOf(Headers); expect(options.headers.get('Content-Type')).toBe('application/x-www-form-urlencoded'); expect(options.body).toBeInstanceOf(URLSearchParams); @@ -1180,7 +1180,7 @@ describe('OAuth Authorization', () => { }) ); - const options = mockFetch.mock.calls[0]![1]; + const options = mockFetch.mock.calls[0][1]; expect(options.headers).toBeInstanceOf(Headers); expect(options.headers.get('Content-Type')).toBe('application/x-www-form-urlencoded'); @@ -1229,10 +1229,10 @@ describe('OAuth Authorization', () => { }) ); - const headers = mockFetch.mock.calls[0]![1].headers as Headers; + const headers = mockFetch.mock.calls[0][1].headers as Headers; expect(headers.get('Content-Type')).toBe('application/x-www-form-urlencoded'); expect(headers.get('Authorization')).toBe('Basic Y2xpZW50MTIzOnNlY3JldDEyMw=='); - const body = mockFetch.mock.calls[0]![1].body as URLSearchParams; + const body = mockFetch.mock.calls[0][1].body as URLSearchParams; expect(body.get('grant_type')).toBe('authorization_code'); expect(body.get('code')).toBe('code123'); expect(body.get('code_verifier')).toBe('verifier123'); @@ -1297,7 +1297,7 @@ describe('OAuth Authorization', () => { expect(customFetch).toHaveBeenCalledTimes(1); expect(mockFetch).not.toHaveBeenCalled(); - const [url, options] = customFetch.mock.calls[0]!; + const [url, options] = customFetch.mock.calls[0]; expect(url.toString()).toBe('https://auth.example.com/token'); expect(options).toEqual( expect.objectContaining({ @@ -1366,9 +1366,9 @@ describe('OAuth Authorization', () => { }) ); - const headers = mockFetch.mock.calls[0]![1].headers as Headers; + const headers = mockFetch.mock.calls[0][1].headers as Headers; expect(headers.get('Content-Type')).toBe('application/x-www-form-urlencoded'); - const body = mockFetch.mock.calls[0]![1].body as URLSearchParams; + const body = mockFetch.mock.calls[0][1].body as URLSearchParams; expect(body.get('grant_type')).toBe('refresh_token'); expect(body.get('refresh_token')).toBe('refresh123'); expect(body.get('client_id')).toBe('client123'); @@ -1410,10 +1410,10 @@ describe('OAuth Authorization', () => { }) ); - const headers = mockFetch.mock.calls[0]![1].headers as Headers; + const headers = mockFetch.mock.calls[0][1].headers as Headers; expect(headers.get('Content-Type')).toBe('application/x-www-form-urlencoded'); expect(headers.get('Authorization')).toBe('Basic Y2xpZW50MTIzOnNlY3JldDEyMw=='); - const body = mockFetch.mock.calls[0]![1].body as URLSearchParams; + const body = mockFetch.mock.calls[0][1].body as URLSearchParams; expect(body.get('grant_type')).toBe('refresh_token'); expect(body.get('refresh_token')).toBe('refresh123'); expect(body.get('client_id')).toBeNull(); @@ -1740,10 +1740,10 @@ describe('OAuth Authorization', () => { expect(mockFetch).toHaveBeenCalledTimes(3); // First call should be to protected resource metadata - expect(mockFetch.mock.calls[0]![0].toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); + expect(mockFetch.mock.calls[0][0].toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); // Second call should be to oauth metadata at the root path - expect(mockFetch.mock.calls[1]![0].toString()).toBe('https://resource.example.com/.well-known/oauth-authorization-server'); + expect(mockFetch.mock.calls[1][0].toString()).toBe('https://resource.example.com/.well-known/oauth-authorization-server'); }); it('uses base URL (with root path) as authorization server when protected-resource-metadata discovery fails', async () => { @@ -1869,7 +1869,7 @@ describe('OAuth Authorization', () => { }) ); - const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]!; + const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]; const authUrl: URL = redirectCall[0]; expect(authUrl.searchParams.get('resource')).toBe('https://api.example.com/mcp-server'); }); @@ -2126,7 +2126,7 @@ describe('OAuth Authorization', () => { }) ); - const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]!; + const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]; const authUrl: URL = redirectCall[0]; // Should use the PRM's resource value, not the full requested URL expect(authUrl.searchParams.get('resource')).toBe('https://api.example.com/'); @@ -2184,7 +2184,7 @@ describe('OAuth Authorization', () => { }) ); - const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]!; + const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]; const authUrl: URL = redirectCall[0]; // Resource parameter should not be present when PRM is not available expect(authUrl.searchParams.has('resource')).toBe(false); @@ -2379,9 +2379,9 @@ describe('OAuth Authorization', () => { expect(result).toBe('REDIRECT'); // Verify the authorization URL includes the scopes from PRM - const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]!; + const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]; const authUrl: URL = redirectCall[0]; - expect(authUrl?.searchParams.get('scope')).toBe('mcp:read mcp:write mcp:admin'); + expect(authUrl.searchParams.get('scope')).toBe('mcp:read mcp:write mcp:admin'); }); it('prefers explicit scope parameter over scopes_supported from PRM', async () => { @@ -2444,7 +2444,7 @@ describe('OAuth Authorization', () => { expect(result).toBe('REDIRECT'); // Verify the authorization URL uses the explicit scope, not scopes_supported - const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]!; + const redirectCall = (mockProvider.redirectToAuthorization as Mock).mock.calls[0]; const authUrl: URL = redirectCall[0]; expect(authUrl.searchParams.get('scope')).toBe('mcp:read'); }); @@ -2501,10 +2501,10 @@ describe('OAuth Authorization', () => { const calls = mockFetch.mock.calls; // First call should be to PRM - expect(calls[0]![0].toString()).toBe('https://my.resource.com/.well-known/oauth-protected-resource/path/name'); + expect(calls[0][0].toString()).toBe('https://my.resource.com/.well-known/oauth-protected-resource/path/name'); // Second call should be to AS metadata with the path from authorization server - expect(calls[1]![0].toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server/oauth'); + expect(calls[1][0].toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server/oauth'); }); it('supports overriding the fetch function used for requests', async () => { @@ -2565,10 +2565,10 @@ describe('OAuth Authorization', () => { expect(mockFetch).not.toHaveBeenCalled(); // Verify custom fetch was called for PRM discovery - expect(customFetch.mock.calls[0]![0].toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); + expect(customFetch.mock.calls[0][0].toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); // Verify custom fetch was called for AS metadata discovery - expect(customFetch.mock.calls[1]![0].toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server'); + expect(customFetch.mock.calls[1][0].toString()).toBe('https://auth.example.com/.well-known/oauth-authorization-server'); }); }); @@ -2627,7 +2627,7 @@ describe('OAuth Authorization', () => { }); expect(tokens).toEqual(validTokens); - const request = mockFetch.mock.calls[0]![1]; + const request = mockFetch.mock.calls[0][1]; // Check Authorization header const authHeader = request.headers.get('Authorization'); @@ -2655,7 +2655,7 @@ describe('OAuth Authorization', () => { }); expect(tokens).toEqual(validTokens); - const request = mockFetch.mock.calls[0]![1]; + const request = mockFetch.mock.calls[0][1]; // Check no Authorization header expect(request.headers.get('Authorization')).toBeNull(); @@ -2681,7 +2681,7 @@ describe('OAuth Authorization', () => { }); expect(tokens).toEqual(validTokens); - const request = mockFetch.mock.calls[0]![1]; + const request = mockFetch.mock.calls[0][1]; // Check Authorization header - should use Basic auth as it's the most secure const authHeader = request.headers.get('Authorization'); @@ -2716,7 +2716,7 @@ describe('OAuth Authorization', () => { }); expect(tokens).toEqual(validTokens); - const request = mockFetch.mock.calls[0]![1]; + const request = mockFetch.mock.calls[0][1]; // Check no Authorization header expect(request.headers.get('Authorization')).toBeNull(); @@ -2741,7 +2741,7 @@ describe('OAuth Authorization', () => { }); expect(tokens).toEqual(validTokens); - const request = mockFetch.mock.calls[0]![1]; + const request = mockFetch.mock.calls[0][1]; // Check headers expect(request.headers.get('Content-Type')).toBe('application/x-www-form-urlencoded'); @@ -2795,7 +2795,7 @@ describe('OAuth Authorization', () => { }); expect(tokens).toEqual(validTokens); - const request = mockFetch.mock.calls[0]![1]; + const request = mockFetch.mock.calls[0][1]; // Check Authorization header const authHeader = request.headers.get('Authorization'); @@ -2822,7 +2822,7 @@ describe('OAuth Authorization', () => { }); expect(tokens).toEqual(validTokens); - const request = mockFetch.mock.calls[0]![1]; + const request = mockFetch.mock.calls[0][1]; // Check no Authorization header expect(request.headers.get('Authorization')).toBeNull(); @@ -2836,7 +2836,7 @@ describe('OAuth Authorization', () => { describe('RequestInit headers passthrough', () => { it('custom headers from RequestInit are passed to auth discovery requests', async () => { - const { createFetchWithInit } = await import('@modelcontextprotocol/core'); + const { createFetchWithInit } = await import('../../src/shared/transport.js'); const customFetch = vi.fn().mockResolvedValue({ ok: true, @@ -2858,7 +2858,7 @@ describe('OAuth Authorization', () => { await discoverOAuthProtectedResourceMetadata('https://resource.example.com', undefined, wrappedFetch); expect(customFetch).toHaveBeenCalledTimes(1); - const [url, options] = customFetch.mock.calls[0]!; + const [url, options] = customFetch.mock.calls[0]; expect(url.toString()).toBe('https://resource.example.com/.well-known/oauth-protected-resource'); expect(options.headers).toMatchObject({ @@ -2869,7 +2869,7 @@ describe('OAuth Authorization', () => { }); it('auth-specific headers override base headers from RequestInit', async () => { - const { createFetchWithInit } = await import('@modelcontextprotocol/core'); + const { createFetchWithInit } = await import('../../src/shared/transport.js'); const customFetch = vi.fn().mockResolvedValue({ ok: true, @@ -2896,7 +2896,7 @@ describe('OAuth Authorization', () => { }); expect(customFetch).toHaveBeenCalled(); - const [, options] = customFetch.mock.calls[0]!; + const [, options] = customFetch.mock.calls[0]; // Auth-specific Accept header should override base Accept header expect(options.headers).toMatchObject({ @@ -2907,7 +2907,7 @@ describe('OAuth Authorization', () => { }); it('other RequestInit options are passed through', async () => { - const { createFetchWithInit } = await import('@modelcontextprotocol/core'); + const { createFetchWithInit } = await import('../../src/shared/transport.js'); const customFetch = vi.fn().mockResolvedValue({ ok: true, @@ -2931,7 +2931,7 @@ describe('OAuth Authorization', () => { await discoverOAuthProtectedResourceMetadata('https://resource.example.com', undefined, wrappedFetch); expect(customFetch).toHaveBeenCalledTimes(1); - const [, options] = customFetch.mock.calls[0]!; + const [, options] = customFetch.mock.calls[0]; // All RequestInit options should be preserved expect(options.credentials).toBe('include'); diff --git a/packages/client/test/client/cross-spawn.test.ts b/test/client/cross-spawn.test.ts similarity index 94% rename from packages/client/test/client/cross-spawn.test.ts rename to test/client/cross-spawn.test.ts index 8e4a80fc24..26ae682fe4 100644 --- a/packages/client/test/client/cross-spawn.test.ts +++ b/test/client/cross-spawn.test.ts @@ -1,10 +1,8 @@ -import type { ChildProcess } from 'node:child_process'; - -import type { JSONRPCMessage } from '@modelcontextprotocol/core'; +import { StdioClientTransport, getDefaultEnvironment } from '../../src/client/stdio.js'; import spawn from 'cross-spawn'; -import type { Mock, MockedFunction } from 'vitest'; - -import { getDefaultEnvironment, StdioClientTransport } from '../../src/client/stdio.js'; +import { JSONRPCMessage } from '../../src/types.js'; +import { ChildProcess } from 'node:child_process'; +import { Mock, MockedFunction } from 'vitest'; // mock cross-spawn vi.mock('cross-spawn'); diff --git a/test/integration/test/client/client.test.ts b/test/client/index.test.ts similarity index 97% rename from test/integration/test/client/client.test.ts rename to test/client/index.test.ts index 5574a2d849..9735eb2bac 100644 --- a/test/integration/test/client/client.test.ts +++ b/test/client/index.test.ts @@ -1,31 +1,36 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable no-constant-binary-expression */ /* eslint-disable @typescript-eslint/no-unused-expressions */ -import { Client, getSupportedElicitationModes } from '@modelcontextprotocol/client'; -import type { Prompt, Resource, Tool, Transport } from '@modelcontextprotocol/core'; +import { Client, getSupportedElicitationModes } from '../../src/client/index.js'; import { + RequestSchema, + NotificationSchema, + ResultSchema, + LATEST_PROTOCOL_VERSION, + SUPPORTED_PROTOCOL_VERSIONS, + InitializeRequestSchema, + ListResourcesRequestSchema, + ListToolsRequestSchema, + ListToolsResultSchema, + ListPromptsRequestSchema, CallToolRequestSchema, CallToolResultSchema, CreateMessageRequestSchema, - CreateTaskResultSchema, ElicitRequestSchema, ElicitResultSchema, - ErrorCode, - InitializeRequestSchema, - InMemoryTransport, - LATEST_PROTOCOL_VERSION, - ListPromptsRequestSchema, - ListResourcesRequestSchema, ListRootsRequestSchema, - ListToolsRequestSchema, - ListToolsResultSchema, + ErrorCode, McpError, - NotificationSchema, - RequestSchema, - ResultSchema, - SUPPORTED_PROTOCOL_VERSIONS -} from '@modelcontextprotocol/core'; -import { InMemoryTaskStore, McpServer, Server } from '@modelcontextprotocol/server'; + CreateTaskResultSchema, + Tool, + Prompt, + Resource +} from '../../src/types.js'; +import { Transport } from '../../src/shared/transport.js'; +import { Server } from '../../src/server/index.js'; +import { McpServer } from '../../src/server/mcp.js'; +import { InMemoryTransport } from '../../src/inMemory.js'; +import { InMemoryTaskStore } from '../../src/experimental/tasks/stores/in-memory.js'; import * as z3 from 'zod/v3'; import * as z4 from 'zod/v4'; @@ -1287,9 +1292,9 @@ test('should handle tool list changed notification with auto refresh', async () // Should be 1 notification with 2 tools because autoRefresh is true expect(notifications).toHaveLength(1); - expect(notifications[0]![0]).toBeNull(); - expect(notifications[0]![1]).toHaveLength(2); - expect(notifications[0]![1]?.[1]!.name).toBe('test-tool'); + expect(notifications[0][0]).toBeNull(); + expect(notifications[0][1]).toHaveLength(2); + expect(notifications[0][1]?.[1].name).toBe('test-tool'); }); /*** @@ -1347,8 +1352,8 @@ test('should handle tool list changed notification with manual refresh', async ( // Should be 1 notification with no tool data because autoRefresh is false expect(notifications).toHaveLength(1); - expect(notifications[0]![0]).toBeNull(); - expect(notifications[0]![1]).toBeNull(); + expect(notifications[0][0]).toBeNull(); + expect(notifications[0][1]).toBeNull(); }); /*** @@ -1407,9 +1412,9 @@ test('should handle prompt list changed notification with auto refresh', async ( // Should be 1 notification with 2 prompts because autoRefresh is true expect(notifications).toHaveLength(1); - expect(notifications[0]![0]).toBeNull(); - expect(notifications[0]![1]).toHaveLength(2); - expect(notifications[0]![1]?.[1]!.name).toBe('test-prompt'); + expect(notifications[0][0]).toBeNull(); + expect(notifications[0][1]).toHaveLength(2); + expect(notifications[0][1]?.[1].name).toBe('test-prompt'); }); /*** @@ -1462,9 +1467,9 @@ test('should handle resource list changed notification with auto refresh', async // Should be 1 notification with 2 resources because autoRefresh is true expect(notifications).toHaveLength(1); - expect(notifications[0]![0]).toBeNull(); - expect(notifications[0]![1]).toHaveLength(2); - expect(notifications[0]![1]?.[1]!.name).toBe('test-resource'); + expect(notifications[0][0]).toBeNull(); + expect(notifications[0][1]).toHaveLength(2); + expect(notifications[0][1]?.[1].name).toBe('test-resource'); }); /*** @@ -1548,10 +1553,10 @@ test('should handle multiple list changed handlers configured together', async ( // Both handlers should have received their respective notifications expect(toolNotifications).toHaveLength(1); - expect(toolNotifications[0]![1]).toHaveLength(2); + expect(toolNotifications[0][1]).toHaveLength(2); expect(promptNotifications).toHaveLength(1); - expect(promptNotifications[0]![1]).toHaveLength(2); + expect(promptNotifications[0][1]).toHaveLength(2); }); /*** @@ -1650,8 +1655,8 @@ test('should activate listChanged handler when server advertises capability', as // Handler SHOULD have been called expect(notifications).toHaveLength(1); - expect(notifications[0]![0]).toBeNull(); - expect(notifications[0]![1]).toHaveLength(1); + expect(notifications[0][0]).toBeNull(); + expect(notifications[0][1]).toHaveLength(1); }); /*** @@ -2414,7 +2419,7 @@ describe('Task-based execution', () => { // Verify task was created successfully by listing tasks const taskList = await client.experimental.tasks.listTasks(); expect(taskList.tasks.length).toBeGreaterThan(0); - const task = taskList.tasks[0]!; + const task = taskList.tasks[0]; expect(task.status).toBe('completed'); }); @@ -2488,7 +2493,7 @@ describe('Task-based execution', () => { // Query task status by listing tasks and getting the first one const taskList = await client.experimental.tasks.listTasks(); expect(taskList.tasks.length).toBeGreaterThan(0); - const task = taskList.tasks[0]!; + const task = taskList.tasks[0]; expect(task).toBeDefined(); expect(task.taskId).toBeDefined(); expect(task.status).toBe('completed'); @@ -3487,9 +3492,9 @@ test('should expose requestStream() method for streaming responses', async () => // Should have received only a result message (no task messages) expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('result'); - if (messages[0]!.type === 'result') { - expect(messages[0]!.result.content).toEqual([{ type: 'text', text: 'Tool result' }]); + expect(messages[0].type).toBe('result'); + if (messages[0].type === 'result') { + expect(messages[0].result.content).toEqual([{ type: 'text', text: 'Tool result' }]); } await client.close(); @@ -3542,9 +3547,9 @@ test('should expose callToolStream() method for streaming tool calls', async () // Should have received messages ending with result expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('result'); - if (messages[0]!.type === 'result') { - expect(messages[0]!.result.content).toEqual([{ type: 'text', text: 'Tool result' }]); + expect(messages[0].type).toBe('result'); + if (messages[0].type === 'result') { + expect(messages[0].result.content).toEqual([{ type: 'text', text: 'Tool result' }]); } await client.close(); @@ -3623,9 +3628,9 @@ test('should validate structured output in callToolStream()', async () => { // Should have received result with validated structured content expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('result'); - if (messages[0]!.type === 'result') { - expect(messages[0]!.result.structuredContent).toEqual({ value: 42 }); + expect(messages[0].type).toBe('result'); + if (messages[0].type === 'result') { + expect(messages[0].result.structuredContent).toEqual({ value: 42 }); } await client.close(); @@ -3699,9 +3704,9 @@ test('callToolStream() should yield error when structuredContent does not match } expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('error'); - if (messages[0]!.type === 'error') { - expect(messages[0]!.error.message).toMatch(/Structured content does not match the tool's output schema/); + expect(messages[0].type).toBe('error'); + if (messages[0].type === 'error') { + expect(messages[0].error.message).toMatch(/Structured content does not match the tool's output schema/); } await client.close(); @@ -3771,9 +3776,9 @@ test('callToolStream() should yield error when tool with outputSchema returns no } expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('error'); - if (messages[0]!.type === 'error') { - expect(messages[0]!.error.message).toMatch(/Tool test-tool has an output schema but did not return structured content/); + expect(messages[0].type).toBe('error'); + if (messages[0].type === 'error') { + expect(messages[0].error.message).toMatch(/Tool test-tool has an output schema but did not return structured content/); } await client.close(); @@ -3836,9 +3841,9 @@ test('callToolStream() should handle tools without outputSchema normally', async } expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('result'); - if (messages[0]!.type === 'result') { - expect(messages[0]!.result.content).toEqual([{ type: 'text', text: 'Normal response' }]); + expect(messages[0].type).toBe('result'); + if (messages[0].type === 'result') { + expect(messages[0].result.content).toEqual([{ type: 'text', text: 'Normal response' }]); } await client.close(); @@ -3931,10 +3936,10 @@ test('callToolStream() should handle complex JSON schema validation', async () = } expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('result'); - if (messages[0]!.type === 'result') { - expect(messages[0]!.result.structuredContent).toBeDefined(); - const structuredContent = messages[0]!.result.structuredContent as { name: string; age: number }; + expect(messages[0].type).toBe('result'); + if (messages[0].type === 'result') { + expect(messages[0].result.structuredContent).toBeDefined(); + const structuredContent = messages[0].result.structuredContent as { name: string; age: number }; expect(structuredContent.name).toBe('John Doe'); expect(structuredContent.age).toBe(30); } @@ -4010,9 +4015,9 @@ test('callToolStream() should yield error with additional properties when not al } expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('error'); - if (messages[0]!.type === 'error') { - expect(messages[0]!.error.message).toMatch(/Structured content does not match the tool's output schema/); + expect(messages[0].type).toBe('error'); + if (messages[0].type === 'error') { + expect(messages[0].error.message).toMatch(/Structured content does not match the tool's output schema/); } await client.close(); @@ -4085,10 +4090,10 @@ test('callToolStream() should not validate structuredContent when isError is tru // Should have received result (not error), with isError flag set expect(messages.length).toBe(1); - expect(messages[0]!.type).toBe('result'); - if (messages[0]!.type === 'result') { - expect(messages[0]!.result.isError).toBe(true); - expect(messages[0]!.result.content).toEqual([{ type: 'text', text: 'Something went wrong' }]); + expect(messages[0].type).toBe('result'); + if (messages[0].type === 'result') { + expect(messages[0].result.isError).toBe(true); + expect(messages[0].result.content).toEqual([{ type: 'text', text: 'Something went wrong' }]); } await client.close(); diff --git a/packages/client/test/client/middleware.test.ts b/test/client/middleware.test.ts similarity index 96% rename from packages/client/test/client/middleware.test.ts rename to test/client/middleware.test.ts index 451715423d..06bda69c82 100644 --- a/packages/client/test/client/middleware.test.ts +++ b/test/client/middleware.test.ts @@ -1,8 +1,7 @@ -import type { FetchLike } from '@modelcontextprotocol/core'; -import type { Mocked, MockedFunction, MockInstance } from 'vitest'; - -import type { OAuthClientProvider } from '../../src/client/auth.js'; -import { applyMiddlewares, createMiddleware, withLogging, withOAuth } from '../../src/client/middleware.js'; +import { withOAuth, withLogging, applyMiddlewares, createMiddleware } from '../../src/client/middleware.js'; +import { OAuthClientProvider } from '../../src/client/auth.js'; +import { FetchLike } from '../../src/shared/transport.js'; +import { MockInstance, Mocked, MockedFunction } from 'vitest'; vi.mock('../../src/client/auth.js', async () => { const actual = await vi.importActual('../../src/client/auth.js'); @@ -65,7 +64,7 @@ describe('withOAuth', () => { ); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('Authorization')).toBe('Bearer test-token'); }); @@ -91,7 +90,7 @@ describe('withOAuth', () => { ); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('Authorization')).toBe('Bearer test-token'); }); @@ -106,7 +105,7 @@ describe('withOAuth', () => { expect(mockFetch).toHaveBeenCalledTimes(1); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('Authorization')).toBeNull(); }); @@ -153,7 +152,7 @@ describe('withOAuth', () => { // Verify the retry used the new token const retryCallArgs = mockFetch.mock.calls[1]; - const retryHeaders = retryCallArgs![1]?.headers as Headers; + const retryHeaders = retryCallArgs[1]?.headers as Headers; expect(retryHeaders.get('Authorization')).toBe('Bearer new-token'); }); @@ -201,7 +200,7 @@ describe('withOAuth', () => { // Verify the retry used the new token const retryCallArgs = mockFetch.mock.calls[1]; - const retryHeaders = retryCallArgs![1]?.headers as Headers; + const retryHeaders = retryCallArgs[1]?.headers as Headers; expect(retryHeaders.get('Authorization')).toBe('Bearer new-token'); }); @@ -291,7 +290,7 @@ describe('withOAuth', () => { ); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('Content-Type')).toBe('application/json'); expect(headers.get('Authorization')).toBe('Bearer test-token'); }); @@ -493,7 +492,7 @@ describe('withLogging', () => { responseHeaders: undefined }); - const logCall = mockLogger.mock.calls[0]![0]; + const logCall = mockLogger.mock.calls[0][0]; expect(logCall.requestHeaders?.get('Authorization')).toBe('Bearer token'); expect(logCall.requestHeaders?.get('Content-Type')).toBe('application/json'); }); @@ -516,7 +515,7 @@ describe('withLogging', () => { await enhancedFetch('https://api.example.com/data'); - const logCall = mockLogger.mock.calls[0]![0]; + const logCall = mockLogger.mock.calls[0][0]; expect(logCall.responseHeaders?.get('Content-Type')).toBe('application/json'); expect(logCall.responseHeaders?.get('Cache-Control')).toBe('no-cache'); }); @@ -610,7 +609,7 @@ describe('withLogging', () => { await enhancedFetch('https://api.example.com/data'); - const logCall = mockLogger.mock.calls[0]![0]; + const logCall = mockLogger.mock.calls[0][0]; expect(logCall.duration).toBeGreaterThanOrEqual(90); // Allow some margin for timing }); }); @@ -655,7 +654,7 @@ describe('applyMiddleware', () => { ); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('X-Middleware-1')).toBe('applied'); }); @@ -687,7 +686,7 @@ describe('applyMiddleware', () => { await composedFetch('https://api.example.com/data'); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('X-Middleware-1')).toBe('applied'); expect(headers.get('X-Middleware-2')).toBe('applied'); expect(headers.get('X-Middleware-3')).toBe('applied'); @@ -712,7 +711,7 @@ describe('applyMiddleware', () => { // Should have both Authorization header and logging const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('Authorization')).toBe('Bearer test-token'); expect(mockLogger).toHaveBeenCalledWith({ method: 'GET', @@ -812,7 +811,7 @@ describe('Integration Tests', () => { ); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('Authorization')).toBe('Bearer sse-token'); expect(headers.get('Content-Type')).toBe('application/json'); }); @@ -858,7 +857,7 @@ describe('Integration Tests', () => { }); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('Authorization')).toBe('Bearer streamable-token'); expect(headers.get('Accept')).toBe('application/json, text/event-stream'); }); @@ -944,7 +943,7 @@ describe('createMiddleware', () => { ); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('X-Custom-Header')).toBe('custom-value'); }); @@ -970,13 +969,13 @@ describe('createMiddleware', () => { // Test API route await enhancedFetch('https://example.com/api/users'); let callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('X-API-Version')).toBe('v2'); // Test non-API route await enhancedFetch('https://example.com/public/page'); callArgs = mockFetch.mock.calls[1]; - const maybeHeaders = callArgs![1]?.headers as Headers | undefined; + const maybeHeaders = callArgs[1]?.headers as Headers | undefined; expect(maybeHeaders?.get('X-API-Version')).toBeUndefined(); }); @@ -1017,7 +1016,7 @@ describe('createMiddleware', () => { const response = await next(input, init); if (response.headers.get('content-type')?.includes('application/json')) { - const data = (await response.json()) as Record; + const data = await response.json(); const transformed = { ...data, timestamp: 123456789 }; return new Response(JSON.stringify(transformed), { @@ -1092,7 +1091,7 @@ describe('createMiddleware', () => { await enhancedFetch('https://api.example.com/data'); const callArgs = mockFetch.mock.calls[0]; - const headers = callArgs![1]?.headers as Headers; + const headers = callArgs[1]?.headers as Headers; expect(headers.get('Authorization')).toBe('Custom token'); }); diff --git a/packages/client/test/client/sse.test.ts b/test/client/sse.test.ts similarity index 98% rename from packages/client/test/client/sse.test.ts rename to test/client/sse.test.ts index 94e12c652f..6574b60b8b 100644 --- a/packages/client/test/client/sse.test.ts +++ b/test/client/sse.test.ts @@ -1,15 +1,12 @@ -import type { IncomingMessage, Server, ServerResponse } from 'node:http'; -import { createServer } from 'node:http'; -import type { AddressInfo } from 'node:net'; - -import type { JSONRPCMessage, OAuthTokens } from '@modelcontextprotocol/core'; -import { InvalidClientError, InvalidGrantError, UnauthorizedClientError } from '@modelcontextprotocol/core'; -import { listenOnRandomPort } from '@modelcontextprotocol/test-helpers'; -import type { Mock, Mocked, MockedFunction, MockInstance } from 'vitest'; - -import type { OAuthClientProvider } from '../../src/client/auth.js'; -import { UnauthorizedError } from '../../src/client/auth.js'; +import { createServer, ServerResponse, type IncomingMessage, type Server } from 'node:http'; +import { JSONRPCMessage } from '../../src/types.js'; import { SSEClientTransport } from '../../src/client/sse.js'; +import { OAuthClientProvider, UnauthorizedError } from '../../src/client/auth.js'; +import { OAuthTokens } from '../../src/shared/auth.js'; +import { InvalidClientError, InvalidGrantError, UnauthorizedClientError } from '../../src/server/auth/errors.js'; +import { Mock, Mocked, MockedFunction, MockInstance } from 'vitest'; +import { listenOnRandomPort } from '../helpers/http.js'; +import { AddressInfo } from 'node:net'; describe('SSEClientTransport', () => { let resourceServer: Server; @@ -172,7 +169,7 @@ describe('SSEClientTransport', () => { await new Promise(resolve => setTimeout(resolve, 50)); expect(errors).toHaveLength(1); - expect(errors[0]!.message).toMatch(/JSON/); + expect(errors[0].message).toMatch(/JSON/); }); it('handles messages via POST requests', async () => { @@ -313,7 +310,7 @@ describe('SSEClientTransport', () => { await transport.send(message); - const calledHeaders = (global.fetch as Mock).mock.calls[0]![1].headers; + const calledHeaders = (global.fetch as Mock).mock.calls[0][1].headers; expect(calledHeaders.get('Authorization')).toBe('Bearer test-token'); expect(calledHeaders.get('X-Custom-Header')).toBe('custom-value'); expect(calledHeaders.get('content-type')).toBe('application/json'); @@ -322,7 +319,7 @@ describe('SSEClientTransport', () => { await transport.send(message); - const updatedHeaders = (global.fetch as Mock).mock.calls[1]![1].headers; + const updatedHeaders = (global.fetch as Mock).mock.calls[1][1].headers; expect(updatedHeaders.get('X-Custom-Header')).toBe('updated-value'); } finally { global.fetch = originalFetch; @@ -356,7 +353,7 @@ describe('SSEClientTransport', () => { await transport.send(message); - const calledHeaders = (global.fetch as Mock).mock.calls[0]![1].headers; + const calledHeaders = (global.fetch as Mock).mock.calls[0][1].headers; expect(calledHeaders.get('Authorization')).toBe('Bearer test-token'); expect(calledHeaders.get('X-Custom-Header')).toBe('custom-value'); expect(calledHeaders.get('content-type')).toBe('application/json'); @@ -365,7 +362,7 @@ describe('SSEClientTransport', () => { await transport.send(message); - const updatedHeaders = (global.fetch as Mock).mock.calls[1]![1].headers; + const updatedHeaders = (global.fetch as Mock).mock.calls[1][1].headers; expect(updatedHeaders.get('X-Custom-Header')).toBe('updated-value'); } finally { global.fetch = originalFetch; @@ -390,7 +387,7 @@ describe('SSEClientTransport', () => { await transport.send({ jsonrpc: '2.0', id: '1', method: 'test', params: {} }); - const calledHeaders = (global.fetch as Mock).mock.calls[0]![1].headers; + const calledHeaders = (global.fetch as Mock).mock.calls[0][1].headers; expect(calledHeaders.get('Authorization')).toBe('Bearer test-token'); expect(calledHeaders.get('X-Custom-Header')).toBe('custom-value'); expect(calledHeaders.get('content-type')).toBe('application/json'); diff --git a/packages/client/test/client/stdio.test.ts b/test/client/stdio.test.ts similarity index 86% rename from packages/client/test/client/stdio.test.ts rename to test/client/stdio.test.ts index 28a7834bcb..52a871ee1c 100644 --- a/packages/client/test/client/stdio.test.ts +++ b/test/client/stdio.test.ts @@ -1,7 +1,5 @@ -import type { JSONRPCMessage } from '@modelcontextprotocol/core'; - -import type { StdioServerParameters } from '../../src/client/stdio.js'; -import { StdioClientTransport } from '../../src/client/stdio.js'; +import { JSONRPCMessage } from '../../src/types.js'; +import { StdioClientTransport, StdioServerParameters } from '../../src/client/stdio.js'; // Configure default server parameters based on OS // Uses 'more' command for Windows and 'tee' command for Unix/Linux @@ -61,8 +59,8 @@ test('should read messages', async () => { }); await client.start(); - await client.send(messages[0]!); - await client.send(messages[1]!); + await client.send(messages[0]); + await client.send(messages[1]); await finished; expect(readMessages).toEqual(messages); diff --git a/packages/client/test/client/streamableHttp.test.ts b/test/client/streamableHttp.test.ts similarity index 98% rename from packages/client/test/client/streamableHttp.test.ts rename to test/client/streamableHttp.test.ts index 0c5d2dc018..52c8f10748 100644 --- a/packages/client/test/client/streamableHttp.test.ts +++ b/test/client/streamableHttp.test.ts @@ -1,12 +1,9 @@ -import type { JSONRPCMessage, JSONRPCRequest } from '@modelcontextprotocol/core'; -import { InvalidClientError, InvalidGrantError, UnauthorizedClientError } from '@modelcontextprotocol/core'; +import { StartSSEOptions, StreamableHTTPClientTransport, StreamableHTTPReconnectionOptions } from '../../src/client/streamableHttp.js'; +import { OAuthClientProvider, UnauthorizedError } from '../../src/client/auth.js'; +import { JSONRPCMessage, JSONRPCRequest } from '../../src/types.js'; +import { InvalidClientError, InvalidGrantError, UnauthorizedClientError } from '../../src/server/auth/errors.js'; import { type Mock, type Mocked } from 'vitest'; -import type { OAuthClientProvider } from '../../src/client/auth.js'; -import { UnauthorizedError } from '../../src/client/auth.js'; -import type { StartSSEOptions, StreamableHTTPReconnectionOptions } from '../../src/client/streamableHttp.js'; -import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp.js'; - describe('StreamableHTTPClientTransport', () => { let transport: StreamableHTTPClientTransport; let mockAuthProvider: Mocked; @@ -117,7 +114,7 @@ describe('StreamableHTTPClientTransport', () => { // Check that second request included session ID header const calls = (global.fetch as Mock).mock.calls; - const lastCall = calls[calls.length - 1]!; + const lastCall = calls[calls.length - 1]; expect(lastCall[1].headers).toBeDefined(); expect(lastCall[1].headers.get('mcp-session-id')).toBe('test-session-id'); }); @@ -154,7 +151,7 @@ describe('StreamableHTTPClientTransport', () => { // Verify the DELETE request was sent with the session ID const calls = (global.fetch as Mock).mock.calls; - const lastCall = calls[calls.length - 1]!; + const lastCall = calls[calls.length - 1]; expect(lastCall[1].method).toBe('DELETE'); expect(lastCall[1].headers.get('mcp-session-id')).toBe('test-session-id'); @@ -415,7 +412,7 @@ describe('StreamableHTTPClientTransport', () => { // Verify fetch was called with the lastEventId header expect(fetchSpy).toHaveBeenCalled(); - const fetchCall = fetchSpy.mock.calls[0]!; + const fetchCall = fetchSpy.mock.calls[0]; const headers = fetchCall[1].headers; expect(headers.get('last-event-id')).toBe('test-event-id'); }); @@ -775,8 +772,8 @@ describe('StreamableHTTPClientTransport', () => { ); // THE KEY ASSERTION: A second fetch call proves reconnection was attempted. expect(fetchMock).toHaveBeenCalledTimes(2); - expect(fetchMock.mock.calls[0]![1]?.method).toBe('GET'); - expect(fetchMock.mock.calls[1]![1]?.method).toBe('GET'); + expect(fetchMock.mock.calls[0][1]?.method).toBe('GET'); + expect(fetchMock.mock.calls[1][1]?.method).toBe('GET'); }); it('should NOT reconnect a POST-initiated stream that fails', async () => { @@ -825,7 +822,7 @@ describe('StreamableHTTPClientTransport', () => { // ASSERT // THE KEY ASSERTION: Fetch was only called ONCE. No reconnection was attempted. expect(fetchMock).toHaveBeenCalledTimes(1); - expect(fetchMock.mock.calls[0]![1]?.method).toBe('POST'); + expect(fetchMock.mock.calls[0][1]?.method).toBe('POST'); }); it('should reconnect a POST-initiated stream after receiving a priming event', async () => { @@ -941,7 +938,7 @@ describe('StreamableHTTPClientTransport', () => { // THE KEY ASSERTION: Fetch was called ONCE only - no reconnection! // The response was received, so no need to reconnect. expect(fetchMock).toHaveBeenCalledTimes(1); - expect(fetchMock.mock.calls[0]![1]?.method).toBe('POST'); + expect(fetchMock.mock.calls[0][1]?.method).toBe('POST'); }); it('should not attempt reconnection after close() is called', async () => { @@ -992,7 +989,7 @@ describe('StreamableHTTPClientTransport', () => { // ASSERT // Only 1 call: the initial POST. No reconnection attempts after close(). expect(fetchMock).toHaveBeenCalledTimes(1); - expect(fetchMock.mock.calls[0]![1]?.method).toBe('POST'); + expect(fetchMock.mock.calls[0][1]?.method).toBe('POST'); }); it('should not throw JSON parse error on priming events with empty data', async () => { @@ -1490,11 +1487,11 @@ describe('StreamableHTTPClientTransport', () => { // Should have attempted reconnection expect(fetchMock).toHaveBeenCalledTimes(2); - expect(fetchMock.mock.calls[0]![1]?.method).toBe('GET'); - expect(fetchMock.mock.calls[1]![1]?.method).toBe('GET'); + expect(fetchMock.mock.calls[0][1]?.method).toBe('GET'); + expect(fetchMock.mock.calls[1][1]?.method).toBe('GET'); // Second call should include Last-Event-ID - const secondCallHeaders = fetchMock.mock.calls[1]![1]?.headers; + const secondCallHeaders = fetchMock.mock.calls[1][1]?.headers; expect(secondCallHeaders?.get('last-event-id')).toBe('evt-1'); }); }); diff --git a/examples/shared/test/demoInMemoryOAuthProvider.test.ts b/test/examples/server/demoInMemoryOAuthProvider.test.ts similarity index 96% rename from examples/shared/test/demoInMemoryOAuthProvider.test.ts rename to test/examples/server/demoInMemoryOAuthProvider.test.ts index 4018dddbe9..a49a8b426a 100644 --- a/examples/shared/test/demoInMemoryOAuthProvider.test.ts +++ b/test/examples/server/demoInMemoryOAuthProvider.test.ts @@ -1,11 +1,10 @@ -import type { OAuthClientInformationFull } from '@modelcontextprotocol/core'; -import type { AuthorizationParams } from '@modelcontextprotocol/server'; -import { InvalidRequestError } from '@modelcontextprotocol/server'; -import { createExpressResponseMock } from '@modelcontextprotocol/test-helpers'; -import type { Response } from 'express'; -import { beforeEach, describe, expect, it } from 'vitest'; - -import { DemoInMemoryAuthProvider, DemoInMemoryClientsStore } from '../src/demoInMemoryOAuthProvider.js'; +import { Response } from 'express'; +import { DemoInMemoryAuthProvider, DemoInMemoryClientsStore } from '../../../src/examples/server/demoInMemoryOAuthProvider.js'; +import { AuthorizationParams } from '../../../src/server/auth/provider.js'; +import { OAuthClientInformationFull } from '../../../src/shared/auth.js'; +import { InvalidRequestError } from '../../../src/server/auth/errors.js'; + +import { createExpressResponseMock } from '../../helpers/http.js'; describe('DemoInMemoryAuthProvider', () => { let provider: DemoInMemoryAuthProvider; diff --git a/packages/core/test/experimental/in-memory.test.ts b/test/experimental/tasks/stores/in-memory.test.ts similarity index 95% rename from packages/core/test/experimental/in-memory.test.ts rename to test/experimental/tasks/stores/in-memory.test.ts index 6520efcec6..ceef6c6d84 100644 --- a/packages/core/test/experimental/in-memory.test.ts +++ b/test/experimental/tasks/stores/in-memory.test.ts @@ -1,8 +1,7 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; - -import type { QueuedMessage } from '../../src/experimental/tasks/interfaces.js'; -import { InMemoryTaskMessageQueue, InMemoryTaskStore } from '../../src/experimental/tasks/stores/in-memory.js'; -import type { Request, TaskCreationParams } from '../../src/types/types.js'; +import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; +import { InMemoryTaskStore, InMemoryTaskMessageQueue } from '../../../../src/experimental/tasks/stores/in-memory.js'; +import { TaskCreationParams, Request } from '../../../../src/types.js'; +import { QueuedMessage } from '../../../../src/experimental/tasks/interfaces.js'; describe('InMemoryTaskStore', () => { let store: InMemoryTaskStore; @@ -241,7 +240,7 @@ describe('InMemoryTaskStore', () => { expect(task?.status).toBe('completed'); const storedResult = await store.getTaskResult(taskId); - expect(storedResult).toStrictEqual(result); + expect(storedResult).toEqual(result); }); it('should throw if task not found', async () => { @@ -275,7 +274,7 @@ describe('InMemoryTaskStore', () => { expect(task?.status).toBe('failed'); const storedResult = await store.getTaskResult(taskId); - expect(storedResult).toStrictEqual(result); + expect(storedResult).toEqual(result); }); it('should reject storing result for task already in failed status', async () => { @@ -349,7 +348,7 @@ describe('InMemoryTaskStore', () => { await store.storeTaskResult(createdTask.taskId, 'completed', result); const retrieved = await store.getTaskResult(createdTask.taskId); - expect(retrieved).toStrictEqual(result); + expect(retrieved).toEqual(result); }); }); @@ -570,14 +569,14 @@ describe('InMemoryTaskStore', () => { it('should return empty array when no tasks', () => { const tasks = store.getAllTasks(); - expect(tasks).toStrictEqual([]); + expect(tasks).toEqual([]); }); }); describe('listTasks', () => { it('should return empty list when no tasks', async () => { const result = await store.listTasks(); - expect(result.tasks).toStrictEqual([]); + expect(result.tasks).toEqual([]); expect(result.nextCursor).toBeUndefined(); }); @@ -690,7 +689,7 @@ describe('InMemoryTaskMessageQueue', () => { await queue.enqueue('task-1', requestMessage); const dequeued = await queue.dequeue('task-1'); - expect(dequeued).toStrictEqual(requestMessage); + expect(dequeued).toEqual(requestMessage); }); it('should enqueue and dequeue notification messages', async () => { @@ -707,7 +706,7 @@ describe('InMemoryTaskMessageQueue', () => { await queue.enqueue('task-2', notificationMessage); const dequeued = await queue.dequeue('task-2'); - expect(dequeued).toStrictEqual(notificationMessage); + expect(dequeued).toEqual(notificationMessage); }); it('should enqueue and dequeue response messages', async () => { @@ -724,7 +723,7 @@ describe('InMemoryTaskMessageQueue', () => { await queue.enqueue('task-3', responseMessage); const dequeued = await queue.dequeue('task-3'); - expect(dequeued).toStrictEqual(responseMessage); + expect(dequeued).toEqual(responseMessage); }); it('should return undefined when dequeuing from empty queue', async () => { @@ -768,9 +767,9 @@ describe('InMemoryTaskMessageQueue', () => { await queue.enqueue('task-fifo', notification); await queue.enqueue('task-fifo', response); - expect(await queue.dequeue('task-fifo')).toStrictEqual(request); - expect(await queue.dequeue('task-fifo')).toStrictEqual(notification); - expect(await queue.dequeue('task-fifo')).toStrictEqual(response); + expect(await queue.dequeue('task-fifo')).toEqual(request); + expect(await queue.dequeue('task-fifo')).toEqual(notification); + expect(await queue.dequeue('task-fifo')).toEqual(response); expect(await queue.dequeue('task-fifo')).toBeUndefined(); }); }); @@ -815,14 +814,14 @@ describe('InMemoryTaskMessageQueue', () => { const all = await queue.dequeueAll('task-all'); expect(all).toHaveLength(3); - expect(all[0]).toStrictEqual(request); - expect(all[1]).toStrictEqual(response); - expect(all[2]).toStrictEqual(notification); + expect(all[0]).toEqual(request); + expect(all[1]).toEqual(response); + expect(all[2]).toEqual(notification); }); it('should return empty array for non-existent task', async () => { const all = await queue.dequeueAll('non-existent'); - expect(all).toStrictEqual([]); + expect(all).toEqual([]); }); it('should clear the queue after dequeueAll', async () => { @@ -905,8 +904,8 @@ describe('InMemoryTaskMessageQueue', () => { await queue.enqueue('task-a', message1); await queue.enqueue('task-b', message2); - expect(await queue.dequeue('task-a')).toStrictEqual(message1); - expect(await queue.dequeue('task-b')).toStrictEqual(message2); + expect(await queue.dequeue('task-a')).toEqual(message1); + expect(await queue.dequeue('task-b')).toEqual(message2); expect(await queue.dequeue('task-a')).toBeUndefined(); expect(await queue.dequeue('task-b')).toBeUndefined(); }); @@ -930,7 +929,7 @@ describe('InMemoryTaskMessageQueue', () => { await queue.enqueue('task-error', errorResponse); const dequeued = await queue.dequeue('task-error'); - expect(dequeued).toStrictEqual(errorResponse); + expect(dequeued).toEqual(errorResponse); expect(dequeued?.type).toBe('error'); }); }); diff --git a/test/integration/test/experimental/tasks/task-listing.test.ts b/test/experimental/tasks/task-listing.test.ts similarity index 94% rename from test/integration/test/experimental/tasks/task-listing.test.ts rename to test/experimental/tasks/task-listing.test.ts index 28b39bb3b0..bf51f14048 100644 --- a/test/integration/test/experimental/tasks/task-listing.test.ts +++ b/test/experimental/tasks/task-listing.test.ts @@ -1,6 +1,5 @@ -import { ErrorCode, McpError } from '@modelcontextprotocol/core'; -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; - +import { describe, it, expect, beforeEach, afterEach } from 'vitest'; +import { ErrorCode, McpError } from '../../../src/types.js'; import { createInMemoryTaskEnvironment } from '../../helpers/mcp.js'; describe('Task Listing with Pagination', () => { @@ -74,7 +73,7 @@ describe('Task Listing with Pagination', () => { // Get all tasks to get a valid cursor const allTasks = taskStore.getAllTasks(); - const validCursor = allTasks[2]!.taskId; + const validCursor = allTasks[2].taskId; // Use the cursor - should work even though we don't know its internal structure const result = await client.experimental.tasks.listTasks(validCursor); @@ -110,7 +109,7 @@ describe('Task Listing with Pagination', () => { // Verify it's also accessible via tasks/list const listResult = await client.experimental.tasks.listTasks(); expect(listResult.tasks).toHaveLength(1); - expect(listResult.tasks[0]!.taskId).toBe(task.taskId); + expect(listResult.tasks[0].taskId).toBe(task.taskId); }); it('should not include related-task metadata in list response', async () => { diff --git a/test/integration/test/experimental/tasks/task.test.ts b/test/experimental/tasks/task.test.ts similarity index 95% rename from test/integration/test/experimental/tasks/task.test.ts rename to test/experimental/tasks/task.test.ts index 8a99fe513a..37e3938d28 100644 --- a/test/integration/test/experimental/tasks/task.test.ts +++ b/test/experimental/tasks/task.test.ts @@ -1,6 +1,6 @@ -import { isTerminal } from '@modelcontextprotocol/core'; -import type { Task } from '@modelcontextprotocol/server'; -import { describe, expect, it } from 'vitest'; +import { describe, it, expect } from 'vitest'; +import { isTerminal } from '../../../src/experimental/tasks/interfaces.js'; +import type { Task } from '../../../src/types.js'; describe('Task utility functions', () => { describe('isTerminal', () => { diff --git a/test/helpers/eslint.config.mjs b/test/helpers/eslint.config.mjs deleted file mode 100644 index 951c9f3a91..0000000000 --- a/test/helpers/eslint.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -// @ts-check - -import baseConfig from '@modelcontextprotocol/eslint-config'; - -export default baseConfig; diff --git a/test/helpers/src/helpers/http.ts b/test/helpers/http.ts similarity index 85% rename from test/helpers/src/helpers/http.ts rename to test/helpers/http.ts index 86252e10f3..291cc37fab 100644 --- a/test/helpers/src/helpers/http.ts +++ b/test/helpers/http.ts @@ -1,7 +1,7 @@ -import type { Server, ServerResponse } from 'node:http'; -import type { AddressInfo } from 'node:net'; - +import type http from 'node:http'; +import { type Server } from 'node:http'; import type { Response } from 'express'; +import { AddressInfo } from 'node:net'; import { vi } from 'vitest'; /** @@ -84,13 +84,13 @@ export function createExpressResponseMock(options: { trackRedirectUrl?: boolean * All core methods are jest/vitest fns returning `this` so that * tests can assert on writeHead/write/on/end calls. */ -export function createNodeServerResponseMock(): ServerResponse { +export function createNodeServerResponseMock(): http.ServerResponse { const res = { - writeHead: vi.fn().mockReturnThis(), - write: vi.fn().mockReturnThis(), - on: vi.fn().mockReturnThis(), - end: vi.fn().mockReturnThis() + writeHead: vi.fn().mockReturnThis(), + write: vi.fn().mockReturnThis(), + on: vi.fn().mockReturnThis(), + end: vi.fn().mockReturnThis() }; - return res as unknown as ServerResponse; + return res as unknown as http.ServerResponse; } diff --git a/test/integration/test/helpers/mcp.ts b/test/helpers/mcp.ts similarity index 82% rename from test/integration/test/helpers/mcp.ts rename to test/helpers/mcp.ts index 5c53c7a925..6cd08fdf00 100644 --- a/test/integration/test/helpers/mcp.ts +++ b/test/helpers/mcp.ts @@ -1,7 +1,8 @@ -import { Client } from '@modelcontextprotocol/client'; -import { InMemoryTransport } from '@modelcontextprotocol/core'; -import type { ClientCapabilities, ServerCapabilities } from '@modelcontextprotocol/server'; -import { InMemoryTaskMessageQueue, InMemoryTaskStore, Server } from '@modelcontextprotocol/server'; +import { InMemoryTransport } from '../../src/inMemory.js'; +import { Client } from '../../src/client/index.js'; +import { Server } from '../../src/server/index.js'; +import { InMemoryTaskStore, InMemoryTaskMessageQueue } from '../../src/experimental/tasks/stores/in-memory.js'; +import type { ClientCapabilities, ServerCapabilities } from '../../src/types.js'; export interface InMemoryTaskEnvironment { client: Client; diff --git a/test/helpers/src/helpers/oauth.ts b/test/helpers/oauth.ts similarity index 90% rename from test/helpers/src/helpers/oauth.ts rename to test/helpers/oauth.ts index 15780beeee..c08350efff 100644 --- a/test/helpers/src/helpers/oauth.ts +++ b/test/helpers/oauth.ts @@ -1,5 +1,4 @@ -import type { FetchLike } from '@modelcontextprotocol/core'; -import { vi } from 'vitest'; +import type { FetchLike } from '../../src/shared/transport.js'; export interface MockOAuthFetchOptions { resourceServerUrl: string; @@ -77,13 +76,12 @@ export function createMockOAuthFetch(options: MockOAuthFetchOptions): FetchLike }; } -type MockFetch = (...args: unknown[]) => unknown; - /** * Helper to install a vi.fn-based global.fetch mock for tests that rely on global fetch. */ -export function mockGlobalFetch(): MockFetch { - const mockFetch = vi.fn() as unknown as MockFetch; - (globalThis as { fetch?: MockFetch }).fetch = mockFetch; +export function mockGlobalFetch() { + const mockFetch = vi.fn(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (globalThis as any).fetch = mockFetch; return mockFetch; } diff --git a/test/helpers/package.json b/test/helpers/package.json deleted file mode 100644 index 3d17b9d85a..0000000000 --- a/test/helpers/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@modelcontextprotocol/test-helpers", - "private": true, - "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": ">=20", - "pnpm": ">=10.24.0" - }, - "packageManager": "pnpm@10.24.0", - "keywords": [ - "modelcontextprotocol", - "mcp" - ], - "scripts": { - "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", - "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "npm run typecheck && npm run lint", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" - }, - "devDependencies": { - "@modelcontextprotocol/core": "workspace:^", - "@modelcontextprotocol/client": "workspace:^", - "@modelcontextprotocol/server": "workspace:^", - "zod": "catalog:runtimeShared", - "vitest": "catalog:devTools", - "@modelcontextprotocol/tsconfig": "workspace:^", - "@modelcontextprotocol/vitest-config": "workspace:^", - "@modelcontextprotocol/eslint-config": "workspace:^" - } -} diff --git a/test/helpers/src/fixtures/zodTestMatrix.ts b/test/helpers/src/fixtures/zodTestMatrix.ts deleted file mode 100644 index fc4ee63db1..0000000000 --- a/test/helpers/src/fixtures/zodTestMatrix.ts +++ /dev/null @@ -1,22 +0,0 @@ -import * as z3 from 'zod/v3'; -import * as z4 from 'zod/v4'; - -// Shared Zod namespace type that exposes the common surface area used in tests. -export type ZNamespace = typeof z3 & typeof z4; - -export const zodTestMatrix = [ - { - zodVersionLabel: 'Zod v3', - z: z3 as ZNamespace, - isV3: true as const, - isV4: false as const - }, - { - zodVersionLabel: 'Zod v4', - z: z4 as ZNamespace, - isV3: false as const, - isV4: true as const - } -] as const; - -export type ZodMatrixEntry = (typeof zodTestMatrix)[number]; diff --git a/test/helpers/src/index.ts b/test/helpers/src/index.ts deleted file mode 100644 index 2154c889cd..0000000000 --- a/test/helpers/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './fixtures/zodTestMatrix.js'; -export * from './helpers/http.js'; -export * from './helpers/oauth.js'; -export * from './helpers/tasks.js'; diff --git a/test/helpers/src/helpers/tasks.ts b/test/helpers/tasks.ts similarity index 94% rename from test/helpers/src/helpers/tasks.ts rename to test/helpers/tasks.ts index 4db3231a67..d2fed9f5da 100644 --- a/test/helpers/src/helpers/tasks.ts +++ b/test/helpers/tasks.ts @@ -1,4 +1,4 @@ -import type { Task } from '@modelcontextprotocol/core'; +import type { Task } from '../../src/types.js'; /** * Polls the provided getTask function until the task reaches the desired status or times out. diff --git a/test/helpers/tsconfig.json b/test/helpers/tsconfig.json deleted file mode 100644 index b5c57f756e..0000000000 --- a/test/helpers/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "@modelcontextprotocol/tsconfig", - "include": ["./", "../integration/test/helpers/mcp.ts"], - "exclude": ["node_modules", "dist"], - "compilerOptions": { - "paths": { - "*": ["./*"], - "@modelcontextprotocol/core": ["./node_modules/@modelcontextprotocol/core/src/index.ts"], - "@modelcontextprotocol/client": ["./node_modules/@modelcontextprotocol/client/src/index.ts"], - "@modelcontextprotocol/server": ["./node_modules/@modelcontextprotocol/server/src/index.ts"], - "@modelcontextprotocol/vitest-config": ["./node_modules/@modelcontextprotocol/vitest-config/tsconfig.json"] - } - } -} diff --git a/test/helpers/vitest.config.js b/test/helpers/vitest.config.js deleted file mode 100644 index 38f030fdd6..0000000000 --- a/test/helpers/vitest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import baseConfig from '../../common/vitest-config/vitest.config.js'; - -export default baseConfig; diff --git a/packages/core/test/inMemory.test.ts b/test/inMemory.test.ts similarity index 95% rename from packages/core/test/inMemory.test.ts rename to test/inMemory.test.ts index 72f28240b3..f42420067b 100644 --- a/packages/core/test/inMemory.test.ts +++ b/test/inMemory.test.ts @@ -1,5 +1,6 @@ -import type { AuthInfo, JSONRPCMessage } from '../src/types/types.js'; -import { InMemoryTransport } from '../src/util/inMemory.js'; +import { InMemoryTransport } from '../src/inMemory.js'; +import { JSONRPCMessage } from '../src/types.js'; +import { AuthInfo } from '../src/server/auth/types.js'; describe('InMemoryTransport', () => { let clientTransport: InMemoryTransport; diff --git a/test/integration/test/processCleanup.test.ts b/test/integration-tests/processCleanup.test.ts similarity index 89% rename from test/integration/test/processCleanup.test.ts rename to test/integration-tests/processCleanup.test.ts index aa991501e1..11940697b9 100644 --- a/test/integration/test/processCleanup.test.ts +++ b/test/integration-tests/processCleanup.test.ts @@ -1,11 +1,12 @@ import path from 'node:path'; import { Readable, Writable } from 'node:stream'; +import { Client } from '../../src/client/index.js'; +import { StdioClientTransport } from '../../src/client/stdio.js'; +import { Server } from '../../src/server/index.js'; +import { StdioServerTransport } from '../../src/server/stdio.js'; +import { LoggingMessageNotificationSchema } from '../../src/types.js'; -import { Client, StdioClientTransport } from '@modelcontextprotocol/client'; -import { LoggingMessageNotificationSchema, Server, StdioServerTransport } from '@modelcontextprotocol/server'; - -// Use the local fixtures directory alongside this test file -const FIXTURES_DIR = path.resolve(__dirname, './__fixtures__'); +const FIXTURES_DIR = path.resolve(__dirname, '../../src/__fixtures__'); describe('Process cleanup', () => { vi.setConfig({ testTimeout: 5000 }); // 5 second timeout diff --git a/test/integration/test/stateManagementStreamableHttp.test.ts b/test/integration-tests/stateManagementStreamableHttp.test.ts similarity index 96% rename from test/integration/test/stateManagementStreamableHttp.test.ts rename to test/integration-tests/stateManagementStreamableHttp.test.ts index c33100efad..d79d95c757 100644 --- a/test/integration/test/stateManagementStreamableHttp.test.ts +++ b/test/integration-tests/stateManagementStreamableHttp.test.ts @@ -1,18 +1,18 @@ -import { randomUUID } from 'node:crypto'; import { createServer, type Server } from 'node:http'; - -import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'; +import { randomUUID } from 'node:crypto'; +import { Client } from '../../src/client/index.js'; +import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp.js'; +import { McpServer } from '../../src/server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../src/server/streamableHttp.js'; import { CallToolResultSchema, - LATEST_PROTOCOL_VERSION, - ListPromptsResultSchema, - ListResourcesResultSchema, ListToolsResultSchema, - McpServer, - StreamableHTTPServerTransport -} from '@modelcontextprotocol/server'; -import { listenOnRandomPort } from '@modelcontextprotocol/test-helpers'; -import { type ZodMatrixEntry, zodTestMatrix } from '@modelcontextprotocol/test-helpers'; + ListResourcesResultSchema, + ListPromptsResultSchema, + LATEST_PROTOCOL_VERSION +} from '../../src/types.js'; +import { zodTestMatrix, type ZodMatrixEntry } from '../../src/__fixtures__/zodTestMatrix.js'; +import { listenOnRandomPort } from '../helpers/http.js'; describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const { z } = entry; diff --git a/test/integration/test/taskLifecycle.test.ts b/test/integration-tests/taskLifecycle.test.ts similarity index 97% rename from test/integration/test/taskLifecycle.test.ts rename to test/integration-tests/taskLifecycle.test.ts index 216479e938..629a61b669 100644 --- a/test/integration/test/taskLifecycle.test.ts +++ b/test/integration-tests/taskLifecycle.test.ts @@ -1,24 +1,24 @@ -import { randomUUID } from 'node:crypto'; import { createServer, type Server } from 'node:http'; - -import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'; -import type { TaskRequestOptions } from '@modelcontextprotocol/server'; +import { randomUUID } from 'node:crypto'; +import { Client } from '../../src/client/index.js'; +import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp.js'; +import { McpServer } from '../../src/server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../src/server/streamableHttp.js'; import { CallToolResultSchema, CreateTaskResultSchema, ElicitRequestSchema, ElicitResultSchema, ErrorCode, - InMemoryTaskMessageQueue, - InMemoryTaskStore, McpError, - McpServer, RELATED_TASK_META_KEY, - StreamableHTTPServerTransport, TaskSchema -} from '@modelcontextprotocol/server'; -import { listenOnRandomPort, waitForTaskStatus } from '@modelcontextprotocol/test-helpers'; +} from '../../src/types.js'; import { z } from 'zod'; +import { InMemoryTaskStore, InMemoryTaskMessageQueue } from '../../src/experimental/tasks/stores/in-memory.js'; +import type { TaskRequestOptions } from '../../src/shared/protocol.js'; +import { listenOnRandomPort } from '../helpers/http.js'; +import { waitForTaskStatus } from '../helpers/tasks.js'; describe('Task Lifecycle Integration Tests', () => { let server: Server; @@ -556,9 +556,9 @@ describe('Task Lifecycle Integration Tests', () => { // Verify all messages were delivered in order expect(receivedMessages.length).toBe(3); - expect(receivedMessages[0]!.message).toBe('Request 1 of 3'); - expect(receivedMessages[1]!.message).toBe('Request 2 of 3'); - expect(receivedMessages[2]!.message).toBe('Request 3 of 3'); + expect(receivedMessages[0].message).toBe('Request 1 of 3'); + expect(receivedMessages[1].message).toBe('Request 2 of 3'); + expect(receivedMessages[2].message).toBe('Request 3 of 3'); // Verify final result includes all responses expect(result.content).toEqual([{ type: 'text', text: 'Received responses: Response 1, Response 2, Response 3' }]); @@ -1274,14 +1274,14 @@ describe('Task Lifecycle Integration Tests', () => { // Verify all 3 messages were delivered expect(receivedMessages.length).toBe(3); - expect(receivedMessages[0]!.message).toBe('Streaming message 1 of 3'); - expect(receivedMessages[1]!.message).toBe('Streaming message 2 of 3'); - expect(receivedMessages[2]!.message).toBe('Streaming message 3 of 3'); + expect(receivedMessages[0].message).toBe('Streaming message 1 of 3'); + expect(receivedMessages[1].message).toBe('Streaming message 2 of 3'); + expect(receivedMessages[2].message).toBe('Streaming message 3 of 3'); // Verify messages were delivered over time (not all at once) // The delay between messages should be approximately 300ms - const timeBetweenFirstAndSecond = receivedMessages[1]!.timestamp - receivedMessages[0]!.timestamp; - const timeBetweenSecondAndThird = receivedMessages[2]!.timestamp - receivedMessages[1]!.timestamp; + const timeBetweenFirstAndSecond = receivedMessages[1].timestamp - receivedMessages[0].timestamp; + const timeBetweenSecondAndThird = receivedMessages[2].timestamp - receivedMessages[1].timestamp; // Allow some tolerance for timing (messages should be at least 200ms apart) expect(timeBetweenFirstAndSecond).toBeGreaterThan(200); @@ -1470,8 +1470,8 @@ describe('Task Lifecycle Integration Tests', () => { // Verify all queued messages were delivered before the final result expect(receivedMessages.length).toBe(2); - expect(receivedMessages[0]!.message).toBe('Quick message 1 of 2'); - expect(receivedMessages[1]!.message).toBe('Quick message 2 of 2'); + expect(receivedMessages[0].message).toBe('Quick message 1 of 2'); + expect(receivedMessages[1].message).toBe('Quick message 2 of 2'); // Verify final result is correct expect(result.content).toEqual([{ type: 'text', text: 'Task completed quickly' }]); @@ -1638,15 +1638,15 @@ describe('Task Lifecycle Integration Tests', () => { expect(messages.length).toBeGreaterThanOrEqual(2); // First message should be taskCreated - expect(messages[0]!.type).toBe('taskCreated'); - expect(messages[0]!.task).toBeDefined(); + expect(messages[0].type).toBe('taskCreated'); + expect(messages[0].task).toBeDefined(); // Should have a taskStatus message const statusMessages = messages.filter(m => m.type === 'taskStatus'); expect(statusMessages.length).toBeGreaterThanOrEqual(1); // Last message should be result - const lastMessage = messages[messages.length - 1]!; + const lastMessage = messages[messages.length - 1]; expect(lastMessage.type).toBe('result'); expect(lastMessage.result).toBeDefined(); diff --git a/test/integration/test/taskResumability.test.ts b/test/integration-tests/taskResumability.test.ts similarity index 85% rename from test/integration/test/taskResumability.test.ts rename to test/integration-tests/taskResumability.test.ts index 1e4d8a0fd7..187a3d2ff7 100644 --- a/test/integration/test/taskResumability.test.ts +++ b/test/integration-tests/taskResumability.test.ts @@ -1,50 +1,13 @@ -import { randomUUID } from 'node:crypto'; import { createServer, type Server } from 'node:http'; - -import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'; -import { - CallToolResultSchema, - LoggingMessageNotificationSchema, - McpServer, - StreamableHTTPServerTransport -} from '@modelcontextprotocol/server'; -import type { EventStore, JSONRPCMessage } from '@modelcontextprotocol/server'; -import type { ZodMatrixEntry } from '@modelcontextprotocol/test-helpers'; -import { listenOnRandomPort, zodTestMatrix } from '@modelcontextprotocol/test-helpers'; - -/** - * Simple in-memory EventStore for testing resumability. - */ -class InMemoryEventStore implements EventStore { - private events = new Map(); - - async storeEvent(streamId: string, message: JSONRPCMessage): Promise { - const eventId = `${streamId}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`; - this.events.set(eventId, { streamId, message }); - return eventId; - } - - async replayEventsAfter( - lastEventId: string, - { send }: { send: (eventId: string, message: JSONRPCMessage) => Promise } - ): Promise { - if (!lastEventId || !this.events.has(lastEventId)) return ''; - const streamId = lastEventId.split('_')[0] ?? ''; - if (!streamId) return ''; - - let found = false; - const sorted = [...this.events.entries()].sort((a, b) => a[0].localeCompare(b[0])); - for (const [eventId, { streamId: sid, message }] of sorted) { - if (sid !== streamId) continue; - if (eventId === lastEventId) { - found = true; - continue; - } - if (found) await send(eventId, message); - } - return streamId; - } -} +import { randomUUID } from 'node:crypto'; +import { Client } from '../../src/client/index.js'; +import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp.js'; +import { McpServer } from '../../src/server/mcp.js'; +import { StreamableHTTPServerTransport } from '../../src/server/streamableHttp.js'; +import { CallToolResultSchema, LoggingMessageNotificationSchema } from '../../src/types.js'; +import { InMemoryEventStore } from '../../src/examples/shared/inMemoryEventStore.js'; +import { zodTestMatrix, type ZodMatrixEntry } from '../../src/__fixtures__/zodTestMatrix.js'; +import { listenOnRandomPort } from '../helpers/http.js'; describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const { z } = entry; diff --git a/test/integration/eslint.config.mjs b/test/integration/eslint.config.mjs deleted file mode 100644 index 951c9f3a91..0000000000 --- a/test/integration/eslint.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -// @ts-check - -import baseConfig from '@modelcontextprotocol/eslint-config'; - -export default baseConfig; diff --git a/test/integration/package.json b/test/integration/package.json deleted file mode 100644 index e709e431af..0000000000 --- a/test/integration/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "@modelcontextprotocol/test-integration", - "private": true, - "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": ">=20", - "pnpm": ">=10.24.0" - }, - "packageManager": "pnpm@10.24.0", - "keywords": [ - "modelcontextprotocol", - "mcp" - ], - "scripts": { - "lint": "eslint test/ && prettier --ignore-path ../../.prettierignore --check .", - "lint:fix": "eslint test/ --fix && prettier --ignore-path ../../.prettierignore --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" - }, - "devDependencies": { - "@modelcontextprotocol/core": "workspace:^", - "@modelcontextprotocol/client": "workspace:^", - "@modelcontextprotocol/server": "workspace:^", - "zod": "catalog:runtimeShared", - "vitest": "catalog:devTools", - "supertest": "catalog:devTools", - "@modelcontextprotocol/tsconfig": "workspace:^", - "@modelcontextprotocol/vitest-config": "workspace:^", - "@modelcontextprotocol/eslint-config": "workspace:^", - "@modelcontextprotocol/test-helpers": "workspace:^" - } -} diff --git a/test/integration/test/issues/test_1277_zod_v4_description.test.ts b/test/integration/test/issues/test_1277_zod_v4_description.test.ts deleted file mode 100644 index fe58cfcd50..0000000000 --- a/test/integration/test/issues/test_1277_zod_v4_description.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Regression test for https://github.com/modelcontextprotocol/typescript-sdk/issues/1277 - * - * Zod v4 stores `.describe()` descriptions directly on the schema object, - * not in `._zod.def.description`. This test verifies that descriptions are - * correctly extracted for prompt arguments. - */ - -import { Client } from '@modelcontextprotocol/client'; -import { InMemoryTransport, ListPromptsResultSchema } from '@modelcontextprotocol/core'; -import { McpServer } from '@modelcontextprotocol/server'; -import { type ZodMatrixEntry, zodTestMatrix } from '@modelcontextprotocol/test-helpers'; - -describe.each(zodTestMatrix)('Issue #1277: $zodVersionLabel', (entry: ZodMatrixEntry) => { - const { z } = entry; - - test('should preserve argument descriptions from .describe()', async () => { - const mcpServer = new McpServer({ - name: 'test server', - version: '1.0' - }); - const client = new Client({ - name: 'test client', - version: '1.0' - }); - - mcpServer.prompt( - 'test', - { - name: z.string().describe('The user name'), - value: z.string().describe('The value to set') - }, - async ({ name, value }) => ({ - messages: [ - { - role: 'assistant', - content: { - type: 'text', - text: `${name}: ${value}` - } - } - ] - }) - ); - - const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); - - await Promise.all([client.connect(clientTransport), mcpServer.server.connect(serverTransport)]); - - const result = await client.request( - { - method: 'prompts/list' - }, - ListPromptsResultSchema - ); - - expect(result.prompts).toHaveLength(1); - expect(result.prompts[0]!.name).toBe('test'); - expect(result.prompts[0]!.arguments).toEqual([ - { name: 'name', required: true, description: 'The user name' }, - { name: 'value', required: true, description: 'The value to set' } - ]); - }); -}); diff --git a/test/integration/tsconfig.json b/test/integration/tsconfig.json deleted file mode 100644 index f69a602fd1..0000000000 --- a/test/integration/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "@modelcontextprotocol/tsconfig", - "include": ["./"], - "exclude": ["node_modules", "dist"], - "compilerOptions": { - "paths": { - "*": ["./*"], - "@modelcontextprotocol/core": ["./node_modules/@modelcontextprotocol/core/src/index.ts"], - "@modelcontextprotocol/client": ["./node_modules/@modelcontextprotocol/client/src/index.ts"], - "@modelcontextprotocol/server": ["./node_modules/@modelcontextprotocol/server/src/index.ts"], - "@modelcontextprotocol/vitest-config": ["./node_modules/@modelcontextprotocol/vitest-config/tsconfig.json"], - "@modelcontextprotocol/test-helpers": ["./node_modules/@modelcontextprotocol/test-helpers/src/index.ts"] - } - } -} diff --git a/test/integration/vitest.config.js b/test/integration/vitest.config.js deleted file mode 100644 index 38f030fdd6..0000000000 --- a/test/integration/vitest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import baseConfig from '../../common/vitest-config/vitest.config.js'; - -export default baseConfig; diff --git a/packages/server/test/server/auth/handlers/authorize.test.ts b/test/server/auth/handlers/authorize.test.ts similarity index 90% rename from packages/server/test/server/auth/handlers/authorize.test.ts rename to test/server/auth/handlers/authorize.test.ts index b84de3bc3f..0f831ae7de 100644 --- a/packages/server/test/server/auth/handlers/authorize.test.ts +++ b/test/server/auth/handlers/authorize.test.ts @@ -1,13 +1,11 @@ -import type { AuthInfo, OAuthClientInformationFull, OAuthTokens } from '@modelcontextprotocol/core'; -import { InvalidTokenError } from '@modelcontextprotocol/core'; -import type { Response } from 'express'; -import express from 'express'; +import { authorizationHandler, AuthorizationHandlerOptions } from '../../../../src/server/auth/handlers/authorize.js'; +import { OAuthServerProvider, AuthorizationParams } from '../../../../src/server/auth/provider.js'; +import { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; +import { OAuthClientInformationFull, OAuthTokens } from '../../../../src/shared/auth.js'; +import express, { Response } from 'express'; import supertest from 'supertest'; - -import type { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; -import type { AuthorizationHandlerOptions } from '../../../../src/server/auth/handlers/authorize.js'; -import { authorizationHandler } from '../../../../src/server/auth/handlers/authorize.js'; -import type { AuthorizationParams, OAuthServerProvider } from '../../../../src/server/auth/provider.js'; +import { AuthInfo } from '../../../../src/server/auth/types.js'; +import { InvalidTokenError } from '../../../../src/server/auth/errors.js'; describe('Authorization Handler', () => { // Mock client data @@ -134,7 +132,7 @@ describe('Authorization Handler', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.origin + location.pathname).toBe('https://example.com/callback'); }); @@ -171,7 +169,7 @@ describe('Authorization Handler', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.origin + location.pathname).toBe('https://example.com/callback'); }); }); @@ -187,7 +185,7 @@ describe('Authorization Handler', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.searchParams.get('error')).toBe('invalid_request'); }); @@ -201,7 +199,7 @@ describe('Authorization Handler', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.searchParams.get('error')).toBe('invalid_request'); }); @@ -215,7 +213,7 @@ describe('Authorization Handler', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.searchParams.get('error')).toBe('invalid_request'); }); }); @@ -259,7 +257,7 @@ describe('Authorization Handler', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.origin + location.pathname).toBe('https://example.com/callback'); expect(location.searchParams.get('code')).toBe('mock_auth_code'); expect(location.searchParams.get('state')).toBe('xyz789'); @@ -276,7 +274,7 @@ describe('Authorization Handler', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.searchParams.get('state')).toBe('state-value-123'); }); @@ -289,7 +287,7 @@ describe('Authorization Handler', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.searchParams.has('code')).toBe(true); }); }); diff --git a/packages/server/test/server/auth/handlers/metadata.test.ts b/test/server/auth/handlers/metadata.test.ts similarity index 97% rename from packages/server/test/server/auth/handlers/metadata.test.ts rename to test/server/auth/handlers/metadata.test.ts index 0dc51e51d7..2eb7693f2f 100644 --- a/packages/server/test/server/auth/handlers/metadata.test.ts +++ b/test/server/auth/handlers/metadata.test.ts @@ -1,9 +1,8 @@ -import type { OAuthMetadata } from '@modelcontextprotocol/core'; +import { metadataHandler } from '../../../../src/server/auth/handlers/metadata.js'; +import { OAuthMetadata } from '../../../../src/shared/auth.js'; import express from 'express'; import supertest from 'supertest'; -import { metadataHandler } from '../../../../src/server/auth/handlers/metadata.js'; - describe('Metadata Handler', () => { const exampleMetadata: OAuthMetadata = { issuer: 'https://auth.example.com', diff --git a/packages/server/test/server/auth/handlers/register.test.ts b/test/server/auth/handlers/register.test.ts similarity index 96% rename from packages/server/test/server/auth/handlers/register.test.ts rename to test/server/auth/handlers/register.test.ts index b10e048eda..03fde46d23 100644 --- a/packages/server/test/server/auth/handlers/register.test.ts +++ b/test/server/auth/handlers/register.test.ts @@ -1,11 +1,9 @@ -import type { OAuthClientInformationFull, OAuthClientMetadata } from '@modelcontextprotocol/core'; +import { clientRegistrationHandler, ClientRegistrationHandlerOptions } from '../../../../src/server/auth/handlers/register.js'; +import { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; +import { OAuthClientInformationFull, OAuthClientMetadata } from '../../../../src/shared/auth.js'; import express from 'express'; import supertest from 'supertest'; -import type { MockInstance } from 'vitest'; - -import type { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; -import type { ClientRegistrationHandlerOptions } from '../../../../src/server/auth/handlers/register.js'; -import { clientRegistrationHandler } from '../../../../src/server/auth/handlers/register.js'; +import { MockInstance } from 'vitest'; describe('Client Registration Handler', () => { // Mock client store with registration support diff --git a/packages/server/test/server/auth/handlers/revoke.test.ts b/test/server/auth/handlers/revoke.test.ts similarity index 92% rename from packages/server/test/server/auth/handlers/revoke.test.ts rename to test/server/auth/handlers/revoke.test.ts index 61ff51b246..69cac83d94 100644 --- a/packages/server/test/server/auth/handlers/revoke.test.ts +++ b/test/server/auth/handlers/revoke.test.ts @@ -1,14 +1,12 @@ -import type { AuthInfo, OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; -import { InvalidTokenError } from '@modelcontextprotocol/core'; -import type { Response } from 'express'; -import express from 'express'; +import { revocationHandler, RevocationHandlerOptions } from '../../../../src/server/auth/handlers/revoke.js'; +import { OAuthServerProvider, AuthorizationParams } from '../../../../src/server/auth/provider.js'; +import { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; +import { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '../../../../src/shared/auth.js'; +import express, { Response } from 'express'; import supertest from 'supertest'; -import type { MockInstance } from 'vitest'; - -import type { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; -import type { RevocationHandlerOptions } from '../../../../src/server/auth/handlers/revoke.js'; -import { revocationHandler } from '../../../../src/server/auth/handlers/revoke.js'; -import type { AuthorizationParams, OAuthServerProvider } from '../../../../src/server/auth/provider.js'; +import { AuthInfo } from '../../../../src/server/auth/types.js'; +import { InvalidTokenError } from '../../../../src/server/auth/errors.js'; +import { MockInstance } from 'vitest'; describe('Revocation Handler', () => { // Mock client data diff --git a/packages/server/test/server/auth/handlers/token.test.ts b/test/server/auth/handlers/token.test.ts similarity index 96% rename from packages/server/test/server/auth/handlers/token.test.ts rename to test/server/auth/handlers/token.test.ts index 02eab891f8..658142b4b5 100644 --- a/packages/server/test/server/auth/handlers/token.test.ts +++ b/test/server/auth/handlers/token.test.ts @@ -1,16 +1,14 @@ -import type { AuthInfo, OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; -import { InvalidGrantError, InvalidTokenError } from '@modelcontextprotocol/core'; -import type { Response } from 'express'; -import express from 'express'; -import * as pkceChallenge from 'pkce-challenge'; +import { tokenHandler, TokenHandlerOptions } from '../../../../src/server/auth/handlers/token.js'; +import { OAuthServerProvider, AuthorizationParams } from '../../../../src/server/auth/provider.js'; +import { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; +import { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '../../../../src/shared/auth.js'; +import express, { Response } from 'express'; import supertest from 'supertest'; -import { type Mock } from 'vitest'; - -import type { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; -import type { TokenHandlerOptions } from '../../../../src/server/auth/handlers/token.js'; -import { tokenHandler } from '../../../../src/server/auth/handlers/token.js'; -import type { AuthorizationParams, OAuthServerProvider } from '../../../../src/server/auth/provider.js'; +import * as pkceChallenge from 'pkce-challenge'; +import { InvalidGrantError, InvalidTokenError } from '../../../../src/server/auth/errors.js'; +import { AuthInfo } from '../../../../src/server/auth/types.js'; import { ProxyOAuthServerProvider } from '../../../../src/server/auth/providers/proxyProvider.js'; +import { type Mock } from 'vitest'; // Mock pkce-challenge vi.mock('pkce-challenge', () => ({ diff --git a/packages/server/test/server/auth/middleware/allowedMethods.test.ts b/test/server/auth/middleware/allowedMethods.test.ts similarity index 96% rename from packages/server/test/server/auth/middleware/allowedMethods.test.ts rename to test/server/auth/middleware/allowedMethods.test.ts index 40e9c3b1fa..7c939de6aa 100644 --- a/packages/server/test/server/auth/middleware/allowedMethods.test.ts +++ b/test/server/auth/middleware/allowedMethods.test.ts @@ -1,8 +1,6 @@ -import type { Request, Response } from 'express'; -import express from 'express'; -import request from 'supertest'; - import { allowedMethods } from '../../../../src/server/auth/middleware/allowedMethods.js'; +import express, { Request, Response } from 'express'; +import request from 'supertest'; describe('allowedMethods', () => { let app: express.Express; diff --git a/packages/server/test/server/auth/middleware/bearerAuth.test.ts b/test/server/auth/middleware/bearerAuth.test.ts similarity index 98% rename from packages/server/test/server/auth/middleware/bearerAuth.test.ts rename to test/server/auth/middleware/bearerAuth.test.ts index 7b464bbff6..68162be9b4 100644 --- a/packages/server/test/server/auth/middleware/bearerAuth.test.ts +++ b/test/server/auth/middleware/bearerAuth.test.ts @@ -1,11 +1,10 @@ -import type { AuthInfo } from '@modelcontextprotocol/core'; -import { CustomOAuthError, InsufficientScopeError, InvalidTokenError, ServerError } from '@modelcontextprotocol/core'; -import { createExpressResponseMock } from '@modelcontextprotocol/test-helpers'; -import type { Request, Response } from 'express'; -import type { Mock } from 'vitest'; - +import { Request, Response } from 'express'; +import { Mock } from 'vitest'; import { requireBearerAuth } from '../../../../src/server/auth/middleware/bearerAuth.js'; -import type { OAuthTokenVerifier } from '../../../../src/server/auth/provider.js'; +import { AuthInfo } from '../../../../src/server/auth/types.js'; +import { InsufficientScopeError, InvalidTokenError, CustomOAuthError, ServerError } from '../../../../src/server/auth/errors.js'; +import { OAuthTokenVerifier } from '../../../../src/server/auth/provider.js'; +import { createExpressResponseMock } from '../../../helpers/http.js'; // Mock verifier const mockVerifyAccessToken = vi.fn(); diff --git a/packages/server/test/server/auth/middleware/clientAuth.test.ts b/test/server/auth/middleware/clientAuth.test.ts similarity index 92% rename from packages/server/test/server/auth/middleware/clientAuth.test.ts rename to test/server/auth/middleware/clientAuth.test.ts index 55a00f0c25..50cc1d9076 100644 --- a/packages/server/test/server/auth/middleware/clientAuth.test.ts +++ b/test/server/auth/middleware/clientAuth.test.ts @@ -1,11 +1,9 @@ -import type { OAuthClientInformationFull } from '@modelcontextprotocol/core'; +import { authenticateClient, ClientAuthenticationMiddlewareOptions } from '../../../../src/server/auth/middleware/clientAuth.js'; +import { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; +import { OAuthClientInformationFull } from '../../../../src/shared/auth.js'; import express from 'express'; import supertest from 'supertest'; -import type { OAuthRegisteredClientsStore } from '../../../../src/server/auth/clients.js'; -import type { ClientAuthenticationMiddlewareOptions } from '../../../../src/server/auth/middleware/clientAuth.js'; -import { authenticateClient } from '../../../../src/server/auth/middleware/clientAuth.js'; - describe('clientAuth middleware', () => { // Mock client store const mockClientStore: OAuthRegisteredClientsStore = { diff --git a/packages/server/test/server/auth/providers/proxyProvider.test.ts b/test/server/auth/providers/proxyProvider.test.ts similarity index 95% rename from packages/server/test/server/auth/providers/proxyProvider.test.ts rename to test/server/auth/providers/proxyProvider.test.ts index 375179e5b5..40fb55d572 100644 --- a/packages/server/test/server/auth/providers/proxyProvider.test.ts +++ b/test/server/auth/providers/proxyProvider.test.ts @@ -1,11 +1,12 @@ -import type { AuthInfo, OAuthClientInformationFull, OAuthTokens } from '@modelcontextprotocol/core'; -import { InsufficientScopeError, InvalidTokenError, ServerError } from '@modelcontextprotocol/core'; -import type { Response } from 'express'; +import { Response } from 'express'; +import { ProxyOAuthServerProvider, ProxyOptions } from '../../../../src/server/auth/providers/proxyProvider.js'; +import { AuthInfo } from '../../../../src/server/auth/types.js'; +import { OAuthClientInformationFull, OAuthTokens } from '../../../../src/shared/auth.js'; +import { ServerError } from '../../../../src/server/auth/errors.js'; +import { InvalidTokenError } from '../../../../src/server/auth/errors.js'; +import { InsufficientScopeError } from '../../../../src/server/auth/errors.js'; import { type Mock } from 'vitest'; -import type { ProxyOptions } from '../../../../src/server/auth/providers/proxyProvider.js'; -import { ProxyOAuthServerProvider } from '../../../../src/server/auth/providers/proxyProvider.js'; - describe('Proxy OAuth Server Provider', () => { // Mock client data const validClient: OAuthClientInformationFull = { @@ -183,7 +184,7 @@ describe('Proxy OAuth Server Provider', () => { const tokens = await provider.exchangeAuthorizationCode(validClient, 'test-code', 'test-verifier'); const fetchCall = (global.fetch as Mock).mock.calls[0]; - const body = fetchCall![1].body as string; + const body = fetchCall[1].body as string; expect(body).not.toContain('resource='); expect(tokens).toEqual(mockTokenResponse); }); diff --git a/packages/server/test/server/auth/router.test.ts b/test/server/auth/router.test.ts similarity index 96% rename from packages/server/test/server/auth/router.test.ts rename to test/server/auth/router.test.ts index 250fca4c46..521c650c4d 100644 --- a/packages/server/test/server/auth/router.test.ts +++ b/test/server/auth/router.test.ts @@ -1,14 +1,11 @@ -import type { OAuthClientInformationFull, OAuthMetadata, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; -import type { AuthInfo } from '@modelcontextprotocol/core'; -import { InvalidTokenError } from '@modelcontextprotocol/core'; -import type { Response } from 'express'; -import express from 'express'; +import { mcpAuthRouter, AuthRouterOptions, mcpAuthMetadataRouter, AuthMetadataOptions } from '../../../src/server/auth/router.js'; +import { OAuthServerProvider, AuthorizationParams } from '../../../src/server/auth/provider.js'; +import { OAuthRegisteredClientsStore } from '../../../src/server/auth/clients.js'; +import { OAuthClientInformationFull, OAuthMetadata, OAuthTokenRevocationRequest, OAuthTokens } from '../../../src/shared/auth.js'; +import express, { Response } from 'express'; import supertest from 'supertest'; - -import type { OAuthRegisteredClientsStore } from '../../../src/server/auth/clients.js'; -import type { AuthorizationParams, OAuthServerProvider } from '../../../src/server/auth/provider.js'; -import type { AuthMetadataOptions, AuthRouterOptions } from '../../../src/server/auth/router.js'; -import { mcpAuthMetadataRouter, mcpAuthRouter } from '../../../src/server/auth/router.js'; +import { AuthInfo } from '../../../src/server/auth/types.js'; +import { InvalidTokenError } from '../../../src/server/auth/errors.js'; describe('MCP Auth Router', () => { // Setup mock provider with full capabilities @@ -298,7 +295,7 @@ describe('MCP Auth Router', () => { }); expect(response.status).toBe(302); - const location = new URL(response.header.location!); + const location = new URL(response.header.location); expect(location.searchParams.has('code')).toBe(true); }); diff --git a/packages/server/test/server/completable.test.ts b/test/server/completable.test.ts similarity index 93% rename from packages/server/test/server/completable.test.ts rename to test/server/completable.test.ts index ff94b641bd..3f917a492c 100644 --- a/packages/server/test/server/completable.test.ts +++ b/test/server/completable.test.ts @@ -1,6 +1,5 @@ import { completable, getCompleter } from '../../src/server/completable.js'; -import type { ZodMatrixEntry } from './__fixtures__/zodTestMatrix.js'; -import { zodTestMatrix } from './__fixtures__/zodTestMatrix.js'; +import { zodTestMatrix, type ZodMatrixEntry } from '../../src/__fixtures__/zodTestMatrix.js'; describe.each(zodTestMatrix)('completable with $zodVersionLabel', (entry: ZodMatrixEntry) => { const { z } = entry; diff --git a/test/integration/test/server/elicitation.test.ts b/test/server/elicitation.test.ts similarity index 98% rename from test/integration/test/server/elicitation.test.ts rename to test/server/elicitation.test.ts index 6cf6d53953..c6f297b462 100644 --- a/test/integration/test/server/elicitation.test.ts +++ b/test/server/elicitation.test.ts @@ -7,10 +7,12 @@ * Per the MCP spec, elicitation only supports object schemas, not primitives. */ -import { Client } from '@modelcontextprotocol/client'; -import type { ElicitRequestFormParams } from '@modelcontextprotocol/core'; -import { AjvJsonSchemaValidator, CfWorkerJsonSchemaValidator, ElicitRequestSchema, InMemoryTransport } from '@modelcontextprotocol/core'; -import { Server } from '@modelcontextprotocol/server'; +import { Client } from '../../src/client/index.js'; +import { InMemoryTransport } from '../../src/inMemory.js'; +import { ElicitRequestFormParams, ElicitRequestSchema } from '../../src/types.js'; +import { AjvJsonSchemaValidator } from '../../src/validation/ajv-provider.js'; +import { CfWorkerJsonSchemaValidator } from '../../src/validation/cfworker-provider.js'; +import { Server } from '../../src/server/index.js'; const ajvProvider = new AjvJsonSchemaValidator(); const cfWorkerProvider = new CfWorkerJsonSchemaValidator(); diff --git a/test/integration/test/server.test.ts b/test/server/index.test.ts similarity index 98% rename from test/integration/test/server.test.ts rename to test/server/index.test.ts index fcac6cc451..a32aa03327 100644 --- a/test/integration/test/server.test.ts +++ b/test/server/index.test.ts @@ -1,39 +1,37 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { Client } from '@modelcontextprotocol/client'; -import type { - AnyObjectSchema, - JsonSchemaType, - JsonSchemaValidator, - jsonSchemaValidator, - LoggingMessageNotification, - Transport -} from '@modelcontextprotocol/core'; +import supertest from 'supertest'; +import { Client } from '../../src/client/index.js'; +import { InMemoryTransport } from '../../src/inMemory.js'; +import type { Transport } from '../../src/shared/transport.js'; import { - CallToolRequestSchema, - CallToolResultSchema, CreateMessageRequestSchema, CreateMessageResultSchema, - CreateTaskResultSchema, - ElicitationCompleteNotificationSchema, ElicitRequestSchema, ElicitResultSchema, + ElicitationCompleteNotificationSchema, ErrorCode, - InMemoryTransport, LATEST_PROTOCOL_VERSION, ListPromptsRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, + type LoggingMessageNotification, McpError, NotificationSchema, RequestSchema, ResultSchema, SetLevelRequestSchema, - SUPPORTED_PROTOCOL_VERSIONS -} from '@modelcontextprotocol/core'; -import { createMcpExpressApp, InMemoryTaskMessageQueue, InMemoryTaskStore, McpServer, Server } from '@modelcontextprotocol/server'; -import supertest from 'supertest'; + SUPPORTED_PROTOCOL_VERSIONS, + CreateTaskResultSchema +} from '../../src/types.js'; +import { Server } from '../../src/server/index.js'; +import { McpServer } from '../../src/server/mcp.js'; +import { InMemoryTaskStore, InMemoryTaskMessageQueue } from '../../src/experimental/tasks/stores/in-memory.js'; +import { CallToolRequestSchema, CallToolResultSchema } from '../../src/types.js'; +import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator } from '../../src/validation/types.js'; +import type { AnyObjectSchema } from '../../src/server/zod-compat.js'; import * as z3 from 'zod/v3'; import * as z4 from 'zod/v4'; +import { createMcpExpressApp } from '../../src/server/express.js'; describe('Zod v3', () => { /* @@ -1984,8 +1982,11 @@ describe('createMessage backwards compatibility', () => { // Verify result is returned correctly expect(result.model).toBe('test-model'); - expect(result.content).toMatchObject({ type: 'text', text: 'I will use the weather tool' }); - expect(result.content).not.toBeInstanceOf(Array); + expect(result.content.type).toBe('text'); + // With tools param, result.content can be array (CreateMessageResultWithTools type) + // This would fail type-check if we used CreateMessageResult which doesn't allow arrays + const contentArray = Array.isArray(result.content) ? result.content : [result.content]; + expect(contentArray.length).toBe(1); }); }); @@ -3023,11 +3024,11 @@ describe('Task-based execution', () => { // Verify all tasks completed successfully for (let i = 0; i < taskIds.length; i++) { - const task = await client.experimental.tasks.getTask(taskIds[i]!); + const task = await client.experimental.tasks.getTask(taskIds[i]); expect(task.status).toBe('completed'); - expect(task.taskId).toBe(taskIds[i]!); + expect(task.taskId).toBe(taskIds[i]); - const result = await client.experimental.tasks.getTaskResult(taskIds[i]!, CallToolResultSchema); + const result = await client.experimental.tasks.getTaskResult(taskIds[i], CallToolResultSchema); expect(result.content).toEqual([{ type: 'text', text: `Completed task ${i + 1}` }]); } diff --git a/test/integration/test/server/mcp.test.ts b/test/server/mcp.test.ts similarity index 96% rename from test/integration/test/server/mcp.test.ts rename to test/server/mcp.test.ts index f7bcececc3..3464bb2527 100644 --- a/test/integration/test/server/mcp.test.ts +++ b/test/server/mcp.test.ts @@ -1,11 +1,12 @@ -import { Client } from '@modelcontextprotocol/client'; -import { getDisplayName, InMemoryTaskStore, InMemoryTransport, UriTemplate } from '@modelcontextprotocol/core'; +import { Client } from '../../src/client/index.js'; +import { InMemoryTransport } from '../../src/inMemory.js'; +import { getDisplayName } from '../../src/shared/metadataUtils.js'; +import { UriTemplate } from '../../src/shared/uriTemplate.js'; import { - type CallToolResult, CallToolResultSchema, + type CallToolResult, CompleteResultSchema, ElicitRequestSchema, - ErrorCode, GetPromptResultSchema, ListPromptsResultSchema, ListResourcesResultSchema, @@ -15,12 +16,13 @@ import { type Notification, ReadResourceResultSchema, type TextContent, - UrlElicitationRequiredError -} from '@modelcontextprotocol/core'; - -import { completable } from '../../../../packages/server/src/server/completable.js'; -import { McpServer, ResourceTemplate } from '../../../../packages/server/src/server/mcp.js'; -import { type ZodMatrixEntry, zodTestMatrix } from '../../../../packages/server/test/server/__fixtures__/zodTestMatrix.js'; + UrlElicitationRequiredError, + ErrorCode +} from '../../src/types.js'; +import { completable } from '../../src/server/completable.js'; +import { McpServer, ResourceTemplate } from '../../src/server/mcp.js'; +import { InMemoryTaskStore } from '../../src/experimental/tasks/stores/in-memory.js'; +import { zodTestMatrix, type ZodMatrixEntry } from '../../src/__fixtures__/zodTestMatrix.js'; function createLatch() { let latch = false; @@ -290,8 +292,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.tools).toHaveLength(1); - expect(result.tools[0]!.name).toBe('test'); - expect(result.tools[0]!.inputSchema).toEqual({ + expect(result.tools[0].name).toBe('test'); + expect(result.tools[0].inputSchema).toEqual({ type: 'object', properties: {} }); @@ -445,7 +447,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ListToolsResultSchema ); - expect(listResult.tools[0]!.inputSchema).toMatchObject({ + expect(listResult.tools[0].inputSchema).toMatchObject({ properties: { name: { type: 'string' }, value: { type: 'number' } @@ -538,7 +540,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ListToolsResultSchema ); - expect(listResult.tools[0]!.outputSchema).toMatchObject({ + expect(listResult.tools[0].outputSchema).toMatchObject({ type: 'object', properties: { result: { type: 'number' }, @@ -682,16 +684,16 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.tools).toHaveLength(2); - expect(result.tools[0]!.name).toBe('test'); - expect(result.tools[0]!.inputSchema).toMatchObject({ + expect(result.tools[0].name).toBe('test'); + expect(result.tools[0].inputSchema).toMatchObject({ type: 'object', properties: { name: { type: 'string' }, value: { type: 'number' } } }); - expect(result.tools[1]!.name).toBe('test (new api)'); - expect(result.tools[1]!.inputSchema).toEqual(result.tools[0]!.inputSchema); + expect(result.tools[1].name).toBe('test (new api)'); + expect(result.tools[1].inputSchema).toEqual(result.tools[0].inputSchema); }); /*** @@ -745,10 +747,10 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.tools).toHaveLength(2); - expect(result.tools[0]!.name).toBe('test'); - expect(result.tools[0]!.description).toBe('Test description'); - expect(result.tools[1]!.name).toBe('test (new api)'); - expect(result.tools[1]!.description).toBe('Test description'); + expect(result.tools[0].name).toBe('test'); + expect(result.tools[0].description).toBe('Test description'); + expect(result.tools[1].name).toBe('test (new api)'); + expect(result.tools[1].description).toBe('Test description'); }); /*** @@ -800,18 +802,62 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.tools).toHaveLength(2); - expect(result.tools[0]!.name).toBe('test'); - expect(result.tools[0]!.annotations).toEqual({ + expect(result.tools[0].name).toBe('test'); + expect(result.tools[0].annotations).toEqual({ title: 'Test Tool', readOnlyHint: true }); - expect(result.tools[1]!.name).toBe('test (new api)'); - expect(result.tools[1]!.annotations).toEqual({ + expect(result.tools[1].name).toBe('test (new api)'); + expect(result.tools[1].annotations).toEqual({ title: 'Test Tool', readOnlyHint: true }); }); + /*** + * Test: Tool Registration with securitySchemes + */ + test('should register tool with securitySchemes and include it in list response', async () => { + const mcpServer = new McpServer({ + name: 'test server', + version: '1.0' + }); + const client = new Client({ + name: 'test client', + version: '1.0' + }); + + mcpServer.registerTool( + 'secure-tool', + { + description: 'A tool with security schemes', + securitySchemes: [ + { type: 'oauth2', scopes: ['read', 'write'] }, + { type: 'noauth' } + ] + }, + async () => ({ + content: [{ type: 'text', text: 'Secure response' }] + }) + ); + + const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); + + await Promise.all([client.connect(clientTransport), mcpServer.server.connect(serverTransport)]); + + const result = await client.request( + { method: 'tools/list' }, + ListToolsResultSchema + ); + + expect(result.tools).toHaveLength(1); + expect(result.tools[0].name).toBe('secure-tool'); + expect(result.tools[0].securitySchemes).toEqual([ + { type: 'oauth2', scopes: ['read', 'write'] }, + { type: 'noauth' } + ]); + }); + /*** * Test: Tool Registration with Parameters and Annotations */ @@ -847,18 +893,18 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const result = await client.request({ method: 'tools/list' }, ListToolsResultSchema); expect(result.tools).toHaveLength(2); - expect(result.tools[0]!.name).toBe('test'); - expect(result.tools[0]!.inputSchema).toMatchObject({ + expect(result.tools[0].name).toBe('test'); + expect(result.tools[0].inputSchema).toMatchObject({ type: 'object', properties: { name: { type: 'string' } } }); - expect(result.tools[0]!.annotations).toEqual({ + expect(result.tools[0].annotations).toEqual({ title: 'Test Tool', readOnlyHint: true }); - expect(result.tools[1]!.name).toBe('test (new api)'); - expect(result.tools[1]!.inputSchema).toEqual(result.tools[0]!.inputSchema); - expect(result.tools[1]!.annotations).toEqual(result.tools[0]!.annotations); + expect(result.tools[1].name).toBe('test (new api)'); + expect(result.tools[1].inputSchema).toEqual(result.tools[0].inputSchema); + expect(result.tools[1].annotations).toEqual(result.tools[0].annotations); }); /*** @@ -907,21 +953,21 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const result = await client.request({ method: 'tools/list' }, ListToolsResultSchema); expect(result.tools).toHaveLength(2); - expect(result.tools[0]!.name).toBe('test'); - expect(result.tools[0]!.description).toBe('A tool with everything'); - expect(result.tools[0]!.inputSchema).toMatchObject({ + expect(result.tools[0].name).toBe('test'); + expect(result.tools[0].description).toBe('A tool with everything'); + expect(result.tools[0].inputSchema).toMatchObject({ type: 'object', properties: { name: { type: 'string' } } }); - expect(result.tools[0]!.annotations).toEqual({ + expect(result.tools[0].annotations).toEqual({ title: 'Complete Test Tool', readOnlyHint: true, openWorldHint: false }); - expect(result.tools[1]!.name).toBe('test (new api)'); - expect(result.tools[1]!.description).toBe('A tool with everything'); - expect(result.tools[1]!.inputSchema).toEqual(result.tools[0]!.inputSchema); - expect(result.tools[1]!.annotations).toEqual(result.tools[0]!.annotations); + expect(result.tools[1].name).toBe('test (new api)'); + expect(result.tools[1].description).toBe('A tool with everything'); + expect(result.tools[1].inputSchema).toEqual(result.tools[0].inputSchema); + expect(result.tools[1].annotations).toEqual(result.tools[0].annotations); }); /*** @@ -974,21 +1020,21 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const result = await client.request({ method: 'tools/list' }, ListToolsResultSchema); expect(result.tools).toHaveLength(2); - expect(result.tools[0]!.name).toBe('test'); - expect(result.tools[0]!.description).toBe('A tool with everything but empty params'); - expect(result.tools[0]!.inputSchema).toMatchObject({ + expect(result.tools[0].name).toBe('test'); + expect(result.tools[0].description).toBe('A tool with everything but empty params'); + expect(result.tools[0].inputSchema).toMatchObject({ type: 'object', properties: {} }); - expect(result.tools[0]!.annotations).toEqual({ + expect(result.tools[0].annotations).toEqual({ title: 'Complete Test Tool with empty params', readOnlyHint: true, openWorldHint: false }); - expect(result.tools[1]!.name).toBe('test (new api)'); - expect(result.tools[1]!.description).toBe('A tool with everything but empty params'); - expect(result.tools[1]!.inputSchema).toEqual(result.tools[0]!.inputSchema); - expect(result.tools[1]!.annotations).toEqual(result.tools[0]!.annotations); + expect(result.tools[1].name).toBe('test (new api)'); + expect(result.tools[1].description).toBe('A tool with everything but empty params'); + expect(result.tools[1].inputSchema).toEqual(result.tools[0].inputSchema); + expect(result.tools[1].annotations).toEqual(result.tools[0].annotations); }); /*** @@ -1197,7 +1243,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(listResult.tools).toHaveLength(1); - expect(listResult.tools[0]!.outputSchema).toMatchObject({ + expect(listResult.tools[0].outputSchema).toMatchObject({ type: 'object', properties: { processedInput: { type: 'string' }, @@ -1821,9 +1867,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const result = await client.request({ method: 'tools/list' }, ListToolsResultSchema); expect(result.tools).toHaveLength(1); - expect(result.tools[0]!.name).toBe('test-with-meta'); - expect(result.tools[0]!.description).toBe('A tool with _meta field'); - expect(result.tools[0]!._meta).toEqual(metaData); + expect(result.tools[0].name).toBe('test-with-meta'); + expect(result.tools[0].description).toBe('A tool with _meta field'); + expect(result.tools[0]._meta).toEqual(metaData); }); /*** @@ -1857,8 +1903,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const result = await client.request({ method: 'tools/list' }, ListToolsResultSchema); expect(result.tools).toHaveLength(1); - expect(result.tools[0]!.name).toBe('test-without-meta'); - expect(result.tools[0]!._meta).toBeUndefined(); + expect(result.tools[0].name).toBe('test-without-meta'); + expect(result.tools[0]._meta).toBeUndefined(); }); test('should include execution field in listTools response when tool has execution settings', async () => { @@ -1922,8 +1968,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const result = await client.request({ method: 'tools/list' }, ListToolsResultSchema); expect(result.tools).toHaveLength(1); - expect(result.tools[0]!.name).toBe('task-tool'); - expect(result.tools[0]!.execution).toEqual({ + expect(result.tools[0].name).toBe('task-tool'); + expect(result.tools[0].execution).toEqual({ taskSupport: 'required' }); @@ -1991,8 +2037,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const result = await client.request({ method: 'tools/list' }, ListToolsResultSchema); expect(result.tools).toHaveLength(1); - expect(result.tools[0]!.name).toBe('optional-task-tool'); - expect(result.tools[0]!.execution).toEqual({ + expect(result.tools[0].name).toBe('optional-task-tool'); + expect(result.tools[0].execution).toEqual({ taskSupport: 'optional' }); @@ -2007,7 +2053,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { }); // Spy on console.warn to verify warnings are logged - const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {}); + const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { }); // Test valid tool names testServer.registerTool( @@ -2085,8 +2131,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.resources).toHaveLength(1); - expect(result.resources[0]!.name).toBe('test'); - expect(result.resources[0]!.uri).toBe('test://resource'); + expect(result.resources[0].name).toBe('test'); + expect(result.resources[0].uri).toBe('test://resource'); }); /*** @@ -2330,7 +2376,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { result = await client.request({ method: 'resources/list' }, ListResourcesResultSchema); expect(result.resources).toHaveLength(1); - expect(result.resources[0]!.uri).toBe('test://resource2'); + expect(result.resources[0].uri).toBe('test://resource2'); }); /*** @@ -2437,9 +2483,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.resources).toHaveLength(1); - expect(result.resources[0]!.description).toBe('Test resource'); - expect(result.resources[0]!.mimeType).toBe('text/plain'); - expect(result.resources[0]!.annotations).toEqual({ + expect(result.resources[0].description).toBe('Test resource'); + expect(result.resources[0].mimeType).toBe('text/plain'); + expect(result.resources[0].annotations).toEqual({ audience: ['user'], priority: 0.5, lastModified: mockDate @@ -2480,8 +2526,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.resourceTemplates).toHaveLength(1); - expect(result.resourceTemplates[0]!.name).toBe('test'); - expect(result.resourceTemplates[0]!.uriTemplate).toBe('test://resource/{id}'); + expect(result.resourceTemplates[0].name).toBe('test'); + expect(result.resourceTemplates[0].uriTemplate).toBe('test://resource/{id}'); }); /*** @@ -2535,10 +2581,10 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.resources).toHaveLength(2); - expect(result.resources[0]!.name).toBe('Resource 1'); - expect(result.resources[0]!.uri).toBe('test://resource/1'); - expect(result.resources[1]!.name).toBe('Resource 2'); - expect(result.resources[1]!.uri).toBe('test://resource/2'); + expect(result.resources[0].name).toBe('Resource 1'); + expect(result.resources[0].uri).toBe('test://resource/1'); + expect(result.resources[1].name).toBe('Resource 2'); + expect(result.resources[1].uri).toBe('test://resource/2'); }); /*** @@ -3035,8 +3081,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.prompts).toHaveLength(1); - expect(result.prompts[0]!.name).toBe('test'); - expect(result.prompts[0]!.arguments).toBeUndefined(); + expect(result.prompts[0].name).toBe('test'); + expect(result.prompts[0].arguments).toBeUndefined(); }); /*** * Test: Updating Existing Prompt @@ -3182,8 +3228,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ListPromptsResultSchema ); - expect(listResult.prompts[0]!.arguments).toHaveLength(2); - expect(listResult.prompts[0]!.arguments!.map(a => a.name).sort()).toEqual(['name', 'value']); + expect(listResult.prompts[0].arguments).toHaveLength(2); + expect(listResult.prompts[0].arguments?.map(a => a.name).sort()).toEqual(['name', 'value']); // Call the prompt with the new schema const getResult = await client.request( @@ -3341,7 +3387,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { result = await client.request({ method: 'prompts/list' }, ListPromptsResultSchema); expect(result.prompts).toHaveLength(1); - expect(result.prompts[0]!.name).toBe('prompt2'); + expect(result.prompts[0].name).toBe('prompt2'); }); /*** @@ -3388,8 +3434,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.prompts).toHaveLength(1); - expect(result.prompts[0]!.name).toBe('test'); - expect(result.prompts[0]!.arguments).toEqual([ + expect(result.prompts[0].name).toBe('test'); + expect(result.prompts[0].arguments).toEqual([ { name: 'name', required: true }, { name: 'value', required: true } ]); @@ -3432,8 +3478,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.prompts).toHaveLength(1); - expect(result.prompts[0]!.name).toBe('test'); - expect(result.prompts[0]!.description).toBe('Test description'); + expect(result.prompts[0].name).toBe('test'); + expect(result.prompts[0].description).toBe('Test description'); }); /*** @@ -3981,14 +4027,14 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { expect(result.resources).toHaveLength(2); // Resource 1 should have its own metadata - expect(result.resources[0]!.name).toBe('Resource 1'); - expect(result.resources[0]!.description).toBe('Individual resource description'); - expect(result.resources[0]!.mimeType).toBe('text/plain'); + expect(result.resources[0].name).toBe('Resource 1'); + expect(result.resources[0].description).toBe('Individual resource description'); + expect(result.resources[0].mimeType).toBe('text/plain'); // Resource 2 should inherit template metadata - expect(result.resources[1]!.name).toBe('Resource 2'); - expect(result.resources[1]!.description).toBe('Template description'); - expect(result.resources[1]!.mimeType).toBe('application/json'); + expect(result.resources[1].name).toBe('Resource 2'); + expect(result.resources[1].description).toBe('Template description'); + expect(result.resources[1].mimeType).toBe('application/json'); }); /*** @@ -4048,9 +4094,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { expect(result.resources).toHaveLength(1); // All fields should be from the individual resource, not the template - expect(result.resources[0]!.name).toBe('Overridden Name'); - expect(result.resources[0]!.description).toBe('Overridden description'); - expect(result.resources[0]!.mimeType).toBe('text/markdown'); + expect(result.resources[0].name).toBe('Overridden Name'); + expect(result.resources[0].description).toBe('Overridden description'); + expect(result.resources[0].mimeType).toBe('text/markdown'); }); test('should support optional prompt arguments', async () => { @@ -4088,8 +4134,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.prompts).toHaveLength(1); - expect(result.prompts[0]!.name).toBe('test-prompt'); - expect(result.prompts[0]!.arguments).toEqual([ + expect(result.prompts[0].name).toBe('test-prompt'); + expect(result.prompts[0].arguments).toEqual([ { name: 'name', description: undefined, @@ -5168,8 +5214,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { ); expect(result.resources).toHaveLength(1); - expect(result.resources[0]!.name).toBe('test'); - expect(result.resources[0]!.uri).toBe('test://resource'); + expect(result.resources[0].name).toBe('test'); + expect(result.resources[0].uri).toBe('test://resource'); }); /*** @@ -5313,14 +5359,14 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { expect(result.resources).toHaveLength(2); // Resource 1 should have its own metadata - expect(result.resources[0]!.name).toBe('Resource 1'); - expect(result.resources[0]!.description).toBe('Individual resource description'); - expect(result.resources[0]!.mimeType).toBe('text/plain'); + expect(result.resources[0].name).toBe('Resource 1'); + expect(result.resources[0].description).toBe('Individual resource description'); + expect(result.resources[0].mimeType).toBe('text/plain'); // Resource 2 should inherit template metadata - expect(result.resources[1]!.name).toBe('Resource 2'); - expect(result.resources[1]!.description).toBe('Template description'); - expect(result.resources[1]!.mimeType).toBe('application/json'); + expect(result.resources[1].name).toBe('Resource 2'); + expect(result.resources[1].description).toBe('Template description'); + expect(result.resources[1].mimeType).toBe('application/json'); }); /*** @@ -5380,9 +5426,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { expect(result.resources).toHaveLength(1); // All fields should be from the individual resource, not the template - expect(result.resources[0]!.name).toBe('Overridden Name'); - expect(result.resources[0]!.description).toBe('Overridden description'); - expect(result.resources[0]!.mimeType).toBe('text/markdown'); + expect(result.resources[0].name).toBe('Overridden Name'); + expect(result.resources[0].description).toBe('Overridden description'); + expect(result.resources[0].mimeType).toBe('text/markdown'); }); }); @@ -6344,7 +6390,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { // Should receive error result expect(result.isError).toBe(true); const content = result.content as TextContent[]; - expect(content[0]!.text).toContain('requires task augmentation'); + expect(content[0].text).toContain('requires task augmentation'); taskStore.cleanup(); }); diff --git a/packages/server/test/server/sse.test.ts b/test/server/sse.test.ts similarity index 98% rename from packages/server/test/server/sse.test.ts rename to test/server/sse.test.ts index 0fc9eebc81..4686f2ba9d 100644 --- a/packages/server/test/server/sse.test.ts +++ b/test/server/sse.test.ts @@ -1,13 +1,12 @@ -import type http from 'node:http'; -import { createServer, type Server } from 'node:http'; - -import type { CallToolResult, JSONRPCMessage } from '@modelcontextprotocol/core'; -import type { ZodMatrixEntry } from '@modelcontextprotocol/test-helpers'; -import { listenOnRandomPort, zodTestMatrix } from '@modelcontextprotocol/test-helpers'; +import http from 'node:http'; import { type Mocked } from 'vitest'; -import { McpServer } from '../../src/server/mcp.js'; import { SSEServerTransport } from '../../src/server/sse.js'; +import { McpServer } from '../../src/server/mcp.js'; +import { createServer, type Server } from 'node:http'; +import { CallToolResult, JSONRPCMessage } from '../../src/types.js'; +import { zodTestMatrix, type ZodMatrixEntry } from '../../src/__fixtures__/zodTestMatrix.js'; +import { listenOnRandomPort } from '../helpers/http.js'; const createMockResponse = () => { const res = { @@ -143,7 +142,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const baseUrl = await listenOnRandomPort(server); const addr = server.address(); - const port = typeof addr === 'string' ? new URL(baseUrl).port : (addr as unknown as { port: number }).port; + const port = typeof addr === 'string' ? new URL(baseUrl).port : (addr as any).port; return { server, transport, mcpServer, baseUrl, sessionId, serverPort: Number(port) }; } diff --git a/packages/server/test/server/stdio.test.ts b/test/server/stdio.test.ts similarity index 90% rename from packages/server/test/server/stdio.test.ts rename to test/server/stdio.test.ts index f1c9e038cd..86379c8a61 100644 --- a/packages/server/test/server/stdio.test.ts +++ b/test/server/stdio.test.ts @@ -1,8 +1,6 @@ import { Readable, Writable } from 'node:stream'; - -import type { JSONRPCMessage } from '@modelcontextprotocol/core'; -import { ReadBuffer, serializeMessage } from '@modelcontextprotocol/core'; - +import { ReadBuffer, serializeMessage } from '../../src/shared/stdio.js'; +import { JSONRPCMessage } from '../../src/types.js'; import { StdioServerTransport } from '../../src/server/stdio.js'; let input: Readable; @@ -95,8 +93,8 @@ test('should read multiple messages', async () => { }; }); - input.push(serializeMessage(messages[0]!)); - input.push(serializeMessage(messages[1]!)); + input.push(serializeMessage(messages[0])); + input.push(serializeMessage(messages[1])); await server.start(); await finished; diff --git a/packages/server/test/server/streamableHttp.test.ts b/test/server/streamableHttp.test.ts similarity index 95% rename from packages/server/test/server/streamableHttp.test.ts rename to test/server/streamableHttp.test.ts index d8c6388e47..8d94b272e4 100644 --- a/packages/server/test/server/streamableHttp.test.ts +++ b/test/server/streamableHttp.test.ts @@ -1,23 +1,12 @@ +import { createServer, type Server, IncomingMessage, ServerResponse } from 'node:http'; +import { AddressInfo, createServer as netCreateServer } from 'node:net'; import { randomUUID } from 'node:crypto'; -import type { IncomingMessage, Server, ServerResponse } from 'node:http'; -import { createServer } from 'node:http'; -import type { AddressInfo } from 'node:net'; -import { createServer as netCreateServer } from 'node:net'; - -import type { - AuthInfo, - CallToolResult, - JSONRPCErrorResponse, - JSONRPCMessage, - JSONRPCResultResponse, - RequestId -} from '@modelcontextprotocol/core'; -import { listenOnRandomPort } from '@modelcontextprotocol/test-helpers'; - +import { EventStore, StreamableHTTPServerTransport, EventId, StreamId } from '../../src/server/streamableHttp.js'; import { McpServer } from '../../src/server/mcp.js'; -import { StreamableHTTPServerTransport } from '../../src/server/streamableHttp.js'; -import type { EventId, EventStore, StreamId } from '../../src/server/webStandardStreamableHttp.js'; -import { type ZodMatrixEntry, zodTestMatrix } from './__fixtures__/zodTestMatrix.js'; +import { CallToolResult, JSONRPCMessage } from '../../src/types.js'; +import { AuthInfo } from '../../src/server/auth/types.js'; +import { zodTestMatrix, type ZodMatrixEntry } from '../../src/__fixtures__/zodTestMatrix.js'; +import { listenOnRandomPort } from '../helpers/http.js'; async function getFreePort() { return new Promise(res => { @@ -66,21 +55,10 @@ const TEST_MESSAGES = { method: 'initialize', params: { clientInfo: { name: 'test-client', version: '1.0' }, - protocolVersion: '2025-11-25', + protocolVersion: '2025-03-26', capabilities: {} }, - id: 'init-1' - } as JSONRPCMessage, - // Initialize message with an older protocol version for backward compatibility tests - initializeOldVersion: { - jsonrpc: '2.0', - method: 'initialize', - params: { - clientInfo: { name: 'test-client', version: '1.0' }, - protocolVersion: '2025-06-18', - capabilities: {} - }, id: 'init-1' } as JSONRPCMessage, @@ -120,7 +98,8 @@ async function sendPostRequest( if (sessionId) { headers['mcp-session-id'] = sessionId; - headers['mcp-protocol-version'] = '2025-11-25'; + // After initialization, include the protocol version header + headers['mcp-protocol-version'] = '2025-03-26'; } return fetch(baseUrl, { @@ -130,12 +109,7 @@ async function sendPostRequest( }); } -function expectErrorResponse( - data: unknown, - expectedCode: number, - expectedMessagePattern: RegExp, - options?: { expectData?: boolean } -): void { +function expectErrorResponse(data: unknown, expectedCode: number, expectedMessagePattern: RegExp): void { expect(data).toMatchObject({ jsonrpc: '2.0', error: expect.objectContaining({ @@ -143,9 +117,6 @@ function expectErrorResponse( message: expect.stringMatching(expectedMessagePattern) }) }); - if (options?.expectData) { - expect((data as { error: { data?: string } }).error.data).toBeDefined(); - } } describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { /** @@ -462,7 +433,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const response = await sendPostRequest(baseUrl, TEST_MESSAGES.toolsList); expect(response.status).toBe(400); - const errorData = (await response.json()) as JSONRPCErrorResponse; + const errorData = await response.json(); expectErrorResponse(errorData, -32000, /Bad Request/); expect(errorData.id).toBeNull(); }); @@ -489,7 +460,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -530,7 +501,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -562,7 +533,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -574,7 +545,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -593,7 +564,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'application/json', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -698,28 +669,6 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { expectErrorResponse(errorData, -32700, /Parse error/); }); - it('should include error data in parse error response for unexpected errors', async () => { - sessionId = await initializeServer(); - - // We can't easily trigger the catch-all error handler, but we can verify - // that the JSON parse error includes useful information - const response = await fetch(baseUrl, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json, text/event-stream', - 'mcp-session-id': sessionId - }, - body: '{ invalid json }' - }); - - expect(response.status).toBe(400); - const errorData = (await response.json()) as JSONRPCErrorResponse; - expectErrorResponse(errorData, -32700, /Parse error/); - // The error message should contain details about what went wrong - expect(errorData.error.message).toContain('Invalid JSON'); - }); - it('should return 400 error for invalid JSON-RPC messages', async () => { sessionId = await initializeServer(); @@ -809,7 +758,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -847,7 +796,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': tempSessionId || '', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -866,7 +815,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': 'invalid-session-id', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -920,12 +869,15 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { expect(response.status).toBe(400); const errorData = await response.json(); - expectErrorResponse(errorData, -32000, /Bad Request: Unsupported protocol version: .+ \(supported versions: .+\)/); + expectErrorResponse(errorData, -32000, /Bad Request: Unsupported protocol version \(supported versions: .+\)/); }); it('should accept when protocol version differs from negotiated version', async () => { sessionId = await initializeServer(); + // Spy on console.warn to verify warning is logged + const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {}); + // Send request with different but supported protocol version const response = await fetch(baseUrl, { method: 'POST', @@ -940,9 +892,11 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { // Request should still succeed expect(response.status).toBe(200); + + warnSpy.mockRestore(); }); - it('should reject unsupported protocol version on GET requests', async () => { + it('should handle protocol version validation for GET requests', async () => { sessionId = await initializeServer(); // GET request with unsupported protocol version @@ -951,16 +905,16 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '1999-01-01' // Unsupported version + 'mcp-protocol-version': 'invalid-version' } }); expect(response.status).toBe(400); const errorData = await response.json(); - expectErrorResponse(errorData, -32000, /Bad Request: Unsupported protocol version/); + expectErrorResponse(errorData, -32000, /Bad Request: Unsupported protocol version \(supported versions: .+\)/); }); - it('should reject unsupported protocol version on DELETE requests', async () => { + it('should handle protocol version validation for DELETE requests', async () => { sessionId = await initializeServer(); // DELETE request with unsupported protocol version @@ -968,13 +922,13 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': sessionId, - 'mcp-protocol-version': '1999-01-01' // Unsupported version + 'mcp-protocol-version': 'invalid-version' } }); expect(response.status).toBe(400); const errorData = await response.json(); - expectErrorResponse(errorData, -32000, /Bad Request: Unsupported protocol version/); + expectErrorResponse(errorData, -32000, /Bad Request: Unsupported protocol version \(supported versions: .+\)/); }); }); }); @@ -1135,13 +1089,13 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { expect(response.status).toBe(200); expect(response.headers.get('content-type')).toBe('application/json'); - const results = (await response.json()) as JSONRPCResultResponse[]; + const results = await response.json(); expect(Array.isArray(results)).toBe(true); expect(results).toHaveLength(2); // Batch responses can come in any order - const listResponse = results.find((r: { id?: RequestId }) => r.id === 'batch-1'); - const callResponse = results.find((r: { id?: RequestId }) => r.id === 'batch-2'); + const listResponse = results.find((r: { id?: string }) => r.id === 'batch-1'); + const callResponse = results.find((r: { id?: string }) => r.id === 'batch-2'); expect(listResponse).toEqual( expect.objectContaining({ @@ -1326,7 +1280,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { send: (eventId: EventId, message: JSONRPCMessage) => Promise; } ): Promise { - const streamId = lastEventId.split('_')[0]!; + const streamId = lastEventId.split('_')[0]; // Extract stream ID from the event ID // For test simplicity, just return all events with matching streamId that aren't the lastEventId for (const [eventId, { message }] of storedEvents.entries()) { @@ -1350,6 +1304,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { baseUrl = result.baseUrl; mcpServer = result.mcpServer; + // Verify resumability is enabled on the transport + expect(transport['_eventStore']).toBeDefined(); + // Initialize the server const initResponse = await sendPostRequest(baseUrl, TEST_MESSAGES.initialize); sessionId = initResponse.headers.get('mcp-session-id') as string; @@ -1368,7 +1325,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -1399,7 +1356,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { expect(idMatch).toBeTruthy(); // Verify the event was stored - const eventId = idMatch![1]!; + const eventId = idMatch![1]; expect(storedEvents.has(eventId)).toBe(true); const storedEvent = storedEvents.get(eventId); expect(eventId.startsWith('_GET_stream')).toBe(true); @@ -1413,7 +1370,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); expect(sseResponse.status).toBe(200); @@ -1433,7 +1390,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { // Extract the event ID const idMatch = text.match(/id: ([^\n]+)/); expect(idMatch).toBeTruthy(); - const firstEventId = idMatch![1]!; + const firstEventId = idMatch![1]; // Send a second notification await mcpServer.server.sendLoggingMessage({ level: 'info', data: 'Second notification from MCP server' }); @@ -1447,7 +1404,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25', + 'mcp-protocol-version': '2025-03-26', 'last-event-id': firstEventId } }); @@ -1471,7 +1428,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); expect(sseResponse.status).toBe(200); @@ -1488,7 +1445,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { // Extract the event ID const idMatch = text.match(/id: ([^\n]+)/); expect(idMatch).toBeTruthy(); - const lastEventId = idMatch![1]!; + const lastEventId = idMatch![1]; // Close the SSE stream to simulate a disconnect await reader!.cancel(); @@ -1504,7 +1461,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { headers: { Accept: 'text/event-stream', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25', + 'mcp-protocol-version': '2025-03-26', 'last-event-id': lastEventId } }); @@ -1608,7 +1565,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'GET', headers: { Accept: 'text/event-stream', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); expect(stream1.status).toBe(200); @@ -1618,7 +1575,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'GET', headers: { Accept: 'text/event-stream', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); expect(stream2.status).toBe(409); // Conflict - only one stream allowed @@ -1651,7 +1608,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { { send }: { send: (eventId: EventId, message: JSONRPCMessage) => Promise } ): Promise { const event = storedEvents.get(lastEventId); - const streamId = event?.streamId || lastEventId.split('::')[0]!; + const streamId = event?.streamId || lastEventId.split('::')[0]; const eventsToReplay: Array<[string, { message: JSONRPCMessage }]> = []; for (const [eventId, data] of storedEvents.entries()) { if (data.streamId === streamId && eventId > lastEventId) { @@ -1735,12 +1692,12 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { baseUrl = result.baseUrl; mcpServer = result.mcpServer; - // Initialize with OLD protocol version to get session ID - const initResponse = await sendPostRequest(baseUrl, TEST_MESSAGES.initializeOldVersion); + // Initialize to get session ID + const initResponse = await sendPostRequest(baseUrl, TEST_MESSAGES.initialize); sessionId = initResponse.headers.get('mcp-session-id') as string; expect(sessionId).toBeDefined(); - // Send a tool call request with the same OLD protocol version + // Send a tool call request with OLD protocol version const toolCallRequest: JSONRPCMessage = { jsonrpc: '2.0', id: 100, @@ -1975,12 +1932,12 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { return { content: [{ type: 'text', text: 'Done' }] }; }); - // Initialize with OLD protocol version to get session ID - const initResponse = await sendPostRequest(baseUrl, TEST_MESSAGES.initializeOldVersion); + // Initialize to get session ID + const initResponse = await sendPostRequest(baseUrl, TEST_MESSAGES.initialize); sessionId = initResponse.headers.get('mcp-session-id') as string; expect(sessionId).toBeDefined(); - // Call the tool with the same OLD protocol version + // Call the tool with OLD protocol version const toolCallRequest: JSONRPCMessage = { jsonrpc: '2.0', id: 200, @@ -2052,7 +2009,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { 'Content-Type': 'application/json', Accept: 'text/event-stream, application/json', 'mcp-session-id': sessionId, - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' }, body: JSON.stringify(toolCallRequest) }); @@ -2252,7 +2209,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const text = new TextDecoder().decode(value); const idMatch = text.match(/id: ([^\n]+)/); expect(idMatch).toBeTruthy(); - const lastEventId = idMatch![1]!; + const lastEventId = idMatch![1]; // Call the tool to close the standalone SSE stream const toolCallRequest: JSONRPCMessage = { @@ -2323,8 +2280,8 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { // Verify we received the notification that was sent while disconnected expect(allText).toContain('Missed while disconnected'); - }, 15000); - }); + }); + }, 10000); // Test onsessionclosed callback describe('StreamableHTTPServerTransport onsessionclosed callback', () => { @@ -2350,7 +2307,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': tempSessionId || '', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -2410,7 +2367,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': 'invalid-session-id', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -2458,7 +2415,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': sessionId1 || '', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -2471,7 +2428,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': sessionId2 || '', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -2570,7 +2527,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': tempSessionId || '', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -2631,7 +2588,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': tempSessionId || '', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -2675,7 +2632,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { method: 'DELETE', headers: { 'mcp-session-id': tempSessionId || '', - 'mcp-protocol-version': '2025-11-25' + 'mcp-protocol-version': '2025-03-26' } }); @@ -2751,7 +2708,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { }); expect(response.status).toBe(403); - const body = (await response.json()) as JSONRPCErrorResponse; + const body = await response.json(); expect(body.error.message).toContain('Invalid Host header:'); }); @@ -2821,7 +2778,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { }); expect(response.status).toBe(403); - const body = (await response.json()) as JSONRPCErrorResponse; + const body = await response.json(); expect(body.error.message).toBe('Invalid Origin header: http://evil.com'); }); @@ -2901,7 +2858,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { }); expect(response1.status).toBe(403); - const body1 = (await response1.json()) as JSONRPCErrorResponse; + const body1 = await response1.json(); expect(body1.error.message).toBe('Invalid Origin header: http://evil.com'); // Test with valid origin diff --git a/test/integration/test/title.test.ts b/test/server/title.test.ts similarity index 80% rename from test/integration/test/title.test.ts rename to test/server/title.test.ts index 4eec82335d..de353af306 100644 --- a/test/integration/test/title.test.ts +++ b/test/server/title.test.ts @@ -1,7 +1,8 @@ -import { Client } from '@modelcontextprotocol/client'; -import { InMemoryTransport } from '@modelcontextprotocol/core'; -import { McpServer, ResourceTemplate, Server } from '@modelcontextprotocol/server'; -import { type ZodMatrixEntry, zodTestMatrix } from '@modelcontextprotocol/test-helpers'; +import { Server } from '../../src/server/index.js'; +import { Client } from '../../src/client/index.js'; +import { InMemoryTransport } from '../../src/inMemory.js'; +import { McpServer, ResourceTemplate } from '../../src/server/mcp.js'; +import { zodTestMatrix, type ZodMatrixEntry } from '../../src/__fixtures__/zodTestMatrix.js'; describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const { z } = entry; @@ -32,9 +33,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const tools = await client.listTools(); expect(tools.tools).toHaveLength(1); - expect(tools.tools[0]!.name).toBe('test-tool'); - expect(tools.tools[0]!.title).toBe('Test Tool Display Name'); - expect(tools.tools[0]!.description).toBe('A test tool'); + expect(tools.tools[0].name).toBe('test-tool'); + expect(tools.tools[0].title).toBe('Test Tool Display Name'); + expect(tools.tools[0].description).toBe('A test tool'); }); it('should work with tools without title', async () => { @@ -52,9 +53,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const tools = await client.listTools(); expect(tools.tools).toHaveLength(1); - expect(tools.tools[0]!.name).toBe('test-tool'); - expect(tools.tools[0]!.title).toBeUndefined(); - expect(tools.tools[0]!.description).toBe('A test tool'); + expect(tools.tools[0].name).toBe('test-tool'); + expect(tools.tools[0].title).toBeUndefined(); + expect(tools.tools[0].description).toBe('A test tool'); }); it('should work with prompts that have title using update', async () => { @@ -75,9 +76,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const prompts = await client.listPrompts(); expect(prompts.prompts).toHaveLength(1); - expect(prompts.prompts[0]!.name).toBe('test-prompt'); - expect(prompts.prompts[0]!.title).toBe('Test Prompt Display Name'); - expect(prompts.prompts[0]!.description).toBe('A test prompt'); + expect(prompts.prompts[0].name).toBe('test-prompt'); + expect(prompts.prompts[0].title).toBe('Test Prompt Display Name'); + expect(prompts.prompts[0].description).toBe('A test prompt'); }); it('should work with prompts using registerPrompt', async () => { @@ -110,10 +111,10 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const prompts = await client.listPrompts(); expect(prompts.prompts).toHaveLength(1); - expect(prompts.prompts[0]!.name).toBe('test-prompt'); - expect(prompts.prompts[0]!.title).toBe('Test Prompt Display Name'); - expect(prompts.prompts[0]!.description).toBe('A test prompt'); - expect(prompts.prompts[0]!.arguments).toHaveLength(1); + expect(prompts.prompts[0].name).toBe('test-prompt'); + expect(prompts.prompts[0].title).toBe('Test Prompt Display Name'); + expect(prompts.prompts[0].description).toBe('A test prompt'); + expect(prompts.prompts[0].arguments).toHaveLength(1); }); it('should work with resources using registerResource', async () => { @@ -147,10 +148,10 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const resources = await client.listResources(); expect(resources.resources).toHaveLength(1); - expect(resources.resources[0]!.name).toBe('test-resource'); - expect(resources.resources[0]!.title).toBe('Test Resource Display Name'); - expect(resources.resources[0]!.description).toBe('A test resource'); - expect(resources.resources[0]!.mimeType).toBe('text/plain'); + expect(resources.resources[0].name).toBe('test-resource'); + expect(resources.resources[0].title).toBe('Test Resource Display Name'); + expect(resources.resources[0].description).toBe('A test resource'); + expect(resources.resources[0].mimeType).toBe('text/plain'); }); it('should work with dynamic resources using registerResource', async () => { @@ -183,10 +184,10 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => { const resourceTemplates = await client.listResourceTemplates(); expect(resourceTemplates.resourceTemplates).toHaveLength(1); - expect(resourceTemplates.resourceTemplates[0]!.name).toBe('user-profile'); - expect(resourceTemplates.resourceTemplates[0]!.title).toBe('User Profile'); - expect(resourceTemplates.resourceTemplates[0]!.description).toBe('User profile information'); - expect(resourceTemplates.resourceTemplates[0]!.uriTemplate).toBe('users://{userId}/profile'); + expect(resourceTemplates.resourceTemplates[0].name).toBe('user-profile'); + expect(resourceTemplates.resourceTemplates[0].title).toBe('User Profile'); + expect(resourceTemplates.resourceTemplates[0].description).toBe('User profile information'); + expect(resourceTemplates.resourceTemplates[0].uriTemplate).toBe('users://{userId}/profile'); // Test reading the resource const readResult = await client.readResource({ uri: 'users://123/profile' }); diff --git a/packages/core/test/shared/auth-utils.test.ts b/test/shared/auth-utils.test.ts similarity index 98% rename from packages/core/test/shared/auth-utils.test.ts rename to test/shared/auth-utils.test.ts index 64cb5a1634..b3b13a2f60 100644 --- a/packages/core/test/shared/auth-utils.test.ts +++ b/test/shared/auth-utils.test.ts @@ -1,4 +1,4 @@ -import { checkResourceAllowed, resourceUrlFromServerUrl } from '../../src/shared/auth-utils.js'; +import { resourceUrlFromServerUrl, checkResourceAllowed } from '../../src/shared/auth-utils.js'; describe('auth-utils', () => { describe('resourceUrlFromServerUrl', () => { diff --git a/packages/core/test/shared/auth.test.ts b/test/shared/auth.test.ts similarity index 99% rename from packages/core/test/shared/auth.test.ts rename to test/shared/auth.test.ts index 770e0c4d48..c4ecab59d5 100644 --- a/packages/core/test/shared/auth.test.ts +++ b/test/shared/auth.test.ts @@ -1,9 +1,9 @@ import { - OAuthClientMetadataSchema, + SafeUrlSchema, OAuthMetadataSchema, OpenIdProviderMetadataSchema, - OptionalSafeUrlSchema, - SafeUrlSchema + OAuthClientMetadataSchema, + OptionalSafeUrlSchema } from '../../src/shared/auth.js'; describe('SafeUrlSchema', () => { diff --git a/packages/core/test/shared/protocol-transport-handling.test.ts b/test/shared/protocol-transport-handling.test.ts similarity index 96% rename from packages/core/test/shared/protocol-transport-handling.test.ts rename to test/shared/protocol-transport-handling.test.ts index 0e1b9b5c9b..60eff5c2e0 100644 --- a/packages/core/test/shared/protocol-transport-handling.test.ts +++ b/test/shared/protocol-transport-handling.test.ts @@ -1,9 +1,8 @@ -import { beforeEach, describe, expect, test } from 'vitest'; -import * as z from 'zod/v4'; - +import { describe, expect, test, beforeEach } from 'vitest'; import { Protocol } from '../../src/shared/protocol.js'; -import type { Transport } from '../../src/shared/transport.js'; -import type { JSONRPCMessage, Notification, Request, Result } from '../../src/types/types.js'; +import { Transport } from '../../src/shared/transport.js'; +import { Request, Notification, Result, JSONRPCMessage } from '../../src/types.js'; +import * as z from 'zod/v4'; // Mock Transport class class MockTransport implements Transport { diff --git a/packages/core/test/shared/protocol.test.ts b/test/shared/protocol.test.ts similarity index 97% rename from packages/core/test/shared/protocol.test.ts rename to test/shared/protocol.test.ts index b16a4453d5..6681cfd17f 100644 --- a/packages/core/test/shared/protocol.test.ts +++ b/test/shared/protocol.test.ts @@ -1,41 +1,32 @@ -import type { MockInstance } from 'vitest'; -import { vi } from 'vitest'; -import type { ZodType } from 'zod'; -import { z } from 'zod'; - -import type { - QueuedMessage, - QueuedNotification, - QueuedRequest, - TaskMessageQueue, - TaskStore -} from '../../src/experimental/tasks/interfaces.js'; -import { InMemoryTaskMessageQueue } from '../../src/experimental/tasks/stores/in-memory.js'; -import { mergeCapabilities, Protocol } from '../../src/shared/protocol.js'; -import type { ErrorMessage, ResponseMessage } from '../../src/shared/responseMessage.js'; -import { toArrayAsync } from '../../src/shared/responseMessage.js'; -import type { Transport, TransportSendOptions } from '../../src/shared/transport.js'; -import type { +import { ZodType, z } from 'zod'; +import { + CallToolRequestSchema, ClientCapabilities, - JSONRPCErrorResponse, + ErrorCode, JSONRPCMessage, - JSONRPCRequest, - JSONRPCResultResponse, + McpError, Notification, + RELATED_TASK_META_KEY, Request, RequestId, Result, ServerCapabilities, Task, TaskCreationParams -} from '../../src/types/types.js'; -import { CallToolRequestSchema, ErrorCode, McpError, RELATED_TASK_META_KEY } from '../../src/types/types.js'; +} from '../../src/types.js'; +import { Protocol, mergeCapabilities } from '../../src/shared/protocol.js'; +import { Transport, TransportSendOptions } from '../../src/shared/transport.js'; +import { TaskStore, TaskMessageQueue, QueuedMessage, QueuedNotification, QueuedRequest } from '../../src/experimental/tasks/interfaces.js'; +import { MockInstance, vi } from 'vitest'; +import { JSONRPCResponse, JSONRPCRequest, JSONRPCError } from '../../src/types.js'; +import { ErrorMessage, ResponseMessage, toArrayAsync } from '../../src/shared/responseMessage.js'; +import { InMemoryTaskMessageQueue } from '../../src/experimental/tasks/stores/in-memory.js'; // Type helper for accessing private/protected Protocol properties in tests interface TestProtocol { _taskMessageQueue?: TaskMessageQueue; - _requestResolvers: Map void>; - _responseHandlers: Map void>; + _requestResolvers: Map void>; + _responseHandlers: Map void>; _taskProgressTokens: Map; _clearTaskQueue: (taskId: string, sessionId?: string) => Promise; requestTaskStore: (request: Request, authInfo: unknown) => TaskStore; @@ -721,7 +712,7 @@ describe('protocol tests', () => { expect(sendSpy).toHaveBeenCalledTimes(1); // The final sent object might not even have the `params` key, which is fine. // We can check that it was called and that the params are "falsy". - const sentNotification = sendSpy.mock.calls[0]![0]; + const sentNotification = sendSpy.mock.calls[0][0]; expect(sentNotification.method).toBe('test/debounced'); expect(sentNotification.params).toBeUndefined(); }); @@ -1346,7 +1337,7 @@ describe('Task-based execution', () => { await listedTasks.waitForLatch(); expect(mockTaskStore.listTasks).toHaveBeenCalledWith(undefined, undefined); - const sentMessage = sendSpy.mock.calls[0]![0]; + const sentMessage = sendSpy.mock.calls[0][0]; expect(sentMessage.jsonrpc).toBe('2.0'); expect(sentMessage.id).toBe(3); expect(sentMessage.result.tasks).toEqual([ @@ -1409,7 +1400,7 @@ describe('Task-based execution', () => { await listedTasks.waitForLatch(); expect(mockTaskStore.listTasks).toHaveBeenCalledWith('task-2', undefined); - const sentMessage = sendSpy.mock.calls[0]![0]; + const sentMessage = sendSpy.mock.calls[0][0]; expect(sentMessage.jsonrpc).toBe('2.0'); expect(sentMessage.id).toBe(2); expect(sentMessage.result.tasks).toEqual([ @@ -1453,7 +1444,7 @@ describe('Task-based execution', () => { await listedTasks.waitForLatch(); expect(mockTaskStore.listTasks).toHaveBeenCalledWith(undefined, undefined); - const sentMessage = sendSpy.mock.calls[0]![0]; + const sentMessage = sendSpy.mock.calls[0][0]; expect(sentMessage.jsonrpc).toBe('2.0'); expect(sentMessage.id).toBe(3); expect(sentMessage.result.tasks).toEqual([]); @@ -1488,7 +1479,7 @@ describe('Task-based execution', () => { await new Promise(resolve => setTimeout(resolve, 10)); expect(mockTaskStore.listTasks).toHaveBeenCalledWith('bad-cursor', undefined); - const sentMessage = sendSpy.mock.calls[0]![0]; + const sentMessage = sendSpy.mock.calls[0][0]; expect(sentMessage.jsonrpc).toBe('2.0'); expect(sentMessage.id).toBe(4); expect(sentMessage.error).toBeDefined(); @@ -1506,7 +1497,7 @@ describe('Task-based execution', () => { setTimeout(() => { transport.onmessage?.({ jsonrpc: '2.0', - id: sendSpy.mock.calls[0]![0].id, + id: sendSpy.mock.calls[0][0].id, result: { tasks: [ { @@ -1534,7 +1525,7 @@ describe('Task-based execution', () => { expect.any(Object) ); expect(result.tasks).toHaveLength(1); - expect(result.tasks[0]?.taskId).toBe('task-1'); + expect(result.tasks[0].taskId).toBe('task-1'); }); it('should call listTasks with cursor from client side', async () => { @@ -1546,7 +1537,7 @@ describe('Task-based execution', () => { setTimeout(() => { transport.onmessage?.({ jsonrpc: '2.0', - id: sendSpy.mock.calls[0]![0].id, + id: sendSpy.mock.calls[0][0].id, result: { tasks: [ { @@ -1576,7 +1567,7 @@ describe('Task-based execution', () => { expect.any(Object) ); expect(result.tasks).toHaveLength(1); - expect(result.tasks[0]?.taskId).toBe('task-11'); + expect(result.tasks[0].taskId).toBe('task-11'); expect(result.nextCursor).toBe('task-11'); }); }); @@ -1629,7 +1620,7 @@ describe('Task-based execution', () => { 'Client cancelled task execution.', undefined ); - const sentMessage = sendSpy.mock.calls[0]![0] as unknown as JSONRPCResultResponse; + const sentMessage = sendSpy.mock.calls[0][0] as unknown as JSONRPCResponse; expect(sentMessage.jsonrpc).toBe('2.0'); expect(sentMessage.id).toBe(5); expect(sentMessage.result._meta).toBeDefined(); @@ -1667,7 +1658,7 @@ describe('Task-based execution', () => { taskDeleted.releaseLatch(); expect(mockTaskStore.getTask).toHaveBeenCalledWith('non-existent', undefined); - const sentMessage = sendSpy.mock.calls[0]![0] as unknown as JSONRPCErrorResponse; + const sentMessage = sendSpy.mock.calls[0][0] as unknown as JSONRPCError; expect(sentMessage.jsonrpc).toBe('2.0'); expect(sentMessage.id).toBe(6); expect(sentMessage.error).toBeDefined(); @@ -1715,7 +1706,7 @@ describe('Task-based execution', () => { expect(mockTaskStore.getTask).toHaveBeenCalledWith(completedTask.taskId, undefined); expect(mockTaskStore.updateTaskStatus).not.toHaveBeenCalled(); - const sentMessage = sendSpy.mock.calls[0]![0] as unknown as JSONRPCErrorResponse; + const sentMessage = sendSpy.mock.calls[0][0] as unknown as JSONRPCError; expect(sentMessage.jsonrpc).toBe('2.0'); expect(sentMessage.id).toBe(7); expect(sentMessage.error).toBeDefined(); @@ -1732,7 +1723,7 @@ describe('Task-based execution', () => { setTimeout(() => { transport.onmessage?.({ jsonrpc: '2.0', - id: sendSpy.mock.calls[0]![0].id, + id: sendSpy.mock.calls[0][0].id, result: { _meta: {}, taskId: 'task-to-delete', @@ -1807,7 +1798,7 @@ describe('Task-based execution', () => { // This is done by the RequestTaskStore wrapper to get the updated task for the notification const getTaskCalls = mockTaskStore.getTask.mock.calls; const lastGetTaskCall = getTaskCalls[getTaskCalls.length - 1]; - expect(lastGetTaskCall?.[0]).toBe(task.taskId); + expect(lastGetTaskCall[0]).toBe(task.taskId); }); }); @@ -1857,7 +1848,7 @@ describe('Task-based execution', () => { ); // Verify _meta is not present or doesn't contain RELATED_TASK_META_KEY - const response = sendSpy.mock.calls[0]![0] as { result?: { _meta?: Record } }; + const response = sendSpy.mock.calls[0][0] as { result?: { _meta?: Record } }; expect(response.result?._meta?.[RELATED_TASK_META_KEY]).toBeUndefined(); }); @@ -1894,7 +1885,7 @@ describe('Task-based execution', () => { await new Promise(resolve => setTimeout(resolve, 50)); // Verify response does NOT include related-task metadata - const response = sendSpy.mock.calls[0]![0] as { result?: { _meta?: Record } }; + const response = sendSpy.mock.calls[0][0] as { result?: { _meta?: Record } }; expect(response.result?._meta).toEqual({}); }); @@ -1933,7 +1924,7 @@ describe('Task-based execution', () => { await new Promise(resolve => setTimeout(resolve, 50)); // Verify response does NOT include related-task metadata - const response = sendSpy.mock.calls[0]![0] as { result?: { _meta?: Record } }; + const response = sendSpy.mock.calls[0][0] as { result?: { _meta?: Record } }; expect(response.result?._meta).toEqual({}); }); @@ -2423,7 +2414,7 @@ describe('Progress notification support for tasks', () => { await new Promise(resolve => setTimeout(resolve, 10)); // Get the message ID from the sent request - const sentRequest = sendSpy.mock.calls[0]![0] as { id: number; params: { _meta: { progressToken: number } } }; + const sentRequest = sendSpy.mock.calls[0][0] as { id: number; params: { _meta: { progressToken: number } } }; const messageId = sentRequest.id; const progressToken = sentRequest.params._meta.progressToken; @@ -2532,7 +2523,7 @@ describe('Progress notification support for tasks', () => { // Wait a bit for the request to be sent await new Promise(resolve => setTimeout(resolve, 10)); - const sentRequest = sendSpy.mock.calls[0]![0] as { id: number; params: { _meta: { progressToken: number } } }; + const sentRequest = sendSpy.mock.calls[0][0] as { id: number; params: { _meta: { progressToken: number } } }; const messageId = sentRequest.id; const progressToken = sentRequest.params._meta.progressToken; @@ -2642,7 +2633,7 @@ describe('Progress notification support for tasks', () => { onprogress: progressCallback }); - const sentRequest = sendSpy.mock.calls[0]![0] as { id: number; params: { _meta: { progressToken: number } } }; + const sentRequest = sendSpy.mock.calls[0][0] as { id: number; params: { _meta: { progressToken: number } } }; const messageId = sentRequest.id; const progressToken = sentRequest.params._meta.progressToken; @@ -2740,7 +2731,7 @@ describe('Progress notification support for tasks', () => { onprogress: progressCallback }); - const sentRequest = sendSpy.mock.calls[0]![0] as { id: number; params: { _meta: { progressToken: number } } }; + const sentRequest = sendSpy.mock.calls[0][0] as { id: number; params: { _meta: { progressToken: number } } }; const messageId = sentRequest.id; const progressToken = sentRequest.params._meta.progressToken; @@ -2835,7 +2826,7 @@ describe('Progress notification support for tasks', () => { onprogress: progressCallback }); - const sentRequest = sendSpy.mock.calls[0]![0] as { id: number; params: { _meta: { progressToken: number } } }; + const sentRequest = sendSpy.mock.calls[0][0] as { id: number; params: { _meta: { progressToken: number } } }; const messageId = sentRequest.id; const progressToken = sentRequest.params._meta.progressToken; @@ -2908,7 +2899,7 @@ describe('Progress notification support for tasks', () => { onprogress: onProgressMock }); - const sentMessage = sendSpy.mock.calls[0]![0]; + const sentMessage = sendSpy.mock.calls[0][0]; expect(sentMessage.params._meta.progressToken).toBeDefined(); }); @@ -2933,7 +2924,7 @@ describe('Progress notification support for tasks', () => { onprogress: onProgressMock }); - const sentMessage = sendSpy.mock.calls[0]![0]; + const sentMessage = sendSpy.mock.calls[0][0]; const progressToken = sentMessage.params._meta.progressToken; // Simulate progress notification @@ -2983,7 +2974,7 @@ describe('Progress notification support for tasks', () => { onprogress: onProgressMock }); - const sentMessage = sendSpy.mock.calls[0]![0]; + const sentMessage = sendSpy.mock.calls[0][0]; const progressToken = sentMessage.params._meta.progressToken; // Simulate CreateTaskResult response @@ -3886,7 +3877,7 @@ describe('Message Interception', () => { expect(queue).toBeDefined(); // Clean up the pending request - const requestId = (sendSpy.mock.calls[0]![0] as JSONRPCResultResponse).id; + const requestId = (sendSpy.mock.calls[0][0] as JSONRPCResponse).id; transport.onmessage?.({ jsonrpc: '2.0', id: requestId, @@ -4496,7 +4487,7 @@ describe('requestStream() method', () => { // Should yield exactly one result message expect(messages).toHaveLength(1); - expect(messages[0]?.type).toBe('result'); + expect(messages[0].type).toBe('result'); expect(messages[0]).toHaveProperty('result'); }); @@ -4539,10 +4530,10 @@ describe('requestStream() method', () => { // Should yield exactly one error message expect(messages).toHaveLength(1); - expect(messages[0]?.type).toBe('error'); + expect(messages[0].type).toBe('error'); expect(messages[0]).toHaveProperty('error'); - if (messages[0]?.type === 'error') { - expect(messages[0]?.error?.message).toContain('Test error'); + if (messages[0].type === 'error') { + expect(messages[0].error.message).toContain('Test error'); } }); @@ -4577,9 +4568,9 @@ describe('requestStream() method', () => { // Should yield error message about cancellation expect(messages).toHaveLength(1); - expect(messages[0]?.type).toBe('error'); - if (messages[0]?.type === 'error') { - expect(messages[0]?.error?.message).toContain('cancelled'); + expect(messages[0].type).toBe('error'); + if (messages[0].type === 'error') { + expect(messages[0].error.message).toContain('cancelled'); } }); @@ -4619,7 +4610,7 @@ describe('requestStream() method', () => { // Verify error is terminal and last message expect(messages.length).toBeGreaterThan(0); const lastMessage = messages[messages.length - 1]; - assertErrorResponse(lastMessage!); + assertErrorResponse(lastMessage); expect(lastMessage.error).toBeDefined(); expect(lastMessage.error.message).toContain('Server error'); }); @@ -4656,7 +4647,7 @@ describe('requestStream() method', () => { // Verify error is terminal and last message expect(messages.length).toBeGreaterThan(0); const lastMessage = messages[messages.length - 1]; - assertErrorResponse(lastMessage!); + assertErrorResponse(lastMessage); expect(lastMessage.error).toBeDefined(); expect(lastMessage.error.code).toBe(ErrorCode.RequestTimeout); } finally { @@ -4692,7 +4683,7 @@ describe('requestStream() method', () => { // Verify error is terminal and last message expect(messages.length).toBeGreaterThan(0); const lastMessage = messages[messages.length - 1]; - assertErrorResponse(lastMessage!); + assertErrorResponse(lastMessage); expect(lastMessage.error).toBeDefined(); expect(lastMessage.error.message).toContain('cancelled'); }); @@ -4731,7 +4722,7 @@ describe('requestStream() method', () => { // Verify only one message (the error) was yielded expect(messages).toHaveLength(1); - expect(messages[0]?.type).toBe('error'); + expect(messages[0].type).toBe('error'); // Try to send another message (should be ignored) transport.onmessage?.({ @@ -4805,7 +4796,7 @@ describe('requestStream() method', () => { // Verify error is terminal and last message expect(messages.length).toBeGreaterThan(0); const lastMessage = messages[messages.length - 1]; - assertErrorResponse(lastMessage!); + assertErrorResponse(lastMessage); expect(lastMessage.error).toBeDefined(); }); @@ -4833,7 +4824,7 @@ describe('requestStream() method', () => { // Verify error is terminal and last message expect(messages.length).toBeGreaterThan(0); const lastMessage = messages[messages.length - 1]; - assertErrorResponse(lastMessage!); + assertErrorResponse(lastMessage); expect(lastMessage.error).toBeDefined(); }); @@ -4872,12 +4863,12 @@ describe('requestStream() method', () => { // Verify error is the last message expect(messages.length).toBeGreaterThan(0); const lastMessage = messages[messages.length - 1]; - expect(lastMessage?.type).toBe('error'); + expect(lastMessage.type).toBe('error'); // Verify all messages before the last are not terminal for (let i = 0; i < messages.length - 1; i++) { - expect(messages[i]?.type).not.toBe('error'); - expect(messages[i]?.type).not.toBe('result'); + expect(messages[i].type).not.toBe('error'); + expect(messages[i].type).not.toBe('result'); } }); }); @@ -4940,7 +4931,7 @@ describe('Error handling for missing resolvers', () => { // Manually trigger the response handling logic if (queuedMessage && queuedMessage.type === 'response') { - const responseMessage = queuedMessage.message as JSONRPCResultResponse; + const responseMessage = queuedMessage.message as JSONRPCResponse; const requestId = responseMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(requestId); @@ -5061,7 +5052,7 @@ describe('Error handling for missing resolvers', () => { expect(resolverMock).toHaveBeenCalledWith(expect.any(McpError)); // Verify the error has the correct properties - const calledError = resolverMock.mock.calls[0]![0]; + const calledError = resolverMock.mock.calls[0][0]; expect(calledError.code).toBe(ErrorCode.InternalError); expect(calledError.message).toContain('Task cancelled or completed'); @@ -5121,7 +5112,7 @@ describe('Error handling for missing resolvers', () => { expect(resolverMock).toHaveBeenCalledWith(expect.any(McpError)); // Verify the error has the correct properties - const calledError = resolverMock.mock.calls[0]![0]; + const calledError = resolverMock.mock.calls[0][0]; expect(calledError.code).toBe(ErrorCode.InternalError); expect(calledError.message).toContain('Task cancelled or completed'); @@ -5146,7 +5137,7 @@ describe('Error handling for missing resolvers', () => { const messageId = 123; // Create a response resolver without a corresponding response handler - const responseResolver = (response: JSONRPCResultResponse | Error) => { + const responseResolver = (response: JSONRPCResponse | Error) => { const handler = testProtocol._responseHandlers.get(messageId); if (handler) { handler(response); @@ -5156,7 +5147,7 @@ describe('Error handling for missing resolvers', () => { }; // Simulate the resolver being called without a handler - const mockResponse: JSONRPCResultResponse = { + const mockResponse: JSONRPCResponse = { jsonrpc: '2.0', id: messageId, result: { content: [] } @@ -5194,7 +5185,7 @@ describe('Error handling for missing resolvers', () => { const msg = await taskMessageQueue.dequeue(task.taskId); if (msg && msg.type === 'response') { const testProtocol = protocol as unknown as TestProtocol; - const responseMessage = msg.message as JSONRPCResultResponse; + const responseMessage = msg.message as JSONRPCResponse; const requestId = responseMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(requestId); if (!resolver) { @@ -5262,7 +5253,7 @@ describe('Error handling for missing resolvers', () => { // Manually trigger the error handling logic if (queuedMessage && queuedMessage.type === 'error') { - const errorMessage = queuedMessage.message as JSONRPCErrorResponse; + const errorMessage = queuedMessage.message as JSONRPCError; const reqId = errorMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(reqId); @@ -5275,7 +5266,7 @@ describe('Error handling for missing resolvers', () => { // Verify resolver was called with McpError expect(resolverMock).toHaveBeenCalledWith(expect.any(McpError)); - const calledError = resolverMock.mock.calls[0]![0]; + const calledError = resolverMock.mock.calls[0][0]; expect(calledError.code).toBe(ErrorCode.InvalidRequest); expect(calledError.message).toContain('Invalid request parameters'); @@ -5310,7 +5301,7 @@ describe('Error handling for missing resolvers', () => { // Manually trigger the error handling logic if (queuedMessage && queuedMessage.type === 'error') { const testProtocol = protocol as unknown as TestProtocol; - const errorMessage = queuedMessage.message as JSONRPCErrorResponse; + const errorMessage = queuedMessage.message as JSONRPCError; const requestId = errorMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(requestId); @@ -5357,7 +5348,7 @@ describe('Error handling for missing resolvers', () => { const queuedMessage = await taskMessageQueue.dequeue(task.taskId); if (queuedMessage && queuedMessage.type === 'error') { - const errorMessage = queuedMessage.message as JSONRPCErrorResponse; + const errorMessage = queuedMessage.message as JSONRPCError; const reqId = errorMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(reqId); @@ -5370,7 +5361,7 @@ describe('Error handling for missing resolvers', () => { // Verify resolver was called with McpError including data expect(resolverMock).toHaveBeenCalledWith(expect.any(McpError)); - const calledError = resolverMock.mock.calls[0]![0]; + const calledError = resolverMock.mock.calls[0][0]; expect(calledError.code).toBe(ErrorCode.InvalidParams); expect(calledError.message).toContain('Validation failed'); expect(calledError.data).toEqual({ field: 'userName', reason: 'required' }); @@ -5399,7 +5390,7 @@ describe('Error handling for missing resolvers', () => { const msg = await taskMessageQueue.dequeue(task.taskId); if (msg && msg.type === 'error') { const testProtocol = protocol as unknown as TestProtocol; - const errorMessage = msg.message as JSONRPCErrorResponse; + const errorMessage = msg.message as JSONRPCError; const requestId = errorMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(requestId); if (!resolver) { @@ -5466,7 +5457,7 @@ describe('Error handling for missing resolvers', () => { let msg; while ((msg = await taskMessageQueue.dequeue(task.taskId))) { if (msg.type === 'response') { - const responseMessage = msg.message as JSONRPCResultResponse; + const responseMessage = msg.message as JSONRPCResponse; const requestId = responseMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(requestId); if (resolver) { @@ -5474,7 +5465,7 @@ describe('Error handling for missing resolvers', () => { resolver(responseMessage); } } else if (msg.type === 'error') { - const errorMessage = msg.message as JSONRPCErrorResponse; + const errorMessage = msg.message as JSONRPCError; const requestId = errorMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(requestId); if (resolver) { @@ -5491,7 +5482,7 @@ describe('Error handling for missing resolvers', () => { expect(resolver3).toHaveBeenCalledWith(expect.objectContaining({ id: 3 })); // Verify error has correct properties - const error = resolver2.mock.calls[0]![0]; + const error = resolver2.mock.calls[0][0]; expect(error.code).toBe(ErrorCode.InvalidRequest); expect(error.message).toContain('Request failed'); @@ -5541,7 +5532,7 @@ describe('Error handling for missing resolvers', () => { let msg; while ((msg = await taskMessageQueue.dequeue(task.taskId))) { if (msg.type === 'response') { - const responseMessage = msg.message as JSONRPCResultResponse; + const responseMessage = msg.message as JSONRPCResponse; const requestId = responseMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(requestId); if (resolver) { @@ -5549,7 +5540,7 @@ describe('Error handling for missing resolvers', () => { resolver(responseMessage); } } else if (msg.type === 'error') { - const errorMessage = msg.message as JSONRPCErrorResponse; + const errorMessage = msg.message as JSONRPCError; const requestId = errorMessage.id as RequestId; const resolver = testProtocol._requestResolvers.get(requestId); if (resolver) { diff --git a/packages/core/test/shared/stdio.test.ts b/test/shared/stdio.test.ts similarity index 94% rename from packages/core/test/shared/stdio.test.ts rename to test/shared/stdio.test.ts index 455c8a6270..e8cbb5245a 100644 --- a/packages/core/test/shared/stdio.test.ts +++ b/test/shared/stdio.test.ts @@ -1,5 +1,5 @@ +import { JSONRPCMessage } from '../../src/types.js'; import { ReadBuffer } from '../../src/shared/stdio.js'; -import type { JSONRPCMessage } from '../../src/types/types.js'; const testMessage: JSONRPCMessage = { jsonrpc: '2.0', diff --git a/packages/core/test/shared/toolNameValidation.test.ts b/test/shared/toolNameValidation.test.ts similarity index 97% rename from packages/core/test/shared/toolNameValidation.test.ts rename to test/shared/toolNameValidation.test.ts index 131cbbc5f6..bd3c5ea4fb 100644 --- a/packages/core/test/shared/toolNameValidation.test.ts +++ b/test/shared/toolNameValidation.test.ts @@ -1,7 +1,5 @@ -import type { MockInstance } from 'vitest'; -import { vi } from 'vitest'; - -import { issueToolNameWarning, validateAndWarnToolName, validateToolName } from '../../src/shared/toolNameValidation.js'; +import { validateToolName, validateAndWarnToolName, issueToolNameWarning } from '../../src/shared/toolNameValidation.js'; +import { vi, MockInstance } from 'vitest'; // Spy on console.warn to capture output let warnSpy: MockInstance; diff --git a/packages/core/test/shared/uriTemplate.test.ts b/test/shared/uriTemplate.test.ts similarity index 100% rename from packages/core/test/shared/uriTemplate.test.ts rename to test/shared/uriTemplate.test.ts diff --git a/packages/core/test/spec.types.test.ts b/test/spec.types.test.ts similarity index 66% rename from packages/core/test/spec.types.test.ts rename to test/spec.types.test.ts index f7f99fe272..3b65d4d4f2 100644 --- a/packages/core/test/spec.types.test.ts +++ b/test/spec.types.test.ts @@ -5,15 +5,24 @@ * - Runtime checks to verify each Spec type has a static check * (note: a few don't have SDK types, see MISSING_SDK_TYPES below) */ +import * as SDKTypes from '../src/types.js'; +import * as SpecTypes from '../src/spec.types.js'; import fs from 'node:fs'; -import path from 'node:path'; - -import type * as SpecTypes from '../src/types/spec.types.js'; -import type * as SDKTypes from '../src/types/types.js'; /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-unsafe-function-type */ +// Removes index signatures added by ZodObject.passthrough(). +type RemovePassthrough = T extends object + ? T extends Array + ? Array> + : T extends Function + ? T + : { + [K in keyof T as string extends K ? never : K]: RemovePassthrough; + } + : T; + // Adds the `jsonrpc` property to a type, to match the on-wire format of notifications. type WithJSONRPC = T & { jsonrpc: '2.0' }; @@ -87,103 +96,112 @@ type FixSpecCreateMessageResult = T extends { content: infer C; role: infer R : T; const sdkTypeChecks = { - RequestParams: (sdk: SDKTypes.RequestParams, spec: SpecTypes.RequestParams) => { + RequestParams: (sdk: RemovePassthrough, spec: SpecTypes.RequestParams) => { sdk = spec; spec = sdk; }, - NotificationParams: (sdk: SDKTypes.NotificationParams, spec: SpecTypes.NotificationParams) => { + NotificationParams: (sdk: RemovePassthrough, spec: SpecTypes.NotificationParams) => { sdk = spec; spec = sdk; }, - CancelledNotificationParams: (sdk: SDKTypes.CancelledNotificationParams, spec: SpecTypes.CancelledNotificationParams) => { + CancelledNotificationParams: ( + sdk: RemovePassthrough, + spec: SpecTypes.CancelledNotificationParams + ) => { sdk = spec; spec = sdk; }, InitializeRequestParams: ( - sdk: SDKTypes.InitializeRequestParams, + sdk: RemovePassthrough, spec: FixSpecInitializeRequestParams ) => { sdk = spec; spec = sdk; }, - ProgressNotificationParams: (sdk: SDKTypes.ProgressNotificationParams, spec: SpecTypes.ProgressNotificationParams) => { + ProgressNotificationParams: ( + sdk: RemovePassthrough, + spec: SpecTypes.ProgressNotificationParams + ) => { sdk = spec; spec = sdk; }, - ResourceRequestParams: (sdk: SDKTypes.ResourceRequestParams, spec: SpecTypes.ResourceRequestParams) => { + ResourceRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.ResourceRequestParams) => { sdk = spec; spec = sdk; }, - ReadResourceRequestParams: (sdk: SDKTypes.ReadResourceRequestParams, spec: SpecTypes.ReadResourceRequestParams) => { + ReadResourceRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.ReadResourceRequestParams) => { sdk = spec; spec = sdk; }, - SubscribeRequestParams: (sdk: SDKTypes.SubscribeRequestParams, spec: SpecTypes.SubscribeRequestParams) => { + SubscribeRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.SubscribeRequestParams) => { sdk = spec; spec = sdk; }, - UnsubscribeRequestParams: (sdk: SDKTypes.UnsubscribeRequestParams, spec: SpecTypes.UnsubscribeRequestParams) => { + UnsubscribeRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.UnsubscribeRequestParams) => { sdk = spec; spec = sdk; }, ResourceUpdatedNotificationParams: ( - sdk: SDKTypes.ResourceUpdatedNotificationParams, + sdk: RemovePassthrough, spec: SpecTypes.ResourceUpdatedNotificationParams ) => { sdk = spec; spec = sdk; }, - GetPromptRequestParams: (sdk: SDKTypes.GetPromptRequestParams, spec: SpecTypes.GetPromptRequestParams) => { + GetPromptRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.GetPromptRequestParams) => { sdk = spec; spec = sdk; }, - CallToolRequestParams: (sdk: SDKTypes.CallToolRequestParams, spec: SpecTypes.CallToolRequestParams) => { + CallToolRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.CallToolRequestParams) => { sdk = spec; spec = sdk; }, - SetLevelRequestParams: (sdk: SDKTypes.SetLevelRequestParams, spec: SpecTypes.SetLevelRequestParams) => { + SetLevelRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.SetLevelRequestParams) => { sdk = spec; spec = sdk; }, LoggingMessageNotificationParams: ( - sdk: MakeUnknownsNotOptional, + sdk: MakeUnknownsNotOptional>, spec: SpecTypes.LoggingMessageNotificationParams ) => { sdk = spec; spec = sdk; }, - CreateMessageRequestParams: (sdk: SDKTypes.CreateMessageRequestParams, spec: SpecTypes.CreateMessageRequestParams) => { + CreateMessageRequestParams: ( + sdk: RemovePassthrough, + spec: SpecTypes.CreateMessageRequestParams + ) => { sdk = spec; spec = sdk; }, - CompleteRequestParams: (sdk: SDKTypes.CompleteRequestParams, spec: SpecTypes.CompleteRequestParams) => { + CompleteRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.CompleteRequestParams) => { sdk = spec; spec = sdk; }, - ElicitRequestParams: (sdk: SDKTypes.ElicitRequestParams, spec: SpecTypes.ElicitRequestParams) => { + ElicitRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.ElicitRequestParams) => { sdk = spec; spec = sdk; }, - ElicitRequestFormParams: (sdk: SDKTypes.ElicitRequestFormParams, spec: SpecTypes.ElicitRequestFormParams) => { + ElicitRequestFormParams: (sdk: RemovePassthrough, spec: SpecTypes.ElicitRequestFormParams) => { sdk = spec; spec = sdk; }, - ElicitRequestURLParams: (sdk: SDKTypes.ElicitRequestURLParams, spec: SpecTypes.ElicitRequestURLParams) => { + ElicitRequestURLParams: (sdk: RemovePassthrough, spec: SpecTypes.ElicitRequestURLParams) => { sdk = spec; spec = sdk; }, ElicitationCompleteNotification: ( - sdk: WithJSONRPC, + sdk: RemovePassthrough>, spec: SpecTypes.ElicitationCompleteNotification ) => { sdk = spec; spec = sdk; }, - PaginatedRequestParams: (sdk: SDKTypes.PaginatedRequestParams, spec: SpecTypes.PaginatedRequestParams) => { + PaginatedRequestParams: (sdk: RemovePassthrough, spec: SpecTypes.PaginatedRequestParams) => { sdk = spec; spec = sdk; }, - CancelledNotification: (sdk: WithJSONRPC, spec: SpecTypes.CancelledNotification) => { + CancelledNotification: (sdk: RemovePassthrough>, spec: SpecTypes.CancelledNotification) => { sdk = spec; spec = sdk; }, @@ -195,19 +213,19 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ProgressNotification: (sdk: WithJSONRPC, spec: SpecTypes.ProgressNotification) => { + ProgressNotification: (sdk: RemovePassthrough>, spec: SpecTypes.ProgressNotification) => { sdk = spec; spec = sdk; }, - SubscribeRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.SubscribeRequest) => { + SubscribeRequest: (sdk: RemovePassthrough>, spec: SpecTypes.SubscribeRequest) => { sdk = spec; spec = sdk; }, - UnsubscribeRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.UnsubscribeRequest) => { + UnsubscribeRequest: (sdk: RemovePassthrough>, spec: SpecTypes.UnsubscribeRequest) => { sdk = spec; spec = sdk; }, - PaginatedRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.PaginatedRequest) => { + PaginatedRequest: (sdk: RemovePassthrough>, spec: SpecTypes.PaginatedRequest) => { sdk = spec; spec = sdk; }, @@ -215,7 +233,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ListRootsRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.ListRootsRequest) => { + ListRootsRequest: (sdk: RemovePassthrough>, spec: SpecTypes.ListRootsRequest) => { sdk = spec; spec = sdk; }, @@ -227,7 +245,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ElicitRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.ElicitRequest) => { + ElicitRequest: (sdk: RemovePassthrough>, spec: SpecTypes.ElicitRequest) => { sdk = spec; spec = sdk; }, @@ -235,7 +253,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - CompleteRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.CompleteRequest) => { + CompleteRequest: (sdk: RemovePassthrough>, spec: SpecTypes.CompleteRequest) => { sdk = spec; spec = sdk; }, @@ -287,7 +305,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ClientNotification: (sdk: WithJSONRPC, spec: SpecTypes.ClientNotification) => { + ClientNotification: (sdk: RemovePassthrough>, spec: SpecTypes.ClientNotification) => { sdk = spec; spec = sdk; }, @@ -311,7 +329,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ListToolsRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.ListToolsRequest) => { + ListToolsRequest: (sdk: RemovePassthrough>, spec: SpecTypes.ListToolsRequest) => { sdk = spec; spec = sdk; }, @@ -323,60 +341,75 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - CallToolRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.CallToolRequest) => { + CallToolRequest: (sdk: RemovePassthrough>, spec: SpecTypes.CallToolRequest) => { sdk = spec; spec = sdk; }, - ToolListChangedNotification: (sdk: WithJSONRPC, spec: SpecTypes.ToolListChangedNotification) => { + ToolListChangedNotification: ( + sdk: RemovePassthrough>, + spec: SpecTypes.ToolListChangedNotification + ) => { sdk = spec; spec = sdk; }, ResourceListChangedNotification: ( - sdk: WithJSONRPC, + sdk: RemovePassthrough>, spec: SpecTypes.ResourceListChangedNotification ) => { sdk = spec; spec = sdk; }, PromptListChangedNotification: ( - sdk: WithJSONRPC, + sdk: RemovePassthrough>, spec: SpecTypes.PromptListChangedNotification ) => { sdk = spec; spec = sdk; }, RootsListChangedNotification: ( - sdk: WithJSONRPC, + sdk: RemovePassthrough>, spec: SpecTypes.RootsListChangedNotification ) => { sdk = spec; spec = sdk; }, - ResourceUpdatedNotification: (sdk: WithJSONRPC, spec: SpecTypes.ResourceUpdatedNotification) => { + ResourceUpdatedNotification: ( + sdk: RemovePassthrough>, + spec: SpecTypes.ResourceUpdatedNotification + ) => { sdk = spec; spec = sdk; }, - SamplingMessage: (sdk: SDKTypes.SamplingMessage, spec: SpecTypes.SamplingMessage) => { + SamplingMessage: (sdk: RemovePassthrough, spec: SpecTypes.SamplingMessage) => { sdk = spec; spec = sdk; }, - CreateMessageResult: (sdk: SDKTypes.CreateMessageResult, spec: FixSpecCreateMessageResult) => { + CreateMessageResult: ( + sdk: RemovePassthrough, + spec: FixSpecCreateMessageResult + ) => { sdk = spec; spec = sdk; }, - SetLevelRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.SetLevelRequest) => { + SetLevelRequest: (sdk: RemovePassthrough>, spec: SpecTypes.SetLevelRequest) => { sdk = spec; spec = sdk; }, - PingRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.PingRequest) => { + PingRequest: (sdk: RemovePassthrough>, spec: SpecTypes.PingRequest) => { sdk = spec; spec = sdk; }, - InitializedNotification: (sdk: WithJSONRPC, spec: SpecTypes.InitializedNotification) => { + InitializedNotification: ( + sdk: RemovePassthrough>, + spec: SpecTypes.InitializedNotification + ) => { sdk = spec; spec = sdk; }, - ListResourcesRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.ListResourcesRequest) => { + ListResourcesRequest: ( + sdk: RemovePassthrough>, + spec: SpecTypes.ListResourcesRequest + ) => { sdk = spec; spec = sdk; }, @@ -385,7 +418,7 @@ const sdkTypeChecks = { spec = sdk; }, ListResourceTemplatesRequest: ( - sdk: WithJSONRPCRequest, + sdk: RemovePassthrough>, spec: SpecTypes.ListResourceTemplatesRequest ) => { sdk = spec; @@ -395,7 +428,10 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ReadResourceRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.ReadResourceRequest) => { + ReadResourceRequest: ( + sdk: RemovePassthrough>, + spec: SpecTypes.ReadResourceRequest + ) => { sdk = spec; spec = sdk; }, @@ -419,7 +455,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ResourceTemplate: (sdk: SDKTypes.ResourceTemplateType, spec: SpecTypes.ResourceTemplate) => { + ResourceTemplate: (sdk: SDKTypes.ResourceTemplate, spec: SpecTypes.ResourceTemplate) => { sdk = spec; spec = sdk; }, @@ -431,7 +467,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ListPromptsRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.ListPromptsRequest) => { + ListPromptsRequest: (sdk: RemovePassthrough>, spec: SpecTypes.ListPromptsRequest) => { sdk = spec; spec = sdk; }, @@ -439,7 +475,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - GetPromptRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.GetPromptRequest) => { + GetPromptRequest: (sdk: RemovePassthrough>, spec: SpecTypes.GetPromptRequest) => { sdk = spec; spec = sdk; }, @@ -523,11 +559,7 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - JSONRPCErrorResponse: (sdk: SDKTypes.JSONRPCErrorResponse, spec: SpecTypes.JSONRPCErrorResponse) => { - sdk = spec; - spec = sdk; - }, - JSONRPCResultResponse: (sdk: SDKTypes.JSONRPCResultResponse, spec: SpecTypes.JSONRPCResultResponse) => { + JSONRPCError: (sdk: SDKTypes.JSONRPCError, spec: SpecTypes.JSONRPCError) => { sdk = spec; spec = sdk; }, @@ -535,12 +567,15 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - CreateMessageRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.CreateMessageRequest) => { + CreateMessageRequest: ( + sdk: RemovePassthrough>, + spec: SpecTypes.CreateMessageRequest + ) => { sdk = spec; spec = sdk; }, InitializeRequest: ( - sdk: WithJSONRPCRequest, + sdk: RemovePassthrough>, spec: FixSpecInitializeRequest ) => { sdk = spec; @@ -558,22 +593,28 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ClientRequest: (sdk: WithJSONRPCRequest, spec: FixSpecClientRequest) => { + ClientRequest: ( + sdk: RemovePassthrough>, + spec: FixSpecClientRequest + ) => { sdk = spec; spec = sdk; }, - ServerRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.ServerRequest) => { + ServerRequest: (sdk: RemovePassthrough>, spec: SpecTypes.ServerRequest) => { sdk = spec; spec = sdk; }, LoggingMessageNotification: ( - sdk: MakeUnknownsNotOptional>, + sdk: RemovePassthrough>>, spec: SpecTypes.LoggingMessageNotification ) => { sdk = spec; spec = sdk; }, - ServerNotification: (sdk: MakeUnknownsNotOptional>, spec: SpecTypes.ServerNotification) => { + ServerNotification: ( + sdk: MakeUnknownsNotOptional>>, + spec: SpecTypes.ServerNotification + ) => { sdk = spec; spec = sdk; }, @@ -601,15 +642,18 @@ const sdkTypeChecks = { sdk = spec; spec = sdk; }, - ToolUseContent: (sdk: SDKTypes.ToolUseContent, spec: SpecTypes.ToolUseContent) => { + ToolUseContent: (sdk: RemovePassthrough, spec: SpecTypes.ToolUseContent) => { sdk = spec; spec = sdk; }, - ToolResultContent: (sdk: SDKTypes.ToolResultContent, spec: SpecTypes.ToolResultContent) => { + ToolResultContent: (sdk: RemovePassthrough, spec: SpecTypes.ToolResultContent) => { sdk = spec; spec = sdk; }, - SamplingMessageContentBlock: (sdk: SDKTypes.SamplingMessageContentBlock, spec: SpecTypes.SamplingMessageContentBlock) => { + SamplingMessageContentBlock: ( + sdk: RemovePassthrough, + spec: SpecTypes.SamplingMessageContentBlock + ) => { sdk = spec; spec = sdk; }, @@ -620,80 +664,12 @@ const sdkTypeChecks = { Role: (sdk: SDKTypes.Role, spec: SpecTypes.Role) => { sdk = spec; spec = sdk; - }, - TaskAugmentedRequestParams: (sdk: SDKTypes.TaskAugmentedRequestParams, spec: SpecTypes.TaskAugmentedRequestParams) => { - sdk = spec; - spec = sdk; - }, - ToolExecution: (sdk: SDKTypes.ToolExecution, spec: SpecTypes.ToolExecution) => { - sdk = spec; - spec = sdk; - }, - TaskStatus: (sdk: SDKTypes.TaskStatus, spec: SpecTypes.TaskStatus) => { - sdk = spec; - spec = sdk; - }, - TaskMetadata: (sdk: SDKTypes.TaskMetadata, spec: SpecTypes.TaskMetadata) => { - sdk = spec; - spec = sdk; - }, - RelatedTaskMetadata: (sdk: SDKTypes.RelatedTaskMetadata, spec: SpecTypes.RelatedTaskMetadata) => { - sdk = spec; - spec = sdk; - }, - Task: (sdk: SDKTypes.Task, spec: SpecTypes.Task) => { - sdk = spec; - spec = sdk; - }, - CreateTaskResult: (sdk: SDKTypes.CreateTaskResult, spec: SpecTypes.CreateTaskResult) => { - sdk = spec; - spec = sdk; - }, - GetTaskResult: (sdk: SDKTypes.GetTaskResult, spec: SpecTypes.GetTaskResult) => { - sdk = spec; - spec = sdk; - }, - GetTaskPayloadRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.GetTaskPayloadRequest) => { - sdk = spec; - spec = sdk; - }, - ListTasksRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.ListTasksRequest) => { - sdk = spec; - spec = sdk; - }, - ListTasksResult: (sdk: SDKTypes.ListTasksResult, spec: SpecTypes.ListTasksResult) => { - sdk = spec; - spec = sdk; - }, - CancelTaskRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.CancelTaskRequest) => { - sdk = spec; - spec = sdk; - }, - CancelTaskResult: (sdk: SDKTypes.CancelTaskResult, spec: SpecTypes.CancelTaskResult) => { - sdk = spec; - spec = sdk; - }, - GetTaskRequest: (sdk: WithJSONRPCRequest, spec: SpecTypes.GetTaskRequest) => { - sdk = spec; - spec = sdk; - }, - GetTaskPayloadResult: (sdk: SDKTypes.GetTaskPayloadResult, spec: SpecTypes.GetTaskPayloadResult) => { - sdk = spec; - spec = sdk; - }, - TaskStatusNotificationParams: (sdk: SDKTypes.TaskStatusNotificationParams, spec: SpecTypes.TaskStatusNotificationParams) => { - sdk = spec; - spec = sdk; - }, - TaskStatusNotification: (sdk: WithJSONRPC, spec: SpecTypes.TaskStatusNotification) => { - sdk = spec; - spec = sdk; } }; // This file is .gitignore'd, and fetched by `npm run fetch:spec-types` (called by `npm run test`) -const SPEC_TYPES_FILE = path.resolve(__dirname, '../src/types/spec.types.ts'); -const SDK_TYPES_FILE = path.resolve(__dirname, '../src/types/types.ts'); +const SPEC_TYPES_FILE = 'src/spec.types.ts'; +const SDK_TYPES_FILE = 'src/types.ts'; const MISSING_SDK_TYPES = [ // These are inlined in the SDK: @@ -702,8 +678,7 @@ const MISSING_SDK_TYPES = [ ]; function extractExportedTypes(source: string): string[] { - const matches = [...source.matchAll(/export\s+(?:interface|class|type)\s+(\w+)\b/g)]; - return matches.map(m => m[1]!); + return [...source.matchAll(/export\s+(?:interface|class|type)\s+(\w+)\b/g)].map(m => m[1]); } describe('Spec Types', () => { @@ -714,7 +689,7 @@ describe('Spec Types', () => { it('should define some expected types', () => { expect(specTypes).toContain('JSONRPCNotification'); expect(specTypes).toContain('ElicitResult'); - expect(specTypes).toHaveLength(145); + expect(specTypes).toHaveLength(127); }); it('should have up to date list of missing sdk types', () => { diff --git a/packages/core/test/types.capabilities.test.ts b/test/types.capabilities.test.ts similarity index 99% rename from packages/core/test/types.capabilities.test.ts rename to test/types.capabilities.test.ts index ed414d2db0..6d7c39dc76 100644 --- a/packages/core/test/types.capabilities.test.ts +++ b/test/types.capabilities.test.ts @@ -1,4 +1,4 @@ -import { ClientCapabilitiesSchema, InitializeRequestParamsSchema } from '../src/types/types.js'; +import { ClientCapabilitiesSchema, InitializeRequestParamsSchema } from '../src/types.js'; describe('ClientCapabilitiesSchema backwards compatibility', () => { describe('ElicitationCapabilitySchema preprocessing', () => { diff --git a/packages/core/test/types.test.ts b/test/types.test.ts similarity index 98% rename from packages/core/test/types.test.ts rename to test/types.test.ts index c14fe40603..64bb78a21d 100644 --- a/packages/core/test/types.test.ts +++ b/test/types.test.ts @@ -1,21 +1,21 @@ import { + LATEST_PROTOCOL_VERSION, + SUPPORTED_PROTOCOL_VERSIONS, + ResourceLinkSchema, + ContentBlockSchema, + PromptMessageSchema, CallToolResultSchema, - ClientCapabilitiesSchema, CompleteRequestSchema, - ContentBlockSchema, + ToolSchema, + ToolUseContentSchema, + ToolResultContentSchema, + ToolChoiceSchema, + SamplingMessageSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, - LATEST_PROTOCOL_VERSION, - PromptMessageSchema, - ResourceLinkSchema, - SamplingMessageSchema, - SUPPORTED_PROTOCOL_VERSIONS, - ToolChoiceSchema, - ToolResultContentSchema, - ToolSchema, - ToolUseContentSchema -} from '../src/types/types.js'; + ClientCapabilitiesSchema +} from '../src/types.js'; describe('Types', () => { test('should have correct latest protocol version', () => { @@ -178,7 +178,7 @@ describe('Types', () => { annotations: { audience: ['user'], priority: 0.5, - lastModified: mockDate + lastModified: new Date().toISOString() } }; @@ -273,9 +273,9 @@ describe('Types', () => { expect(result.success).toBe(true); if (result.success) { expect(result.data.content).toHaveLength(3); - expect(result.data.content[0]?.type).toBe('text'); - expect(result.data.content[1]?.type).toBe('resource_link'); - expect(result.data.content[2]?.type).toBe('resource_link'); + expect(result.data.content[0].type).toBe('text'); + expect(result.data.content[1].type).toBe('resource_link'); + expect(result.data.content[2].type).toBe('resource_link'); } }); @@ -899,8 +899,8 @@ describe('Types', () => { expect(Array.isArray(content)).toBe(true); if (Array.isArray(content)) { expect(content).toHaveLength(2); - expect(content[0]?.type).toBe('text'); - expect(content[1]?.type).toBe('tool_use'); + expect(content[0].type).toBe('text'); + expect(content[1].type).toBe('tool_use'); } } diff --git a/packages/core/test/validation/validation.test.ts b/test/validation/validation.test.ts similarity index 100% rename from packages/core/test/validation/validation.test.ts rename to test/validation/validation.test.ts diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000000..4b712da77b --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "outDir": "./dist/cjs" + }, + "include": ["src/**/*"], + "exclude": ["**/*.test.ts", "src/__mocks__/**/*", "src/__fixtures__/**/*"] +} diff --git a/common/tsconfig/tsconfig.json b/tsconfig.json similarity index 51% rename from common/tsconfig/tsconfig.json rename to tsconfig.json index 6db7d705bf..c7346e4fee 100644 --- a/common/tsconfig/tsconfig.json +++ b/tsconfig.json @@ -1,24 +1,14 @@ { "compilerOptions": { - "target": "esnext", - "lib": ["esnext"], - "module": "NodeNext", - "moduleResolution": "NodeNext", - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "libReplacement": false, - "noImplicitReturns": true, - "incremental": true, + "target": "es2018", + "module": "Node16", + "moduleResolution": "Node16", "declaration": true, "declarationMap": true, "sourceMap": true, "outDir": "./dist", "strict": true, "esModuleInterop": true, - "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "isolatedModules": true, @@ -27,5 +17,7 @@ "pkce-challenge": ["./node_modules/pkce-challenge/dist/index.node"] }, "types": ["node", "vitest/globals"] - } + }, + "include": ["src/**/*", "test/**/*"], + "exclude": ["node_modules", "dist"] } diff --git a/tsconfig.prod.json b/tsconfig.prod.json new file mode 100644 index 0000000000..82710bd6ab --- /dev/null +++ b/tsconfig.prod.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/esm" + }, + "include": ["src/**/*"], + "exclude": ["**/*.test.ts", "src/__mocks__/**/*", "src/__fixtures__/**/*"] +} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000000..f283689f15 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + globals: true, + environment: 'node', + setupFiles: ['./vitest.setup.ts'], + include: ['test/**/*.test.ts'] + } +}); diff --git a/packages/client/vitest.setup.js b/vitest.setup.ts similarity index 70% rename from packages/client/vitest.setup.js rename to vitest.setup.ts index d6e9c6678c..820dcbd896 100644 --- a/packages/client/vitest.setup.js +++ b/vitest.setup.ts @@ -3,5 +3,6 @@ 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') { - globalThis.crypto = webcrypto; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (globalThis as any).crypto = webcrypto as unknown as Crypto; } diff --git a/vitest.workspace.js b/vitest.workspace.js deleted file mode 100644 index b09f1f1fd4..0000000000 --- a/vitest.workspace.js +++ /dev/null @@ -1,3 +0,0 @@ -import { defineWorkspace } from 'vitest/config'; - -export default defineWorkspace(['packages/**/vitest.config.js']);