Skip to main content
Glama

ocean-agent

🌊 OPEN BETA: Ocean Agent is in open beta for everyone as of Aug 26, 2026. No invitation and no waitlist: install it and connect your own account. The bracket engine is still being live-validated with our own funds too. Follow the daily scorecard on Telegram.

English · 한국어

🌊 Website: oceanagent.fi · PyPI: ocean-agent

Tell your AI to trade. An MCP server for Pacifica that turns natural language into correct, risk-sized perpetual futures orders, plus a 24/7 autonomous trading entity governed by a policy file you control.

uvx ocean-agent        # no install needed

⚠️ This places real orders with real money. Read the disclaimer before connecting an account.

Built entirely on Pacifica. Calls the Pacifica REST API directly with the same Ed25519 agent-key signing the official tooling uses, no npm dependency.


Why this instead of raw API access

The official Pacifica MCP exposes the API as-is: your AI must compute exact prices and sizes itself, and a price that isn't a multiple of the market's tick size is rejected by the exchange. ocean-agent adds the layer above that:

Raw API / official MCP

ocean-agent

Order prices

AI computes exact values

Say "3% stop", tick/lot/min-order corrected automatically

Position sizing

Manual

Risk-based (fixed % of capital at risk per trade)

Safety

None

Two-step confirm gate on every money-moving tool

Statistics

None

Measured win rates and expected value, not textbook theory


Related MCP server: seashail

MCP tools

Market & analysis

  • analyze_chart, multi-timeframe indicator snapshot with measured hit rates per signal on that specific coin and timeframe. Says "no edge detected" when there isn't one.

  • top_setups, live ranking of statistically-proven setups (EV × win rate × sample confidence), with entry, stop, target and leverage

  • market_context, Fear & Greed regime read

  • scan_funding, every market ranked by funding APR

  • learned_winrates / learned_combos, win-rate database built from live observation, including multi-signal combinations

  • review_predictions, past calls graded against what actually happened

Trading

  • open_with_bracket, entry plus exchange-native TP/SL in one call. The stops live on the exchange, so they fire even with your machine off.

  • protect_position, retrofit native TP/SL onto any open position

  • open_funding_position / close_funding_position, delta-neutral funding carry (spot buy + perp short) executed atomically as a batch

  • plan_oi_hedge, sizes an OI-farming position with its cross-exchange hedge, fee and funding math included

  • open_pacifica_leg, check_position, account_status

Print (experimental, uses an endpoint Pacifica has not documented; may change without notice)

  • print_quote, live premium, implied volatility and liquidation price

  • print_order / print_status / print_close

  • evaluate_print, statistical verdict on whether a Print offer is worth it: fill probability, average overshoot, and the breakeven APY that would compensate for it


Autonomous trading entity

A self-directed trader governed by policy.yaml, a delegation contract. It cannot act outside those bounds.

This is a separate always-on process, not an MCP tool. An MCP server only runs when your AI client calls it; a trader that must hold positions and manage stops around the clock needs its own process. Start it deliberately, and it keeps running whether or not any AI is connected.

python -m ocean_agent.autonomous --init    # create policy.yaml to edit
python -m ocean_agent.autonomous --dry     # decide, but place no orders
python -m ocean_agent.autonomous           # run continuously
python -m ocean_agent.autonomous --once    # single cycle
python -m ocean_agent.autonomous --report  # performance summary

Read policy.yaml before the first real run, capital, leverage cap, risk per trade and the hard-stop threshold all live there. Start with --dry.

Each cycle it reads the market, grades what it learned, manages open positions, and enters only setups that clear every gate.

Portfolio buckets, capital split across directional trading, funding carry and a cash reserve, rebalanced every cycle.

Position aftercare, moves the stop to breakeven once a trade is ahead, trails it as profit grows, and takes partial profit at target. Stops only ever move in your favour.

Liquidity gate, skips markets where your own order would be a large share of daily volume. Thin books are the real hazard: an order that only partly fills, and a stop that cannot be executed at its price.

Net-exposure limit, caps how one-directional the book can get, so a single market reversal cannot hit every position at once.

Self-remeasurement, this is the actual learning engine. On a schedule the bot re-measures the full matrix of coins × timeframes × signals and updates which timeframes it trades and which signals it trusts. Regimes change: in one measurement the 8h timeframe showed no edge at all; weeks later it was the best-performing band. Fixed parameters go stale, so they are not fixed.

python -m ocean_agent.rematrix          # remeasure now
python -m ocean_agent.rematrix --show   # what it currently believes

Adaptation, signals that lose in live grading are suspended, size is cut during drawdown and restored on recovery. Parameters adapt within policy bounds; the bot never rewrites its own code.

