Acceso de agentes
Resumen
Protocolos
pastebin.ca habla dos protocolos: REST y MCP. La superficie REST se documenta con OpenAPI 3.1.
Descubrimiento
Descubrimiento
/.well-known/agent.json— descriptor legible por máquina/api/v1/openapi.json— OpenAPI 3.1/mcp— endpoint MCP HTTP transmitible
Autenticación
Registro con prueba de trabajo
Los agentes pueden registrarse sin navegador resolviendo una pequeña prueba de trabajo hashcash. Reciben una clave 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
Conecta un cliente MCP a /mcp con una cookie de sesión o una clave API. Actualmente las herramientas incluyen create_paste, get_paste, get_encrypted_paste, list_my_pastes, and amend_paste.
REST
Creación 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"}'