render-question-mcp
# render-question-mcp
An MCP (Model Context Protocol) server that enables AI agents to collect structured, validated user input through native UI forms using elicitation.
## Features
- **6 Question Types**: text, number, boolean, radio, dropdown, checkbox (with true multi-select support!)
- **Multi-Select Checkboxes**: Native array support for selecting multiple options
- **Comprehensive Validation**: required fields, min/max values, patterns, email/URI formats
- **Type-Safe**: Built with TypeScript and Zod for runtime validation
- **Native UI**: Renders forms in the MCP client's native interface
- **Zero Ambiguity**: Eliminates conversational back-and-forth for data collection
## Installation
### Prerequisites
- **Node.js** >= 20.0.0
- An MCP-compatible client (Cursor, Claude Desktop, VS Code, etc.)
### Getting Started
First, install the render-question-mcp server with your client.
**Standard config** works in most tools:
```json
{
"mcpServers": {
"render-question": {
"command": "npx",
"args": [
"render-question-mcp@latest"
]
}
}
}
```
<details>
<summary>Claude Code</summary>
Use the Claude Code CLI to add the server:
```bash
claude mcp add render-question npx render-question-mcp@latest
```
</details>
<details>
<summary>Claude Desktop</summary>
Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
```json
{
"mcpServers": {
"render-question": {
"command": "npx",
"args": ["render-question-mcp@latest"]
}
}
}
```
</details>
<details>
<summary>Cursor</summary>
#### Click the button to install:
[](https://cursor.com/en-US/install-mcp?name=render-question&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJyZW5kZXItcXVlc3Rpb24tbWNwQGxhdGVzdCJdfQ==)
#### Or install manually:
Go to `Cursor Settings` β `MCP` β `Add new MCP Server`. Name to your liking, use `command` type with the command `npx render-question-mcp@latest`. You can also verify config or add command arguments via clicking `Edit`.
#### Project-Specific Configuration
Create `.cursor/mcp.json` in your project root:
```json
{
"mcpServers": {
"render-question": {
"command": "npx",
"args": ["render-question-mcp@latest"]
}
}
}
```
</details>
<details>
<summary>VS Code</summary>
Follow the [MCP install guide](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server), use the standard config above.
Alternatively, install using the VS Code CLI:
```bash
code --add-mcp '{"name":"render-question","command":"npx","args":["render-question-mcp@latest"]}'
```
</details>
<details>
<summary>Cline</summary>
Add via the Cline VS Code extension settings or by updating your `cline_mcp_settings.json` file:
```json
{
"mcpServers": {
"render-question": {
"command": "npx",
"args": [
"render-question-mcp@latest"
]
}
}
}
```
</details>
<details>
<summary>Zed</summary>
Follow the [MCP Servers documentation](https://zed.dev/docs/assistant/model-context-protocol). Use the standard config above.
</details>
---
### Local Development
For local development and testing:
```json
{
"mcpServers": {
"render-question": {
"command": "node",
"args": ["/absolute/path/to/render-question-mcp/dist/index.js"],
"env": {
"LOG_LEVEL": "debug"
}
}
}
}
```
---
### Verify Installation
After installation, verify render-question-mcp is working:
1. **Restart your MCP client** completely
2. **Check connection status**:
- **Cursor**: Look for green dot in Settings β Tools & Integrations β MCP Tools
- **Claude Desktop**: Check for "render_question" in available tools
- **VS Code**: Verify in GitHub Copilot settings
3. **Test with a simple query**:
```
Ask me for my name and email address
```
If you see the AI agent use the `render_question` tool and display a native form, you're all set! π
## Usage
The server provides a single tool: `render_question`
### Basic Example: Single Text Field
```typescript
{
"questions": [
{
"id": "email",
"type": "text",
"label": "What is your email address?",
"validation": {
"required": true,
"format": "email"
},
"helpText": "We'll use this for project notifications",
"placeholder": "developer@example.com"
}
]
}
```
### Example: Multiple Questions Form
```typescript
{
"title": "Developer Onboarding",
"description": "Help us set up your development environment",
"questions": [
{
"id": "name",
"type": "text",
"label": "Your full name",
"validation": {
"required": true,
"minLength": 2
},
"placeholder": "Jane Doe"
},
{
"id": "experience",
"type": "number",
"label": "Years of experience with TypeScript",
"validation": {
"required": true,
"min": 0,
"max": 50
}
},
{
"id": "role",
"type": "dropdown",
"label": "What's your primary role?",
"options": [
{ "value": "frontend", "label": "Frontend Developer" },
{ "value": "backend", "label": "Backend Developer" },
{ "value": "fullstack", "label": "Full-Stack Developer" },
{ "value": "devops", "label": "DevOps Engineer" }
],
"validation": { "required": true }
},
{
"id": "remote",
"type": "boolean",
"label": "Are you working remotely?",
"default": true
}
]
}
```
## Question Types
### Text Input
```typescript
{
"id": "username",
"type": "text",
"label": "Username",
"validation": {
"required": true,
"minLength": 3,
"maxLength": 20,
"pattern": "^[a-zA-Z0-9_]+$"
},
"placeholder": "john_doe"
}
```
### Number Input
```typescript
{
"id": "port",
"type": "number",
"label": "Port Number",
"validation": {
"required": true,
"min": 1,
"max": 65535
},
"default": 3000
}
```
### Boolean (Single Checkbox)
```typescript
{
"id": "agree",
"type": "boolean",
"label": "I agree to the terms and conditions",
"validation": {
"required": true
}
}
```
### Radio Buttons (Single Choice)
```typescript
{
"id": "theme",
"type": "radio",
"label": "Select a theme",
"options": [
{ "value": "light", "label": "Light Mode" },
{ "value": "dark", "label": "Dark Mode" },
{ "value": "auto", "label": "Auto (System)" }
],
"validation": {
"required": true
}
}
```
### Dropdown (Single Choice)
```typescript
{
"id": "framework",
"type": "dropdown",
"label": "Choose a framework",
"options": [
{ "value": "react", "label": "React" },
{ "value": "vue", "label": "Vue.js" },
{ "value": "angular", "label": "Angular" },
{ "value": "svelte", "label": "Svelte" }
]
}
```
### Checkbox (Multi-Select) β¨ NEW!
```typescript
{
"id": "features",
"type": "checkbox",
"label": "Select features to enable",
"options": [
{ "value": "auth", "label": "Authentication" },
{ "value": "db", "label": "Database Integration" },
{ "value": "api", "label": "REST API" },
{ "value": "websocket", "label": "WebSocket Support" }
],
"validation": {
"min": 1, // Require at least 1 selection
"max": 3 // Allow maximum 3 selections
},
"helpText": "Choose all features you want to include"
}
```
**Response format for multi-select:**
```json
{
"features": ["auth", "db", "api"] // Array of selected values
}
```
## Validation Options
- **required**: `boolean` - Field must be filled
- **min** / **max**: `number` - Min/max value for numbers, or min/max items for checkbox arrays
- **minLength** / **maxLength**: `number` - Min/max length for strings
- **pattern**: `string` - Regular expression pattern
- **format**: `"email" | "uri" | "url" | "date" | "date-time"` - Format validation
- **errorMessage**: `string` - Custom error message
## Response Format
The tool returns a structured response:
```json
{
"answers": {
"name": "Jane Doe",
"experience": 5,
"role": "fullstack",
"remote": true,
"features": ["auth", "db", "api"]
},
"metadata": {
"completedAt": "2025-11-13T10:30:00Z",
"duration": 15000,
"action": "submit"
}
}
```
Possible actions:
- `submit` - User submitted the form
- `cancel` - User canceled the dialog
- `decline` - User declined to answer
## Development
### Setup
```bash
pnpm install
pnpm build
```
### Testing
```bash
pnpm test
pnpm test:coverage
```
### Local Testing
1. Build the project:
```bash
pnpm build
```
2. Link locally:
```bash
npm link
```
3. Configure your MCP client to use the local build
4. Test with an MCP Inspector or client
## Examples
See the [examples](./examples) directory for real-world use cases:
- [Developer Onboarding](./examples/onboarding.ts)
- [Database Configuration](./examples/database-config.ts)
- [Deployment Approval](./examples/deployment-approval.ts)
## Architecture
```
src/
βββ index.ts # CLI entry point
βββ server.ts # MCP server setup
βββ stdio.ts # Stdio transport
βββ types.ts # TypeScript type definitions
βββ elicitation/
β βββ core.ts # Core elicitation logic
β βββ schemas.ts # Schema builders
βββ tools/
βββ index.ts # Tool registry
βββ render_question.ts # Main tool implementation
```
## For AI Agents
See [AGENTS.md](./AGENTS.md) for detailed guidance on using this tool effectively in AI workflows.
## License
MIT
## Contributing
Contributions welcome! Please read the contributing guidelines and submit a PR.
## Related Projects
- [MCP Specification](https://modelcontextprotocol.io)
- [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
- [mcp-elicit](https://github.com/blizzy78/mcp-elicit) - Reference implementation
TDQS
Scored across 1 tool
There is only one tool, so there is no possibility of misselection or overlap with a sibling. The tool's purpose (render a form and collect validated input) is unambiguous and clearly stated.
The single name `render_question` follows a clear verb_noun snake_case convention. With one tool there is no opportunity for convention drift.
One tool is thin for a server surface, though it is genuinely a single capability (form elicitation) that is heavily parameterized rather than split into multiple operations. It sits at the borderline of the 1-2 tool 'feels thin' band.
The surface covers the domain well: all question types, validation rules, and examples are handled by one call. The notable gap is native multi-select (arrays), which requires a documented multi-boolean workaround and pushes complexity onto the caller.