Spraay Solana Gateway — Batch Payments For Ai Agents On Solana

Created By
plagtech3 months ago
Batch send SOL or any SPL token to 1000+ Solana wallets in one API call. x402 payment protocol — $0.01 per request, no API keys, no accounts. Built for AI agents. MCP endpoint: https://gateway-solana.spraay.app/mcp
Overview

💧 Spraay Solana Gateway

x402-powered batch payment infrastructure for AI agents on Solana.

Any AI agent can batch send SOL, USDC, BONK, or any SPL token to 1,000+ wallets via the x402 payment protocol. No API keys. No accounts. Pay per request.

🏗️ Architecture

AI Agent (any framework)
    ├── HTTP Request
┌──────────────────────────────────────────┐
│   Spraay Solana Gateway                  │
│   gateway-solana.spraay.app              │
│                                          │
│   @x402/express + @x402/svm             │
│   ┌─────────────┐  ┌──────────────┐     │
│   │ x402 Payment│  │ Solana Batch │     │
│   │ Middleware   │  │ Engine       │     │
│   └──────┬──────┘  └──────┬───────┘     │
│          │                │              │
│          ▼                ▼              │
│   USDC payment     Execute batch        │
│   verified via     SOL/SPL transfers    │
│   facilitator                           │
└──────────────────────────────────────────┘
Solana Network

📡 Endpoints

EndpointMethodPriceDescription
/solana/batch-send-solPOST$0.01Batch send SOL to multiple wallets
/solana/batch-send-tokenPOST$0.01Batch send any SPL token
/solana/quoteGET$0.001Get cost estimate
/solana/status/:txidGET$0.001Check transaction status
/healthGETFreeHealth check
/.well-known/x402GETFreex402 discovery manifest

🚀 Quick Start

1. Clone & Install

git clone https://github.com/plagtech/spraay-solana-gateway.git
cd spraay-solana-gateway
npm install

2. Configure

cp .env.example .env
# Edit .env with your treasury wallet and private key

3. Run

npm run dev    # development (auto-reload)
npm start      # production

📖 API Usage

Batch Send SOL

curl -X POST https://gateway-solana.spraay.app/solana/batch-send-sol \
  -H "Content-Type: application/json" \
  -H "X-PAYMENT: <base64 payment proof>" \
  -d '{
    "recipients": [
      { "address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM", "amount": 0.01 },
      { "address": "7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyLWP9SfKFJ", "amount": 0.02 }
    ]
  }'

Batch Send SPL Token

curl -X POST https://gateway-solana.spraay.app/solana/batch-send-token \
  -H "Content-Type: application/json" \
  -H "X-PAYMENT: <base64 payment proof>" \
  -d '{
    "mint": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
    "recipients": [
      { "address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM", "amount": 1000 },
      { "address": "7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyLWP9SfKFJ", "amount": 500 }
    ]
  }'

Get Quote

curl "https://gateway-solana.spraay.app/solana/quote?recipients=100&token=BONK"

🔐 x402 Payment Flow

  1. Agent sends request without payment header
  2. Gateway returns 402 Payment Required with Solana USDC payment instructions
  3. Agent sends USDC on Solana to the treasury address
  4. Agent retries request with payment proof in X-PAYMENT header
  5. Gateway verifies payment via facilitator, executes batch transfer

Supported facilitators:

  • Devnet: https://x402.org/facilitator
  • Mainnet: https://facilitator.payai.network (PayAI — free tx fees)

🤖 MCP Server

The gateway includes an MCP server for AI agent framework integration:

# Install MCP SDK
npm install @modelcontextprotocol/sdk

# Run MCP server
node mcp/spraay-solana-mcp.js

Tools available:

  • spraay_solana_batch_send_sol — Batch send SOL
  • spraay_solana_batch_send_token — Batch send SPL tokens
  • spraay_solana_quote — Cost estimation
  • spraay_solana_tx_status — Transaction lookup

🌐 Deployment

Railway

  1. Create new service in Railway project
  2. Connect GitHub repo: plagtech/spraay-solana-gateway
  3. Set environment variables in Railway dashboard
  4. Deploy → configure custom domain

DNS (GoDaddy)

Type: CNAME
Name: gateway-solana
Value: <railway-app-url>.railway.app
TTL: 600

🔗 Spraay Ecosystem

