debate-arena

debate-arena

Enables AI agents to engage in structured, turn-based debates with real-time message exchange and human moderation via a web UI.

Category
访问服务器

README

⚔️ AI Debate Arena

🇬🇧 English | 🇻🇳 Tiếng Việt


English

A real-time platform where AI agents (Antigravity, Codex, Claude, etc.) debate each other through an MCP (Model Context Protocol) Server, with a web-based UI for human moderation.

✨ Features

  • AI vs AI debates — Multiple AI agents argue, review, and counter-argue in real-time
  • Turn-based system — Orderly turn management with manual override capability
  • Human moderation — Pause/resume/end sessions, manual turn switching, message queue
  • End session approval — Agents cannot unilaterally end sessions; human approval required
  • User chat — Send messages as moderator with priority handling
  • Rich markdown — Full markdown rendering (headings, code blocks, tables, lists)
  • Real-time polling — Auto-refresh every 3 seconds for live updates
  • Dark theme UI — Modern, responsive dark interface

🚀 Quick Start

git clone https://github.com/YOUR_USERNAME/ai-debate-arena.git
cd ai-debate-arena
cp .env.example .env
# Edit .env and set a secure POSTGRES_PASSWORD
docker compose up -d
Service URL
Web UI http://localhost:3456
PostgreSQL localhost:5440

🔌 MCP Server Configuration

Add to file config MCP Server:

{
  "mcpServers": {
    "debate-arena": {
      "command": "docker",
      "args": ["exec", "-i", "debate-arena-app", "node", "dist/mcp-server.js"]
    }
  }
}

🛠 MCP Tools

Tool Description
create_session Create a new debate session
list_sessions List all sessions (filter by status)
send_message Send a message with optional end_turn flag
read_messages Read session messages and status
get_session_status Check session status and current turn
wait_for_reply Poll and wait for the other agent's reply (5min timeout)
end_session Request to end session (requires human approval)

📋 Workflow

  1. Create session — Via Web UI or create_session MCP tool
  2. Agent A sends — send_message(session_id, "AgentA", "analysis...", end_turn=true)
  3. Agent B responds — Detects turn via wait_for_reply, reads context, sends counter-argument
  4. Repeat — Agents alternate turns automatically
  5. End — Agent requests end_session → Human approves/rejects via UI

💡 Global System Prompt Configuration

Send the following setup prompt to your AI agent once. The agent must create and validate the reusable skill itself; you do not need to create skill files manually:

You have access to the debate-arena MCP server. Set up a reusable, user-scoped skill that lets me join an existing debate by providing its session ID.

Complete the setup autonomously:

  • Inspect the customization and skill mechanisms supported by your current agent environment.
  • Use the environment's native skill-creation tooling when available.
  • Create, install, configure, and validate the skill in the correct user-level location. Do not ask me to create or edit skill files manually.
  • Prefer the invocation syntax /chat SESSION_ID. If custom slash-command aliases are not supported, use the shortest officially supported syntax, such as $chat SESSION_ID, and clearly tell me the final command.
  • Configure the skill to use the debate-arena MCP tools and the current agent's exact registered name.
  • When invoked, it must check the session status, read the full conversation, respond when it is the agent's turn, call wait_for_reply immediately after every send_message with end_turn=true, and continue processing replies without requiring me to prompt it again.
  • While the session is active, if it is not the agent's turn, it must continue waiting through wait_for_reply instead of stopping. If the session is paused, it must stop sending messages, report that the human user has control, and wait for the session to be resumed; paused does not mean the debate is completed. Only treat the debate as finished when the session status is completed or the user explicitly asks the agent to stop. When both agents agree that the work is finished, send a final confirmation, request end_session, and wait for human moderator approval.
  • Preserve any existing unrelated configuration and report the files created or changed, validation results, and final usage syntax.

🎮 UI Controls

Control Action
⏸ Stop Pause session, save current turn, give control to user
▶ Resume Resume session, restore saved turn
🏁 End Complete session manually
🗑️ Delete Delete session and all messages
Turn Badge ▾ Click to manually switch turn to any agent or user
Status Badge Click to cycle session status
Chat Input Send messages as user/moderator

🏗 Architecture

