# 🐙 tentactl

Kraken exchange agent toolkit — MCP server + OpenClaw skill for crypto trading, market data, and portfolio management.

Use it as an **MCP server** (Claude Desktop, Cursor, OpenClaw via mcporter) or as an **OpenClaw skill** for natural language crypto automation.

## Installation

### Download binary

Grab the latest release for your platform from [GitHub Releases](https://github.com/askbeka/tentactl/releases).

### Build from source

```bash
cargo install tentactl
```

Or clone and build:

```bash
git clone https://github.com/askbeka/tentactl.git
cd tentactl
cargo build --release
# Binary at target/release/tentactl
```

## Usage

### As MCP Server

Add to your MCP client config (Claude Desktop, OpenClaw, Cursor, etc.):

```json
{
  "mcpServers": {
    "kraken": {
      "command": "tentactl",
      "env": {
        "KRAKEN_API_KEY": "your-api-key",
        "KRAKEN_API_SECRET": "your-api-secret"
      }
    }
  }
}
```

### As OpenClaw Skill

Copy the `skill/` directory to your OpenClaw workspace:

```bash
cp -r skill/ ~/.openclaw/workspace/skills/kraken/
```

Then set up API keys:

```bash
~/.openclaw/workspace/skills/kraken/scripts/setup-keys.sh
```

Market data tools work without API keys. Account and trading tools require authentication.

## Available Tools

### Market Data (no auth required)

| Tool | Description |
|------|-------------|
| `get_ticker` | Current price, volume, high/low for a trading pair |
| `get_orderbook` | Order book depth (asks/bids) |
| `get_ohlc` | OHLC candlestick data |

### Account (requires API keys)

| Tool | Description |
|------|-------------|
| `get_balance` | All non-zero account balances |
| `get_trade_history` | Recent executed trades |
| `get_open_orders` | Currently open orders |

### Trading (requires API keys) ⚠️

| Tool | Description |
|------|-------------|
| `place_order` | Place a buy/sell order (market or limit) |
| `cancel_order` | Cancel an open order |

> **⚠️ Trading tools execute real trades with real money.** Use `validate: true` for dry runs.

## Getting Kraken API Keys

1. Log in to [Kraken](https://www.kraken.com)
2. Go to **Settings → API** (or visit `https://www.kraken.com/u/security/api`)
3. Click **Generate New Key**
4. For read-only access: enable **Query Funds** and **Query Open Orders & Trades**
5. For trading: also enable **Create & Modify Orders**
6. Copy the API Key and Private Key (secret)

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `KRAKEN_API_KEY` | For account/trading | Your Kraken API key |
| `KRAKEN_API_SECRET` | For account/trading | Your Kraken API secret |
| `RUST_LOG` | No | Log level (e.g. `info`, `debug`) — logs go to stderr |

## Development

```bash
cargo build
cargo test        # 37 tests
cargo clippy -- -D warnings
cargo fmt --check
```

## License

MIT
