npm package: @henriots89/ymax-agent-kit
Description: MCP server and tools for AI agents to manage Ymax cross-chain yield portfolios
Author: Sommelier
Latest version: 0.1.0

# @somm/ymax-agent-kit

MCP server that gives AI agents tools to inspect, analyze, and manage Ymax cross-chain yield portfolios across Morpho vaults on Ethereum, Base, and Arbitrum.

## Quick start

Add to your `.mcp.json`:

```json
{
  "mcpServers": {
    "ymax": {
      "command": "npx",
      "args": ["@somm/ymax-agent-kit"],
      "env": {
        "YMAX_PORTFOLIO_ID": "portfolio145"
      }
    }
  }
}
```

Then ask your agent:

> "Check my Ymax portfolio and tell me whether I should rebalance. If so, show me what you would change and why."

No private key needed for preview mode. The agent can inspect portfolios, compute allocations, assess risk, and preview rebalances using live data.

## Tools

| Tool | Type | Description |
|------|------|-------------|
| `get_portfolio` | read | Portfolio state: positions, balances, target allocations, total value |
| `get_instruments` | read | Available instruments with APYs, fees, TVL across chains |
| `compute_allocation` | read | Strategy engine: yield + diversity scoring with constraints |
| `check_rebalance` | read | Whether rebalance is warranted, with reasons and bps deltas |
| `sign_and_submit_rebalance` | write | Preview (`dryRun=true`) or execute rebalance. Risk-gated. |
| `query_risk_scores` | read | Per-vault risk scores from Morpho data (composite, tier, components) |
| `query_market_risk` | read | Single-instrument risk detail by YDS instrument ID |

Risk data comes from the Morpho-native vault risk resolver. Each vault is scored on LLTV, utilization, concentration, and TVL depth using live Morpho GraphQL data. No external risk service required.

## Environment variables

| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `YMAX_PORTFOLIO_ID` | Yes | - | Portfolio ID (e.g., `portfolio145`) |
| `YMAX_YDS_BASE` | No | `https://ymax.app` | Ymax Data Service URL |
| `YMAX_CHAIN_ID` | No | `1` | EVM chain ID |
| `YMAX_VERSION` | No | `ymax1` | Ymax protocol version |
| `YMAX_PRIVATE_KEY` | For live submit | - | Delegate key (0x-prefixed). Omit for preview-only. |

## Strategy parameters

`compute_allocation` and `sign_and_submit_rebalance` accept optional tuning:

| Parameter | Default | What it controls |
|-----------|---------|-----------------|
| `yieldWeight` | 0.4 | How much to prioritize raw APY (0-1) |
| `diversityWeight` | 0.6 | How much to prioritize curator diversification (0-1) |
| `maxSingleInstrument` | 0.40 | Maximum allocation to any one instrument |
| `maxSingleCurator` | 0.50 | Maximum allocation to any one curator |
| `minAllocation` | 0.05 | Below this, don't allocate at all |

## What this is

A terminal/MCP-first toolkit for AI agent developers. Not a consumer dashboard. The agent inspects live portfolio data, computes constrained allocations, assesses vault-level risk, and previews or executes rebalances — all through MCP tool calls.

## More info

- [Full tutorial](https://github.com/PeggyJV/ymax-rwa-strategy/blob/main/docs/guides/build-a-ymax-yield-agent.md)
- [Product context](https://github.com/PeggyJV/ymax-rwa-strategy/blob/main/PRODUCT.md)
- [Architecture](https://github.com/PeggyJV/ymax-rwa-strategy/blob/main/ARCHITECTURE.md)