@neutrome/open-ai-router 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neutrome/open-ai-router",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
package/src/index.ts CHANGED
@@ -57,7 +57,7 @@ export type {
57
57
  } from "./router/index.ts";
58
58
  export {
59
59
  createRemoteMcpToolSet,
60
- createSseMcpClient,
60
+ createStreamableHttpMcpClient,
61
61
  stringifyMcpToolResult,
62
62
  wireToolName,
63
63
  } from "./router/index.ts";
@@ -38,7 +38,7 @@ export type RemoteMcpToolConfig = {
38
38
  };
39
39
 
40
40
  export type RemoteMcpServerConfig = {
41
- type: "mcp_sse";
41
+ type: "mcp_streamable_http";
42
42
  url: string;
43
43
  headers?: Record<string, string>;
44
44
  tools: RemoteMcpToolConfig[];
@@ -118,8 +118,8 @@ describe("router execution", () => {
118
118
  },
119
119
  mcps: {
120
120
  crm: {
121
- type: "mcp_sse",
122
- url: "https://mcp.example.test/sse",
121
+ type: "mcp_streamable_http",
122
+ url: "https://mcp.example.test/mcp",
123
123
  headers: { authorization: "Bearer static" },
124
124
  tools: [{
125
125
  name: "lookup",
@@ -13,7 +13,7 @@ export {
13
13
  export { listConfiguredModels, resolveInvocationTarget, resolveInvocationTargets } from "./resolve.ts";
14
14
  export {
15
15
  createRemoteMcpToolSet,
16
- createSseMcpClient,
16
+ createStreamableHttpMcpClient,
17
17
  stringifyMcpToolResult,
18
18
  wireToolName,
19
19
  } from "./mcp.ts";
package/src/router/mcp.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
- import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
2
+ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3
+ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
3
4
  import type { ExecutionContext, Tool } from "@neutrome/lil-engine";
4
5
  import type { RemoteMcpServerRuntime, RouterRuntime } from "./runtime.ts";
5
6
 
@@ -24,7 +25,7 @@ export function createRemoteMcpToolSet(
24
25
  factory?: RemoteMcpClientFactory,
25
26
  ): RemoteMcpToolSet {
26
27
  const pool = new RemoteMcpSessionPool(
27
- factory ?? ((server, signal) => createSseMcpClient(server, signal, runtime.fetchImpl)),
28
+ factory ?? ((server, signal) => createStreamableHttpMcpClient(server, signal, runtime.fetchImpl)),
28
29
  );
29
30
  const tools: Tool[] = [];
30
31
  const usedNames = new Map<string, number>();
@@ -55,18 +56,18 @@ export function createRemoteMcpToolSet(
55
56
  return { tools, close: () => pool.closeAll() };
56
57
  }
57
58
 
58
- export async function createSseMcpClient(
59
+ export async function createStreamableHttpMcpClient(
59
60
  server: RemoteMcpServerRuntime,
60
61
  signal?: AbortSignal,
61
62
  fetchImpl?: typeof fetch,
62
63
  ): Promise<RemoteMcpToolCallClient> {
63
64
  const client = new Client({ name: "open-ai-router", version: "0.1.0" });
64
- const transport = new SSEClientTransport(new URL(server.url), {
65
+ const transport = new StreamableHTTPClientTransport(new URL(server.url), {
65
66
  requestInit: { headers: server.headers ?? {} },
66
67
  ...(fetchImpl ? { fetch: fetchImpl } : {}),
67
68
  });
68
69
  signal?.addEventListener("abort", () => void client.close(), { once: true });
69
- await client.connect(transport);
70
+ await client.connect(transport as Transport);
70
71
  return {
71
72
  callTool(name, args) {
72
73
  return client.callTool({ name, arguments: args });