# LightRail > Non-custodial cross-chain swap, bridge and stake routing. LightRail queries > every applicable liquidity source in parallel, ranks them by output, and > returns an unsigned transaction for your own key to sign. It never holds > funds and never signs. Agents are first-class here: there is a dedicated API with its own credentials, scopes and spending limits, rather than a browser-only app you have to scrape. ## Machine-readable API - [OpenAPI 3.1 specification](/openapi.json): every endpoint, schema and error - MCP server: `/api/agent/mcp` — Streamable HTTP transport, protocol revisions 2025-06-18 and 2025-03-26 ## Connecting an MCP client Point any MCP client at `https:///api/agent/mcp` with an agent key as a bearer token, and LightRail's capabilities appear as tools — `lightrail_list_chains`, `lightrail_list_tokens`, `lightrail_get_quotes`, `lightrail_build_transaction`, `lightrail_get_transfer_status`, `lightrail_get_portfolio`, and the memecoin tools `lightrail_meme_feed`, `lightrail_meme_risk`, `lightrail_meme_plan`. No integration code required. ```json { "mcpServers": { "lightrail": { "type": "http", "url": "https:///api/agent/mcp", "headers": { "Authorization": "Bearer lr_agent_…" } } } } ``` The server is stateless (no session id), answers `application/json` rather than SSE, and does not support JSON-RPC batching. `initialize`, `ping` and `tools/list` need no credentials so a client can connect and show what is available; `tools/call` requires a key with the matching scope. ## Getting access Agent keys are minted by a wallet signature at `POST /api/agent/keys` — the owning wallet signs a short message, and the raw key is returned once. Each key carries its own scopes (`quote`, `build`, `portfolio`), an optional wallet allowlist, a request rate, optional per-transaction and 24h USD ceilings, and an optional sell-check policy that refuses any build buying a token which fails the pre-buy sell simulation (or could not be checked). Keys are revocable at any time by the wallet that minted them. Authenticate with `Authorization: Bearer lr_agent_…`. ## Typical flow 1. `POST /api/agent/v1/quotes` with the pair and a smallest-unit `fromAmount`. Every applicable source answers; results are ranked, best output first. 2. Pick a quote. Keep its `source` and `execution.build` exactly as returned. 3. `POST /api/agent/v1/build` with those, plus the address that will sign. 4. If `approval.required` is true, send `approval.transaction` first. If it is `null`, the allowance could not be read — check it yourself rather than assuming none is needed. 5. Send `transaction`. For cross-chain routes, poll `GET /api/agent/v1/status`. ## Things worth knowing - Amounts are always smallest-unit integer **strings**, never decimals. - Use the zero address for a chain's native coin. - Resolve token addresses from `GET /api/agent/v1/tokens`, not from memory. A wrong address routes funds to the wrong contract. - `sourcesEmpty` means those sources had no route for the pair — that is a normal answer, not a failure. `sourcesFailed` is what is worth retrying. - `toAmountUSD` is null on sources that do not price their output (the direct PulseChain bridge and LibertySwap legs). Pass it to `/build` as `notionalUsd` when present so your key's ceilings can be enforced. - Approvals are encoded for the exact amount. LightRail will not ask you to grant an unbounded allowance. - `GET /api/agent/v1/status` only indexes Rubic-routed transfers. Direct PulseChain bridge and LibertySwap transfers report `indexed: false` and settle automatically on the destination chain — check the destination balance rather than polling forever. ## Coverage Sources queried: Rubic (which itself fans out across ~40 providers and 100+ chains), ParaSwap, KyberSwap, OpenOcean, a direct PulseChain multi-DEX aggregator, the official PulseChain OmniBridge, LibertySwap, and native staking contracts (Lido, Frax) for stake routes that aggregators price as swaps. LibertySwap is the only source that bridges PulseChain to Base, BSC, Polygon and Arbitrum rather than only Ethereum. ## Memecoins Robinhood Chain (chain id 4663), Solana and Base, with pons, pump.fun and LetsBonk (Raydium LaunchLab) launches covered. 1. `GET /api/agent/v1/meme/feed?chain=all&list=new|graduating|trending` to find launches. `graduation` is 0..1 progress along a bonding curve. 2. `POST /api/agent/v1/meme/risk` with `{ chainId, address }` before buying. `level` is `ok`, `caution` or `danger`; every check carries its `source`. Checks with status `unknown` (listed in `unchecked`) could not be determined — never read them as safe. 3. `POST /api/agent/v1/meme/plan` to buy from whatever you hold. - `mode: "direct"`: one transaction. Build any of `quotes` with `/build`. - `mode: "two-step"`: build `legs[0]` (a bridge into the launch's pair asset), poll `/status` until `DONE`, then quote the buy again with the amount that actually arrived and build that. `legs[1]` is an estimate priced from the bridge's minimum output. - Solana buys come back as a Jupiter quote for your own Solana signer. - `policy.refusal` is set when your key's sell-check policy would block the buy, so you never bridge toward a purchase your key will refuse. pons tokens still on their bonding curve are quoted and built directly against the curve (source `pons`). A build is refused during a launch's opening 5-second snipe-tax window — retry a few seconds later.