Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions skills/advanced-swap-orders/MCP-README.md
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 +1 to +6
Copy link

Copilot AI Mar 23, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +6
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description lists an added mcp-server.py (FastMCP) and HTTP transport support, but the repo changes add mcp-server.js and start-mcp.sh only. Please align the documentation in this README with the actual deliverable (and/or add the missing files/transports) so users aren’t misled when following the PR summary.

Copilot uses AI. Check for mistakes.
## 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
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown table under β€œTools” uses double leading ||, which breaks table rendering in many markdown parsers. Use a standard table header row like | Tool | Description | (single pipe at start/end).

Copilot uses AI. Check for mistakes.

## 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
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The β€œVia npx” config snippet implies npx @orbs-network/spot mcp works, but the current package.json in this repo does not define a bin/CLI entrypoint, so this configuration will fail. Either add the npm bin/CLI wiring in this PR or change the docs to only show the supported node .../mcp-server.js launch method.

Copilot uses AI. Check for mistakes.

## 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
Loading
Loading