-
Notifications
You must be signed in to change notification settings - Fork 2
π Add MCP server wrapper for advanced-swap-orders #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f88b2e3
97b31cb
3909f20
4c4e000
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # MCP Server β Orbs Advanced Swap Orders | ||
|
|
||
| Model Context Protocol (MCP) server exposing gasless, oracle-protected swap orders across multiple EVM chains. | ||
|
|
||
| **Zero external dependencies** β implements the MCP stdio protocol (JSON-RPC 2.0 over stdin/stdout) directly in Node.js. All configuration is read dynamically from `manifest.json` and `assets/`. | ||
|
|
||
|
Comment on lines
+3
to
+6
|
||
| ## Quick Start | ||
|
|
||
| ```bash | ||
| # stdio transport (for MCP clients like Claude Desktop, Cursor, etc.) | ||
| ./start-mcp.sh | ||
|
|
||
| # or directly | ||
| node mcp-server.js | ||
| ``` | ||
|
|
||
| ## Tools | ||
|
|
||
| | Tool | Description | | ||
| |------|-------------| | ||
| | `prepare_order` | Prepare a gasless swap order (market, limit, stop-loss, take-profit, TWAP, delayed-start). Returns EIP-712 typed data for signing. | | ||
| | `submit_order` | Submit a signed order to the Orbs relay network for oracle-protected execution. | | ||
| | `query_orders` | Query order status by swapper address or order hash. | | ||
| | `get_supported_chains` | List all supported chains with IDs, names, and adapter addresses (from manifest.json). | | ||
| | `get_token_addressbook` | Common token addresses (WETH, USDC, USDT, etc.) for every supported chain. | | ||
|
Comment on lines
+19
to
+25
|
||
|
|
||
| ## Workflow | ||
|
|
||
| 1. **`get_token_addressbook`** β find token addresses for your chain | ||
| 2. **`prepare_order`** β get EIP-712 typed data + approval calldata | ||
| 3. Sign the typed data with the user's wallet (off-chain, gasless) | ||
| 4. **`submit_order`** β send signed order to Orbs relay network | ||
| 5. **`query_orders`** β monitor order execution status | ||
|
|
||
| ## MCP Client Configuration | ||
|
|
||
| ### Claude Desktop / Cursor (`claude_desktop_config.json`) | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "orbs-swap": { | ||
| "command": "node", | ||
| "args": ["/path/to/skills/advanced-swap-orders/mcp-server.js"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Via npx (if published) | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "orbs-swap": { | ||
| "command": "npx", | ||
| "args": ["@orbs-network/spot", "mcp"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
Comment on lines
+50
to
+61
|
||
|
|
||
| ## Architecture | ||
|
|
||
| - **Single file**: `mcp-server.js` β no build step, no transpilation | ||
| - **Zero dependencies**: implements JSON-RPC 2.0 / MCP protocol inline | ||
| - **Config from manifest**: chains, contracts, and metadata read from `manifest.json` at startup | ||
| - **Token data from assets**: `assets/token-addressbook.md` loaded and served directly | ||
| - **Tool execution**: each tool calls `node scripts/order.js` via `child_process` | ||
| - **Transport**: stdio (newline-delimited JSON-RPC 2.0) | ||
|
|
||
| ## Supported Chains | ||
|
|
||
| Dynamically loaded from `manifest.json`. Currently: | ||
|
|
||
| Ethereum (1), BNB Chain (56), Polygon (137), Sonic (146), Base (8453), Arbitrum One (42161), Avalanche (43114), Linea (59144). | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Node.js 18+ (uses `node:fs`, `node:path`, `node:child_process`) | ||
| - No additional npm packages required | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation claims the server supports β10 EVM chainsβ, but the skillβs manifest currently lists 8 chains (1, 56, 137, 146, 8453, 42161, 43114, 59144) and
get_supported_chains()will return only those. Please update the README to match the manifest/server behavior, or update the manifest + server to actually expose the additional chains mentioned.