这是一个允许AI助手通过Discord向人类提问的MCP(模型上下文协议)服务器。
<img width="845" alt="2025-06-23 18-25-43的屏幕截图" src="https://gips0.baidu.com/it/u=2936780064,2450954924&fm=3081&app=3381&f=PNG?w=1690&h=1116" />当AI助手在工作中需要人类输入或判断时,会使用此MCP服务器。例如:
cargo install --git https://github.com/KOBA789/human-in-the-loop.git
在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"
}
}
}
}
对于Claude Code(claude.ai/code),在您的MCP设置中添加:
{
"mcpServers": {
"human-in-the-loop": {
"command": "human-in-the-loop",
"args": [
"--discord-channel-id", "channel-id",
"--discord-user-id", "user-id"
]
}
}
}
在运行Claude Code之前,将Discord令牌设置为环境变量:
export DISCORD_TOKEN="your-discord-bot-token"
claude
注意:服务器会自动从DISCORD_TOKEN环境变量中读取Discord令牌。如果需要,也可以通过--discord-token参数传递它。
AI助手可以使用ask_human工具向人类提问:
Human: 请创建一份文档大纲。您可以根据需要向人类提问。
Assistant: 我将创建一份文档大纲。让我先问您一些问题。
[使用ask_human工具]
AI会在Discord中发布问题,并提及指定用户。当用户在Discord中回复时,回复内容会被返回给AI助手。
ask_human工具