Hashlock Markets exposes six MCP tools for cross-chain atomic swaps
Baris Sozen walks through how MCP-capable AI agents can execute full cross-chain atomic swaps on Hashlock Markets using just six tools across Ethereum, Bitcoin, and SUI — with no bridge, custody, or slippage.
Score breakdown
Developers building AI trading or DeFi agents can wire any MCP-compatible model into Hashlock Markets' six-tool surface to execute trustless, atomic cross-chain swaps without writing chain-specific settlement logic.
- 01Hashlock Markets MCP server exposes exactly six tools: `create_rfq`, `respond_rfq`, `create_htlc`, `get_htlc`, `withdraw_htlc`, and `refund_htlc`.
- 02The swap mechanism is a sealed-bid RFQ combined with hash time-locked contracts (HTLCs), requiring no bridge, custody, or public orderbook.
- 03SHA-256 is used as the hash function across all three supported chains for cross-chain compatibility.
Baris Sozen's post on Dev.to provides a practical walkthrough of the Hashlock Markets MCP server, which exposes six tools over the Model Context Protocol to enable AI agents to execute cross-chain atomic swaps autonomously. The six tools divide cleanly into two phases: the quote phase uses `create_rfq` (taker posts a sealed-bid Request for Quote) and `respond_rfq` (makers privately quote against it, with no information leakage to competing makers or the public orderbook); the settlement phase uses `create_htlc` (locks funds on-chain against a SHA-256 hash commitment with a timelock), `get_htlc` (queries live trade status including lock transactions, contract addresses, amounts, and timelock expiries), `withdraw_htlc` (claims funds by revealing the 32-byte preimage, making the swap atomic), and `refund_htlc` (returns funds to the sender after the timelock if the counterparty never mirrors).
If either side fails, `refund_htlc` returns funds after the deadline — no trusted recovery operator required.
The post traces the full agent execution sequence for a swap like "sell 2 ETH for BTC at market": the agent calls `create_rfq`, receives private quotes via `respond_rfq`, locks funds with `create_htlc` using a taker-known preimage P and a deliberately longer timelock (to prevent race attacks), monitors the maker's mirror via `get_htlc`, then calls `withdraw_htlc` to reveal P and atomically settle both legs. If either side fails, `refund_htlc` returns funds after the deadline — no trusted recovery operator required.
The protocol currently supports three chains — Ethereum (EVM HTLC contract), Bitcoin (native Script/Tapscript HTLC), and SUI (Move-based HTLC object) — with Solana and Arbitrum on the roadmap. SHA-256 is used across all three for compatibility, and chain-specific details like fee estimation, script templates, and confirmation thresholds are handled server-side. Agents built against the `v0.1.7` surface will automatically gain access to new chains as they are added. Two transport options are available: a remote streamable-HTTP endpoint at `https://hashlock.markets/mcp` (best for hosted agents) and a local stdio transport via the `hashlock-tech/mcp` npm package (best for local development).
Key facts
- 01Hashlock Markets MCP server exposes exactly six tools: `create_rfq`, `respond_rfq`, `create_htlc`, `get_htlc`, `withdraw_htlc`, and `refund_htlc`.
- 02The swap mechanism is a sealed-bid RFQ combined with hash time-locked contracts (HTLCs), requiring no bridge, custody, or public orderbook.
- 03SHA-256 is used as the hash function across all three supported chains for cross-chain compatibility.