human-in-the-loop
An MCP (Model Context Protocol) server that allows AI assistants to ask questions to humans via Discord.
claude mcp add --transport stdio koba789-human-in-the-loop cargo install --git https://github.com/KOBA789/human-in-the-loop.git --force
How to use
The Human-in-the-Loop MCP server enables AI assistants to delegate questions to humans through Discord. It is designed for scenarios where AI needs human input or confirmation before proceeding, such as drafting documentation, validating uncertain decisions, or retrieving specialized knowledge. The server exposes an ask_human capability that creates a Discord thread, mentions the specified user, and waits for a human reply. Once a response is received, the answer is returned to the AI so it can continue its workflow. To use it, configure your MCP client (Claude Desktop or Claude Code, or any MCP-compatible client) to point at the human-in-the-loop server and provide the Discord channel and user IDs. The server reads the Discord token from the DISCORD_TOKEN environment variable by default, or you can pass it via a --discord-token argument if supported by your client.
In practice, an AI assistant will call the ask_human tool when it needs input. The server handles creating or reusing a Discord thread, posting the question and pinging the target user, and then awaiting a reply. When the human responds, the content is returned to the AI, allowing the workflow to continue with human-provided information integrated into the AI’s output.
How to install
Prerequisites:
- Rust (1.70 or higher)
- Rust toolchain (cargo) available in your environment
- Discord bot token with appropriate permissions (Send Messages, Create Public Threads, Read Message History) and Message Content Intent enabled
Step 1: Install the server binary from GitHub
# Install directly from the Git repository
cargo install --git https://github.com/KOBA789/human-in-the-loop.git --force
Step 2: Configure the Discord bot and environment
- Create a Discord bot and obtain the token
- Ensure the token is available to the server, e.g. via environment variable
export DISCORD_TOKEN="your-discord-bot-token"
Step 3: Run the server
# After installation, invoke the binary (the installed executable is typically named 'human-in-the-loop')
human-in-the-loop
Step 4: Connect with MCP clients
- In Claude Desktop, add a new MCP server entry with:
- command: human-in-the-loop
- args: --discord-channel-id <channel-id> --discord-user-id <user-id>
- env: DISCORD_TOKEN set to your bot token
- In Claude Code, set the MCP server similarly and ensure DISCORD_TOKEN is exported or provided via environment
If your client supports passing the token directly, you can use the --discord-token argument as well.
Additional notes
Tips and notes:
- Ensure your Discord bot has the required permissions: Send Messages, Create Public Threads, Read Message History, and access to message content if needed.
- Enable Message Content Intent in the Discord Developer Portal for your bot to read user responses when using Code or Desktop clients.
- The server uses a thread-based flow to keep human questions organized; expect a channel to temporarily host a thread per interaction.
- If the Discord token changes, update the DISCORD_TOKEN environment variable or re-authenticate via your MCP client configuration.
- For debugging, you can run the server locally and verify that the ask_human tool triggers a thread and returns the human's reply to the AI.
- If you need to migrate to MCP Elicitation in the future, this server is designed to operate alongside MCP’s elicitation workflows.
Related MCP Servers
goose
an open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
cunzhi
告别AI提前终止烦恼,助力AI更加持久
probe
AI-friendly semantic code search engine for large codebases. Combines ripgrep speed with tree-sitter AST parsing. Powers AI coding assistants with precise, context-aware code understanding.
mcp-center
A centralized platform for managing and connecting MCP servers. MCP Center provides a high-performance proxy service that enables seamless communication between MCP clients and multiple MCP servers.
backlog -rust
MCP server for Backlog, project management service.
perplexity-web-api
🔍 Perplexity AI MCP without API key