Skip to main content
The gravity-index CLI lets you search the Gravity Index from the command line. The CLI is in the Gravity repository and is not on a package registry. Use it only if you have repository access. For public agent integrations, use the npm MCP server.

Before you start

  • Get access to the Gravity repository and clone it.
  • Install Python 3.9 or later.
  • Get a publisher API key. Every command needs it.

Install

  1. Go to your local copy of the Gravity repository.
  2. Copy the script to a folder on your PATH.
  3. Make sure that ~/.local/bin is on your PATH. Add export PATH="$HOME/.local/bin:$PATH" to your shell startup file.
  4. Install httpx.
  5. Set your publisher API key.
  6. Run a test search.
    You see a recommendation, the reasons for it, and a setup link.
For other interfaces (MCP server and REST API), see Install.

Environment variables

Commands

The CLI prints the recommendation, the reasons, the setup steps, the environment variables, a tracked setup link, the grclid, and the search_id. To send identity fields for attribution, add flags:

Follow-up

Replace SEARCH_ID with the search_id from the earlier search.

Browse

Service details

Troubleshoot