MCPcopy Create free account
hub / github.com/Noumena-Network/code / createNodeWsClient

Function createNodeWsClient

src/services/mcp/client.ts:448–459  ·  view source on GitHub ↗

* Create a ws.WebSocket client with the MCP protocol. * Bun's ws shim types lack the 3-arg constructor (url, protocols, options) * that the real ws package supports, so we cast the constructor here.

(
  url: string,
  options: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

446 * that the real ws package supports, so we cast the constructor here.
447 */
448async function createNodeWsClient(
449 url: string,
450 options: Record<string, unknown>,
451): Promise<WsClientLike> {
452 const wsModule = await import('ws')
453 const WS = wsModule.default as unknown as new (
454 url: string,
455 protocols: string[],
456 options: Record<string, unknown>,
457 ) => WsClientLike
458 return new WS(url, ['mcp'], options)
459}
460
461const IMAGE_MIME_TYPES = new Set([
462 'image/jpeg',

Callers 1

client.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected