JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q52796F
  • License MIT

MCP Interactive server for LLM --> user communication

Package Exports

  • mcp-interactive
  • mcp-interactive/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mcp-interactive) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

MCP Interactive Server

An interactive MCP (Model Context Protocol) server with a graphical interface for user interaction.

Description

This server provides the ask_user tool, which allows MCP clients to display interactive dialogues to the user via an Electron GUI. It supports both text input and predefined answer options.

Features

  • Interactive Dialogues: Displaying pop-up windows with questions to the user
  • Predefined Options: Support for radio buttons to select from predefined options
  • Markdown Support: Formatting messages using Markdown
  • Text Input: Ability for free text input by the user

Installation

  1. Install dependencies:
npm install
  1. Make sure you have Electron installed:
npm list electron

Usage

Starting the Server

node index.js

The server will await JSON-RPC requests via stdin/stdout.

ask_user Tool

Parameter Schema:

{
  "projectName": "string",     // Project/context name (required)
  "message": "string",        // Message for the user (required)
  "predefinedOptions": [       // Predefined answer options (optional)
    "string"
  ]
}

Example Request with Predefined Options:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "ask_user",
    "arguments": {
      "projectName": "My Project",
      "message": "Please select one of the options:",
      "predefinedOptions": ["Option 1", "Option 2", "Option 3"]
    }
  }
}

Example Request with Text Input:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "ask_user",
    "arguments": {
      "projectName": "My Project",
      "message": "Please enter your name:"
    }
  }
}

Server Response:

{
  "result": {
    "content": [
      {
        "text": "User replied: Option 1",
        "type": "text"
      }
    ]
  },
  "jsonrpc": "2.0",
  "id": 1
}

Testing

Quick Test with echo:

echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | node index.js

ask_user Tool Test:

echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "ask_user", "arguments": {"projectName": "Test", "message": "Choose option:", "predefinedOptions": ["A", "B", "C"]}}}' | node index.js

Interactive Test:

node test_interactive.js

Workflow:

  1. MCP client sends an ask_user request
  2. The server launches the Electron GUI process
  3. A dialog window with the question is displayed
  4. The user selects an option or enters text
  5. The response is sent back to the MCP server
  6. The server returns the result to the client

License

MIT