# Wayfinder Paths SDK

GitHub: <https://github.com/WayfinderFoundation/wayfinder-paths-sdk>

Build, test, and run automated DeFi strategies with Python — or let your coding agent do it for you.

Wayfinder Paths gives you composable building blocks that work across chains and protocols. Write a strategy once, deploy it to lending markets, perp exchanges, prediction markets, or vaults — the SDK handles the protocol-specific plumbing.

Works with **Claude Code**, **Codex**, **Opencode**, and any MCP-compatible coding agent.

* **Strategies**: capital deployment + position management across 6+ pre-built strategies
* **Adapters**: protocol integrations — Hyperliquid, Aave V3, Morpho, Moonwell, Boros, Pendle, Polymarket, Uniswap V3, and more
* **MCP server**: connect your coding agent to your wallets, quotes, and strategy actions
* **Contract tooling**: compile, deploy, and verify Solidity contracts from your coding agent

## Quickstart

```bash
git clone https://github.com/WayfinderFoundation/wayfinder-paths-sdk
cd wayfinder-paths-sdk
# Open in your coding agent (Claude Code, Codex, Opencode, etc.)
```

Then:

1. Your agent will guide you through running the bootstrap script:

   ```bash
   # Bootstrap Poetry + deps, create config.json, update .mcp.json, generate wallets
   python3 scripts/setup.py
   ```
2. Get an API key at `https://strategies.wayfinder.ai/` (connect your wallet → create API key).
3. Add it to `config.json` under `system.api_key` (or export `WAYFINDER_API_KEY`).
4. Fund your wallets (at minimum, the `main` wallet) with gas + assets on the chains you plan to use.
5. Enable the project MCP server (from `.mcp.json`) when prompted.

No coding agent? Follow [Installation](https://wayfinder-1.gitbook.io/wayfinder/getting-started/installation) for manual setup.

## Example prompts (copy/paste)

These examples assume you have a `main` wallet in `config.json` and you’ve funded it on the relevant chains.

Teaser outputs below are illustrative (numbers, routes, and providers will differ).

### 1) What’s in my wallet?

```
User: What's in my wallet?

Agent: I’ll pull your balances and positions (no funds move).
[Reads:]
  - wayfinder://balances/main

Teaser (example):
- Base: 254.31 USDC, 0.018 ETH
- Arbitrum: 100.00 USDC, 0.006 ETH
```

### 2) Swap USDC (Arbitrum) → PROMPT (Base)

```
User: Swap 100 USDC on Arbitrum for PROMPT on Base.
      Quote first, then ask for confirmation before executing.

Agent: I’ll resolve PROMPT on Base, then fetch a cross-chain quote.
[Reads:]
  - wayfinder://tokens/search/base/prompt
[Calls:]
  - mcp__wayfinder__quote_swap(wallet_label="main", from_token="usd-coin-arbitrum", to_token="<prompt-token-id>", amount="100")

Teaser (example):
- Best quote: 100 USDC (Arbitrum) → ~XX.XX PROMPT (Base)
- Provider: <provider>
Proceed to execute? (yes/no)
```

### 3) Check ETH funding on Hyperliquid

```
User: Check the current ETH funding rate on Hyperliquid and tell me if it's positive or negative.

Agent: [Reads wayfinder://hyperliquid/markets]

Teaser (example):
ETH funding (raw): +0.0000XX → positive (shorts receive funding)
```

### 3b) Check Polymarket portfolio + redeem resolved positions

```
User: Show me my Polymarket portfolio and redeem anything resolved.

Agent: I’ll fetch your Polymarket state (no funds move), then ask before redeeming.
[Calls:]
  - mcp__wayfinder__polymarket(action="status", wallet_label="main")

If a position is redeemable:
  - mcp__wayfinder__polymarket_execute(action="redeem_positions", wallet_label="main", condition_id="0x...")
```

### 4) If funding is positive: buy wstETH (Base) and short ETH perp (2×)

```
User: If ETH funding is positive:
      1) Swap 100 USDC on Base into wstETH.
      2) Short $100 notional ETH perp on Hyperliquid at 2x cross leverage.
      Ask for confirmation before each fund-moving step.

Agent: I’ll check funding first, then stage each action with a confirmation step.
[Reads:]
  - wayfinder://hyperliquid/markets
[Calls:]
  - mcp__wayfinder__quote_swap(...)
  - mcp__wayfinder__execute(kind="swap", ...)
  - mcp__wayfinder__hyperliquid_execute(action="place_order", ...)

Teaser (example):
- Swap executed: <tx_hash> (Base)
- Perp short opened: ETH, $100 notional, 2x cross
Verify:
  - wayfinder://balances/main
  - wayfinder://hyperliquid/main/state
```

### 5) Deposit to the Moonwell wstETH loop strategy

```
User: Deposit 100 USDC into the Moonwell wstETH loop strategy and then show me status.
      Ask for confirmation before any fund-moving action.

Agent: I’ll run the deposit action, then poll status.
[Calls:]
  - mcp__wayfinder__run_strategy(strategy="moonwell_wsteth_loop_strategy", action="deposit", main_token_amount=100, gas_token_amount=0.01)
  - mcp__wayfinder__run_strategy(strategy="moonwell_wsteth_loop_strategy", action="status")

Teaser (example):
- Position: USDC collateral + wstETH collateral - WETH debt
- Metrics: health factor, leverage, LTV, peg diff
```

## Related Projects

* **OpenClaw** — conversational DeFi skill for Telegram bots and MCP-compatible agents: [GitHub repo](https://github.com/WayfinderFoundation/wayfinder-openclaw-skill)
* **Autolab** — autonomous strategy search and optimization: [Docs](https://wayfinder-1.gitbook.io/wayfinder/autolab/autolab)
* **AGENTS.md** — the SDK ships with agent-agnostic instructions that work across Claude Code, Codex, and Opencode

## Get Started

* [Quickstart](https://wayfinder-1.gitbook.io/wayfinder/getting-started/quickstart)
* [Architecture](https://wayfinder-1.gitbook.io/wayfinder/how-it-works/architecture)
* [Protocols](https://wayfinder-1.gitbook.io/wayfinder/protocols-and-adapters/protocols)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wayfinder-1.gitbook.io/wayfinder/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
