npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

snowrail-mcp

v1.0.0

Published

MCP server para SnowRail (treasury orchestrator en Avalanche)

Readme

SnowRail MCP Server

Servidor MCP que expone los endpoints de SnowRail (tesorería y orquestador de pagos en Avalanche) como herramientas utilizables por agentes compatibles con el Model Context Protocol.

Requisitos

  • Node.js >= 20
  • pnpm (recomendado para manejar las dependencias declaradas en pnpm-lock.yaml)

Instalación y uso

pnpm install         # instala dependencias
pnpm dev             # ejecuta el servidor MCP en modo desarrollo usando tsx
pnpm build           # compila a JavaScript (salida en dist/)
pnpm start           # corre la versión compilada

El servidor habla por STDIO (patrón recomendado para MCP) y se inicializa desde src/snowrail-mcp.ts.

Variables de entorno

| Variable | Por defecto | Descripción | |----------------------|-------------|-------------| | SNOWRAIL_MCP_MODE | core | Determina qué herramientas se registran. Valores válidos: core, advanced, internal. | | SNOWRAIL_ENV | staging | Selecciona qué base URL usar (development, staging, production). | | SNOWRAIL_API_BASE | – | URL absoluta para sobrescribir la base calculada con SNOWRAIL_ENV. |

La resolución final de la URL se maneja desde resolveBaseUrl y snowrailFetch, permitiendo override por tool mediante los parámetros environment o baseUrl.

Modos y herramientas disponibles

Todas las herramientas retornan el resultado como contenido textual MCP (text/json). Los parámetros se validan con Zod antes de llamar al backend.

Modo core

| Tool | Endpoint | Notas | |------|----------|-------| | snowrail_health | GET /health | Diagnóstico básico del backend. | | snowrail_agent_identity | GET /api/agent/identity | Identidad del agente registrado. | | snowrail_agent_stats | GET /api/agent/stats | Estadísticas del agente. | | snowrail_agent_activity | GET /api/agent/activity | Historial de actividad. | | snowrail_treasury_balance | GET /api/treasury/balance | Balance general de la tesorería. | | snowrail_payroll_execute | POST /api/payroll/execute | Demo payroll protegido con header X-PAYMENT. | | snowrail_payroll_get_by_id | GET /api/payroll/:id | Obtiene un payroll específico. | | snowrail_payment_process | POST /api/payment/process | Flujo completo de pago a destinatario final (requiere X-PAYMENT). | | snowrail_treasury_test | POST /api/treasury/test | Prueba controlada de tesorería (X-PAYMENT). | | snowrail_facilitator_health | GET /facilitator/health | Salud del facilitador x402. | | snowrail_process_a2a | POST /process | Mensajes Agent-to-Agent firmados (X-PAYMENT). |

Modo advanced

Disponible cuando SNOWRAIL_MCP_MODE es advanced o internal.

| Tool | Endpoint | Notas | |------|----------|-------| | snowrail_facilitator_validate | POST /facilitator/validate | Valida tokens x402. | | snowrail_facilitator_verify | POST /facilitator/verify | Verifica firmas EIP-3009. | | snowrail_facilitator_settle | POST /facilitator/settle | Liquidación de pagos con paymentProof. |

Modo internal

Disponible sólo cuando SNOWRAIL_MCP_MODE=internal. Suma herramientas sensibles y endpoints privados.

| Tool | Endpoint | Notas | |------|----------|-------| | snowrail_x402_callback | POST /internal/x402/callback | Simula callbacks del procesador x402. | | snowrail_auth_signup | POST /auth/signup | Alta de cuentas para dashboard. | | snowrail_auth_login | POST /auth/login | Login para obtener JWT. | | snowrail_auth_me | GET /auth/me | Perfil autenticado vía Authorization: Bearer. | | snowrail_dashboard | GET /api/dashboard | Panel interno protegido con JWT. |

Arquitectura

  • src/snowrail-mcp.ts: punto único de configuración.
  • McpServer de @modelcontextprotocol/sdk registra herramientas con validaciones zod.
  • snowrailFetch centraliza cabeceras, serialización y parsing de respuestas, devolviendo { url, status, data } para que los clientes MCP vean el detalle completo.

Puntos de integración

  • Headers sensibles (X-PAYMENT, Authorization, X-Callback-Secret) se reciben como parámetros de las tools para mantener el servidor agnóstico al secreto real.
  • El helper toToolResult normaliza la salida para que agentes MCP puedan mostrar los JSON crudos que vienen de SnowRail.

Próximos pasos sugeridos

  • Añadir pruebas automatizadas para snowrailFetch.
  • Documentar ejemplos reales de payloads messagePayload y tokens xPayment.