Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
cache: npm

- run: npm ci
- run: npm run check
- run: npm run build
- run: npm test
- run: npm run lint

publish:
runs-on: ubuntu-latest
Expand Down
118 changes: 118 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"dist"
],
"scripts": {
"fetch:spec-types": "curl -o spec.types.ts https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/refs/heads/main/schema/draft/schema.ts",
"fetch:spec-types": "curl -o ./src/spec.types.ts https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/refs/heads/main/schema/draft/schema.ts",
"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",
Expand All @@ -69,6 +70,7 @@
"prepack": "npm run build:esm && npm run build:cjs",
"lint": "eslint src/ && prettier --check .",
"lint:fix": "eslint src/ --fix && prettier --write .",
"check": "npm run fetch:spec-types && npm run typecheck && npm run lint",
"test": "npm run fetch:spec-types && jest",
"start": "npm run server",
"server": "tsx watch --clear-screen=false src/cli.ts server",
Expand Down Expand Up @@ -111,6 +113,7 @@
"@types/node": "^22.0.2",
"@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",
"jest": "^29.7.0",
Expand Down
5 changes: 4 additions & 1 deletion src/client/streamableHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ export class StreamableHTTPClientTransport implements Transport {
// if something happens reader will throw
try {
// Create a pipeline: binary stream -> text decoder -> SSE parser
const reader = stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).getReader();
const reader = stream
.pipeThrough(new TextDecoderStream() as ReadableWritablePair<string, Uint8Array>)
.pipeThrough(new EventSourceParserStream())
.getReader();

while (true) {
const { value: event, done } = await reader.read();
Expand Down
4 changes: 2 additions & 2 deletions src/examples/server/simpleStreamableHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
} from '../../types.js';
import { InMemoryEventStore } from '../shared/inMemoryEventStore.js';
import { setupAuthServer } from './demoInMemoryOAuthProvider.js';
import { OAuthMetadata } from 'src/shared/auth.js';
import { checkResourceAllowed } from 'src/shared/auth-utils.js';
import { OAuthMetadata } from '../../shared/auth.js';
import { checkResourceAllowed } from '../../shared/auth-utils.js';

import cors from 'cors';

Expand Down
2 changes: 1 addition & 1 deletion src/server/sse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { McpServer } from './mcp.js';
import { createServer, type Server } from 'node:http';
import { AddressInfo } from 'node:net';
import { z } from 'zod';
import { CallToolResult, JSONRPCMessage } from 'src/types.js';
import { CallToolResult, JSONRPCMessage } from '../types.js';

const createMockResponse = () => {
const res = {
Expand Down
4 changes: 2 additions & 2 deletions src/spec.types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* (note: a few don't have SDK types, see MISSING_SDK_TYPES below)
*/
import * as SDKTypes from './types.js';
import * as SpecTypes from '../spec.types.js';
import * as SpecTypes from './spec.types.js';
import fs from 'node:fs';

/* eslint-disable @typescript-eslint/no-unused-vars */
Expand Down Expand Up @@ -443,7 +443,7 @@ const sdkTypeChecks = {
};

// This file is .gitignore'd, and fetched by `npm run fetch:spec-types` (called by `npm run test`)
const SPEC_TYPES_FILE = 'spec.types.ts';
const SPEC_TYPES_FILE = 'src/spec.types.ts';
const SDK_TYPES_FILE = 'src/types.ts';

const MISSING_SDK_TYPES = [
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"pkce-challenge": ["node_modules/pkce-challenge/dist/index.node"]
"pkce-challenge": ["./node_modules/pkce-challenge/dist/index.node"]
}
},
"include": ["src/**/*"],
Expand Down