> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adstellar.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Connect an MCP client to AdStellar in a few minutes.

## Claude Desktop / ChatGPT (OAuth — recommended)

Add AdStellar to your `claude_desktop_config.json` with no key at all:

```json theme={null}
{
  "mcpServers": {
    "adstellar": {
      "url": "https://app.adstellar.ai/api/mcp"
    }
  }
}
```

On first use the client registers itself, opens the AdStellar consent screen in your browser, and you pick the team + scopes to grant. Tokens refresh automatically.

## API key (for your own agents)

Create a key in Settings → Developers (or via `POST /api/settings/api-keys`), then:

```json theme={null}
{
  "mcpServers": {
    "adstellar": {
      "url": "https://app.adstellar.ai/api/mcp",
      "headers": {
        "Authorization": "Bearer ast_live_YOUR_KEY"
      }
    }
  }
}
```

Restart the client. You should see AdStellar's tools — try:

> "What's my current credit balance and which ad accounts are connected?"

> "Generate 5 headline variants for my default brand kit, bold tone, goal: drive trial signups."

> "Generate a 9:16 image ad for my product, 2 variations" — then "check the status of batch \<id>"

> "How did my campaigns perform over the last 7 days, grouped by campaign?"

## REST API

Every MCP tool is also a REST endpoint — `POST /api/v1/tools/{toolName}` with the same bearer credential:

```bash theme={null}
curl -X POST https://app.adstellar.ai/api/v1/tools/get_credit_balance \
  -H "Authorization: Bearer ast_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

The full spec lives at the [API Reference](/api-reference) tab (or `GET /api/v1/openapi.json`).

## Raw JSON-RPC (for debugging)

```bash theme={null}
# Discover tools
curl -X POST https://app.adstellar.ai/api/mcp \
  -H "Authorization: Bearer ast_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

# Call a tool
curl -X POST https://app.adstellar.ai/api/mcp \
  -H "Authorization: Bearer ast_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": { "name": "get_credit_balance", "arguments": {} }
  }'
```

Supported methods: `initialize`, `ping`, `tools/list`, `tools/call` (single or batched). The server is stateless — every POST is self-contained.

## Building your own agent

1. Create a key with only the scopes your agent needs.
2. On startup, call `tools/list` to discover the tools visible to that key.
3. Call `get_team_info` to confirm which team you're acting on.
4. Use `list_models` before any generation call so you can pass an explicit `model` id (or omit it for the default router).
5. Generation is async: call `generate_image`/`generate_video`, then poll `get_generation_status` until `complete: true`.
