mcpField
U
user-prompt

user-prompt

本地服务
github.com/Jacob-J-ThomasAI 与智能体037 周前更新

关于 user-prompt

user-prompt 是一款 MCP 服务,让 AI Agent 能在任务执行期间向用户询问补充信息。其 `user_prompt` 工具会在独立终端窗口中显示问题,并以结构化问答返回答案,同时处理超时和窗口关闭情况。

主要功能

  1. 01一次调用提出多个问题
  2. 02在独立终端窗口显示问题
  3. 03以结构化问答返回答案
  4. 04处理 10 分钟响应超时
  5. 05窗口关闭时通知 Agent

适用场景

  1. 01在 Agent 任务中澄清模糊需求
  2. 02遇到意外错误后征求用户决定
  3. 03继续工作流前收集设计选择

MCP 相关

通过 stdio 向 MCP 客户端提供 `user_prompt` 工具。客户端启动服务进程,工具再将用户的回答返回给 Agent。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库
安装包
nugetUserPrompt1.0.2

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

User Prompt MCP 服务

.NET License

mcp-name: io.github.Jacob-J-Thomas/user-prompt

一个 Model Context Protocol(MCP)服务,可让 AI Agent 在任务进行期间通过弹出式终端窗口向用户提问以澄清问题。使用 .NET 8 和 C# 构建。

问题

长期运行的 AI Agent(例如 Claude Code、IDE 编码助手或自定义 Agent 工作流)经常会遇到需要人工输入的情况——需求不明确、出现意外错误,或设计决策有多种可行方案。如果没有提问机制,Agent 要么猜测(通常会猜错),要么完全停下,等待用户注意到。

解决方案

此 MCP 服务提供一个名为 user_prompt 的工具,AI Agent 可在执行过程中的任意时刻调用。调用后,用户的机器上会打开一个新的终端窗口,显示 Agent 的问题。用户输入答案后,响应会直接返回给 Agent,使其能够结合补充的上下文继续工作。

终端提示词演示

功能

  • 弹出式终端提示词 — 问题会显示在专用窗口中,与 Agent 自身的输入/输出分开
  • 支持多个问题 — Agent 可以在一次调用中提出多个问题;所有问题都会以编号列表的形式提前显示
  • 结构化响应 — 答案会以格式清晰的问答对形式返回,方便 Agent 解析
  • 超时处理 — 提供 10 分钟响应时间,并在超时后优雅地显示备用消息
  • 窗口关闭检测 — 如果用户关闭提示窗口而未作答,Agent 会收到明确通知
  • Stdio 传输 — 按照 MCP 规范通过 stdin/stdout 通信,兼容任何 MCP 客户端

前提条件

注意:预构建版本没有其他依赖项。.NET 全局工具和从源代码构建选项需要 .NET 8.0 SDK 或更高版本。

快速开始

从以下三种安装方式中选择一种。每种方式都会完整介绍安装、客户端配置和更新。


选项 A:GitHub Releases

独立可执行文件——无需 .NET SDK。

1. 下载

从最新版本下载适用于你平台的 zip 文件:

平台文件
Windows(x64)UserPromptMcpServer-win-x64.zip
macOS(Intel)UserPromptMcpServer-osx-x64.zip
macOS(Apple Silicon)UserPromptMcpServer-osx-arm64.zip
Linux(x64)UserPromptMcpServer-linux-x64.zip

2. 解压

将文件解压到永久位置,例如:

  • Windows:C:\Tools\UserPromptMcpServer\
  • macOS / Linux:~/tools/UserPromptMcpServer/

3. 配置 MCP 客户端

Claude Code(CLI):

claude mcp add user-prompt -- "C:\Tools\UserPromptMcpServer\UserPromptMcpServer.exe"

其他客户端 — 将命令指向可执行文件(完整示例请参阅客户端配置参考):

{
  "command": "C:\\Tools\\UserPromptMcpServer\\UserPromptMcpServer.exe"
}

**更新:**下载新版本,并替换同一文件夹中的文件。


选项 B:.NET 全局工具

需要 .NET 8.0 SDK 或更高版本。该工具会自动添加到 PATH。

1. 安装

dotnet tool install -g UserPrompt

2. 配置 MCP 客户端

Claude Code(CLI):

claude mcp add user-prompt -- user-prompt

其他客户端 — 命令名称为 user-prompt(完整示例请参阅客户端配置参考):

{
  "command": "user-prompt"
}

更新:

dotnet tool update -g UserPrompt

选项 C:从源代码构建

需要 .NET 8.0 SDK 或更高版本。

git clone https://github.com/Jacob-J-Thomas/user-context-retrieval-mcp-server.git
cd user-context-retrieval-mcp-server
dotnet publish UserPromptMcpServer -c Release -r win-x64 -o ./publish

将 win-x64 替换为适用于你平台的运行时标识符(例如 osx-arm64、linux-x64)。

