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.fun/api

Core Endpoints

MethodPathDescription
POST/api/auth/signupCreate account, get JWT + wallet
POST/api/auth/loginLog in, get JWT
GET/api/tokensList all tokens with curve data
GET/api/token/:addressSingle token details
POST/api/launchLaunch a new token (gasless)
POST/api/tokens/:address/buyBuy tokens with ETH
POST/api/tokens/:address/sellSell tokens for ETH
POST/api/tokens/:address/estimateEstimate trade output
GET/api/tokens/:address/historyPrice history (up to 200 trades)
GET/api/statsProtocol metrics (cached, zero RPC)
GET/api/gasless/statusGas 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 (21 Tools, v1.5.0)

The hosted THRYX MCP server exposes 21 tools that any MCP-compatible AI agent can call. Install with `npx -y @thryx/mcp-server` — auto-registers a fresh wallet on first run. Key tools: thryx_launch (deploy token, gasless, V4-native by default), thryx_buy/thryx_sell (trade), thryx_info (token data), thryx_balance (wallet), thryx_portfolio (full holdings with P&L), thryx_stats_v2 (platform stats), thryx_protocol_params (live fee/curve params), thryx_paymaster_stats (gas sponsorship state), thryx_search/thryx_trending/thryx_graduating (discovery), thryx_safety_score + thryx_rug_check (risk assessment).

Read tools (thryx_about, thryx_info, thryx_safety_score, thryx_rug_check, thryx_recent_tokens, thryx_search, thryx_trending, thryx_graduating, thryx_leaderboard, thryx_token_of_day, thryx_paymaster_stats, thryx_stats_v2, thryx_protocol_params) work without any setup. Write tools (thryx_launch, thryx_buy, thryx_sell, thryx_claim, thryx_set_referrer, thryx_claim_referral) use a server-managed wallet — no private keys, no signing. Add the MCP server to your Claude or Cursor config:

{
  "mcpServers": {
    "thryx": {
      "url": "https://thryx-relay.thryx.workers.dev/mcp"
    }
  }
}

Option 2: REST API

The REST API works with any HTTP client. Sign up with email/password, get a JWT, and call endpoints for launching, trading, and querying tokens. Public endpoints like /api/portfolio/:address, /api/trades/:address, and /api/launches/:address work without auth.

# Sign up
curl -X POST https://thryx.fun/api/auth/signup \
  -H "Content-Type: application/json" \
  -d '{"email":"agent@example.com","password":"..."}'

# Launch a token
curl -X POST https://thryx.fun/api/launch \
  -H "Authorization: Bearer JWT" \
  -d '{"name":"My Token","symbol":"MYTKN"}'

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.

Related Posts

Create Your Token