An MCP (Model Context Protocol) server that allows AI assistants to ask questions to humans via Discord.
This MCP server is used when AI assistants need human input or judgment during their work. For example:
- When having an LLM create documentation, the AI designs the structure while humans provide specific content
- When the AI needs confirmation on uncertain decisions
- When specialized knowledge or personal information is required
- Rust (1.70 or higher)
- Discord account and bot
- MCP-compatible AI client (Claude Desktop, Copilot Edits, etc.)
- Go to Discord Developer Portal
- Create a new application
- Create a bot in the Bot section and obtain the token
- Set required permissions:
- Send Messages
- Create Public Threads
- Read Message History
- Enable privileged gateway intents in Bot section:
- Message Content Intent
cargo install --git https://github.com/KOBA789/human-in-the-loop.gitAdd the following to claude_desktop_config.json:
{
"mcpServers": {
"human-in-the-loop": {
"command": "human-in-the-loop",
"args": [
"--discord-channel-id", "channel-id",
"--discord-user-id", "user-id"
],
"env": {
"DISCORD_TOKEN": "your-discord-bot-token"
}
}
}
}For Claude Code (claude.ai/code), add to your MCP settings:
{
"mcpServers": {
"human-in-the-loop": {
"command": "human-in-the-loop",
"args": [
"--discord-channel-id", "channel-id",
"--discord-user-id", "user-id"
]
}
}
}Set the Discord token as an environment variable before running Claude Code:
export DISCORD_TOKEN="your-discord-bot-token"
claudeNote: The server automatically reads the Discord token from the DISCORD_TOKEN environment variable. You can also pass it via --discord-token argument if needed.
AI assistants can ask questions to humans using the ask_human tool:
Human: Please create a documentation outline. You can ask the human as you need.
Assistant: I'll create a documentation outline. Let me ask you some questions first.
[Uses ask_human tool]
The AI posts questions in Discord and mentions the specified user. When the user replies in Discord, the response is returned to the AI.
- AI assistant calls the
ask_humantool - MCP server creates a thread in the specified Discord channel (or uses existing thread)
- Posts the question and mentions the specified user
- Waits for user's reply
- Returns the reply content to the AI assistant
- Enable Developer Mode in Discord (Settings → Advanced → Developer Mode)
- Right-click on channel → "Copy ID"
- Right-click on user → "Copy ID"
- Future Migration to MCP Elicitation: Once MCP's Elicitation implementation becomes more widespread and standardized, we plan to migrate the UI from Discord to native MCP Elicitation. This will provide a more integrated experience directly within MCP-compatible clients.