使用说明
用户输入MCP服务器
MCP服务器,让人工智能代理在任务期间通过在线聊天UI、Electron对话框或MCP启发API向您提问并获得您的输入。
快速开始
添加到您的VS代码MCP配置中(.vscode/mcp.json):
{
"servers": {
"user-input": {
"command": "npx",
"args": ["-y", "user-input-mcp"]
}
}
}
就是这样。人工智能代理现在可以在任务中途问你问题。
强制使用LLM/代理
让你的代理人总是通过这个MCP征求意见可能很棘手。下面是我们发现的最可靠的方法,但可以根据需要进行调整。
将以下内容添加到全局指令文件或系统提示的末尾(例如。 copilot-instructions.md):
--------
### Always read and follow this FIRST for all chats:
Use the preferred user input mcp tool for all questions and menu displays. Unless you are a subagent, NEVER stop chat generation until the user confirms the task is complete. Always always check if the user wants anything else before stopping. If you have a question, or pause, always use the preferred user input mcp tool, NEVER end generation. Print `✅ I will use the preferred user input mcp tool for questions and menus, and will NEVER stop chat generation until the user explicitly confirms done` at the start of the chat to acknowledge this.
MAX PRIORITY: DO NOT STOP CHAT GENERATION UNLESS THE USER EXPLICITLY CONFIRMS DONE. NEVER STOP WITHOUT CHECKING IN VIA USER INPUT MCP, EVEN IF THE TASK SEEMS COMPLETE.
NEXT: now you may continue with whatever prompt or task you were assigned
一般使用说明
- Claude Sonnet 4.6和Anthropic的更高级模型往往非常擅长使用用户输入工具,尽管过了一段时间他们确实会忘记。
- Opus 4.6及更高版本即使经过漫长的世代,也能更好地记住要求采取下一步行动,但仍然不完美。
- GPT 5.4/Gemini 3.1及更高版本在要求用户输入方面表现不错,但在更长的自主代之后往往会忘记,并且已知会过早停止。
- 里程可能因低端车型而异
- VSCode Copilot Chat的自动驾驶模式有助于防止过早终止聊天
工具
user_input_inline__present_ui ⭐ 推荐
聊天中丰富的内联用户界面(需要MCP应用程序支持——VS Code、Claude Desktop)。
显示选项按钮、自由文本输入或两者兼而有之。每个选项都有一个编辑笔,因此您可以添加上下文。打电话后,代理人必须打电话 user_input_inline__await_presented_ui 与返回 requestId 以获取您的响应(此指令包含在当前UI响应中)。
user_input_elicitation
使用MCP启发API进行本机客户端输入。需要客户启发能力。
user_input_dialog
打开Electron GUI对话框窗口。Electron二进制文件在首次使用时会自动下载(一次性下载约150MB)。
配置
超时:默认情况下没有超时——随时通过停止按钮取消。要设置一个:
{
"servers": {
"user-input": {
"command": "npx",
"args": ["-y", "user-input-mcp"],
"env": {
"USER_INPUT_TIMEOUT_MINUTES": "60"
}
}
}
}
发展
git clone https://github.com/finnmerlett/user-input-mcp.git
cd user-input-mcp
npm install
npm run build
npm start
要在MCP配置中使用本地构建,请执行以下操作:
{
"servers": {
"user-input": {
"command": "node",
"args": ["/absolute/path/to/user-input-mcp/build/index.js"]
}
}
}
项目结构
src/
├── index.ts # MCP server entry point
├── docs/instructions.md # LLM/agent integration instructions
├── tools/
│ ├── user-input-inline.ts # MCP Apps inline form tool
│ ├── user-input-dialog.ts # Electron GUI dialog tool
│ ├── user-input-elicitation.ts # MCP elicitation API tool
│ └── zod-utils.ts # Zod → JSON Schema conversion
├── ui/
│ └── App.tsx # Inline form React component
└── utils/
└── instructions.ts # Instructions loader
工作流程
功能是使用故事驱动的文档开发的 docs/stories/ 以及命名的特征分支 feature/NNN-feature-name.
服务器说明
此服务器包括内置指令(在 src/docs/instructions.md)该指南指导LLM在完成任务之前检查用户输入,并在失败时重试。这些将自动提供给兼容的MCP客户端。如果您的客户端不支持服务器指令,请在系统提示中添加“在完成任务之前始终检查用户输入”。
版本控制
此套餐如下 森伯.固定到主要版本(例如。 user-input-mcp@1)以避免破坏更改。
许可证
麻省理工学院
