interactive-choice-mcp

interactive-choice-mcp

Enables AI to present options and launch an interactive web or terminal interface for user selection, then return the results to the AI.

Category
访问服务器

README

Interactive Choice MCP

<div align="left"> <p> <a href="README.zh.md">中文</a> | <a href="README.md">English</a> </p> </div>

An MCP Server that enables AI to provide options and launch an interactive interface for user selection when facing choice problems, then return the results. Inspired by mcp-feedback-enhanced, built with FastMCP.

  • Showcase: Showcase

Similar Projects

  • imhuso/cunzhi - A Rust + Tauri desktop application that intercepts AI from ending conversations prematurely. Features memory management for project-specific preferences and includes code search capabilities. More comprehensive but heavier than this project.

  • paulp-o/ask-user-questions-mcp - A lightweight TypeScript + Node.js MCP server focused on CLI-based interaction. Designed for multi-agent parallel coding workflows with question queuing and SSH support. More lightweight but only supports terminal interface.

  • fhyfhy17/panel-feedback - Panel Feedback brings AI interaction directly into your IDE's sidebar - seamlessly integrated, always accessible, never intrusive.

Differences: This project provides dual interface support (Web + Terminal) with balanced complexity, focusing on interactive selection scenarios.

(I discovered these projects after completing this one. I hope these excellent projects receive more visibility.)

📋 Table of Contents

✨ Key Features

🎯 Core Capabilities

  • Interactive Choice Interface: AI presents options, users make selections through intuitive interfaces
  • Dual Interface Support: Web-based UI and Terminal UI (experimental)
  • Selection Modes: Single-select and multi-select modes
  • Option Annotations: Users can add annotations to options to provide correct feedback to AI
  • Automation Ready: AI can mark recommended options with timeout auto-submit

📦 Installation

Prerequisites

  • Python 3.12 or higher
  • uv package manager (recommended) or pip

🚀 Quick Start

Add the following configuration:

{
  "mcpServers": {
    "interactive-choice": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/Sighthesia/interactive-choice-mcp",
        "interactive-choice-mcp"
      ]
    }
  }
}
  • This will automatically clone the project repository and install dependencies.

  • For best results, it is recommended to add the following content to your global prompt (still being adjusted, prompts are from cunzhi, currently focusing on optimization for pay-per-use AI assistants, suggestions are welcome):

    - When the requirements are not clear, use `provide_choice` to ask for clarification and provide predefined options.
    - When there are multiple solutions, use `provide_choice` to ask instead of making assumptions on your own.
    - When there is a need to update a solution or strategy, use `provide_choice` to ask instead of making assumptions on your own.
    - Before completing a request, you must call `provide_choice` to request feedback.
    - Without a clear confirmation through the use of `provide_choice` to ask and receive permission to complete the task or end the conversation, it is prohibited to end the dialogue or request on your own initiative.
    

Environment Variables (Optional)

You can override saved configurations by adding the following environment variables to the env section in your MCP configuration:

Environment Variable Description Possible Values Default
CHOICE_WEB_HOST Web server host Any valid IP or hostname 127.0.0.1
CHOICE_WEB_PORT Web server port Any available port number 9999
CHOICE_LANG Interface language en, zh Auto-detected by system language
CHOICE_LOG_LEVEL Log level DEBUG, INFO, WARNING, ERROR INFO
CHOICE_LOG_FILE Log file path Any valid file path Optional
CHOICE_MCP_DATA_DIR Data storage dir Any valid directory path .mcp-data/
Configuration Example

Here is a complete MCP configuration example with environment variables:

{
  "mcpServers": {
    "interactive-choice": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/Sighthesia/interactive-choice-mcp",
        "interactive-choice-mcp"
      ],
      "env": {
        "CHOICE_WEB_HOST": "127.0.0.1",
        "CHOICE_WEB_PORT": "8080",
        "CHOICE_LANG": "en",
        "CHOICE_LOG_LEVEL": "DEBUG",
        "CHOICE_LOG_FILE": "~/.mcp-data/interactive-choice.log",
        "CHOICE_MCP_DATA_DIR": "~/.mcp-data/interactive-choice"
      }
    }
  }
}

🤝 Contributing

Contributions are welcome! Whether it's reporting issues, requesting features, or submitting PRs, it's all greatly appreciated!

For AI-driven development, refer to AGENTS.md and openspec.

📍 Local Development Environment Setup

# Clone the repository
git clone https://github.com/Sighthesia/interactive-choice-mcp.git
cd interactive-choice-mcp

# Install dependencies
uv sync

# Verify installation
uv run pytest
  • You can configure to use a local development environment to run the MCP Server:

    {
      "mcpServers": {
        "interactive-choice": {
          "command": "uv",
          "args": [
            "--directory",
            "/path/to/interactive-choice-mcp",
            "run",
            "server.py"
          ]
        }
      }
    }
    

    Tip: Replace /path/to/interactive-choice-mcp with the actual path, such as ~/interactive-choice-mcp.

🧪 Testing

For detailed testing information, please refer to tests/README.md.

The following are common test commands for development and debugging:

Running Interactive Tests

Temporarily run the Web server for interactive testing to verify user-side interaction effects:

  1. Open Web interaction interface and test the default single-select mode
uv run pytest tests/integration/test_interaction_web.py::TestWebInteractionManual::test_web_e2e_manual_interaction --interactive -v -s
  1. Open terminal interaction interface and test the default single-select mode
uv run pytest tests/integration/test_interaction_terminal.py::TestTerminalInteractionManual::test_terminal_e2e_manual_interaction --interactive -v -s

Running MCP Server Debugging

Run MCP Inspector to verify MCP Server tool input/output effects:

uv run mcp dev server.py

🏗️ Project Architecture

src/
├── core/                    # Core orchestration and business logic
│   ├── models.py           # Data models and schemas
│   ├── orchestrator.py     # Main orchestration logic
│   ├── validation.py       # Input validation
│   └── response.py         # Response generation
├── mcp/                    # MCP tool bindings
│   ├── tools.py           # MCP tool definitions
│   └── response_formatter.py
├── web/                    # Web interface
│   ├── server.py          # FastAPI web server
│   ├── bundler.py         # Asset bundling
│   └── templates.py       # HTML templates
├── terminal/               # Terminal interface
│   ├── ui.py              # Questionary-based UI
│   └── session.py         # Terminal session management
├── store/                  # Data persistence
│   └── interaction_store.py
└── infra/                  # Infrastructure
    ├── logging.py         # Logging configuration
    ├── i18n.py            # Internationalization
    └── storage.py         # File system operations

Future Considerations

  • Since various AI IDEs and CLIs tend to silently run AI commands, the terminal mode interaction experience may be limited and requires further consideration for feasibility

💖 Acknowledgments

📄 License

MIT License.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选