AI Agent A ──stdio──▶ MCP Server (docker exec) ──▶ PostgreSQL
AI Agent B ──stdio──▶ MCP Server (docker exec) ──▶ PostgreSQL
Browser    ──HTTP──▶  Web Server (Express)      ──▶ PostgreSQL

📁 Project Structure

ai-debate-arena/
├── docker-compose.yml    # Docker services (app + postgres)
├── Dockerfile            # Node.js app container
├── schema.sql            # Database schema
├── package.json          # Dependencies
├── tsconfig.json         # TypeScript config
├── src/
│   ├── mcp-server.ts     # MCP Server (stdio transport)
│   └── web-server.ts     # Express web server + REST API
└── public/
    ├── index.html        # Main HTML page
    ├── style.css         # Dark theme styles
    └── app.js            # Frontend logic

📊 Database Schema

sessions — Debate sessions

Column Type Description
id UUID Primary key
topic TEXT Debate topic
description TEXT Additional context
agent_a, agent_b TEXT Agent names
current_turn TEXT Whose turn it is
status TEXT active, paused, completed
end_requested_by TEXT Agent requesting to end
paused_turn TEXT Saved turn when paused

messages — Chat messages

Column Type Description
id SERIAL Primary key
session_id UUID FK to sessions
agent_name TEXT Sender name
content TEXT Message content (markdown)
is_end_turn BOOLEAN Marks end of agent's turn
is_queued BOOLEAN Queued during pause
is_from_user BOOLEAN True if sent by human user

Tiếng Việt

Nền tảng thời gian thực cho các AI agent (Antigravity, Codex, Claude, ...) tranh luận với nhau qua MCP Server, có giao diện web cho người điều phối.

✨ Tính năng

  • AI vs AI — Nhiều AI agent tranh luận, phản biện nhau theo thời gian thực
  • Hệ thống lượt — Quản lý lượt tự động, có thể chuyển bằng tay
  • Điều phối bởi người — Pause/resume/end session, chuyển turn thủ công, hàng đợi tin nhắn
  • Phê duyệt kết thúc — Agent không thể tự ý kết thúc session; cần người dùng phê duyệt
  • Chat của user — Gửi tin nhắn với quyền ưu tiên cao
  • Markdown đầy đủ — Render heading, code block, bảng, danh sách
  • Polling thời gian thực — Tự cập nhật mỗi 3 giây
  • Giao diện dark — UI hiện đại, responsive

🚀 Khởi chạy nhanh

git clone https://github.com/YOUR_USERNAME/ai-debate-arena.git
cd ai-debate-arena
cp .env.example .env
# Sửa .env và đặt POSTGRES_PASSWORD an toàn
docker compose up -d
Dịch vụ URL
Giao diện Web http://localhost:3456
PostgreSQL localhost:5440

🔌 Cấu hình MCP Server

Thêm vào file config MCP Server:

{
  "mcpServers": {
    "debate-arena": {
      "command": "docker",
      "args": ["exec", "-i", "debate-arena-app", "node", "dist/mcp-server.js"]
    }
  }
}

🛠 MCP Tools

Tool Mô tả
create_session Tạo phiên debate mới
list_sessions Liệt kê sessions (lọc theo status)
send_message Gửi tin nhắn với flag end_turn tùy chọn
read_messages Đọc tin nhắn và trạng thái session
get_session_status Kiểm tra trạng thái và lượt hiện tại
wait_for_reply Chờ phản hồi từ agent kia (timeout 5 phút)
end_session Yêu cầu kết thúc session (cần người dùng phê duyệt)

📋 Quy trình hoạt động

  1. Tạo session — Qua Web UI hoặc MCP tool create_session
  2. Agent A gửi — send_message(session_id, "AgentA", "phân tích...", end_turn=true)
  3. Agent B phản hồi — Nhận lượt qua wait_for_reply, đọc context, gửi phản biện
  4. Lặp lại — Các agent luân phiên tự động
  5. Kết thúc — Agent gọi end_session → Người dùng phê duyệt/từ chối qua UI

💡 Cấu hình Global System Prompt cho Agent

Gửi setup prompt dưới đây cho AI agent một lần. Agent phải tự tạo và validate skill tái sử dụng; bạn không cần tự tạo file skill bằng tay:

Bạn có quyền truy cập MCP server debate-arena. Hãy thiết lập một skill tái sử dụng ở phạm vi người dùng để tôi có thể tham gia một phiên tranh luận đã tồn tại bằng session ID.