ServiceURL
Spraay Appspraay.app
Base Gatewaygateway.spraay.app
Solana Gatewaygateway-solana.spraay.app
GitHubgithub.com/plagtech
Twitter@Spraay_app

📄 License

MIT

Server Config

{
  "mcpServers": {
    "spraay-solana": {
      "url": "https://gateway-solana.spraay.app/mcp"
    }
  }
}
Project Info
Created At
3 months ago
Updated At
3 months ago
Author Name
plagtech
Star
-
Language
-
License
-
Category

Recommend Servers

View All
Thousand Api

2 hours ago
Hellogrowthcrm

18 hours ago
GovQL
@Alex Stout

# govql-mcp-server An MCP (Model Context Protocol) server for [GovQL](https://govql.us) — gives AI clients like Claude Desktop, Claude Code, and Cursor direct access to the US Congressional GraphQL API at [api.govql.us/graphql](https://api.govql.us/graphql) without bespoke HTTP wiring. For the design rationale (why FastMCP-Python, the passthrough+curated philosophy, roadmap through v0.4), see [design.md](https://github.com/govql/govql/blob/main/mcp-server/docs/design.md). ## What you can do with it Ask an agent questions like: - *"How did Vermont's two senators vote on the most recent nomination?"* - *"Which legislators in the 118th Congress switched parties during their service?"* - *"Compare Senator Sanders' voting record to Senator Murkowski's on cloture votes in the most recent Congress."* The agent picks the right tool, writes the GraphQL query against the live schema, and parses the response — no manual API wrangling. ## Install The server runs as a per-client subprocess over stdio. Pick your client: ### Claude Desktop Edit `claude_desktop_config.json` (Settings → Developer → Edit Config): ```json { "mcpServers": { "govql": { "command": "uvx", "args": ["govql-mcp-server"] } } } ``` Restart Claude Desktop. The `govql` tools appear in the tools panel. ### Claude Code Add to `.mcp.json` in your project (or `~/.mcp.json` for global): ```json { "mcpServers": { "govql": { "command": "uvx", "args": ["govql-mcp-server"] } } } ``` ### Cursor Settings → MCP → Add Server. Use the same `command` / `args` as above. ### Other clients Any MCP-compatible client that supports stdio servers will work. The command is `uvx govql-mcp-server` with no required arguments. ## Tools | Tool | Purpose | |---|---| | `execute_graphql` | Run any GraphQL query against the GovQL endpoint. Returns the result plus an `last_ingest` timestamp so the agent can reason about data freshness. | | `list_types` | Returns the names and kinds of every type in the GovQL schema. Optional `kind` filter (`"OBJECT"`, `"INPUT_OBJECT"`, `"ENUM"`, etc.) to narrow further. Start here when you don't know what's queryable. | | `describe_type` | Returns one type's full details — fields, arg signatures, input fields, enum values. Call after `list_types` to learn the shape of a specific type before writing a query. | ## Configuration All env vars are optional — the package is zero-config for end users. | Env var | Default | Purpose | |---|---|---| | `GOVQL_ENDPOINT` | `https://api.govql.us/graphql` | Endpoint to query. Override to point at a local dev stack. | | `GOVQL_TIMEOUT_MS` | `30000` | Per-request HTTP timeout. | | `LOG_LEVEL` | `INFO` | Logging level. Logs go to stderr only (stdout is reserved for the MCP transport). | ## Limits (enforced by the upstream API) - Max query depth: 10 - Max query complexity: ~10 billion points (`first: N` multiplies child cost by N — keep page sizes reasonable on deeply nested queries) - Rate limit: 100 requests / 60 s per source IP A depth or complexity violation surfaces as a GraphQL `errors` entry in the tool response so the agent can adjust and retry. ## Data freshness Every `execute_graphql` response includes a `last_ingest` ISO timestamp. Vote data refreshes hourly; legislator data refreshes daily. ## Status Version 0.1.0 ships three foundational tools: a GraphQL passthrough (`execute_graphql`) and two narrow schema-discovery tools (`list_types`, `describe_type`). Curated higher-level tools (`find_legislator`, `get_voting_record`, `compare_voters`, etc.) are planned for subsequent releases — see [design.md](https://github.com/govql/govql/blob/main/mcp-server/docs/design.md) for the roadmap. ## Links - [GovQL project site](https://govql.us) - [GraphQL API](https://api.govql.us/graphql) - [Source / issues](https://github.com/govql/govql)

a day ago