Skip to content

Commit 86085f6

Browse files
committed
"streamableHttp" => "http"
1 parent 383ffc7 commit 86085f6

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

packages/mcp-client/src/McpClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class McpClient {
8484
case "sse":
8585
transport = new SSEClientTransport(asUrl(server.config.url), server.config.options);
8686
break;
87-
case "streamableHttp":
87+
case "http":
8888
transport = new StreamableHTTPClientTransport(asUrl(server.config.url), server.config.options);
8989
break;
9090
}

packages/mcp-client/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ export interface StreamableHTTPServerConfig {
2727
export type ServerConfig =
2828
| { type: "stdio"; config: StdioServerParameters }
2929
| { type: "sse"; config: SSEServerConfig }
30-
| { type: "streamableHttp"; config: StreamableHTTPServerConfig };
30+
| { type: "http"; config: StreamableHTTPServerConfig };

packages/mcp-client/src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ export function urlToServerConfig(urlStr: string, token?: string): ServerConfig
2424
const hostname = url.hostname;
2525
const path = url.pathname;
2626

27-
let type: "streamableHttp" | "sse";
27+
let type: "http" | "sse";
2828
if (path.endsWith("/sse")) {
2929
type = "sse";
3030
} else if (path.endsWith("/mcp")) {
31-
type = "streamableHttp";
31+
type = "http";
3232
} else {
3333
throw new Error(`Unsupported endpoint: ${urlStr}. URL must end with /sse or /mcp`);
3434
}
@@ -43,9 +43,9 @@ export function urlToServerConfig(urlStr: string, token?: string): ServerConfig
4343
hostname === "127.0.0.1");
4444

4545
// Create appropriate config based on type and authorization requirements
46-
if (type === "streamableHttp") {
46+
if (type === "http") {
4747
return {
48-
type: "streamableHttp",
48+
type: "http",
4949
config: {
5050
url: urlStr,
5151
options: shouldIncludeToken

packages/mcp-client/test/UrlConversion.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ describe("urlToServerConfig", () => {
1111

1212
for (const url of urls) {
1313
const config = urlToServerConfig(url, TOKEN);
14-
expect(config.type).toBe("streamableHttp");
15-
if (config.type === "streamableHttp") {
14+
expect(config.type).toBe("http");
15+
if (config.type === "http") {
1616
expect(config.config.url).toBe(url);
1717
}
1818
}
@@ -46,7 +46,7 @@ describe("urlToServerConfig", () => {
4646

4747
for (const url of urls) {
4848
const config = urlToServerConfig(url, TOKEN);
49-
if (config.type === "streamableHttp") {
49+
if (config.type === "http") {
5050
const authHeader = config.config.options?.requestInit?.headers as Record<string, string> | undefined;
5151
expect(authHeader?.Authorization).toBe(`Bearer ${TOKEN}`);
5252
} else if (config.type === "sse") {
@@ -66,7 +66,7 @@ describe("urlToServerConfig", () => {
6666

6767
for (const url of urls) {
6868
const config = urlToServerConfig(url, TOKEN);
69-
if (config.type === "streamableHttp") {
69+
if (config.type === "http") {
7070
const authHeader = config.config.options?.requestInit?.headers as Record<string, string> | undefined;
7171
expect(authHeader?.Authorization).toBe(`Bearer ${TOKEN}`);
7272
} else if (config.type === "sse") {
@@ -86,7 +86,7 @@ describe("urlToServerConfig", () => {
8686

8787
for (const url of urls) {
8888
const config = urlToServerConfig(url, TOKEN);
89-
if (config.type === "streamableHttp" || config.type === "sse") {
89+
if (config.type === "http" || config.type === "sse") {
9090
expect(config.config.options).toBeUndefined();
9191
}
9292
}
@@ -97,7 +97,7 @@ describe("urlToServerConfig", () => {
9797

9898
for (const url of urls) {
9999
const config = urlToServerConfig(url); // No token provided
100-
if (config.type === "streamableHttp" || config.type === "sse") {
100+
if (config.type === "http" || config.type === "sse") {
101101
expect(config.config.options).toBeUndefined();
102102
}
103103
}

0 commit comments

Comments
 (0)