交互式 MCP
一个用 Node.js/TypeScript 实现的 MCP 服务器,用于促进 LLM 与用户之间的交互通信。**注意:**此服务器设计为与 MCP 客户端(例如 Claude Desktop、VS Code)一起在本地运行,因为它需要直接访问用户的操作系统来显示通知和命令行提示符。
(注:该项目尚处于早期阶段。)
**想要快速概览?**请查看介绍性博客文章: 让你的 AI 助手不再猜测——interactive-mcp 介绍
演示视频 |
---|
工具
该服务器通过模型上下文协议(MCP)公开以下工具:
request_user_input
:向用户提问并返回答案。可以显示预定义选项。message_complete_notification
:发送简单的操作系统通知。start_intensive_chat
:启动持久命令行聊天会话。ask_intensive_chat
:在活跃的密集聊天会话中提出问题。stop_intensive_chat
:关闭活动的密集聊天会话。
演示
以下是交互功能的演示:
普通问题 | 完成通知 |
---|---|
![]() | ![]() |
密集聊天开始 | 密集聊天结束 |
---|---|
![]() | ![]() |
使用场景
此服务器非常适合 LLM 需要与本地计算机上的用户直接交互的场景,例如:
- 交互式设置或配置过程。
- 在代码生成或修改期间收集反馈。
- 在结对编程中澄清指令或确认操作。
- LLM 操作期间任何需要用户输入或确认的工作流程。
客户端配置
本节介绍如何配置 MCP 客户端以使用interactive-mcp
服务器。
默认情况下,用户提示将在 30 秒后超时。您可以在配置客户端时直接向args
数组添加命令行标志,以自定义服务器选项,例如超时或禁用工具。
请确保您有可用的npx
命令。
与 Claude Desktop/Cursor 一起使用
将以下最小配置添加到您的claude_desktop_config.json
(Claude Desktop)或mcp.json
(Cursor):
自定义超时示例(30 秒):
与 VS Code 一起使用
将以下最小配置添加到您的用户设置(JSON)文件或.vscode/mcp.json
中:
macOS 建议
为了在 macOS 上使用默认Terminal.app
获得更流畅的体验,请考虑以下配置文件设置:
- (Shell 选项卡):在“当 Shell 退出时” (终端 > 设置 > 配置文件 > [您的配置文件] > Shell )下,选择**“如果 Shell 正常退出则关闭”或“关闭窗口”** 。这有助于在 MCP 服务器启动和停止时管理窗口。
开发设置
本节主要面向希望修改或贡献服务器的开发者。如果您只想将服务器与 MCP 客户端一起使用,请参阅上面的“客户端配置”部分。
先决条件
- **Node.js:**检查
package.json
的版本兼容性。 - **pnpm:**用于包管理。安装 Node.js 后,通过
npm install -g pnpm
安装。
安装(开发人员)
- 克隆存储库:
- 安装依赖项:
运行应用程序(开发人员)
命令行选项
interactive-mcp
服务器接受以下命令行选项。这些选项通常应该在 MCP 客户端的 JSON 设置中配置,方法是直接将它们添加到args
数组中(参见“客户端配置”示例)。
选项 | 别名 | 描述 |
---|---|---|
--timeout | -t | 设置用户输入提示的默认超时时间(以秒为单位)。默认为 30 秒。 |
--disable-tools | -d | 禁用特定工具或群组(逗号分隔列表)。阻止服务器广告或注册它们。选项: request_user_input 、 message_complete_notification 、 intensive_chat 。 |
**示例:**在客户端配置args
数组中设置多个选项:
开发命令
- 构建:
pnpm build
- Lint:
pnpm lint
- 格式:
pnpm format
互动指导原则
与此 MCP 服务器交互时(例如,作为 LLM 客户端),请遵守以下原则以确保清晰度并减少意外更改:
- **优先考虑互动:**频繁使用提供的 MCP 工具(
request_user_input
、start_intensive_chat
等)与用户互动。 - **寻求澄清:**如果要求、说明或上下文不清楚,请务必在继续操作之前提出澄清问题。不要妄下结论。
- **确认操作:**在执行重大操作(如修改文件、运行复杂命令或做出架构决策)之前,请与用户确认计划。
- **提供选项:**尽可能通过 MCP 工具向用户提供预定义的选项,以便快速做出决策。
您可以向 LLM 客户提供以下说明,如下所示:
贡献
欢迎贡献!请遵循标准开发实践。(更多详细信息可稍后添加)。
执照
MIT(有关详细信息,请参阅LICENSE
文件 - 如果适用,或直接指定许可证)。
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
Node.js/TypeScript MCP 服务器促进 LLM 和用户之间的交互式通信,允许 AI 助手请求用户输入、显示通知和管理命令行聊天会话。
Related Resources
Related MCP Servers
- -securityAlicense-qualityA server for the Machine Chat Protocol (MCP) that provides a YAML-based configuration system for LLM applications, allowing users to define resources, tools, and prompts without writing code.Last updated -5PythonMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to interact with Linear project management systems, allowing users to retrieve, create, and update issues, projects, and teams through natural language.Last updated -3291394TypeScriptMIT License
- -securityAlicense-qualityAn MCP server that allows AI assistants to utilize human capabilities by sending requests to humans and receiving their responses through a Streamlit UI.Last updated -42PythonMIT License
- AsecurityFlicenseAqualityAn MCP server that enables LLMs to interact with Agent-to-Agent (A2A) protocol compatible agents, allowing for sending messages, tracking tasks, and receiving streaming responses.Last updated -524TypeScript