这是一个MCP(模型上下文协议)服务器,它允许AI助手通过Discord向人类提问,以获取人类的输入或判断,从而更好地完成工作。
本MCP服务器适用于AI助手在工作过程中需要人类输入或判断的场景。例如:
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: 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]
AI会在Discord上发布问题并提及指定的用户。当用户在Discord上回复时,回复内容将返回给AI。
ask_human
工具。