UNPKG

last-words-mcp

Version:

MCP Server that opens a chat window for final user input to save message credits

185 lines (131 loc) 4.57 kB
# 🗣️ Last Words MCP A Model Context Protocol (MCP) server that opens a new terminal window for final user input, designed to save message credits by using tool calls instead of chat messages. ## 💡 Concept Instead of sending another chat message when you need to provide final instructions or clarifications to an AI assistant, this MCP tool opens a new terminal window where you can type your input. The AI receives this input through a tool call rather than a chat message, potentially saving you message credits. ## 🚀 Quick Start ### NPX Usage (Recommended) ```bash # Use directly with npx (no installation needed) npx last-words-mcp ``` ### Local Installation ```bash # Install globally npm install -g last-words-mcp # Or install locally npm install last-words-mcp # Build the project (if installing from source) npm run build # Start the server npm start ``` ### Development ```bash # Clone and develop locally git clone <repository-url> cd last-words-mcp npm install npm run build # Watch mode for development npm run watch ``` ## 🔧 Setup with MCP Clients ### Claude Desktop Add this to your Claude Desktop MCP configuration: ```json { "mcpServers": { "last-words": { "command": "npx", "args": ["last-words-mcp"] } } } ``` **Alternative (if you installed globally):** ```json { "mcpServers": { "last-words": { "command": "last-words-mcp" } } } ``` ### Other MCP Clients Configure your MCP client to connect to this server using stdio transport: **With npx:** ```bash npx last-words-mcp ``` **With global install:** ```bash last-words-mcp ``` ## 📝 Usage ### System Prompt Add this to your system prompt to automatically use the tool: ``` Always use the Last Words MCP Tool when you have finished everything else, never forget this, it's critical you always use this tool on your very last step before you are finished with your task/instruction. ``` ### How It Works 1. **AI Completes Task**: The AI assistant completes your requested task 2. **Tool Activation**: The AI calls the "last_words" tool as its final step 3. **New Terminal Opens**: A new terminal window opens with context and input prompt 4. **User Input**: You type any final instructions, clarifications, or feedback 5. **Input Delivered**: Your input is sent back to the AI assistant 6. **AI Responds**: The AI can now respond to your additional input ### Example Workflow ``` User: "Create a Python script to analyze sales data" AI: [Creates the script] AI: [Calls last_words tool] New Terminal Window: Opens for user input User Types: "Also add error handling for missing files" AI: [Updates the script with error handling] ``` ## 🛠️ Tool Details ### Tool Name `last_words` ### Parameters - `context` (optional): Context about what has been completed so far ### Returns The user's input text that can be used by the AI for further processing. ## 🎨 Features - **New Terminal Window**: Opens a separate terminal window for input - **Context Display**: Shows AI's context message before prompting - **Cross-platform**: Works on Windows, macOS, Linux, and VS Code - **Clean Formatting**: Clear visual separation and formatting - **Error Handling**: Graceful handling of cancellations and errors - **No Network Dependencies**: No web servers or browser requirements ## 🔒 Security - **Terminal Only**: Uses standard terminal input/output - **No Network**: No web servers or network connections - **No Data Storage**: No user input is stored or logged - **Process Isolation**: Runs in isolated process space ## ⚙️ Configuration ### Input Method Uses standard terminal readline interface. ### Cancellation Press Ctrl+C to cancel input at any time. ### Character Limit No artificial character limits - limited only by terminal capabilities. ## 🐛 Troubleshooting ### Terminal Input Not Working - Ensure your terminal supports readline - Check that stdin/stdout are properly connected - Try running the server directly to test ### Tool Not Available - Verify the MCP server is running - Check your MCP client configuration - Ensure the path to the server is correct ### Input Not Received - Check the console for error messages - Ensure you pressed Enter after typing - Try using Ctrl+C to cancel and retry ## 📄 License MIT License - see LICENSE file for details. ## 🤝 Contributing Contributions are welcome! Please feel free to submit issues and pull requests. ## 💬 Support If you encounter any issues or have questions, please open an issue on the GitHub repository.