Skip to content

WebSocket transport for persistent agent attachment #2

@rodaddy

Description

@rodaddy

Summary

Add WebSocket transport so mcp2cli can act as a persistent tool server that agents connect to for real-time tool discovery, schema introspection, and streamed results.

Motivation

  • HTTP/SSE gives request-response access to remote MCP servers
  • WebSocket enables persistent connections where agents attach once and stream tool calls bidirectionally
  • Similar to how OpenAI Codex connects to tool servers -- agents get real-time discovery without pre-loading schemas
  • Natural evolution toward the LXC gateway vision but accessible to any agent runtime

Proposed Behavior

  1. mcp2cli serve --ws starts a WebSocket server
  2. Agents connect via ws://localhost:<port>
  3. Over WS, agents can:
    • Discover all registered services and tools (unified schema across all backends)
    • Invoke tools with streamed results
    • Subscribe to health/status events
  4. mcp2cli multiplexes across stdio, HTTP, and future backends transparently

Transport Evolution

Transport Use Case Status
stdio Local MCP processes shipped
HTTP/SSE Remote servers, LXC gateway PR #1
WebSocket Persistent agent attachment, streaming this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions