Interactive Clarify

Interactive Clarify

A universal 'Ask User Questions' MCP tool for AI coding agents.

Category
访问服务器

README

Interactive Clarify

A universal "Ask User Questions" MCP tool for AI coding agents. When an AI agent encounters ambiguity, it can open structured clarifying questions in either a VS Code webview panel or a browser UI.

Works with Codex CLI, Claude Code, Factory Droid, and any MCP-compatible agent.

Architecture

AI Agent (Codex / Claude Code / Factory Droid)
  │  MCP stdio
  ▼
MCP Server (Node.js)
  │  Auto / VS Code only / Browser only
  ├──→ VS Code Extension ──→ Webview Panel
  └──→ Local Browser Window
  ▼
Returns JSON answers to agent

Features

  • Tab-based navigation — Questions shown as tabs, with click and keyboard navigation
  • Rich options — Each option has a label, description, and optional preview content
  • Recommended path — The first option is visually marked as recommended, with rationale shown in preview
  • Single & multi-select — Support for both exclusive and multi-choice questions
  • Freeform answer path — Every question supports a selectable freeform answer, and multi-select questions can combine checked options with freeform text
  • Per-answer notes — Selected structured answers can carry optional notes from the preview panel
  • Partial submit — Submission is allowed even when not every question is answered
  • Draft restoration — In-progress answers survive reloads for the same question set
  • Late-submit recovery — If the live MCP requester times out or disconnects, VS Code can still save the submitted response for later retrieval
  • VS Code themed — Webview uses native VS Code CSS variables for dark/light theme
  • Browser fallback — Opens the same React UI in your default browser when VS Code isn't available
  • Universal MCP — Any MCP-compatible agent can use it

Available MCP Tools

  • interactive_clarify
    • default tool
    • prefers VS Code, falls back to browser
    • supports mixed single-select and multi-select question lists in one request
  • interactive_clarify_vscode
    • forces the VS Code extension UI
    • returns an error if VS Code is unavailable
  • interactive_clarify_browser
    • forces the browser UI
    • shows the local browser URL in the page itself
  • interactive_clarify_get_late_response
    • retrieves a response saved after the original live MCP request timed out or disconnected

Project Structure

packages/
├── shared/              # Shared types, constants, and IPC protocol
├── mcp-server/          # MCP server (stdio transport) + browser fallback
└── vscode-extension/    # VS Code extension + React webview panel
    └── src/webview/panel/

Quick Start

Prerequisites

  • Node.js 18+
  • pnpm 9+
  • VS Code (optional, for in-editor webview UI)

1. Build

git clone <repo-url>
cd ask-user-questions-tool-interface
pnpm install
pnpm -r build

2. Configure your AI agent

Pick the agent you use and add the MCP server config (see Agent Configuration below).

3. (Optional) Install VS Code Extension

cd packages/vscode-extension
pnpm run package          # creates .vsix file
code --install-extension interactive-clarify-vscode-0.1.0.vsix

Note: pnpm run package uses vsce which is included as a devDependency. If you see vsce: command not found, make sure you've run pnpm install first.

The package script already passes --no-dependencies because vsce runs npm list internally, which conflicts with pnpm workspaces. If you need to run it manually:

npx @vscode/vsce package --no-dependencies

The extension activates automatically on VS Code startup and listens for incoming questions on a Unix socket.

4. Test it

Without VS Code (browser UI):

# With Codex CLI
codex "Use the interactive_clarify tool to ask me which database I prefer — PostgreSQL, MySQL, or SQLite — before suggesting an implementation"

The questions will open in your default browser using the same React UI.

With VS Code extension installed:

Run the same command — questions will appear in a VS Code webview panel instead of the browser.

Each question controls its own selection mode. Set multiSelect: true on the questions that should render as checkbox groups, and omit it or set false on the ones that should render as radio groups. Multi-select questions keep Freeform chat as an additional answer path alongside checked options.

Smoke test (no agent needed):

Pipe raw JSON-RPC to the MCP server to verify it works:

echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"},"protocolVersion":"2024-11-05"}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"interactive_clarify","arguments":{"questions":[{"question":"Which database should we use?","header":"Database","options":[{"label":"PostgreSQL","description":"Relational DB with extensions"},{"label":"SQLite","description":"Lightweight file-based DB"}],"multiSelect":false}]}}}' | node packages/mcp-server/dist/bin/ask-user-mcp.js

This opens the browser fallback so you can verify the tab-based question UI works.

Agent Configuration

Codex CLI / Codex App

Add to ~/.codex/config.toml:

[mcp_servers.interactive-clarify]
command = "node"
args = ["/absolute/path/to/packages/mcp-server/dist/bin/ask-user-mcp.js"]

Tip: This config file is shared between Codex CLI and the Codex VS Code extension (Codex App). Configuring it once makes the tool available in both.

To instruct Codex to use the tool proactively, add to your system prompt or project instructions:

When you encounter ambiguous requirements or have clarifying questions,
use the interactive_clarify tool to ask the user before proceeding.

Claude Code

Add to .mcp.json (project-scoped, committed to git) or ~/.claude.json (global):

{
  "mcpServers": {
    "interactive-clarify": {
      "command": "node",
      "args": ["/absolute/path/to/packages/mcp-server/dist/bin/ask-user-mcp.js"]
    }
  }
}

Or via CLI:

claude mcp add interactive-clarify node /absolute/path/to/packages/mcp-server/dist/bin/ask-user-mcp.js

Note: Claude Code already has a built-in AskUserQuestion tool. The interactive_clarify tool name avoids any conflict. Both tools can coexist — Claude will use whichever is more appropriate.

Factory Droid

In an active Droid session:

/mcp add interactive-clarify node /absolute/path/to/packages/mcp-server/dist/bin/ask-user-mcp.js

Note: Factory Droid also has a built-in ask_user tool. The interactive_clarify name avoids conflicts.

Generic MCP Client

Any MCP-compatible client using stdio transport:

{
  "command": "node",
  "args": ["/absolute/path/to/packages/mcp-server/dist/bin/ask-user-mcp.js"]
}

If you install the server package globally or invoke package binaries directly, the published bin name is interactive-clarify-mcp.

Reference

Detailed reference is in docs/reference.md, including:

  • tool schemas
  • runtime flow
  • troubleshooting
  • keyboard behavior and answer semantics
  • package responsibilities and development entry points

Environment Variables

Variable Description
INTERACTIVE_CLARIFY_SOCKET Override the default IPC socket path. Default: ~/.interactive-clarify/interactive-clarify.sock

Development

# Watch mode for all packages
pnpm dev

# Rebuild everything
pnpm -r build

# Run the MCP server directly
pnpm --filter @interactive-clarify/mcp-server start

# Package VS Code extension
cd packages/vscode-extension
pnpm run package

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选