Final stop, a single hard halt at catastrophic loss. Otherwise it does not stop, it adapts.


Setup

One command, installs everything (uv, Python, dependencies) and registers the server with Claude Desktop. It asks two questions: wallet address and agent key.

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://oceanagent.fi/install.ps1 | iex"

# macOS / Linux
sh -c "$(curl -LsSf https://oceanagent.fi/install.sh)"

Or set up manually:

  1. Install uv:

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Create an agent wallet key at app.pacifica.fi/apikey. Ocean Agent uses the key to sign orders and never withdraws; you can revoke it at any time.

  2. Put it in .env:

ADDRESS=your_main_wallet_address
PACIFICA_API_KEY=your_agent_wallet_key
PACIFICA_BASE_URL=https://api.pacifica.fi

As written this trades live on mainnet with real funds. Start with --dry, which decides but places no orders. A testnet endpoint is also available if you prefer to rehearse there: remove the PACIFICA_BASE_URL line (testnet uses separate keys: ADDRESS_TESTNET, PACIFICA_API_KEY_TESTNET).

  1. Point your MCP client at it:

{
  "mcpServers": {
    "ocean-agent": {
      "command": "uvx",
      "args": ["ocean-agent@0.4.76"],
      "env": { "PACIFICA_ENV_FILE": "/absolute/path/to/.env" }
    }
  }
}

Restart your AI client, the first launch downloads everything automatically.

  1. Check your setup:

uv run --with ocean-agent python -m ocean_agent.doctor

Any python -m ocean_agent... command in this README runs the same way, prepend uv run --with ocean-agent.


Safety

  • This software never moves funds off the exchange; the key's own permissions are set by the exchange

  • Every order tool previews first and executes only on explicit confirmation

  • Testnet and mainnet keys are kept separate

  • The autonomous entity acts only within policy.yaml

Risk

This is trading software. Leveraged perpetual futures can lose more than the margin you post. Measured win rates come from historical data and are regime-dependent, an edge that held for months can vanish when the market changes character. Nothing here is financial advice. Run it with --dry until you understand exactly what it does, and only risk what you can afford to lose.

License

Business Source License 1.1 (BUSL-1.1): the source is fully visible; trading with your own accounts, research and non-commercial use are free; offering a competing commercial trading service is not. Converts automatically to MIT on 2030-08-25.

Available Tools

22 tools
accept_termsRecord Terms AnswerA
DestructiveIdempotent

Record the user's answer to the Terms of Use question. Call ONLY after the user has explicitly answered in chat. confirm=true records acceptance (which approves the builder code from the Terms with the user's key); confirm=false records the decline. Either answer is asked only once.

Inputs: confirm (required). Returns: result

account_statusAccount StatusA
Read-onlyIdempotent

Get the connected Pacifica account: USDC balance, equity, open positions, and any funding-farm position opened by this tool.

Inputs: no named parameters. Returns: result

analyze_chartChart & Indicator AnalysisA
Read-onlyIdempotent

Technical analysis for a Pacifica market from real candle data (never estimated). DEFAULT interval='multi' runs the full playbook: FOUR timeframes at once (1h/4h/12h/1d), each with a state snapshot (trend/RSI/MACD/Bollinger) PLUS the measured historical win rates of indicator signals on THIS exact coin+timeframe (only signals passing 30+ samples, +5%p edge, positive EV after fees are shown), marking which are firing right now vs waiting. Pass a single interval (1m/3m/5m/15m/30m/1h/2h/4h/8h/12h/1d/1w) for a deep 8-indicator snapshot of just that timeframe (incl. StochRSI, ATR, VWAP). Takes ~30s in multi mode. Win rates are past-regime measurements, not guarantees, pair with market_context for regime read.

Inputs: symbol, interval. Returns: result

check_positionFarm Position HealthA
Read-onlyIdempotent

Check the health of the current farm position: live funding APR, price move since entry, and whether exit conditions are met. Use this periodically to decide whether to close.

Inputs: no named parameters. Returns: result

close_funding_positionClose Funding Farm PositionA
Destructive

Close the funding-farm position previously opened by this tool (both legs for hedged mode). Requires PACIFICA_API_KEY. IMPORTANT: places a REAL closing order. Call with confirm=false first to preview; only confirm=true after the user approves.

Inputs: confirm. Returns: result

evaluate_printPrint Expected-Value EvaluatorA
Read-onlyIdempotent

Evaluate a Pacifica Print offer statistically. Print pays daily APY while a target-price order waits, but fills you at your target when the 24h checkpoint lands beyond it (often with the market already past your price). This tool uses ~9 YEARS of hourly history (Binance history joined to Pacifica) to compute: fill probability, average overshoot (instant mark-to-market loss when filled), and the BREAKEVEN APY that would compensate it. Pass shown_apy (the % displayed in the Pacifica UI) to get a verdict: favorable or negative expected value. distance_pct is the target's distance from mark (0.5–5).

