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

# CLI

> Search the Index from the terminal

Search the Gravity Index from the command line. The standalone CLI currently ships from the Gravity repo, so use this path if you have repo access; public agent integrations should use the npm MCP server.

## Install

From a local Gravity checkout:

```bash theme={null}
cd gravity
mkdir -p ~/.local/bin
cp index/cli/gravity-index ~/.local/bin/gravity-index
chmod +x ~/.local/bin/gravity-index
pip install --user httpx
```

Make sure `~/.local/bin` is on your `PATH` (add `export PATH="$HOME/.local/bin:$PATH"` to your shell rc).

Requires Python 3.9+. Full install options (MCP, npm wrapper, API) are on the [Install page](/gravity-index/install).

## Optional configuration

```bash theme={null}
# Override the API URL (defaults to https://index.trygravity.ai)
export GRAVITY_INDEX_URL=https://index.trygravity.com
```

## Commands

### Search

```bash theme={null}
gravity-index search "I need a serverless database"

# With publisher identity metadata for attribution/matching
gravity-index search "I need a serverless database" \
  --external-session-id session_123 \
  --external-user-id-hash sha256_user_id \
  --email-hash sha256_email \
  --metadata-json '{"surface":"chat"}'
```

Returns the recommendation with reasoning and a tracked click link, all color-formatted for the terminal.

### Follow-up

```bash theme={null}
gravity-index search "does it support branching?" --follow-up <search_id>
```

### Browse

```bash theme={null}
# All services
gravity-index browse

# Filter by category
gravity-index browse --category Database

# Search
gravity-index browse "vector"
```

### Service details

```bash theme={null}
gravity-index info supabase
```

## Publisher attribution

Set `GRAVITY_PUBLISHER_KEY` so requests and integrations attribute to your platform:

```bash theme={null}
export GRAVITY_PUBLISHER_KEY=your-publisher-api-key
gravity-index search "auth for Next.js"
```

Optional private ranking modes for publisher-owned integrations:

```bash theme={null}
export GRAVITY_INDEX_MONETIZATION_MODE=boost_cpa  # relevance-first, small boost for CPA-backed tools
```

The CLI does not print economics.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.