@powforge/captcha-mcp
@powforge/captcha-mcp
当智能体重击你的 MCP 服务器时,它返回 429。captcha-mcp 让它们为下一次调用付出代价。 给智能体一个工作量证明谜题(免费,约 5 秒 CPU)或一张 3 sats 的 Lightning 发票——两者都是自主调用者无需账户、邮箱或 API 密钥即可满足的机器可读退避信号。
三个工具,支持 stdio 或 HTTP。仅使用标准库。无需注册、免费回退、可自托管、无收入分成。
为什么不是 429?
429 Too Many Requests 在智能体时代是错误的形态。MCP 服务器报告中反复出现三种模式:
智能体框架将 429 视为连接失败。 它们会立即重试,通常采用指数退避,但仍然过于激进,并放大了最初触发限制的过载。
没有按调用者区分的信号。 429 是针对整个桶(bucket)而非某个智能体触发的。一个吵闹的调用者会让所有其他调用者都被限流,服务器无法要求那个吵闹的调用者特别减速。
Retry-After 只是建议性的,经常被忽略。 智能体不会一致地解析它,也不会一致地尊重它,而且没有等待的动机——重试的成本为零。
captcha-mcp 用 402 风格的挑战(challenge)取代 429。下一次调用需要调用者付出代价(CPU 秒或 3 sats)。这种代价是按调用者计算的、机器可读的,并且会自动限流——无法解决谜题的智能体就无法淹没端点。
Related MCP server: @bitcoinbenji/mcp
快速开始
npx -y @powforge/captcha-mcp无需安装、无需配置、无需 API 密钥。服务器在 stdio 上启动,等待 MCP 客户端。
要将其接入 Claude Code、Cursor 或任何兼容 MCP 的主机,请在你的配置中添加:
{
"mcpServers": {
"powforge-captcha": {
"command": "npx",
"args": ["-y", "@powforge/captcha-mcp"]
}
}
}或者运行 npx @powforge/captcha-mcp --install 来打印配置块。
功能
将 PowForge 的 pow-captcha 服务(captcha.powforge.dev)封装为三个 MCP 工具:
工具 | 用途 |
| 请求一个新的工作量证明谜题。返回 |
| 提交已求解的 nonce。返回一个有效期为 5 分钟的 HMAC 签名访问令牌。 |
| 服务器健康状态、生命周期统计信息、L402 端点元数据。 |
免费层级需要智能体约 5-10 秒的 CPU 时间(SHA-256,默认 14 个前导零位)。付费层级通过 L402 在 Lightning 上花费 3 sats(RFC 7235 + WWW-Authenticate 中的 bolt11 发票)。
为什么选择它而不是 OAuth、API 密钥或 Stripe?
方法 | 每次调用成本 | 需要账户 | 可自托管 | 智能体友好 |
API 密钥 | $0 | 是 | n/a | 否 |
OAuth | $0 | 是 | n/a | 否 |
Stripe 计量 | 高开销 | 是 | n/a | 否 |
托管式 MCP 认证平台 | 100–2000 sats | 否 | 否 | 是 |
PoW + L402(本项目) | 数秒或 3 sats | 否 | 是 | 是 |
智能体没有电子邮件地址。它们不会点击确认链接。它们不会输入信用卡。PoW + Lightning 是唯一适用于完全自主调用者的认证原语。
托管式 MCP 认证平台是可行的,但它们会在供应商基础设施上按每次调用收取 100–2000 sats——你的收入流经他们的管道。这个包运行在你自己的服务器上,使用你自己的 Lightning 节点和密钥。sats 归你所有。
配置
设置 CAPTCHA_URL 以指向不同的验证码后端。默认值为 http://localhost:3077,因此你可以在本地运行全栈进行开发。生产环境可将其指向 https://captcha.powforge.dev。
CAPTCHA_URL=https://captcha.powforge.dev npx @powforge/captcha-mcpHTTP 流式传输
托管式 MCP 客户端(Smithery、基于浏览器的宿主)需要 HTTP,而不是 stdio。传入 --http 或设置 HTTP_MODE=1:
HTTP_MODE=1 PORT=3200 npx @powforge/captcha-mcp
# or
npx @powforge/captcha-mcp --http然后服务器监听:
端点 | 方法 | 用途 |
| POST | 单个 JSON-RPC 请求,单个 JSON-RPC 响应。通知返回 202。 |
| GET | 用于服务器推送通知的 SSE 流(通过 25 秒心跳保持打开)。 |
| GET | 存活探针——返回 |
无状态。没有会话 ID。CORS 开放(Access-Control-Allow-Origin: *),因此浏览器客户端可以工作。Stdio 模式保持不变,且仍然是默认模式——不带任何标志的 npx @powforge/captcha-mcp 仍通过 stdin/stdout 进行 JSON-RPC 通信。
对 HTTP 传输进行冒烟测试:
HTTP_MODE=1 PORT=3200 node src/server.js &
curl -X POST http://localhost:3200/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1"}}}'返回 {jsonrpc:"2.0", id:1, result:{protocolVersion:"2024-11-05", capabilities:{tools:{}}, serverInfo:{...}}}。
本地开发
克隆 captcha widget 仓库 或运行公共服务。MCP 服务器只需要 HTTP 访问 status 下列出的验证码端点。
git clone https://github.com/zekebuilds-lab/captcha-mcp
cd captcha-mcp
node src/server.js它会向 stderr 打印 ready,并在 stdin 上等待 JSON-RPC。
手动对协议进行冒烟测试:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1"}}}' | node src/server.js你应该会看到带有 serverInfo: { name: "@powforge/captcha-mcp", version: "0.2.5" } 的 JSON 响应。
从你自己的后端验证令牌
当智能体向你的服务提交令牌时,在不必信任该智能体的情况下验证它:
curl -X POST https://captcha.powforge.dev/api/token/verify \
-H "Content-Type: application/json" \
-d '{"token":"<token-from-verify-tool>"}'返回 {valid: true, method, issued_at, expires_at} 或 {valid: false, reason}。
相关包
@powforge/captcha— 同一服务的浏览器组件。@powforge/mcp-l402-gate— Express 中间件,用于使用 L402 + Depth-of-Identity 评分来门控任何 MCP 服务器。@powforge/mcp-identity— 智能体信誉预言机。与此门控配合使用,可在首次调用时提供滥用保护。
与其他 MCP 智能体认证原语的比较
门控 MCP 服务器的领域正在变得拥挤。以下是真实的格局,按每个工具与 captcha-mcp 的功能重叠程度排序。
工具 | 支付轨道 | 认证模型 | 可自托管 | 免费 PoW 层级 | 无需账户付款 |
PayGated | Stri |
Maintenance
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP server that enables AI agents to make autonomous Bitcoin Lightning Network payments using the L402 protocol. Agents can pay for API access, purchase resources, and complete transactions without human intervention — invoice comes in, sats go out, done.179MIT
- AlicenseBqualityCmaintenanceMCP server offering 26 Lightning-paid tools for Bitcoin mempool intelligence and sovereign on-prem AI inference, with no third-party APIs and pay-per-call in sats.26181MIT
- AlicenseAqualityAmaintenanceAn MCP server that enables AI agents to access paid AI inference and web tools via HTTP 402 micropayments in USDC on Base, using the agent's wallet as identity.14331MIT
- AlicenseNot gradedqualityFmaintenanceMCP server that gives AI agents Lightning payments, L402 API access, trust verification, and service discovery.12MIT
Related MCP Connectors
Monetize any MCP server: x402 paywall, pay-per-call billing in USDC on Base, agent marketplace.
MCP server connecting AI agents to non-custodial staking data across 130+ networks.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zekebuilds-lab/captcha-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server