LayerHop for developers · MCP server for agents
An MCP server for cross-chain swaps and AI agents
LayerHop runs a Model Context Protocol server at https://mcp.layerhop.com/mcp that lets an AI agent list chains and tokens, get ranked quotes with every fee, and hand the user a prefilled swap link. It holds no private keys and never signs or broadcasts: the user's own wallet signs every swap. You can use the hosted server with nothing to install, or run it locally with @layerhop/mcp.
# Claude Code, hosted server
claude mcp add --transport http layerhop https://mcp.layerhop.com/mcp
# Claude Code, local stdio server
claude mcp add layerhop -e LAYERHOP_API_KEY=lh_live_xxx -- npx -y @layerhop/mcpHow to connect an agent
- 1
Add the server to your client
Use the hosted URL https://mcp.layerhop.com/mcp in any remote-capable MCP client (Claude, ChatGPT connectors, Cursor), or run npx -y @layerhop/mcp for a local stdio server.
- 2
Optionally add your API key and partner id
Without a key the server works under the per-IP rate limit. With a key you get its rate limit and your orders show up in the dashboard. A partner id adds your partner fee to quotes and swap links.
- 3
Ask for a quote
The agent calls get_quote with human amounts ("100" means 100 USDC). The answer has the best quote and alternatives with fees, minimum received and estimated time.
- 4
Hand over a swap link
get_swap_link returns a layerhop.com/swap link prefilled with the route. The user reviews the live quote and signs in their own wallet: the safest way to execute.
- 5
Only if the agent has a user-controlled signer
build_transaction returns the unsigned transaction and simulate_transaction dry-runs it first; report_submitted and get_order_status close the loop.
Code
Copy, then replace the addresses and the key.
{
"mcpServers": {
"layerhop": { "url": "https://mcp.layerhop.com/mcp" }
}
}{
"mcpServers": {
"layerhop": {
"command": "npx",
"args": ["-y", "@layerhop/mcp"],
"env": { "LAYERHOP_API_KEY": "" }
}
}
}What works today, and what doesn't
So you know before you build.
Works today
- Tools to list chains and tokens, look up a token and its risks, get quotes, build a swap link, build and simulate an unsigned transaction, report it and read order status
- Deposit address tools (an API key is required) and Solana limit order tools that return unsigned transactions
- Input checks before any API call: address format per chain family, positive amounts, explicit decimals for unlisted tokens
- The same tools as packages for the Vercel AI SDK, LangChain, OpenAI Agents SDK, ElizaOS, Coinbase AgentKit and GOAT
Good to know
- It never holds keys, signs or broadcasts, so it cannot move funds by itself
- Tron transactions are not supported by the agent tools
- A gasless quote cannot be signed through the server: the agent hands the user the swap link instead
- Never give an AI agent a seed phrase or a private key; LayerHop never asks for one
Questions
Can an agent spend my money through this?
Not by itself. The server cannot sign. The worst a malicious prompt can produce is a quote or an unsigned transaction, and only a wallet the user controls can sign it.
What fee do quotes through MCP carry?
Quotes made through the MCP server use the api fee channel (0.10%). A swap link opens the web app, which quotes on its own channel.
Do I need an API key?
Not to try it: requests without a key work under a per-IP rate limit. For production, sign in to the dashboard with a wallet and create a key (lh_live_…, sent in the x-api-key header). A key gets its own rate limit, shows your usage and logs, and lets your orders trigger webhooks. lh_test_ keys give sandbox quotes and simulated orders.
Does it work with my agent framework?
Yes if your client speaks MCP. If you build your own agent, the same tools ship as packages for the Vercel AI SDK, LangChain, OpenAI Agents SDK, ElizaOS, Coinbase AgentKit and GOAT.
How can an AI read the LayerHop docs?
The docs publish llms.txt and llms-full.txt, and any docs page is available as Markdown by adding .md to its URL.