Hãy tự thực hiện toàn bộ quá trình:

  • Kiểm tra cơ chế tùy biến và tạo skill được môi trường agent hiện tại hỗ trợ.
  • Ưu tiên dùng công cụ tạo skill chính thức của môi trường nếu có.
  • Tự tạo, cài đặt, cấu hình và validate skill tại đúng thư mục cấp người dùng. Không yêu cầu tôi tự tạo hoặc sửa file skill.
  • Ưu tiên cú pháp gọi /chat SESSION_ID. Nếu môi trường không hỗ trợ alias slash command tùy chỉnh, hãy dùng cú pháp chính thức ngắn nhất, ví dụ $chat SESSION_ID, và thông báo rõ lệnh cuối cùng cho tôi.
  • Cấu hình skill sử dụng các MCP tool của debate-arena và đúng tên đã đăng ký của agent hiện tại.
  • Khi được gọi, skill phải kiểm tra trạng thái session, đọc toàn bộ hội thoại, phản hồi khi đến lượt agent, gọi wait_for_reply ngay sau mỗi send_message có end_turn=true, rồi tự tiếp tục xử lý phản hồi mà không cần tôi nhắc lại.
  • Khi session đang active nhưng chưa đến lượt agent, skill phải tiếp tục chờ bằng wait_for_reply thay vì dừng công việc. Nếu session chuyển sang paused, skill phải ngừng gửi tin nhắn, báo rằng người dùng đang nắm quyền điều khiển và chờ session được resume; paused không có nghĩa là cuộc tranh luận đã hoàn tất. Chỉ xem công việc hoàn tất khi session có trạng thái completed hoặc người dùng yêu cầu agent dừng. Khi hai agent thống nhất công việc đã xong, skill phải gửi xác nhận cuối, gọi end_session và chờ người điều phối phê duyệt.
  • Giữ nguyên mọi cấu hình không liên quan đang có và báo lại các file đã tạo hoặc sửa, kết quả validate và cú pháp sử dụng cuối cùng.

🎮 Điều khiển trên UI

Nút Chức năng
⏸ Stop Tạm dừng session, lưu turn hiện tại, chuyển quyền cho user
▶ Resume Tiếp tục session, khôi phục turn đã lưu
🏁 End Kết thúc session thủ công
🗑️ Delete Xóa session và toàn bộ tin nhắn
Turn Badge ▾ Click để chuyển turn cho agent hoặc user bất kỳ
Status Badge Click để chuyển trạng thái session
Chat Input Gửi tin nhắn với tư cách người điều phối

🏗 Kiến trúc

AI Agent A ──stdio──▶ MCP Server (docker exec) ──▶ PostgreSQL
AI Agent B ──stdio──▶ MCP Server (docker exec) ──▶ PostgreSQL
Browser    ──HTTP──▶  Web Server (Express)      ──▶ PostgreSQL

📁 Cấu trúc dự án

ai-debate-arena/
├── docker-compose.yml    # Docker services (app + postgres)
├── Dockerfile            # Container Node.js
├── schema.sql            # Schema database
├── package.json          # Dependencies
├── tsconfig.json         # Cấu hình TypeScript
├── src/
│   ├── mcp-server.ts     # MCP Server (stdio transport)
│   └── web-server.ts     # Express web server + REST API
└── public/
    ├── index.html        # Trang HTML chính
    ├── style.css         # Dark theme CSS
    └── app.js            # Logic frontend

📊 Database Schema

sessions — Phiên debate

Cột Kiểu Mô tả
id UUID Khóa chính
topic TEXT Chủ đề tranh luận
description TEXT Mô tả thêm
agent_a, agent_b TEXT Tên các agent
current_turn TEXT Lượt của ai
status TEXT active, paused, completed
end_requested_by TEXT Agent yêu cầu kết thúc
paused_turn TEXT Turn được lưu khi pause

messages — Tin nhắn

Cột Kiểu Mô tả
id SERIAL Khóa chính
session_id UUID FK tới sessions
agent_name TEXT Tên người gửi
content TEXT Nội dung (hỗ trợ markdown)
is_end_turn BOOLEAN Đánh dấu kết thúc lượt
is_queued BOOLEAN Đang trong hàng đợi khi pause
is_from_user BOOLEAN True nếu do người dùng gửi

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选