Skip to content

Commit 18832e0

Browse files
author
Camilo
committed
refactor: replace transport headers with requestOptions
1 parent d392d77 commit 18832e0

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

core/context/mcp/MCPConnection.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ describe("MCPConnection", () => {
6262
transport: {
6363
type: "sse" as const,
6464
url: "http://test.com/events",
65-
headers: {
66-
"Authorization": "Bearer token123",
67-
"X-Custom-Header": "custom-value"
65+
requestOptions: {
66+
headers: {
67+
"Authorization": "Bearer token123",
68+
"X-Custom-Header": "custom-value"
69+
}
6870
}
6971
},
7072
};

core/context/mcp/MCPConnection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ class MCPConnection {
7676
...init,
7777
headers: {
7878
...init?.headers,
79-
...(options.transport.headers as Record<string, string> | undefined),
79+
...(options.transport.requestOptions?.headers as Record<string, string> | undefined),
8080
}
8181
}),
8282
},
83-
requestInit: { headers: options.transport.headers }
83+
requestInit: { headers: options.transport.requestOptions?.headers }
8484
});
8585
default:
8686
throw new Error(

core/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,19 +1114,19 @@ export interface StdioOptions {
11141114
command: string;
11151115
args: string[];
11161116
env?: Record<string, string>;
1117-
headers?: HeadersInit;
1117+
requestOptions?: RequestOptions;
11181118
}
11191119

11201120
export interface WebSocketOptions {
11211121
type: "websocket";
11221122
url: string;
1123-
headers?: HeadersInit;
1123+
requestOptions?: RequestOptions;
11241124
}
11251125

11261126
export interface SSEOptions {
11271127
type: "sse";
11281128
url: string;
1129-
headers?: HeadersInit;
1129+
requestOptions?: RequestOptions;
11301130
}
11311131

11321132
export type TransportOptions = StdioOptions | WebSocketOptions | SSEOptions;

0 commit comments

Comments
 (0)