π‘ MCP Signaling Server (Django + Channels + ASGI)
Description
# π‘ MCP Signaling Server (Django + Channels + ASGI) This is an asynchronous backend WebSocket signaling server built with Django and Channels, implementing a custom protocol called MCP (Message Context Protocol). It allows React frontend clients to exchange WebRTC signalingβ¦
About
# π‘ MCP Signaling Server (Django + Channels + ASGI) This is an asynchronous backend WebSocket signaling server built with Django and Channels, implementing a custom protocol called MCP (Message Context Protocol). It allows React frontend clients to exchange WebRTC signaling messages in real-time without using RESTβ¦
Details
- Author
- yer-retb
- Downloads
- 191
- Categories
- Developer Tools
Jump to
- ASGI-compliant Django server with real-time WebSocket support
- Custom signaling protocol: MCP (Message Context Protocol)
- Room-based signaling (multi-user capable)
- Supports offer, answer, candidate, and leave messages
- Works with any frontend WebRTC client (React, etc.)
- Includes test script for two-client simulation
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
π‘ MCP Signaling Server (Django + Channels + ASGI)Command (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Clone the repository, create a Python virtual environment, install dependencies from requirements.txt, then run the server using daphne mcp_server.asgi:application. Connect via WebSocket at ws://127.0.0.1:8000/ws/signal/?room=ROOM_NAME. A test script (test_mcp.py) is provided to simulate two clients.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"\ud83d\udce1 mcp signaling server (django + channels + asgi)": {
"Asynchronous-MCP-Server-with-WebRTC-Signaling": {
"command": "python3",
"args": [
"-m",
"venv",
"venv"
]
}
}
}
}
McpServers
{
"Asynchronous-MCP-Server-with-WebRTC-Signaling": {
"command": "python3",
"args": [
"-m",
"venv",
"venv"
]
}
}
π‘ MCP Signaling Server (Django + Channels + ASGI)
This is an asynchronous backend WebSocket signaling server built with Django and Channels, implementing a custom protocol called MCP (Message Context Protocol). It allows React frontend clients to exchange WebRTC signaling messages in real-time without using REST APIs.
---
π Features
ASGI-compliant Django server with real-time WebSocket support
Custom signaling protocol: MCP (Message Context Protocol)
Room-based signaling (multi-user capable)
Supports offer, answer, candidate, and leave messages
Works with any frontend WebRTC client (React, etc.)
Includes test script for two-clients simulation
---
π§± Project Structure
backend/
βββ mcp_server/ # Django project
β βββ settings.py # ASGI + Channels config
β βββ asgi.py # ASGI application
βββ signaling/ # Signaling app
β βββ consumers.py # SignalConsumer logic
β βββ routing.py # WebSocket routing rules
βββ requirements.txt # Python dependencies
βββ manage.py # Django CLI tool
βββ test_mcp.py # Python script to test with 2 clients
βββ venv/ # Virtual environment (not included in repo)
---
βοΈ Installation & Setup
1. Clone the repo and enter backend folder:
git clone https://github.com/yer-retb/Asynchronous-MCP-Server-with-WebRTC-Signaling.git mcp-signaling-server
cd mcp-signaling-server/backend
2. Create and activate virtual environment:
python3 -m venv venv
source venv/bin/activate
3. Install dependencies:
pip install -r requirements.txt
4. Apply migrations (optional if using Django admin):
python manage.py migrate
5. Run the server using Daphne:
daphne mcp_server.asgi:application
Server will be available at:
http://127.0.0.1:8000
WebSocket endpoint: ws://127.0.0.1:8000/ws/signal/?room=ROOM_NAME
---
π MCP Protocol (Message Context Protocol)
Supported Message Types
| Type | Purpose |
| ----------- | ---------------------------- |
| offer | Initial connection offer |
| answer | Response to the offer |
| candidate | ICE candidate for connection |
| leave | User leaves the session |
Example Message Formats
// Offer
{ "type": "offer", "sdp": "..." }
// Answer
{ "type": "answer", "sdp": "..." }
// ICE Candidate
{ "type": "candidate", "candidate": "..." }
// Leave
{ "type": "leave" }
Clients send these messages through the WebSocket. The server forwards each message to all other peers in the same room.
---
π§ͺ Testing the Backend
Use the included script to test with 2 simulated clients:
python test_mcp.py
Expected output:
[Client1] Connected
[Client1] Sent offer
[Client2] Connected
[Client2] Received: {"type": "offer", "sdp": "fake-sdp-from-Client1"}
---
π‘ Technical Decisions
Django Channels: Built-in WebSocket support that works seamlessly with ASGI
Daphne: Production-ready ASGI server compatible with Channels
In-memory rooms: Kept simple using Python dictionaries for development
Room-based signaling: Easier to scale, test, and organize peer communication
---
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





