@whyuds/ask-user
Version:
A cross-platform command-line tool and MCP server to show dialog windows and get user input for AI code editors
100 lines (72 loc) • 2.34 kB
Markdown
# AskUser MCP Server Usage
## Overview
The AskUser tool can be used as an MCP (Model Context Protocol) server, allowing AI code editors like Cursor, Windsurf, and Trae to interact with users during code generation.
## Installation
```bash
npm install -g @whyuds/ask-user
```
## MCP Server Configuration
Add the following configuration to your AI editor's MCP settings:
### For Cursor, Windsurf, Trae, etc.
```json
{
"mcpServers": {
"ask-user": {
"command": "npx",
"args": [
"-y",
"ask-user-mcp"
],
"env": {}
}
}
}
```
### Alternative using global installation
```json
{
"mcpServers": {
"ask-user": {
"command": "ask-user-mcp",
"args": [],
"env": {}
}
}
}
```
## Available Tools
### `ask_user`
Displays a dialog window to get user input during code generation.
**Parameters:**
- `message` (required): The message to display to the user
- `title` (optional): The title of the dialog window
**Returns:**
- User's input as text, or empty string if cancelled
## Example Usage in AI Editors
Once configured, AI assistants can use the `ask_user` tool to:
1. **Ask for clarification** when requirements are unclear
2. **Get user preferences** for implementation choices
3. **Request feedback** on generated code
4. **Seek guidance** when multiple solutions are possible
## Benefits
- **Interactive Development**: AI can ask questions during code generation
- **Better Solutions**: User input leads to more accurate implementations
- **Reduced Iterations**: Fewer back-and-forth corrections needed
- **User Control**: Users can guide the AI's decision-making process
## Technical Details
- **Protocol**: Model Context Protocol (MCP) 2024-11-05
- **Transport**: stdio
- **UI**: Cross-platform Electron dialog
- **Input**: Multi-line text support
- **Shortcuts**: Ctrl+Enter to submit, Escape to cancel
## Troubleshooting
1. **Installation Issues**: Ensure Node.js 14+ is installed
2. **Permission Errors**: Try running with administrator privileges
3. **Display Issues**: Ensure GUI environment is available
4. **MCP Connection**: Check that the editor supports MCP protocol
## Development
To test the MCP server locally:
```bash
node test-mcp-simple.js
```
This will verify that the MCP server initializes correctly and lists available tools.