{
  "markdown": "<p align=\"center\">\n  <img src=\"apps/frontend/apps/cowswap-frontend/public/ophis-logo-full.svg\" alt=\"Ophis\" width=\"320\"/>\n</p>\n\n<h1 align=\"center\">Ophis</h1>\n\n<p align=\"center\">\n  <b>Describe a trade in plain English. Ophis does the rest.</b><br/>\n  An intent-based DEX aggregator with a natural-language layer, built for humans and agents alike.\n</p>\n\n<p align=\"center\">\n  <a href=\"https://github.com/ophis-fi/ophis/actions/workflows/ci.yml\"><img src=\"https://github.com/ophis-fi/ophis/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"/></a>\n  <a href=\"https://github.com/ophis-fi/ophis/actions/workflows/codeql.yml\"><img src=\"https://github.com/ophis-fi/ophis/actions/workflows/codeql.yml/badge.svg\" alt=\"CodeQL\"/></a>\n  <a href=\"https://github.com/ophis-fi/ophis/actions/workflows/security.yml\"><img src=\"https://github.com/ophis-fi/ophis/actions/workflows/security.yml/badge.svg\" alt=\"Security audits\"/></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-GPL--3.0-blue\" alt=\"GPL-3.0 License\"/></a>\n  <a href=\"https://ophis.fi\"><img src=\"https://img.shields.io/badge/Optimism-live-7c3aed\" alt=\"OP mainnet live\"/></a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://swap.ophis.fi\"><b>Swap App</b></a> ·\n  <a href=\"https://docs.ophis.fi\"><b>Docs</b></a> ·\n  <a href=\"https://explorer.ophis.fi\"><b>Explorer</b></a> ·\n  <a href=\"https://docs.ophis.fi/ai-agents\"><b>Agents</b></a> ·\n  <a href=\"packages/sdk\"><b>SDK</b></a> ·\n  <a href=\"SECURITY.md\"><b>Security</b></a>\n</p>\n\n---\n\nSay `swap 100 USDC for ETH on Base` and Ophis resolves the tokens, chain, and\namount, then fills the order through a competitive solver auction that settles\non-chain. It is a fork of [CoW Protocol](https://cow.fi) (orderbook, autopilot,\ndriver, and baseline solver) with a natural-language intent layer over a\nrebranded CoW Swap UI. On Optimism, Ophis runs the whole stack under its own\nsettlement contracts and keeps the full fee; on the other supported chains\n(Ethereum, Base, Arbitrum, and more) it routes through CoW Protocol's hosted\nnetwork.\n\nWhat that buys you on every trade:\n\n- **Gasless, MEV-protected.** Orders settle in a batch auction where every trade\n  clears at one uniform price, so sandwiches and front-running are structurally\n  absent, not best-effort.\n- **Solver-aligned pricing.** On every supported chain the base fee is 1 bp and\n  Ophis earns primarily when execution beats its reference quote: 80% of\n  improvement on volatile pairs (99 bps cap), or 50% on stable pairs (20 bps\n  cap). Hosted chains encode that policy in CIP-75 appData and separately pay\n  CoW Protocol's upstream fees.\n- **Non-custodial, no account, no auth.** Every order is signed in your own\n  wallet (EIP-712 or ERC-1271). Ophis never holds keys or funds and cannot move,\n  freeze, or recover them. The signature is the only trust boundary.\n- **Transparent, capped fees.** A 0.01% (1 bp) base plus the capped improvement\n  policy above, with a share returned monthly as WETH rebates plus an 8%\n  referral on trades you bring.\n\n**Live across 13 EVM chains**, with Ophis-operated settlement on Optimism\n(chain 10), Unichain (130), and Robinhood Chain (4663), plus CoW-hosted\nsettlement on the other supported chains.\n\n## Quickstart: the Intent API\n\nOphis's one bespoke API turns natural language into a structured order. No key,\nno account, just POST your request:\n\n```bash\ncurl -sS https://ophis.fi/api/intent \\\n  -H 'content-type: application/json' \\\n  -d '{\"text\":\"swap 100 USDC for ETH on Base\"}'\n```\n\n```json\n{\n  \"ok\": true,\n  \"data\": {\n    \"intent\": \"swap\",\n    \"entities\": [\n      { \"type\": \"amount\",    \"value\": \"100\",  \"raw\": \"100\",  \"start\": 5,  \"end\": 8 },\n      { \"type\": \"sellToken\", \"value\": \"USDC\", \"raw\": \"USDC\", \"start\": 9,  \"end\": 13 },\n      { \"type\": \"buyToken\",  \"value\": \"ETH\",  \"raw\": \"ETH\",  \"start\": 18, \"end\": 21 },\n      { \"type\": \"chain\",     \"value\": \"base\", \"raw\": \"Base\", \"start\": 25, \"end\": 29 }\n    ]\n  }\n}\n```\n\nMap the chain slug to a chain ID and hand the user a swap deep link to review and\nsign. The endpoint only normalizes text, it never places, signs, or executes a\ntrade. It is rate-limited to 30 requests per minute per IP; non-browser callers\n(no `Origin` header) are allowed, which is the path agents use. Full reference:\n[docs.ophis.fi/intent-api](https://docs.ophis.fi/intent-api).\n\n## Agents and SDK\n\nOphis is built to be traded by autonomous agents, not just people. Pick your\nintegration depth, all of it non-custodial and keyless:\n\n### MCP server (recommended)\n\nPoint any MCP client (Claude, Cursor, a custom agent) at the hosted Model\nContext Protocol server:\n\n```\nhttps://mcp.ophis.fi/mcp\n```\n\nIt speaks Streamable-HTTP MCP and exposes 14 tools: intent parsing, canonical\ntoken resolution, chain discovery, quoting, bounded order build/validation and\nsubmission, rebate and integrator lookups, balances, portfolios, gas, charts,\nand expected-surplus comparison. The server holds no keys and never signs.\n`build_order` returns a bounded, ready-to-sign EIP-712 order with the receiver\npinned to the owner; the agent signs locally with its own key and submits. See\nthe [complete tool reference](apps/mcp-server/README.md#tools). (A bare request\nwithout an `Accept: text/event-stream` header returns HTTP 406, that is the\ntransport negotiating, not an outage.)\n\n### @ophis/sdk\n\nFor agents that build and sign CoW orders directly:\n\n```bash\nnpm install @ophis/sdk\n```\n\nThe SDK encodes four fork details that fail **silently** if you guess them:\n\n- **`getOphisOrderbookUrl(chainId)`** picks the right host. Optimism self-hosts\n  its orderbook (not `api.cow.fi`); the wrong host bypasses the Ophis solver and\n  zeroes the fee.\n- **`getOphisOrderDomain(chainId)`** gives the EIP-712 domain with the correct\n  `verifyingContract`. The OP settlement is non-canonical, so the cow-sdk default\n  is rejected on-chain.\n- **`buildOphisAppDataPartnerFee(chainId)`** builds the exact CIP-75 volume-fee\n  fragment `{ volumeBps, recipient }`, not the price-improvement shape.\n- **`assertReceiverIsOwner(owner, receiver)`** pins the order receiver. An\n  unpinned receiver is the number one drain vector for an automated signer.\n\n### Discovery and the trust boundary\n\nOphis publishes machine-readable manifests for agent discovery under\n`https://ophis.fi/.well-known/`: `mcp.json`, `ai-plugin.json`, `agent-skills/`,\nand `api-catalog` (RFC 9727), plus the root-served `auth.md`, `llms.txt`, and\n`openapi.json`.\n\nThese off-chain helpers make the safe path the easy path, but they are guards,\nnot an authorization boundary: a prompt-injected agent can ignore them. For an\nagent that signs **without a human in the loop**, enforce policy where the agent\ncannot reach it: funds in a Safe smart account, a deterministic policy gate\n(allowlisted tokens, pinned receiver and appData, an oracle-bounded limit price,\nspend caps), a guardian key, and the same policy checked again at orderbook\ningestion. Full guide: [docs.ophis.fi/ai-agents](https://docs.ophis.fi/ai-agents).\n\n## Status\n\nOphis settles across two kinds of chains.\n\n**Ophis-operated** (self-hosted orderbook, solver, and settlement; Ophis keeps the\nfull fee):\n\n| Chain | Chain ID | Status |\n|---|---|---|\n| Optimism | 10 | **Live**: settlement, solver, partner fee |\n| Unichain | 130 | **Live**: settlement, solver, partner fee |\n| Robinhood Chain | 4663 | **Live**: settlement, solver, partner fee |\n\n**CoW-hosted** (orders route through CoW Protocol's settlement and solver network,\nwith the partner fee disbursed by CoW): Ethereum, Base, Arbitrum, Polygon, BNB,\nGnosis, Avalanche, Linea, and the other CoW-supported chains, all live.\n\nOn **BNB Smart Chain (BSC, chain ID 56)** Ophis is live: orders placed through Ophis\n(`SupportedChainId.BNB` in [`cowSdk.ts`](apps/frontend/apps/cowswap-frontend/src/cowSdk.ts),\nmapped from the `bnb` slug in [`chainMap.ts`](apps/frontend/apps/cowswap-frontend/src/ophis/components/intent/chainMap.ts))\nsettle on-chain through CoW Protocol's GPv2Settlement at\n`0x9008D19f58AAbD9eD0D60971565AA8510560ab41` on BSC, giving gasless, MEV-protected\nswaps with no Ophis-side custody. Ophis does not deploy its own settlement on BSC;\nBNB trades use CoW Protocol's canonical BSC deployment.\n\nThe two have different settlement contracts and orderbook hosts, so resolve them\nper chain via `@ophis/sdk` or the MCP `list_chains` tool rather than assuming.\nFull live status: [docs.ophis.fi/status](https://docs.ophis.fi/status).\nCross-chain destinations (Solana, Bitcoin) are surfaced via NEAR Intents.\nCanonical contract addresses and the disclosure policy live in\n[`SECURITY.md`](SECURITY.md).\n\n## Architecture\n\n| Path | Origin | Purpose |\n|---|---|---|\n| `apps/frontend/` | [`cowprotocol/cowswap`](https://github.com/cowprotocol/cowswap) (subtree) | Vite/Nx monorepo holding several surfaces: `apps/cowswap-frontend` is the swap UI (Ophis code under `src/ophis/` and `src/modules/mevReceipt/`), `apps/explorer` is the order explorer, `apps/ophis-landing` is the ophis.fi landing site. Self-contained pnpm workspace (own lockfile, excluded from the root). |\n| `apps/backend/` | [`cowprotocol/services`](https://github.com/cowprotocol/services) (subtree) | Rust orderbook, autopilot, driver, baseline solver. Ophis additions live in dedicated crates and `ophis::` module paths. |\n| `apps/mcp-server/` | New | `@ophis/mcp-server`: agent-facing MCP server (Streamable-HTTP) deployed as a Cloudflare Worker at `mcp.ophis.fi/mcp`. Holds no keys and never signs. |\n| `apps/rebate-indexer/` | New | `@ophis/rebate-indexer`: off-chain volume-tier and WETH rebate indexer plus Safe batch proposer ([rebates.ophis.fi](https://rebates.ophis.fi)). |\n| `apps/docs-ophis/` | New | Docusaurus docs portal ([docs.ophis.fi](https://docs.ophis.fi)). Self-contained app (own lockfile, excluded from the root, like `apps/frontend`). |\n| `packages/sdk/` | New | [`@ophis/sdk`](packages/sdk): dependency-free helpers for the per-chain orderbook host, EIP-712 order domain, CIP-75 partner-fee `appData`, receiver-pinning guards, tier assignment, and the supported-chain registry. |\n| `contracts/` | [`cowprotocol/contracts`](https://github.com/cowprotocol/contracts) (subtree) | `GPv2Settlement`, `GPv2VaultRelayer`, `GPv2AllowListAuthentication`, deployed under an Ophis-controlled solver allowlist. Per-network artifacts in `contracts/deployments/`. |\n| `functions/` | New | Cloudflare Pages Functions: `api/intent.ts` (the natural-language parser, shared by swap and landing), `api/bungee` (bridge proxy), `_middleware.ts` (host routing). |\n| `infra/` | New | Per-chain runtime stacks (`optimism-mainnet/`, `unichain-mainnet/`, `robinhood-mainnet/`, `local/`), plus `rpc/` (eRPC) and `cloudflare/` config. |\n\nUpstream subtrees are vendored as-is; Ophis changes are catalogued in\n`apps/frontend/.ophis-divergences.md` and `apps/backend/.ophis-divergences.md`\nso `git subtree pull` stays tractable.\n\n## Repo map\n\n```\nophis/\n├── apps/\n│   ├── frontend/        cowswap fork: swap UI + explorer + landing site\n│   ├── backend/         cowprotocol/services fork (Rust)\n│   ├── rebate-indexer/  tier + WETH rebate API, Safe batch proposer\n│   ├── docs-ophis/      Docusaurus docs portal\n│   └── mcp-server/      agent-facing MCP Worker (mcp.ophis.fi)\n├── contracts/           GPv2 settlement contracts (+ per-network deployments)\n├── packages/sdk/        @ophis/sdk\n├── functions/           Cloudflare Pages Functions (intent API, bungee, middleware)\n├── infra/               per-chain runtime stacks + rpc + cloudflare config\n├── scripts/             repo utility scripts\n└── docs/                specs, plans, audits, operations runbooks\n```\n\n## Build\n\nRoot workspace (pnpm 9, Node 20.19+ or 22.12+, turborepo):\n\n```sh\npnpm install      # all root-workspace deps\npnpm build        # builds members with a build step (currently @ophis/sdk)\npnpm typecheck    # typechecks every member\npnpm test         # runs the unit suites\n```\n\nOnly `packages/sdk` has a build step today. `apps/rebate-indexer`,\n`apps/mcp-server`, and `infra/rpc` run directly (no `build` script) and are\nvalidated by `pnpm typecheck` and `pnpm test`. The Rust backend (`apps/backend`)\nis a **Cargo** workspace, not a pnpm package, so build and test it with Cargo:\n\n```sh\ncd apps/backend && cargo build && cargo test\n```\n\n`apps/frontend` and `apps/docs-ophis` are self-contained pnpm workspaces with\ntheir own lockfiles, deliberately excluded from the root. Build them from inside\ntheir own directory (see each app's README):\n\n```sh\ncd apps/frontend   && pnpm install --frozen-lockfile && pnpm run build:cowswap\ncd apps/docs-ophis && pnpm install --frozen-lockfile && pnpm run build\n```\n\nThe contracts use Foundry (`forge build`); `forge-std` is a git submodule, so run\n`git submodule update --init` first.\n\n## Deploy\n\nEvery surface deploys independently from `main`:\n\n- **Swap app and Explorer** [`cloudflare-deploy.yml`](.github/workflows/cloudflare-deploy.yml): two sequential Cloudflare Pages deploys (swap.ophis.fi / ophis.fi, then explorer.ophis.fi).\n- **Landing** [`landing-deploy.yml`](.github/workflows/landing-deploy.yml): path-filtered build with a Playwright and Lighthouse budget gate, to Cloudflare Pages.\n- **Docs** [`docs-deploy.yml`](.github/workflows/docs-deploy.yml): the Docusaurus site to its own Cloudflare Pages project.\n- **MCP server** [`mcp-deploy.yml`](.github/workflows/mcp-deploy.yml): to Cloudflare Workers (custom domain `mcp.ophis.fi`) with a least-privilege Workers token; [`mcp-registry-release.yml`](.github/workflows/mcp-registry-release.yml) publishes matching versioned metadata to the official MCP Registry from protected `mcp-v*` tags.\n- **Rebate indexer** [`rebate-indexer-deploy.yml`](.github/workflows/rebate-indexer-deploy.yml): to self-hosted infrastructure over a private network.\n- **Operated-chain backends**: the Optimism, Unichain, and Robinhood Chain\n  orderbooks, autopilots, drivers, and solver lanes run on Ophis infrastructure\n  from `infra/optimism-mainnet/`, `infra/unichain-mainnet/`, and\n  `infra/robinhood-mainnet/`. They are not deployed by a GitHub workflow.\n\nQuality gates: [`ci.yml`](.github/workflows/ci.yml) (lint, typecheck, tests),\n[`codeql.yml`](.github/workflows/codeql.yml),\n[`security.yml`](.github/workflows/security.yml) (dependency and supply-chain\nscans), and [`echidna.yml`](.github/workflows/echidna.yml) (contract fuzzing).\n[`sdk-release.yml`](.github/workflows/sdk-release.yml) publishes `@ophis/sdk` to npm.\nAll package and MCP publishing controls are documented in the\n[release runbook](docs/operations/release-publishing.md).\n\n## Fees and rebates\n\nOn every supported chain, Ophis charges a **0.01% (1 bp)** base plus a capped\nshare of reference-quote improvement: **80% capped at 99 bps** for volatile\npairs and **50% capped at 20 bps** for stable pairs. Operated-chain backends\napply the improvement policy; hosted orders encode it in CIP-75 appData and\nseparately pay CoW Protocol's upstream fees.\n\nPart of the fee flows back to traders:\n\n- **Volume-tier rebates.** Each month a share of collected WETH fees is paid back,\n  split across active wallets by 30-day volume and tier (Bronze through Platinum).\n  The [rebate indexer](https://rebates.ophis.fi) computes shares and a Safe batch\n  proposer pays out.\n- **Referrals.** Mint a code, share `https://swap.ophis.fi/?ref=YOURCODE`, and earn\n  8% of the verified base fee Ophis keeps on trades your referrals route, paid monthly in WETH.\n\nFull numbers and the tier ladder: [docs.ophis.fi/fees](https://docs.ophis.fi/fees)\nand [docs.ophis.fi/affiliate](https://docs.ophis.fi/affiliate).\n\n## Security\n\nSee [`SECURITY.md`](SECURITY.md) for the disclosure policy, canonical contract\naddresses, the partner-fee recipient and governance model, in-scope components,\nand audit history.\n\n## License\n\n[GPL-3.0](LICENSE), inherited from upstream CoW Protocol.\n",
  "bytes": 15821,
  "sha": "4bb062f67fd7bc65c6323c71466c414f504c6c91998ade8e651334250f2c2e36",
  "repo_slug": "ophis-fi/ophis",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_fi_ophis_mcp_0836147e/readme"
}