Skip to content

[Feature]: MCP 确认模式下权限确认等待时间不可配置,约 5 秒超时导致连接中断 / MCP permission confirmation has a hard ~5s timeout that kills the connection #119

Open

Description

@aqidea

提交前检查 / Checklist

  • 我已搜索已有 Issue,未发现相同建议。/ I searched existing issues and found no duplicate.
  • 此 Issue 聚焦一个功能或改进。/ This issue focuses on one feature or improvement.
  • 这不是现有功能异常;如是,我会改用 Bug 报告。/ This is not broken existing behavior; otherwise I will use Bug Report.

功能模块 / Feature area

首页、工作区与连接管理 / Home, workspace, and connection management

问题与使用场景 / Problem and use case

+### 问题描述 / Problem
+MCP Server 使用 Confirm/ask 权限模式时,外部客户端(@navop/cli)发起需要确认的工具调用后,确认框弹出约 5 秒内如果用户未点击,服务端直接关闭 MCP 连接,调用方收到 connection_closed,命令不会执行。
+
+When the MCP server runs in Confirm/ask permission mode, a tool call that requires approval causes the server to close the MCP connection ~5s after the confirmation dialog appears if the user hasn't clicked yet. The client receives connection_closed and the command never runs.
+
+### 复现步骤 / Steps to reproduce
+1. Navop 设置:Settings > General > MCP > MCP Server 开启,Permission Profile = Confirm/ask
+2. 打开任意 SSH 会话,从 CLI 发起写操作,例如:

  • navop terminal exec --target --command "echo test" --json

+3. 确认框弹出后不点击,观察:

    • 约 5.7 秒后 CLI 返回 {"ok":false,"code":"connection_closed","message":"Navop MCP connection closed"}
    • 终端中命令未执行
      +4. 即使 CLI 设置 --timeout 2147483647(最大值)也无效——超时由服务端发起

+### 服务端日志 / Server log
+%APPDATA%\navop\logs\onetcli.log 中可见:
+ +WARN serve_inner: rmcp::service: timed out draining in-flight responses +INFO serve_inner: rmcp::service: serve finished quit_reason=Closed +
+
+### 影响 / Impact
+- 确认窗口只有约 5 秒,用户来不及阅读命令内容就超时,Confirm 模式实际不可用
+- 排查中用户若在 5 秒内点"允许",命令会执行但响应丢失,调用方无法确认结果(不透明)
+- settings.json 的 mcp 配置块中只有 server_enabled/server_mode/permission_mode,无超时相关配置项
+

+### 环境 / Environment
+- Navop v0.12.1(Windows x64 MSI)
+- @navop/cli v0.2.1,Node v22.23.0
+- 权限模式:ask(Confirm)

建议方案 / Proposed solution

+### 建议 / Suggestion
+1. 增加可配置的确认等待时间(如 mcp.approval_timeout_ms,默认 60s 或 300s,0 = 无限等待直到用户允许/拒绝)
+2. 或在确认超时后返回明确的 approval_timeout 错误码(而非直接断开连接),让调用方可区分"被拒绝"与"超时"
+3. 确认超时后不要丢弃命令执行状态;若用户后续点击允许,应能补发响应

替代方案 / Alternatives considered

No response

补充信息 / Additional context

No response

Activity

  1. feigeCode commented on Aug 29, 2026

    @feigeCode
    Owner

    下载最新版本试试,navop/cli需要更新最新版本

  2. added a commit that references this issue on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions