webrtc-mcp-server
Enables peer-to-peer WebRTC communication between AI agents, with room-based signaling, video stream bridging (RTSP/HLS/RTMP to WebRTC), and multi-agent coordination via MCP tools.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@webrtc-mcp-serverJoin the 'alpha' room and broadcast a greeting to all peers."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WebRTC MCP Server
Peer-to-peer WebRTC communication for AI agents. Connects autonomous coding agents over low-latency WebRTC DataChannels with room-based signaling, video stream bridging, and multi-agent coordination — all exposed as MCP tools.
TL;DR
npm install && npm run build
# As MCP server (stdio)
node dist/index.js
# As WebSocket signaling server (for external peers)
WEBRTC_SIGNALING_MODE=ws WEBRTC_WS_PORT=8765 node dist/index.jsFeature | Detail |
Protocol | MCP v2025-03-26 (over stdio), WebSocket signaling |
Tools | 16 MCP tools — peers, rooms, streams, signaling, health |
Concurrency | Worker Thread pool (default 8, max 16) |
Latency | 0.82ms avg signaling RTT (measured) |
Sources | RTSP, HLS, RTMP, WebRTC (auto-detect) |
Tests | 14/14 passing |
Related MCP server: Agent-Comm-Hub
What It Does
Multi-Agent Communication
Connect AI agents (Claude Code, OpenCode, Cursor, and any MCP client) over WebRTC DataChannels. Each agent becomes a peer that can:
Join named rooms for group communication
Send structured messages (JSON) with ACK
Broadcast to all peers in a room
Relay SDP/ICE for WebRTC handshake
Video Streams
Bridge RTSP/HLS/RTMP video streams to WebRTC for real-time frame access:
webrtc_connect_stream(url)→ creates RTCPeerConnection + offer SDPwebrtc_frame_get(stream_id)→ returns latest frame as base64 JPEGwebrtc_stream_status(stream_id)→ health, FPS, throughput metricsFFmpeg-backed decoding with ring-buffer frame cache
Room-Based Signaling
WebSocket server (ws://host:port) for external peers:
join/leave/list_peers— room membershipsignal— SDP/ICE relay between peersbroadcast— fan-out messages to all room membersping/pong— health check
Quick Start
As a standalone server
# stdio mode (MCP transport)
WEBRTC_SIGNALING_MODE=stdio node dist/index.js
# WebSocket signaling mode (for external peers)
WEBRTC_SIGNALING_MODE=ws WEBRTC_WS_PORT=8765 node dist/index.js
# Both modes simultaneously
WEBRTC_SIGNALING_MODE=both node dist/index.jsAs an MCP server (Claude Desktop / Cursor / any MCP client)
{
"mcpServers": {
"webrtc": {
"command": "node",
"args": ["/path/to/dist/index.js"],
"env": {
"WEBRTC_SIGNALING_MODE": "stdio"
}
}
}
}External peer via WebSocket
// Node.js client
const ws = new WebSocket('ws://127.0.0.1:8765');
ws.on('open', () => {
ws.send(JSON.stringify({
type: 'join',
peerId: 'peer-a',
room: 'my-room'
}));
});MCP Tools
Peer Communication (6 tools)
Tool | Description |
| Create RTCPeerConnection + DataChannel with a peer |
| Close connection and release resources |
| Send structured message via DataChannel |
| Broadcast to all peers in a room |
| List all connected peers |
| Detailed status of a specific peer |
Rooms (4 tools)
Tool | Description |
| Create a new signaling room |
| Join a peer to a room |
| Leave a room |
| Relay SDP/ICE candidates between peers |
Video Streams (5 tools)
Tool | Description |
| Connect RTSP/HLS/RTMP source → WebRTC offer |
| Get latest frame as base64 (cached, no re-encode) |
| List all active streams with health metrics |
| Detailed streaming metrics (FPS, throughput) |
| Close a video stream |
Health (1 tool)
Tool | Description |
| Overall server health (peers, rooms, workers, uptime) |
Configuration
All config via environment variables or config.yaml:
Variable | Default | Description |
|
|
|
| 8 | Max concurrent worker threads (≤16) |
| 5 | Frames cached per stream (ring buffer) |
| 500000 | Max JPEG payload (~480KB @ 1920×1080) |
| 30 | Connection timeout in seconds |
| 8765 | WebSocket signaling port |
| 127.0.0.1 | WebSocket bind address |
| warn |
|
| stun:stun.l.google.com:19302 | STUN server |
| (auto) | Comma-separated URL allowlist |
See config.yaml for the full default configuration with TURN, rate limiting, and ICE restart settings.
Multi-Agent Workflow
1. Agent A: webrtc_create_room("team-sync")
2. Agent B: {type:"join", peerId:"agent-b", room:"team-sync"} ← WebSocket
3. Agent A: webrtc_connect(peerId="agent-b") → RTCPeerConnection + DataChannel
4. A → B: webrtc_send(peerId="agent-b", data={"task":"review","file":"src/index.ts"})
5. B → A: webrtc_send(peerId="agent-a", data={"result":"✅ no issues"})
6. Broadcast: webrtc_broadcast(data={"type":"status","msg":"deploying"})Video Stream Workflow
1. webrtc_connect_stream(url="rtsp://camera.local:554/stream1")
→ {stream_id: "cam-123", offer_sdp: "...", ice_servers: [...]}
2. webrtc_frame_get(stream_id="cam-123")
→ {frame: "base64...", timestamp: 1753785600000, resolution: {width:1920, height:1080}}
3. vision_analyze(image="data:image/jpeg;base64,...", question="¿Hay personas?")
→ "Sí, 2 personas detectadas"Frames are cached in a thread-safe ring buffer — repeated frame_get calls return the same buffer without re-encoding.
Architecture
┌─────────────────────────────────────────────────────────┐
│ MCP CLIENT (Claude Desktop, Cursor, any MCP host) │
│ MCP stdio transport: node dist/index.js │
├─────────────────────────────────────────────────────────┤
│ MCP Protocol Handler (v2025-03-26) │
│ → tools/list, tools/call → dispatch │
├─────────────────────────────────────────────────────────┤
│ WebSocket Signaling Server (ws://127.0.0.1:8765) │
│ → join/leave/list_peers/ping/broadcast/signal │
├─────────────────────────────────────────────────────────┤
│ Worker Thread Pool (8 concurrent, round-robin) │
│ ├─ Worker 1: RTCPeerConnection + DataChannel │
│ ├─ Worker 2: RTSP/FFmpeg → WebRTC bridge │
│ └─ Worker N: isolated per peer/stream │
├─────────────────────────────────────────────────────────┤
│ FFmpeg Bridge │
│ RTSP/HLS/RTMP → raw frames → JPEG (via sharp) │
│ FrameCache: thread-safe ring buffer (5 frames) │
└─────────────────────────────────────────────────────────┘Development
npm install # install dependencies
npm run build # TypeScript → dist/
npm run dev # watch mode (tsx)
npm test # 14 tests (vitest)
npm run typecheck # tsc --noEmit
npm run lint # eslintTests
Test Files 2 passed (2)
Tests 14 passed (14)File | Tests |
| 9 tests — room join/leave, peer management, broadcast |
| 5 tests — SDP/ICE routing, health checks |
License
MIT — see LICENSE.
WebRTC is the industry standard for real-time P2P communication (used by Zoom, Google Meet, Discord). This server brings that capability to the MCP ecosystem for multi-agent collaboration.
This server cannot be installed
Maintenance
Related MCP Servers
- Alicense-qualityCmaintenanceOpen coordination network for AI agents and their humans. 13 tools for structured coordination, job marketplace, reputation system. Dual-protocol: MCP + A2A. MIT licensed.Last updated1MIT
- AlicenseBqualityBmaintenanceBuild production-grade multi-agent communication infrastructure in minutes. Real-time messaging, task scheduling, shared memory, and trust-based evolution — all via MCP + SSE.Last updated583MIT
- Alicense-qualityBmaintenanceEnables peer-to-peer communication, discovery, shared state, and file coordination between AI coding agents across machines and sessions.Last updated4718Elastic 2.0
- Alicense-qualityBmaintenanceEnables AI assistants to have voice conversations and screen sharing capabilities via WebRTC, using Pipecat for speech-to-text and text-to-speech.Last updatedBSD 2-Clause "Simplified"
Related MCP Connectors
Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.
Phone, SMS & email for AI agents — one remote MCP endpoint, OAuth login, zero install.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Stuko0/webrtc-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server