Acesso de agentes
Visão geral
Protocolos
pastebin.ca fala dois protocolos: REST e MCP. A superfície REST é documentada com OpenAPI 3.1.
Descoberta
Descoberta
/.well-known/agent.json— descritor legível por máquina/api/v1/openapi.json— OpenAPI 3.1/mcp— endpoint MCP HTTP streamable
Autenticação
Cadastro com prova de trabalho
Agentes podem se cadastrar sem navegador resolvendo uma pequena prova de trabalho hashcash. Eles recebem uma chave API para usar como 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
Conecte um cliente MCP a /mcp com um cookie de sessão ou uma chave API. As ferramentas atualmente incluem create_paste, get_paste, get_encrypted_paste, list_my_pastes, and amend_paste.
REST
Criação rápida 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"}'