副驾驶
最小化MCP服务器暴露一个工具: ask_user.
目的:让代理通过MCP启发向人类请求结构化输入 表格模式 (Copilot UI呈现表单)。
快速入门(npx)
无需安装!配置您的MCP客户端以运行:
npx copilot_loop它做什么
- 实施MCP工具
ask_user. - 工具调用触发器
elicitation/create(模式"form")使用提供的message+requestedSchema. - 返回JSON工具结果信封(
status,action,content,error). - 在等待用户输入的同时,定期发送
notifications/progress(当aprogressToken存在)以减少Copilot工具调用超时。 - 处理工具调用取消并清除正在进行的状态(以便下一个工具调用正常工作)。
- 使用较长的服务器->客户端启发请求超时(默认24小时),因此用户可以在服务器超时的情况下花费>60秒的时间来回答。
安装选项
选项1:npx(推荐)
无需安装。只需配置您的MCP客户端:
- 命令:
npx - Args:
copilot_loop
选项2:全局安装
npm install -g copilot_loop然后配置:
- 命令:
copilot_loop
方案3:地方发展
git clone
cd copilot_loop
npm install
npm run build然后配置:
- 命令:
node - Args:
/path/to/copilot_loop/dist/index.js
调试日志:
ASK_USER_DEBUG=1 node dist/index.js超时/保持活动旋钮:
# Progress notification frequency (default: 5000)
ASK_USER_PROGRESS_INTERVAL_MS=5000
# Server->client elicitation request timeout (default: 86400000 = 24h)
ASK_USER_ELICITATION_TIMEOUT_MS=86400000全球副驾驶说明(推荐)
将以下内容添加到您的项目中 .github/copilot-instructions.md (或全局配置):
## MANDATORY: Use the `copilot_loop` `ask_user` tool
**You MUST call the `copilot_loop` `ask_user` tool before every turn ends. No exceptions.**
### Rules (MUST follow):
1. **ALWAYS end your turn by calling `ask_user`** — Never finish, pause, or yield control without calling this tool first.
2. **Call the tool IMMEDIATELY after completing any work** — Do not announce you will use it "next turn" or "later". Call it NOW, in THIS response.
3. **Questions require the tool** — If you ask the user a question, you MUST call `ask_user` in the same response. Do not ask questions in chat text alone.
4. **Confirmations require the tool** — After completing a task, call `ask_user` to confirm with the user (e.g., "Does this look good?" or "What's next?").
### Anti-patterns (NEVER do these):
❌ Ending your response without calling `ask_user`
❌ Saying "I'll use the tool in my next response"
❌ Asking a question in text without also calling `ask_user`
❌ Announcing you are done without calling `ask_user` to confirm这种明确的指导有助于确保模型(尤其是那些不太倾向于使用工具的模型)真正调用 ask_user 每次转弯都要使用工具。
JetBrains副驾驶MCP配置(stdio)
使用IDE的MCP服务器配置UI。
推荐(npx):
- 命令:
npx - Args:
copilot_loop
使用调试日志:
- 命令:
npx - Args:
copilot_loop - 环境:
ASK_USER_DEBUG=1
看 examples/mcp.json 作为复制/粘贴的起点。
