# Gemini CLI

> Add the Stableship MCP server to Gemini CLI from your terminal, and sign in through your browser.

Gemini CLI connects to the Stableship MCP server and reads `GEMINI.md` from your repository. Once it is connected, ask it to fix what Stableship found; it reads each fix brief, fixes the code and asks Stableship to verify the fix.

> **Note** We have not yet tested Gemini CLI with Stableship end to end. It connects over MCP with the steps below, taken from Gemini CLI's own docs. If a step does not match what you see, tell us at support@stableship.ai.

## Connect

1. Add Stableship in your terminal:

   ```sh
   gemini mcp add --scope user --transport http stableship https://api.stableship.ai/mcp
   ```

2. Start Gemini CLI and run `/mcp auth stableship`. Your browser opens. Approve there.

Approving opens app.stableship.ai: sign in, pick the workspace and approve. No token to copy. You can disconnect it any time in Stableship: **Settings**, then **Connections**, then **Connected apps**.

## Use a token instead

First make a token: in Stableship open **Settings**, then **Connections**, open **API tokens and connected apps**, and choose **Create token** with **Read findings and rules** and **Start checks and verify fixes**. Copy it: it starts with `sst_` and is shown once. Use it where these steps say `sst_your_token`.

Add it to `~/.gemini/settings.json` with a token:

```
{
  "mcpServers": {
    "stableship": {
      "httpUrl": "https://api.stableship.ai/mcp",
      "headers": {
        "Authorization": "Bearer sst_your_token"
      }
    }
  }
}
```

Keep the token out of your repository.

## Check it works

Start Gemini CLI again: `/mcp` lists Stableship. Then ask Gemini CLI to list your Stableship projects: it calls `list_projects` and names your app.

If it does not connect:

- In Gemini CLI, run `/mcp auth stableship`, then approve.
- Or [use a token instead](#use-a-token-instead).

## Keep the rules in your repository

Ask Gemini CLI to call `get_repo_files` and commit what it returns: `.gate/rules.md`, `.gate/context.md`, a Stableship section in `AGENTS.md`, and the same section in `GEMINI.md`, the file Gemini CLI reads. Stableship never writes to your repository, so your agent commits these.
