TE
OfficialMedia

Tencent RTC MCP Server for AI IDEs

Streamline AI IDE integration with Tencent RTC using the MCP server to simplify building audio/video call applications for developers.

Quick Install
npx -y @Tencent-RTC/mcp

Overview

The Tencent RTC MCP (Model Context Protocol) Server is a lightweight backend component designed to bridge AI IDEs and Tencent Real-Time Communication (TRTC). It provides common server-side functionality for managing audio/video rooms, generating secure tokens, relaying stream metadata, and integrating with model-driven experiences in development environments. By centralizing session and token logic, the MCP server reduces the amount of RTC-specific code developers need to write inside AI-powered IDEs or assistants.

MCP is particularly useful when you need consistent room management, recording orchestration, or secure short‑lived credentials for clients that will publish or subscribe to audio/video streams. It can be deployed as a standalone service or run alongside other microservices in an AI IDE stack to handle real-time collaboration, interviews, pair-programming sessions, and other multimodal workflows.

Features

  • Room lifecycle management (create/join/leave rooms)
  • Secure token generation for TRTC client authentication
  • Stream publish/subscribe coordination and metadata exchange
  • Session recording controls and retrieval hooks
  • WebSocket/HTTP APIs for low-latency event delivery
  • Configurable storage and persistence (Redis / Mongo / file-based)
  • Example client integrations (web, desktop, mobile)
  • Docker-friendly deployment and environment-based configuration
  • Basic observability endpoints (health, metrics)

Installation / Configuration

Below are quick-start steps for running a typical MCP server. The repository supports containerized deployment and local development.

Clone the repo:

git clone https://github.com/Tencent-RTC/mcp.git
cd mcp

Run with Node.js (example):

# install dependencies
npm install

# set env vars (example)
export MCP_PORT=8080
export TRTC_APP_ID=your_trtc_appid
export TRTC_SECRET=your_trtc_secret
export SESSION_STORE=redis
export REDIS_URL=redis://localhost:6379

# start in development
npm run dev

# or production
npm run start

Run with Docker:

# build image
docker build -t tencent-rtc-mcp .

# run container
docker run -d \
  -p 8080:8080 \
  -e MCP_PORT=8080 \
  -e TRTC_APP_ID=your_trtc_appid \
  -e TRTC_SECRET=your_trtc_secret \
  -e REDIS_URL=redis://redis:6379 \
  --name mcp-server \
  tencent-rtc-mcp

Common environment variables

VariableDescription
MCP_PORTHTTP/WebSocket port (default 8080)
TRTC_APP_IDTencent TRTC Application ID
TRTC_SECRETSecret key for generating TRTC tokens
SESSION_STORESession backend: memory
REDIS_URLRedis connection string (if using Redis)
MONGO_URIMongoDB connection string (if using Mongo)
TLS_CERT, TLS_KEYOptional TLS cert/key paths for HTTPS

Adjust values based on your infrastructure and secret management practices.

Available Resources

  • GitHub repository: https://github.com/Tencent-RTC/mcp
  • Tencent TRTC SDKs and docs (useful for client-side integration)
  • Example clients: web demo (WebRTC + TRTC), minimal CLI tools for testing
  • API docs: OpenAPI/Swagger (if included in repository) or built-in /docs endpoints
  • Health endpoints: /health, /metrics for monitoring

Check the repo’s examples/ and docs/ folders for language-specific samples and ready-to-run demos.

Typical API Endpoints

The MCP server exposes HTTP and WebSocket endpoints used by clients and AI IDE backends. Example endpoints (names may vary slightly by release):

MethodPathDescription
POST/roomsCreate a new room
POST/rooms/{id}/joinJoin an existing room and get client token
POST/tokensGenerate a short-lived TRTC token for a user
POST/rooms/{id}/record/startStart recording a room
POST/rooms/{id}/record/stopStop recording
GET/rooms/{id}/stateGet current room state & active streams
WS/eventsWebSocket for realtime room events

Example: request a TRTC token

curl -X POST https://mcp.example.com/tokens \
  -H "Content-Type: application/json" \
  -d '{"userId":"alice","roomId":"room-123"}'

Response typically includes token, expiry, and any client connection metadata.

Use Cases

  • AI Pair-Programming: An AI assistant inside an IDE opens a TRTC room via the MCP server so collaborators can join with low-latency voice/video while the assistant synchronizes code context and annotations.
  • Remote Interviews / Coding Sessions: Orchestrate interview rooms, generate per-user tokens, and record sessions for later review or model training while protecting credentials through MCP-generated short-lived tokens.
  • Live Code Review with Commentary: Use MCP to manage who can publish audio/video streams while the IDE overlays AI-generated suggestions or annotations tied to stream metadata.
  • Multimodal Assistants: Combine audio streams with code context and LLM-based suggestions; MCP acts as the boundary that connects real-time media to model inputs and logs relevant session data.
  • Automated Session Archival: Start/stop recording via API hooks so recordings are stored in object storage and linked to session metadata for compliance or training datasets.

Getting Started Tips

  • Secure secrets: Never embed TRTC secrets in client apps—use MCP to mint transient tokens.
  • Start locally with memory store, then switch to Redis or Mongo for production scale.
  • Use TLS in production; configure reverse proxy (nginx) or provide TLS certs directly.
  • Monitor /metrics and log critical events (token generation, join/leave, recording) for auditing.

For developer reference and sample integrations, consult the GitHub repository and the related Tencent TRTC SDK documentation for client-side wiring.

Tags:media