Skip to content

Commit 6298977

Browse files
chore: bring ctor back on runner implementations
1 parent 02ff244 commit 6298977

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/transports/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export abstract class TransportRunnerBase<ConnectParams extends MCPConnectParams
2222
constructor(
2323
protected readonly userConfig: UserConfig,
2424
private readonly createConnectionManager: CreateConnectionManagerFn<ConnectParams>,
25-
additionalLoggers: LoggerBase[] = []
25+
additionalLoggers: LoggerBase[]
2626
) {
2727
const loggers: LoggerBase[] = [...additionalLoggers];
2828
if (this.userConfig.loggers.includes("stderr")) {

src/transports/stdio.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { EJSON } from "bson";
22
import type { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
33
import { JSONRPCMessageSchema } from "@modelcontextprotocol/sdk/types.js";
44
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5-
import { LogId } from "../common/logger.js";
5+
import { type LoggerBase, LogId } from "../common/logger.js";
66
import type { Server } from "../server.js";
7-
import { TransportRunnerBase } from "./base.js";
7+
import { type CreateConnectionManagerFn, TransportRunnerBase } from "./base.js";
8+
import { type UserConfig } from "../common/config.js";
89
import type { MCPConnectParams } from "../common/connectionManager.js";
910

1011
// This is almost a copy of ReadBuffer from @modelcontextprotocol/sdk
@@ -54,6 +55,14 @@ export function createStdioTransport(): StdioServerTransport {
5455
export class StdioRunner<ConnectParams extends MCPConnectParams> extends TransportRunnerBase<ConnectParams> {
5556
private server: Server | undefined;
5657

58+
constructor(
59+
userConfig: UserConfig,
60+
createConnectionManager: CreateConnectionManagerFn<ConnectParams>,
61+
additionalLoggers: LoggerBase[] = []
62+
) {
63+
super(userConfig, createConnectionManager, additionalLoggers);
64+
}
65+
5766
async start(): Promise<void> {
5867
try {
5968
this.server = await this.setupServer();

src/transports/streamableHttp.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import type http from "http";
33
import { randomUUID } from "crypto";
44
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
55
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
6-
import { TransportRunnerBase } from "./base.js";
7-
import { LogId } from "../common/logger.js";
6+
import { LogId, type LoggerBase } from "../common/logger.js";
7+
import { type UserConfig } from "../common/config.js";
88
import { SessionStore } from "../common/sessionStore.js";
99
import type { MCPConnectParams } from "../common/connectionManager.js";
10+
import { type CreateConnectionManagerFn, TransportRunnerBase } from "./base.js";
1011

1112
const JSON_RPC_ERROR_CODE_PROCESSING_REQUEST_FAILED = -32000;
1213
const JSON_RPC_ERROR_CODE_SESSION_ID_REQUIRED = -32001;
@@ -18,6 +19,14 @@ export class StreamableHttpRunner<ConnectParams extends MCPConnectParams> extend
1819
private httpServer: http.Server | undefined;
1920
private sessionStore!: SessionStore;
2021

22+
constructor(
23+
userConfig: UserConfig,
24+
createConnectionManager: CreateConnectionManagerFn<ConnectParams>,
25+
additionalLoggers: LoggerBase[] = []
26+
) {
27+
super(userConfig, createConnectionManager, additionalLoggers);
28+
}
29+
2130
public get address(): string {
2231
const result = this.httpServer?.address();
2332
if (typeof result === "string") {

0 commit comments

Comments
 (0)