然后按照选项 A 中的相同方式配置客户端,并将路径指向 ./publish/ 中的可执行文件。


客户端配置参考

此服务使用 stdio 传输方式,不会监听端口。MCP 客户端会启动服务进程,并通过 stdin/stdout 与其通信。将下方的命令/路径替换为你所选安装选项对应的值。

Claude Desktop

将以下内容添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "user-prompt": {
      "command": "/path/to/UserPromptMcpServer.exe"
    }
  }
}

配置文件位置:

平台路径
Windows%APPDATA%\Claude\claude_desktop_config.json
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Cursor

将以下内容添加到 .cursor/mcp.json(项目级)或 ~/.cursor/mcp.json(全局):

{
  "mcpServers": {
    "user-prompt": {
      "command": "/path/to/UserPromptMcpServer.exe"
    }
  }
}
OpenAI Codex CLI

将以下内容添加到 ~/.codex/config.toml(全局)或 .codex/config.toml(项目级):

[mcp_servers.user-prompt]
command = "/path/to/UserPromptMcpServer.exe"

或者通过 CLI 添加:

codex mcp add user-prompt -- /path/to/UserPromptMcpServer.exe
其他 MCP 客户端

任何支持 stdio 传输方式的 MCP 客户端都可以启动此服务。将其指向可执行文件(如果使用 .NET 全局工具,则指向 user-prompt 命令名称)。

用法

配置完成后,AI Agent 即可自动使用 user_prompt 工具。Agent 会根据自身判断决定何时调用它,无需手动触发。

工具参考

工具名称: user_prompt

参数类型必填说明
reasonstring是清楚说明 Agent 为何需要用户输入。此内容会在终端窗口中醒目显示。
questionsstring[]是具体问题列表。以编号列表形式显示;用户依次回答每个问题。
工具调用示例
{
  "name": "user_prompt",
  "arguments": {
    "reason": "The project has no database configuration and I need to set one up.",
    "questions": [
      "Which database engine should I use (PostgreSQL, SQLite, SQL Server)?",
      "Should I include Entity Framework Core as the ORM?"
    ]
  }
}
响应示例
User responded to 2 question(s):

1. Q: Which database engine should I use (PostgreSQL, SQLite, SQL Server)?
   A: PostgreSQL

2. Q: Should I include Entity Framework Core as the ORM?
   A: Yes, use EF Core with code-first migrations
终端窗口行为

调用此工具时,会打开一个新的 PowerShell 窗口并显示:

  1. 表明 AI Agent 需要输入的标题
  2. Agent 说明的提问原因
  3. 所有以编号列表形式显示的问题
  4. 带编号的输入提示(1>、2> 等)——每个答案按一次 Enter
  5. 窗口自动关闭前的确认消息

如果用户在 10 分钟内没有响应,或在未作答的情况下关闭窗口,Agent 会收到一条描述性备用消息,并可自行决定如何继续。

架构

UserPromptMcpServer/
├── UserPromptMcpServer.csproj   # Project file (.NET 8)
├── Program.cs                   # MCP server entry point (stdio transport)
└── Tools/
    └── UserPromptTool.cs        # Tool implementation
内部工作原理
  1. MCP 客户端通过 stdin 发送 tools/call JSON-RPC 请求
  2. 服务将问题写入临时 JSON 文件
  3. 生成 PowerShell 脚本,并在新的终端窗口中启动
  4. 用户查看问题并依次输入答案
  5. 答案写入响应 JSON 文件;终端关闭
  6. 服务读取响应文件、整理内容、清理临时文件,并通过 stdout 返回结果

所有临时文件都会创建在 %TEMP%/UserPromptMcpServer/<session-guid>/ 下,并在每次调用后清理,无论调用结果如何。

贡献

欢迎贡献!为确保你的更改能够合并,请先创建 issue讨论拟议的更改并获得批准,然后再开始工作。

  1. Fork 仓库
  2. 创建功能分支(git checkout -b feature/my-feature)
  3. 进行更改,并确保项目能够顺利构建(dotnet build)
  4. 使用清晰、具体的说明提交更改
  5. 向 develop 提交拉取请求
开发环境设置
git clone https://github.com/Jacob-J-Thomas/user-context-retrieval-mcp-server.git
cd user-context-retrieval-mcp-server
dotnet restore UserPromptMcpServer/UserPromptMcpServer.csproj
dotnet build UserPromptMcpServer/UserPromptMcpServer.csproj
可贡献的方向
  • 跨平台支持 — macOS 和 Linux 终端启动功能目前只是占位实现,尚未经过测试
  • 测试覆盖率 — 目前还没有测试项目
  • 更多 MCP 工具 — 如果项目范围扩展到不止一个工具

许可证

本项目采用 Apache License 2.0 许可。详情请参阅 LICENSE。

作者

Jacob Thomas — @Jacob-J-Thomas

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。