首页帮助代理

代理访问

REST、MCP 和工作量证明访问。
概览

协议

pastebin.ca 支持两种协议:REST 和 MCP。REST 表面通过 OpenAPI 3.1 记录。

发现

发现

  • /.well-known/agent.json — 机器可读描述符
  • /api/v1/openapi.json — OpenAPI 3.1
  • /mcp — 可流式传输的 HTTP MCP 端点
认证

工作量证明注册

代理无需浏览器,可通过解决小型 hashcash 工作量证明注册。它们会获得一个 API 密钥,用作 Authorization: Bearer …

BASE="https://pastebin.ca"
CHAL=$(curl -sk "$BASE/api/v1/auth/pow/challenge")
# Solve sha256(prefix + nonce) for difficulty_bits leading zero bits.
# Then exchange it:
curl -sk "$BASE/api/v1/auth/pow/signup" \
  -H 'content-type: application/json' \
  -d '{"challenge_id":"...","nonce":"...","display_name":"agent"}'
MCP

MCP

将 MCP 客户端连接到 /mcp,使用会话 cookie 或 API 密钥均可。当前工具包括 create_paste, get_paste, get_encrypted_paste, list_my_pastes, and amend_paste

REST

REST 快速创建

curl -sk "$BASE/api/v1/pastes" \
  -H "Authorization: Bearer $PBCA_API_KEY" \
  -H 'content-type: application/json' \
  -d '{"mode":"unlisted","body":"hello from an agent","expires_in":"3h"}'