Measured result as of 2026-08-05: Print is unfavorable in normal conditions (Pacifica implied vol 26-38% vs realized 40-53%). The one exception found is ETH short at 2% distance while the trailing 7-day realized vol is under 24.2% (~+17%/yr, about 3% of the time). print_eval's vol_gate() reports whether that window is open right now.

Inputs: side, symbol, shown_apy, distance_pct. Returns: result

learned_combosLearned Combo Win RatesA
Read-onlyIdempotent

Show COMBINATION signal win rates learned from live observation, cases where multiple indicators fire together (e.g. RSI-overbought + Bollinger-upper) in a given market regime (fear/neutral/greed). Combos usually carry a stronger edge than any single signal, and the setup scanner automatically boosts picks that match a high-win-rate combo. Empty until enough co-firing signals are graded; fills as the bot runs.

Inputs: top. Returns: result

learned_winratesLearned Signal Win RatesA
Read-onlyIdempotent

Show the signal win rates LEARNED from continuous observation, the bot records every firing signal across the top-volume coins (whether or not it traded them) and grades them against what actually happened, building a real-world win-rate database over time. This is measured live performance, not backtest. Empty early on; fills up as the autonomous loop runs.

Inputs: top. Returns: result

market_contextMarket ContextA
Read-onlyIdempotent

Live market context to pair with chart analysis: crypto Fear & Greed index (with a regime note, dip-buying historically loses in extreme fear), the latest headlines, and the current funding-rate extremes on Pacifica. Use this before acting on any indicator signal, since signal hit-rates depend heavily on the market regime. Context is for risk management and regime read, not news-chasing entries.

Inputs: no named parameters. Returns: result

open_funding_positionOpen Funding Farm PositionA
Destructive

Open a funding-farming position on the best available market. mode='hedged': buy spot + short perp of equal size (delta-neutral, price-risk free, only works on spot-listed coins). mode='directional': single perp position following the funding sign (collects funding but IS exposed to price moves). max_usd caps the position size. Requires PACIFICA_API_KEY. IMPORTANT: this places a REAL order. First call with confirm=false (default) to preview; only call with confirm=true after the user explicitly approves. All orders carry builder code 'mustache' (attached only if the account approved it; otherwise the order still goes through without it).

Inputs: mode, confirm, max_usd. Returns: result

open_pacifica_legOpen Pacifica Hedge LegA
Destructive

Open the Pacifica leg of an OI-farming hedge: a perp position on the given symbol and side ('long' or 'short'). Use plan_oi_hedge first to pick the symbol/side, and open the opposite position on the recommended exchange yourself, this tool only executes the Pacifica side. Requires PACIFICA_API_KEY. IMPORTANT: places a REAL order. Call with confirm=false first to preview; only confirm=true after the user approves. Orders carry builder code 'mustache' (attached only if approved).

Inputs: side (required), symbol (required), confirm, max_usd. Returns: result

open_with_bracketOpen Position with TP/SLA
Destructive

Open a perp position with EXCHANGE-NATIVE take-profit / stop-loss attached, so the position is protected even if this bot or the user's computer is off, Pacifica closes it at the trigger price. side: 'long'/'short'. usd: notional size. stop_loss_pct / take_profit_pct: distance from entry as a percent (e.g. 3 = 3%); 0 disables that leg. Triggers use mark price. IMPORTANT: places a REAL order, call with confirm=false first to preview, confirm=true only after the user approves. Carries builder code 'mustache' (if approved).

Inputs: usd (required), side (required), symbol (required), confirm, +2 more. Returns: result

plan_oi_hedgeOI Hedge PlannerA
Read-onlyIdempotent

Plan OI farming on Pacifica with a cross-exchange hedge. For each coin, compares funding rates across 10+ exchanges (Binance, Bybit, Hyperliquid, Coinbase, Variational, etc.) and recommends: which side to hold on Pacifica (this builds your OI / points), which exchange to open the OPPOSITE position on (this cancels the price risk), and the resulting net funding carry APR. Positive carry = you get PAID to farm OI delta-neutrally. Note: extreme APRs on exotic/pre-market symbols are often illiquid, prefer major coins.

Inputs: top, min_carry_apr. Returns: result

protect_positionAttach Stop-Loss / Take-ProfitA
Destructive

