()
| 171 | } |
| 172 | |
| 173 | private buildTransport(): Transport { |
| 174 | const cfg = this.config as any; |
| 175 | if (cfg.url) { |
| 176 | const opts = { |
| 177 | url: cfg.url, |
| 178 | headers: this.expandHeaders(cfg.headers ?? {}), |
| 179 | connectTimeoutMs: (this.config.startupTimeoutSeconds ?? 10) * 1000, |
| 180 | }; |
| 181 | // Opt-in modern transport for streamable-HTTP servers (Tavily, Higgsfield, …) |
| 182 | // that hang on the older SSE endpoint-event handshake. Set `streamable: true`. |
| 183 | return cfg.streamable ? new StreamableHttpTransport(opts) : new HttpSseTransport(opts); |
| 184 | } |
| 185 | return new StdioTransport({ |
| 186 | command: this.config.command!, |
| 187 | args: this.config.args ?? [], |
| 188 | env: this.expandEnv(this.config.env ?? {}), |
| 189 | }); |
| 190 | } |
| 191 | |
| 192 | private handleMessage(msg: any): void { |
| 193 | if (msg.jsonrpc !== '2.0') { |
no test coverage detected