npm package: @mycloudclaw/cli
Description: CloudClaw CLI — manage AI agents, connectors, and MCP tools from the terminal
Author: mkc909
Latest version: 0.2.0

# @cloudclaw/cli

CloudClaw CLI — manage AI agents, connectors, MCP tools, and BYOK keys from the terminal.

```
cloudclaw [command] [subcommand] [options]
```

## Installation

```bash
npm install -g @cloudclaw/cli
```

## Authentication

### Email / Password
```bash
cloudclaw login
# Prompts for email and password, stores JWT token
```

### MCP API Key
```bash
cloudclaw login --api-key cc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cloudclaw config set tenantSlug my-tenant
```

## Commands

### `cloudclaw status`
Check platform health and connectivity.
```bash
cloudclaw status
cloudclaw status --json
```

### `cloudclaw whoami`
Show current auth state and user/tenant info.
```bash
cloudclaw whoami
```

### `cloudclaw config`
View and set CLI configuration.
```bash
cloudclaw config list
cloudclaw config set apiBaseUrl https://mycloudclaw.com
cloudclaw config set tenantSlug my-tenant
cloudclaw config set tenantId <uuid>
cloudclaw config get tenantSlug
cloudclaw config path
```

Config is stored at `~/.config/cloudclaw/config.json` (platform-dependent, managed by `conf`).

---

### `cloudclaw agents`
Manage AI agent configurations.
```bash
cloudclaw agents list
cloudclaw agents create --name "Support Bot" --slug support-bot --model gemini-2.5-pro
cloudclaw agents create --name "Sales Agent" --slug sales --model gpt-4o --tools "hubspot_get_contact,slack_send_message"
cloudclaw agents get <id>
cloudclaw agents delete <id> --force
cloudclaw agents list --json
```

---

### `cloudclaw mcp`
Interact with the CloudClaw MCP server.

**List available tools:**
```bash
cloudclaw mcp tools
cloudclaw mcp tools --search slack
cloudclaw mcp tools --slug my-tenant
```

**Call a tool (the most important command):**
```bash
# Simple tool call
cloudclaw mcp test slack_send_message --args '{"channel":"#general","text":"Hello from CLI!"}'

# With explicit tenant slug
cloudclaw mcp test github_create_issue --slug my-tenant --args '{"title":"Bug report","body":"..."}'

# HubSpot example
cloudclaw mcp test hubspot_get_contact --args '{"email":"user@example.com"}'

# Stripe example
cloudclaw mcp test stripe_get_customer --args '{"customer_id":"cus_xxx"}'

# Get JSON output
cloudclaw mcp test notion_search --args '{"query":"meeting notes"}' --json
```

**MCP handshake:**
```bash
cloudclaw mcp init
cloudclaw mcp init --slug my-tenant
```

**Discover connectors:**
```bash
cloudclaw mcp discover
```

---

### `cloudclaw connectors`
Browse and manage connectors.
```bash
# Browse the connector registry
cloudclaw connectors list
cloudclaw connectors list --category ai
cloudclaw connectors list --search slack
cloudclaw connectors list --sort newest --limit 50

# Installed connectors
cloudclaw connectors installed

# Install a connector
cloudclaw connectors install slack
cloudclaw connectors install github --config '{"org":"my-org"}'

# Uninstall
cloudclaw connectors uninstall <install-id> --force
```

---

### `cloudclaw keys`
Manage MCP API keys (cc_ prefix tokens).
```bash
cloudclaw keys list
cloudclaw keys create --name "Production Key"
cloudclaw keys revoke <id>
cloudclaw keys revoke <id> --force
```

**Note:** The full key value is shown only once at creation time. Store it immediately.

---

### `cloudclaw byok`
Manage Bring-Your-Own-Key (BYOK) API keys for AI providers.
```bash
# List all stored keys
cloudclaw byok list

# Store a provider API key
cloudclaw byok set openai sk-proj-xxx
cloudclaw byok set anthropic sk-ant-xxx --label "Production Anthropic Key"
cloudclaw byok set gemini AIzaSyxxx

# Validate a stored key
cloudclaw byok validate openai

# Show known providers
cloudclaw byok providers
```

Known providers include: `openai`, `anthropic`, `gemini`, `groq`, `slack`, `github`, `hubspot`, `stripe`, `sendgrid`, `twilio`, `notion`, `linear`, `jira`, `airtable`, `google-sheets`, `mongodb`, `postgres`, and more.

---

### `cloudclaw analytics`
View usage analytics.
```bash
cloudclaw analytics summary
cloudclaw analytics tools
cloudclaw analytics tools --limit 20
cloudclaw analytics interactions
cloudclaw analytics interactions --agent support-bot --limit 50
cloudclaw analytics interactions --type tool_call
```

---

### `cloudclaw a2a`
Agent-to-Agent (A2A) protocol commands.
```bash
# Fetch an agent card
cloudclaw a2a card
cloudclaw a2a card --url https://other-agent.example.com/.well-known/agent.json

# Send a task to an A2A agent
cloudclaw a2a send https://other-agent.example.com --task "Summarize last week's sales"
cloudclaw a2a send https://agent.example.com --task "Get customer data" --auth-type bearer --auth-token sk-xxx

# List A2A connections
cloudclaw a2a list

# Register an A2A connection
cloudclaw a2a register --name "Partner Agent" --url https://partner.example.com/.well-known/agent.json
cloudclaw a2a register --name "Auth Agent" --url https://agent.example.com/.well-known/agent.json --auth-type bearer --auth-token sk-xxx
```

---

## JSON Output

All commands support `--json` for machine-readable output:
```bash
cloudclaw agents list --json | jq '.agents[].name'
cloudclaw mcp tools --json | jq '.tools[].name'
cloudclaw analytics summary --json
```

## Configuration Reference

| Key | Default | Description |
|-----|---------|-------------|
| `apiBaseUrl` | `https://mycloudclaw.com` | API base URL |
| `apiKey` | — | MCP API key (`cc_` prefix) |
| `jwtToken` | — | JWT from email/password login |
| `tenantSlug` | — | Tenant slug for MCP endpoints |
| `tenantId` | — | Tenant UUID for REST API calls |
| `userEmail` | — | Logged-in user email |
| `userName` | — | Logged-in user display name |

## Development

```bash
git clone https://github.com/mkc909/cloudclaw-cli.git
cd cloudclaw-cli
npm install
npm run build
node dist/index.js --help
```

## License

MIT