human-intervention-mcp
Enables AI agents to request human actions or decisions by opening a local browser page for input, allowing the agent to pause and wait for human response.
README
Human Intervention MCP
Human Intervention / "human-in-the-loop" MCP is an open-source Python MCP server that lets AI agents pause and ask a human for either:
request_human_action: a manual step, confirmation, or structured inputask_operator: a consultative question or branching decision
Each tool call opens a local URL in the default browser. One browser tab is used for one operation. There is no queue, no polling API, and no background resume flow.
How It Works
- An agent calls
request_human_actionorask_operator. - The MCP server validates the payload and starts a one-shot local HTTP page on
127.0.0.1with a random port. - The server opens that URL in the default browser.
- The human answers in that tab.
- The original MCP tool call stays open until the form is submitted or the timeout expires.
- The page is torn down immediately after the result is returned.
Why?
In practice, AI agents are often optimized to keep moving.
When running long autonomous workflows, such as Codex /goal tasks, an agent may encounter an unclear decision, an unexpected state, or a step that requires human judgment. Even when instructed to “stop and report immediately if X happens,” many agents will continue trying alternatives first, and burning a lot of tokens, especially with the frontier models. They may spend time exploring workarounds, make assumptions, or choose what appears to be the best path without checking whether that path matches the operator’s intent.
For many use cases, that behavior is useful. The goal is autonomy, speed, and reduced interruption.
But that is not always the right trade-off.
Sometimes it is essential for a human to remain involved at key decision points.
This MCP makes that workflow practical.
Instructing Your Agent
Your AI agent must be explicitly told that this MCP is available and when it should use it. Otherwise, most agents will try to solve ambiguous situations on their own, make assumptions, or keep attempting alternatives before asking for help.
Add instructions like these to your agent prompt or in your markdown files.:
- If you encounter an important decision that I did not explicitly instruct you how to handle, call
ask_operatorbefore choosing a direction. - If multiple valid approaches exist and the choice could affect cost, safety, data, time, architecture, or user experience, use
ask_operator. - If you need me to perform a manual action, use
request_human_action. - Use
request_human_actionfor tasks such as logging in, entering a one-time code, approving a browser prompt, completing a CAPTCHA, clicking an interface element, connecting an account, or reviewing a visual result.
Supported Systems
Python 3.11+ on macOS, Linux, and Windows.
The browser flow assumes the machine running the MCP server can open a local browser tab.
Installation
For local development:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
With uv:
uv sync --extra dev
uv run human-intervention-mcp --help
With pipx:
pipx install .
Commands
human-intervention-mcp mcp
human-intervention-mcp serve-http
human-intervention-mcp doctor
Codex Configuration
[mcp_servers.human_intervention]
command = "human-intervention-mcp"
args = ["mcp"]
tool_timeout_sec = 960
tool_timeout_sec must be greater than response_timeout_seconds.
Claude Code Configuration
{
"mcpServers": {
"human_intervention": {
"command": "human-intervention-mcp",
"args": ["mcp"]
}
}
}
Set the client-side timeout above response_timeout_seconds if your MCP host supports that setting.
Optional Streamable HTTP
human-intervention-mcp serve-http --http-host 127.0.0.1 --http-port 8000 --http-path /mcp
The Streamable HTTP transport uses the same local browser-page flow as STDIO. The browser page opens on the machine where the MCP server process is actually running.
Configuration
Precedence:
- CLI options
- environment variables
- TOML config file
- built-in defaults
Default config path:
- Windows:
%APPDATA%\human-intervention-mcp\config.toml - macOS/Linux:
$XDG_CONFIG_HOME/human-intervention-mcp/config.tomlor~/.config/human-intervention-mcp/config.toml
Example:
[server]
response_timeout_seconds = 900
max_input_fields = 8
max_terminal_output_chars = 16000
max_screenshot_bytes = 8000000
max_image_width = 3840
max_image_height = 3840
[browser]
host = "127.0.0.1"
[http]
host = "127.0.0.1"
port = 8000
path = "/mcp"
Environment variables:
HUMAN_INTERVENTION_MCP_RESPONSE_TIMEOUT_SECONDS
HUMAN_INTERVENTION_MCP_MAX_INPUT_FIELDS
HUMAN_INTERVENTION_MCP_MAX_TERMINAL_OUTPUT_CHARS
HUMAN_INTERVENTION_MCP_MAX_SCREENSHOT_BYTES
HUMAN_INTERVENTION_MCP_MAX_IMAGE_WIDTH
HUMAN_INTERVENTION_MCP_MAX_IMAGE_HEIGHT
HUMAN_INTERVENTION_MCP_BROWSER_HOST
HUMAN_INTERVENTION_MCP_HTTP_HOST
HUMAN_INTERVENTION_MCP_HTTP_PORT
HUMAN_INTERVENTION_MCP_HTTP_PATH
CLI overrides:
human-intervention-mcp mcp --response-timeout-seconds 900 --browser-host 127.0.0.1
Doctor
human-intervention-mcp doctor --mcp-timeout-sec 960
Checks:
- config validity
- browser launcher availability
- timeout margin
Tool Semantics
Use request_human_action when the operator needs to do something outside the agent, such as approving a browser step, entering a code, or performing a manual check.
Use ask_operator when the agent has multiple plausible decisions, was told to ask before deciding, or wants operator guidance without inventing a manual action.
Example request_human_action Input
{
"task_title": "Continue checkout",
"requested_action_markdown": "Please complete the payment confirmation in the browser.",
"reason_markdown": "The site requires a human confirmation before the agent can continue.",
"risk_level": "medium",
"agent_name": "Codex",
"working_directory": "/project",
"terminal_output": "Last command output...",
"screenshot": {
"kind": "file_path",
"path": "checkout.png"
},
"input_fields": [
{
"id": "confirmation_code",
"label": "Confirmation code",
"type": "password",
"required": true,
"placeholder": "Enter code",
"default": null,
"options": null
}
]
}
Example request_human_action Result
{
"status": "completed",
"message": "Confirmed in browser.",
"input_values": {
"confirmation_code": "123456"
},
"metadata": {
"timed_out": false
}
}
Example ask_operator Input
{
"question_title": "Choose implementation path",
"question_markdown": "Which implementation path should I use?",
"reason_markdown": "Both options are viable and I was instructed to ask before deciding.",
"agent_name": "Codex",
"working_directory": "/project",
"options": [
{
"id": "safe",
"label": "Safer path",
"value": "safe",
"description_markdown": "Lower risk and easier to verify."
},
{
"id": "fast",
"label": "Faster path",
"value": "fast",
"description_markdown": "Less work but higher regression risk."
}
],
"allow_multiple": false
}
Example ask_operator Result
{
"status": "answered",
"message": "Use the safer path.",
"selected_options": [
{
"id": "safe",
"label": "Safer path",
"value": "safe"
}
],
"metadata": {
"timed_out": false
}
}
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。