Skip to main content
Glama

MCP Server.exe

by shadowcz007
webSocketTransport.ts788 B
import WebSocket from 'ws'; import { Transport } from '@modelcontextprotocol/sdk/shared/transport'; export class WebSocketServerTransport implements Transport { private ws: WebSocket; public onmessage: ((message: any) => void) | null = null; public onclose: (() => void) | null = null; public onerror: ((error: Error) => void) | null = null; constructor(ws: WebSocket) { this.ws = ws; } async start(): Promise<void> { // Transport is already started when WebSocket connection is established } async send(message: any): Promise<void> { if (this.ws.readyState === WebSocket.OPEN) { this.ws.send(JSON.stringify(message)); } } async close(): Promise<void> { if (this.ws.readyState === WebSocket.OPEN) { this.ws.close(); } } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shadowcz007/mcp_server_exe'

If you have feedback or need assistance with the MCP directory API, please join our Discord server