Building on THRYX: API & Agent Integration
6 min read
THRYX exposes four integration surfaces: a REST API for any HTTP client, an MCP server for AI agents (Claude, GPT), a CLI for terminal automation, and webhooks for event-driven architectures. Here's how each one works.
REST API
All endpoints are served from /api on the same domain. Authentication uses JWT tokens returned from /api/auth/signup or /api/auth/login. Pass the token in the Authorization: Bearer header for authenticated endpoints.
Base URL: https://thryx-launchpad.onrender.com/api
Core Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /api/auth/signup | Create account, get JWT + wallet |
| POST | /api/auth/login | Log in, get JWT |
| GET | /api/tokens | List all tokens with curve data |
| GET | /api/token/:address | Single token details |
| POST | /api/launch | Launch a new token (gasless) |
| POST | /api/tokens/:address/buy | Buy tokens with ETH |
| POST | /api/tokens/:address/sell | Sell tokens for ETH |
| POST | /api/tokens/:address/estimate | Estimate trade output |
| GET | /api/tokens/:address/history | Price history (up to 200 trades) |
| GET | /api/stats | Protocol metrics (cached, zero RPC) |
| GET | /api/gasless/status | Gas funder balance and grant capacity |
Real-Time Streams
Two SSE (Server-Sent Events) streams are available. /api/tokens/:address/stream fires on every trade for a specific token — useful for live price charts. /api/notifications/stream (authenticated via JWT query param) notifies token creators whenever their tokens are traded.
// Subscribe to live trades on a token
const es = new EventSource('/api/tokens/0x.../stream');
es.onmessage = (e) => {
const trade = JSON.parse(e.data);
console.log(trade.action, trade.price, trade.txHash);
};
MCP Server (8 Tools)
The @thryx/mcp-server npm package exposes 8 tools that any MCP-compatible AI agent can call. Key tools: thryx_launch (deploy token), thryx_buy/thryx_sell (trade), thryx_info (curve data), thryx_balance (wallet balances), thryx_stats_v2 (protocol metrics), and thryx_paymaster_stats (gas sponsorship status).
Read-only tools (thryx_about, thryx_info, thryx_balance, thryx_stats_v2, thryx_paymaster_stats) work without any credentials. Add the MCP server to your Claude or Cursor config:
{
"mcpServers": {
"thryx": {
"url": "https://thryx-relay.thryx.workers.dev/mcp"
}
}
}
CLI
The @thryx/cli package provides terminal commands for all protocol operations. Every command supports --json for machine-readable output, making it trivial to pipe into jq or other tools.
# Launch a token (gasless)
thryx launch "My Token" MYTKN --gasless
# Buy tokens with ETH
thryx buy 0xTokenAddress 0.01 --with eth
# Get token info as JSON
thryx info 0xTokenAddress --json | jq '.progressPct'
Webhooks
Register webhooks to receive HTTP POST callbacks when tokens are traded or launched. The webhook payload includes the transaction hash, amounts, and action type. Webhooks auto-disable after 10 consecutive delivery failures.
POST /api/webhooks
{
"url": "https://your-server.com/webhook",
"tokenAddress": "0x...",
"events": "buy,sell,launch",
"secret": "optional-hmac-key"
}
On-Chain Discovery
The Diamond contract at 0x2F77b40c124645d25782CfBdfB1f54C1d76f2cCe supports on-chain discovery. Call agentQuickstart() for a single-call summary of all protocol parameters. contractURI() returns ERC-7572 metadata. eip712Domain() returns the EIP-5267 domain for signing gasless launch messages. No docs needed — the contract tells agents everything.