人工验证服务

一个通过闪电网络支付,为AI代理提供人工验证服务的MCP协议服务器。

  • by AskAHumanOnline
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 AskAHumanOnline/askahuman-mcp-server

使用说明

阿斯卡胡曼·麦克普

MCP(模型上下文协议)服务器,允许AI代理访问人类验证。问一个人一个问题,通过闪电网络支付,并得到一个经过验证的答案——所有这些都是通过标准的MCP工具完成的。

任何与MCP兼容的AI代理(Claude、Gemini、Codex等)都可以使用此服务器请求人类对需要现实世界理解、常识或主观评估的任务进行判断。

平台即将上线 --AskAHuman市场正在路上。跟随 @askahallegedly在线 以获取更新。

先决条件

  • Node.js>=18
  • LND节点 启用REST API并提供资金支持的渠道(用于闪电支付)

安装

直接运行(无需安装):

npx askahuman-mcp

或全局安装:

npm install -g askahuman-mcp

配置

所有配置都是通过环境变量进行的:

变量 必填 描述
ASKAHUMAN_API_URL 是 AskAHuman API的基本URL(例如。 https://api.askahuman.online)
LND_REST_URL 是 LND节点的REST API的URL(例如。 https://localhost:8080)
LND_MACAROON_HEX 是 用于支付授权的十六进制编码LND管理马卡龙
LND_TLS_CERT_PATH 否 LND的TLS证书文件路径(自签名证书需要)
LOG_LEVEL 否 日志详细程度: debug, info, warn, error (默认值: info)

复制 .env.example 到 .env 并填写您的值:

cp .env.example .env

工具

服务器向AI代理公开了五个工具:

工具 描述 关键输入
ask_human 提交问题并通过Lightning付款。立即返回 verificationId (状态 PENDING)--投票 check_verification 为了得到答案 question, taskType, context?, choices?, images?, urgent?, callbackUrl?, maxBudgetSats?, maxWaitMinutes?
check_verification 轮询验证状态;回报 terminal + nextStep 这样代理人就知道什么时候该停下来 verificationId
cancel_verification 检查退款资格(建议,无州变更) verificationId
request_refund 为过期的无人认领任务申请退款 verificationId
get_pricing 查询当前服务器端定价 taskType?

任务类型

  • BINARY_DECISION --是/否问题
  • MULTIPLE_CHOICE --从提供的选项中选择(供应 choices[])
  • TEXT_RESPONSE --自由形式的文本回答
  • MEDIA_VERIFICATION --验证一个或多个图像并获得自由格式的文本答案(提供 images[] 作为公众 超文本传输安全协议 URL,最多8个; choices[] 不允许用于此类型)

快速开始

克劳德桌面

添加到您的Claude Desktop MCP配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):

{
  "mcpServers": {
    "askahuman": {
      "command": "npx",
      "args": ["askahuman-mcp"],
      "env": {
        "ASKAHUMAN_API_URL": "https://api.askahuman.online",
        "LND_REST_URL": "https://localhost:8080",
        "LND_MACAROON_HEX": "<your-macaroon-hex>",
        "LND_TLS_CERT_PATH": "/path/to/tls.cert"
      }
    }
  }
}

重新启动克劳德桌面。这 ask_human 工具将在您的对话中可用。

示例用法

ask_human 是 无阻塞:它为任务定价,支付Lightning发票,提交请求,并立即返回 verificationId 和 status: "PENDING"。然后,代理人进行民意调查 check_verification 直到人类做出反应。(MCP请求超时时间远短于人类的响应时间,因此该工具永远不会阻止等待答案。)

文本/决策任务 --则提示代理:

“询问某人此电子邮件是否看起来像网络钓鱼:[电子邮件内容]”

  1. ask_human 立即返回:
    { "status": "PENDING", "verificationId": "vid-123", "amountPaidSats": 50 }
    
  2. 代理人进行民意调查 check_verification({ "verificationId": "vid-123" }) 每30-60秒:
    • 虽然 terminal: false (nextStep: "keep_polling") → 继续投票。
    • 当 terminal: true 与状态 COMPLETED → 人类的答案在 result 现场。

图像任务(MEDIA_VERIFICATION) --验证图像并获得自由格式的答案:

ask_human({
  "taskType": "MEDIA_VERIFICATION",
  "question": "Do both photos show the same person?",
  "images": [
    "https://example.com/a.jpg",
    "https://example.com/b.jpg"
  ],
  "maxWaitMinutes": 240
})
// → { "status": "PENDING", "verificationId": "vid-456", "amountPaidSats": 80 }

图像URL必须是公开的 超文本传输安全协议 链接(最多8个)。然后投票 check_verification 正如上文所述。

单项选择 --供应 choices[]:

ask_human({
  "taskType": "MULTIPLE_CHOICE",
  "question": "Which category best fits this support ticket?",
  "choices": ["Billing", "Bug report", "Feature request", "Spam"]
})

如果任务在队列中到期而未被认领, check_verification 回报 nextStep: "call_request_refund" --呼叫 request_refund({ "verificationId": "..." }) 夺回卫星。

发展

# Clone the repository
git clone https://github.com/AskAHumanOnline/askahuman-mcp-server.git
cd askahuman-mcp-server

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run with coverage
npx jest --config jest.config.cjs --coverage

# Lint
npm run lint

# Start the server (stdio transport)
npm start

# Interactive tool testing with MCP Inspector
npx @modelcontextprotocol/inspector dist/index.js

运行测试

单元测试模拟所有外部I/O(HTTP调用,LND)。不需要正在运行的服务。

npm test

集成测试(in tests/integration/)默认情况下跳过。它们要求:

  • 一个正在运行的AskAHuman后端
  • 拥有资金渠道的极地闪电网络

运作原理

服务器实现L402支付协议:

  1. 提交 --代理向AskAHuman API发送验证请求
  2. 支付 --API返回带有Lightning发票的402;MCP服务器通过代理的LND节点支付费用
  3. 验证 --付款前图像证明付款;服务器使用L402凭据重试
  4. 返回 --请求排队等待人工验证器 ask_human 立即返回a verificationId (状态 PENDING)
  5. 投票 --代理人打电话来 check_verification 每30-60秒一次,直到它回来 terminal: true;地位 COMPLETED 携带人类的答案 result

如果任务到期而未被认领, check_verification 信号 nextStep: "call_request_refund" 代理人可以打电话 request_refund 夺回卫星。

许可证

麻省理工学院