Attach EXCHANGE-NATIVE stop-loss / take-profit to a position that is ALREADY OPEN (opened anywhere, this bot, the website, or another tool). Percentages are distances from the current mark price (e.g. 3 = 3%); 0 disables that leg. Once set, Pacifica enforces the triggers even if this bot or the user's PC is offline. IMPORTANT: modifies live protection, call with confirm=false first to preview, confirm=true after the user approves.

Inputs: symbol (required), confirm, stop_loss_pct, take_profit_pct. Returns: result

recommend_settingsPosition Sizing AdvisorA
Read-onlyIdempotent

Read the connected account and recommend how to size trading: risk per trade, number of concurrent positions, leverage, margin mode (isolated vs cross), and the notional cap, with the reasoning behind each number.

Read-only: it changes nothing, it only proposes. Every figure is derived from the account balance, the exchange's own market specs (max leverage, maintenance margin), and win rates measured by walk-forward validation over ~9 years of price history, not from convention or rules of thumb.

The central point most people get wrong: leverage does NOT make positions bigger. Position size comes from the stop distance (notional = capital x risk% / stop%), where leverage cancels out. Leverage only changes how much margin is locked, so the best leverage is the SMALLEST one that fits the notional you want, going higher just moves the liquidation price closer for no gain. This tool computes that minimum for the connected account.

Inputs: no named parameters. Returns: result

review_predictionsPrediction ScorecardA
Read-onlyIdempotent

Score past setups from top_setups against what actually happened: per-prediction hit/miss, cumulative realized win rate vs predicted win rate (calibration). If realized falls 10%p+ below predicted, it flags a likely regime change and recommends re-measuring the signal statistics. This is the feedback loop that keeps recommendations honest over time.

Inputs: no named parameters. Returns: result

scan_fundingFunding Rate ScannerA
Read-onlyIdempotent

Scan funding rates across all Pacifica perp markets, ranked by annualized funding APR (absolute value). Positive funding means shorts collect, negative means longs collect. Set hedgeable_only=true to only show coins that also have a spot market (required for delta-neutral farming).

Inputs: top, hedgeable_only. Returns: result

top_setupsTop Trade SetupsA

Scan top-volume Pacifica perps across three horizons and return the highest-probability setups RIGHT NOW: entry, direction, leverage, margin size, take-profit and stop-loss (as price move AND as % of margin), win rate with sample count, and fee-adjusted expected value.

The three timeframes are NOT fixed, they are whichever ones currently measure the highest expected value, re-selected every 7 days by the re-measurement job. Ask analyze_chart if you need a specific timeframe.

The win rate shown is MEASURED, not a backtest number: it comes from walk-forward validation over ~9 years (Binance history joined to Pacifica), where a prediction is formed using only data available at that moment and then checked against what actually happened. That measurement found the realistic ceiling in this market is about 58%, and that raw backtest values above ~55% do not survive out of sample (a backtest claiming 73% came out at 51% in reality). So expect numbers in the low-to-mid 50s. A setup showing "70%" would be a bug, not an opportunity.

STRICT honesty gates: 30+ occurrences on that exact coin+timeframe, at least 2%p above the base rate, positive EV after fees, and the signal must beat the unconditional baseline for its direction (otherwise it is riding market drift, not skill). Returning ZERO setups is common and correct. Every shown setup is logged for later scoring via review_predictions. Takes 1-2 minutes to scan.

Inputs: top, budget_usd. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 22 tools

    Disambiguation4/5

    Most tools have distinct purposes, but some overlap exists between open_funding_position, open_pacifica_leg, and open_with_bracket (all open positions) and between scan_funding and plan_oi_hedge (both analyze funding rates). Descriptions are detailed enough to disambiguate with careful reading.

    Naming Consistency3/5

    Naming mixes verb-first (open_*, close_*, evaluate_*) with noun-style (account_status, print_status, top_setups) and participial (learned_winrates, learned_combos). The print_* group is consistent, but overall there is no single predictable pattern.

    Tool Count3/5

    22 tools is on the heavy side (16-25 range). The scope covers many features (funding farming, OI hedging, Prints, TA, risk, learning), so the count is defensible, but it pushes the upper bound of what feels scoped.

    Completeness4/5

    The surface covers account management, funding farming lifecycle, OI hedging, Prints, technical analysis, risk recommendations, and a feedback loop for predictions. Missing a general close-position tool for regular perps and order management, but these are minor given the focused domain.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      A comprehensive MCP server for Aster DEX perpetual futures trading, enabling AI agents to access real-time market data, perform institutional-grade analysis, execute orders, and run automated trading strategies.
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Agent-native, self-hosted MCP server for crypto trading and DeFi management. Enables agents to query balances, execute trades, and manage positions with a policy engine and secure key storage.
      8
      Apache 2.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP server for OpenAlgo, enabling algorithmic trading operations via natural language commands.
      3
      -