turn-mcp
Health Pass
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 38 GitHub stars
Code Warn
- network request — Outbound network request in public/app.js
Permissions Pass
- Permissions — No dangerous permissions requested
This tool is a self-hosted MCP server that provides a web-based console for human-in-the-loop AI workflows. It allows an AI agent to pause its execution, ask a human for input or approval via a browser UI, and resume the same run with that context intact.
Security Assessment
Overall Risk: Medium. The server does not inherently request dangerous system permissions. However, the rule-based scan flagged a potential hardcoded credential inside the `docker-compose.yml` file, which could accidentally expose sensitive environment variables if pushed to a public registry. Additionally, the tool makes outbound network requests via the frontend (`public/app.js`), likely to support its webhook, Telegram notification, and polling features. While the core server binds to the local host (`127.0.0.1`), developers should carefully inspect the `docker-compose.yml` for secrets and understand exactly what external endpoints the application communicates with before deploying.
Quality Assessment
Quality: Good. The project is actively maintained, with its last code push occurring today. It uses the permissive MIT license and has clear, comprehensive documentation. Community trust appears to be in its early but healthy stages, as indicated by 24 GitHub stars. The straightforward one-command startup and support for multiple platforms (macOS, Windows, Linux) suggest a polished, developer-friendly utility.
Verdict
Use with caution: The tool is well-documented and actively maintained, but developers must audit the hardcoded credential warning and verify outbound network requests before integrating it into their environments.
Achieve infinite conversation turns in a single API request via turn-mcp. Self-hosted MCP server with browser console for human-in-the-loop AI agents.
turn-mcp-web
Turn a single agent request into a durable human-in-the-loop conversation.
turn-mcp-web is a self-hosted MCP server with a browser console. An agent calls turn.wait, execution pauses, a human replies in the web UI, and the same run continues without starting over.
Preview
Why It Exists
Most agent integrations treat a human checkpoint as a dead end:
- the model asks a question
- the run stops
- the next message starts a new run with partial context
turn-mcp-web keeps that checkpoint inside the same execution loop.
work -> turn.wait -> human reply -> work -> turn.wait -> human reply
That makes it useful for approvals, branching decisions, operator handoffs, review queues, and long-running assisted workflows.
The tool result is the operator's reply, unchanged. Every wait ends in one terminal state: reply, timeout, cancel, or interrupt. A session that closes, or a server that shuts down, resolves the wait instead of leaving it hanging.
What You Get
- MCP tool aliases:
turn.wait,turn_wait,turn - browser console for live replies
- Streamable HTTP transport for IDE MCP clients
- stdio entrypoint for desktop clients that spawn MCP servers
- REST long-poll API for Python and non-MCP agent frameworks
- persistent history and event logging
- webhook and Telegram notifications
- operator and viewer API roles
- session list, quick replies, timeout controls, and live SSE updates
- one-command local startup
Quick Start
macOS
Double-click start.command
Windows
Double-click start.bat
Linux
bash start.sh
From Source
npm install
npm run build
npm start
Web console: http://127.0.0.1:3737/
MCP endpoint: http://127.0.0.1:3737/mcp
Core Workflow
- Start the server.
- Connect your MCP client to
http://127.0.0.1:3737/mcpor launch the stdio entrypoint. - Give the agent
skills/turn-mcp-web/SKILL.mdso it routes user-facing checkpoints throughturn.wait. - When the agent pauses, answer in the browser console.
- The same agent run resumes with your reply.
Client Setup
Streamable HTTP
Use this for Cursor, Windsurf, VS Code, Claude Code, Antigravity, and other MCP clients that support remote HTTP servers.
{
"mcpServers": {
"turn-mcp-web": {
"url": "http://127.0.0.1:3737/mcp"
}
}
}
Windsurf uses serverUrl instead of url.
stdio
Use this when the client launches MCP servers as local child processes.
{
"mcpServers": {
"turn-mcp-web": {
"command": "node",
"args": ["/absolute/path/to/dist/server-stdio.js"]
}
}
}
The stdio process still opens the same web console on port 3737.
Python
Use the bundled Python client when your framework does not speak MCP directly.
pip install ./python-client
from turn_mcp_client import TurnMcpClient, TurnMcpCanceled, TurnMcpTimeout
client = TurnMcpClient("http://127.0.0.1:3737")
try:
reply = client.wait(
context="About to apply a production migration.",
question="Should I proceed?",
options=["Proceed", "Show SQL", "Cancel"],
agent_name="MigrationAgent",
)
print(reply)
except TurnMcpTimeout:
print("No reply before timeout.")
except TurnMcpCanceled:
print("Canceled by operator.")
More examples: python-client/README.md
Agent Contract
Give the agent one of these files:
- Skill entry:
skills/turn-mcp-web/SKILL.md - 中文参考:
skills/turn-mcp-web/references/skill.zh-CN.md
Those files tell the agent to use turn.wait as the communication boundary instead of replying directly.
API
Public
GET /healthzGET /api/public-config
Session and wait control
GET /api/waitsGET /api/waits/:idPOST /api/waits/:id/respondPOST /api/waits/:id/cancelPOST /api/waits/:id/extendPOST /api/waits/cancel-allPOST /api/waits/create-and-wait
History and events
GET /api/historyGET /api/history/timelineGET /api/eventsGET /api/stream
Runtime management
GET /api/auth-checkGET /api/sessionsPOST /api/settingsPOST /api/auto-configurePOST /api/auto-unconfigure
Environment
| Variable | Default | Purpose |
|---|---|---|
TURN_MCP_HTTP_HOST |
127.0.0.1 |
HTTP bind host |
TURN_MCP_HTTP_PORT |
3737 |
HTTP bind port |
TURN_MCP_HTTP_PATH |
/mcp |
MCP endpoint path |
TURN_MCP_DEFAULT_TIMEOUT_SECONDS |
600 |
Default wait timeout |
TURN_MCP_API_KEY |
unset | Operator key |
TURN_MCP_VIEWER_API_KEY |
unset | Viewer key |
TURN_MCP_REQUIRE_API_KEY |
auto | Enable auth |
TURN_MCP_EVENT_LOG_FILE |
unset | JSONL event log path |
TURN_MCP_HISTORY_FILE |
unset | JSONL history path |
TURN_MCP_WEBHOOK_URL |
unset | Outbound webhook target |
TURN_MCP_WEBHOOK_EVENTS |
unset | Comma-separated webhook events |
TURN_MCP_WEBHOOK_SECRET |
unset | HMAC signing secret |
TURN_MCP_WEBHOOK_FORMAT |
json |
json, slack, or discord |
TURN_MCP_TELEGRAM_BOT_TOKEN |
unset | Telegram bot token |
TURN_MCP_TELEGRAM_CHAT_ID |
unset | Telegram target chat |
TURN_MCP_TELEGRAM_EVENTS |
wait_created |
Telegram event filter |
TURN_MCP_RATE_LIMIT_MAX |
120 |
Requests per IP |
TURN_MCP_RATE_LIMIT_WINDOW_SECONDS |
60 |
Rate limit window |
TURN_MCP_MAX_CONCURRENT_WAITS_PER_SESSION |
10 |
Per-session concurrency cap |
TURN_MCP_MAX_PENDING_WAITS |
100 |
Process-wide pending wait cap |
TURN_MCP_MAX_CONTEXT_CHARS |
100000 |
Maximum context length |
TURN_MCP_EVENT_LOG_MAX_ITEMS |
2000 |
Event log entries kept in memory |
Authentication
Auth stays off by default on loopback. Setting an API key turns it on. A non-loopback bind refuses to start unless TURN_MCP_API_KEY is set and auth stays enabled. The browser console is same-origin only: cross-site pages and DNS-rebinding hosts are rejected, and API keys are not accepted in the query string.
When auth is enabled, send either of these headers, or the turn_mcp_key cookie set by the console:
x-turn-mcp-api-key: <key>
Authorization: Bearer <key>
Roles:
operator: full controlviewer: read-only inspection and SSE subscription
Docker
docker build -t turn-mcp-web .
docker run --rm -p 3737:3737 \
-e TURN_MCP_HTTP_HOST=0.0.0.0 \
-e TURN_MCP_API_KEY=your_key \
turn-mcp-web
Compose file: docker-compose.yml
Repository Layout
src/ TypeScript server
public/ Browser console
python-client/ Python client package
assets/ README screenshots and demo video
Contributing
See CONTRIBUTING.md.
License
MIT
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found