This MCP server enables interactive communication between AI tools (like Cursor and Windsurf) and users. It allows AI tools to request user input, present options for selection, and collect additional information while executing tasks, significantly improving the efficiency and effectiveness of AI interactions.
Test the functionality with:
# Test option selection with PyQt interface
.\dist\mcp-interactive.exe test select_option --ui pyqt
# Test information supplement with PyQt interface
.\dist\mcp-interactive.exe test request_additional_info --ui pyqt
Choose your preferred UI type and install the corresponding dependencies:
cd requirements
# For CLI UI (minimal dependencies)
pip install -r requirements-base.txt
# For PyQt5 UI
pip install -r requirements-pyqt.txt
# For Web UI
pip install -r requirements-web.txt
If you have uv installed:
# Create and activate virtual environment
uv venv
# On Windows
.venv\Scripts\activate
# On macOS/Linux
source .venv/bin/activate
cd requirements
# Install dependencies based on UI type
# CLI UI (minimal)
uv pip install -r requirements-base.txt
# PyQt5 UI
uv pip install -r requirements-pyqt.txt
# Web UI
uv pip install -r requirements-web.txt
Alternatively, use pyproject.toml:
# Install base dependencies
uv pip install -e .
# Install specific UI type dependencies
uv pip install -e ".[pyqt]" # PyQt5 UI
uv pip install -e ".[web]" # Web UI
uv pip install -e ".[all]" # All UI types
Start the MCP server with your preferred UI type:
# Command line interface (default)
python main.py run --ui=cli
# Web interface
python main.py run --ui=web
# PyQt interface
python main.py run --ui=pyqt
Additional options:
# Specify host and port
python main.py run --host 0.0.0.0 --port 8888
# Specify log level
python main.py run --log-level warning
{
"ai-interaction": {
"command": "python",
"args": ["path/to/main.py", "run", "--transport", "stdio", "--ui", "cli"],
"env": {}
}
}
{
"ai-interaction": {
"command": "D:/Path/To/Your/mcp-interactive.exe",
"args": ["run", "--transport", "stdio", "--ui", "pyqt"],
"env": {}
}
}
Start the server with:
python main.py run --transport sse
Cursor configuration:
{
"ai-interaction": {
"type": "sse",
"url": "http://127.0.0.1:8000/sse",
"env": {}
}
}
Windsurf configuration:
{
"ai-interaction": {
"serverUrl": "http://127.0.0.1:7888/sse",
"disabled": false
}
}
This tool presents options to users and lets them select by entering numbers or providing custom answers.
from fastmcp import Client
async with Client("http://127.0.0.1:8000/sse") as client:
options = [
"Option 1: Implement with TensorFlow",
"Option 2: Implement with PyTorch",
{"title": "Option 3: Implement with JAX", "description": "Better for research purposes"}
]
result = await client.call_tool(
"select_option",
{"options": options, "prompt": "Please select a framework implementation"}
)
selected_option = result.json
print(f"User selected: {selected_option}")
The tool returns:
{
"selected_index": 0, // Index of the user's selection, -1 if custom answer
"selected_option": {}, // Content of the user's selected option
"custom_input": "", // User's custom input, if any
"is_custom": false // Whether it's a custom answer
}
This tool requests additional information from users.
from fastmcp import Client
async with Client("http://127.0.0.1:8000/sse") as client:
additional_info = await client.call_tool(
"request_additional_info",
{
"prompt": "Please provide specific project requirements"
}
)
print(f"User provided information: {additional_info.text}")
# Test option selection tool
python main.py test select_option --ui=cli
# Test information supplement tool
python main.py test request_additional_info --ui=cli
# Run the interactive test client
python mcp_client_en.py --host localhost --port 7888 --ui cli
Options:
--host
: Server host (default: localhost)--port
: Server port (default: 7888)--ui
: UI type to use (cli, pyqt, web)# Test stdio connection with default settings
python mcp_client_stdio.py
# Specify UI type
python mcp_client_stdio.py --ui=pyqt
# Test specific tools
python mcp_client_stdio.py --test=select_option
The config.json
file in the project root directory can configure various options:
{
"reminder": {
"enable_reminder": true,
"reminder_text": "**Note**:\nUnless I explicitly state there are no new tasks, you must never terminate the conversation. After completing each task, call mcp ai-interaction to request or confirm tasks with me!"
},
"ui": {
"default_ui_type": "pyqt"
},
"logging": {
"level": "warning"
}
}
The MCP server supports three different user interface types:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "ai-interaction" '{"command":"python","args":["path/to/main.py","run","--transport","stdio","--ui","cli"],"env":[]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"ai-interaction": {
"command": "python",
"args": [
"path/to/main.py",
"run",
"--transport",
"stdio",
"--ui",
"cli"
],
"env": []
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"ai-interaction": {
"command": "python",
"args": [
"path/to/main.py",
"run",
"--transport",
"stdio",
"--ui",
"cli"
],
"env": []
}
}
}
3. Restart Claude Desktop for the changes to take effect