# Connect Claude Code

> Add the SupaHost MCP server to Claude Code with claude mcp add, keep the access token in an environment variable, share a .mcp.json with your team and add CLAUDE.md rules.

Source: https://supahost.app/docs/ai-tools/claude-code · Updated 2026-11-11

Claude Code connects to the SupaHost MCP server over HTTP with a bearer token. Once connected, it can inspect your schema, write migrations, generate types and deploy Edge Functions in the project you scope it to.

## 1. Create a token

In *Dashboard → **AI agents (MCP)***, pick **Claude Code**, choose **This project only** (or **Whole instance**), decide on **Read-only**, and click **Create token**. Copy the token and add it to your shell profile (`~/.zshrc`, `~/.bashrc`) so Claude Code can read it:

```bash
export SUPAHOST_TOKEN="shp_..."
```

Open a new terminal, or `source` the profile, before the next step. More on scopes and read-only mode in [The SupaHost MCP server](/docs/ai-tools/mcp).

## 2. Add the server

You have two choices. Pick one.

### Just for you (local scope)

Run this in your project folder. Your shell fills in `$SUPAHOST_TOKEN`, and Claude Code stores the server in your own user config, not in the repository:

```bash
claude mcp add --transport http supahost \
  "https://mcp.supahost.space/mcp?project=app-one" \
  --header "Authorization: Bearer $SUPAHOST_TOKEN"
```

Replace `app-one` with your project name. For a whole-instance token use `?instance=acme` instead, and add `&read_only=true` for a read-only connection.

### Shared with your team (project scope)

`--scope project` writes the server to a `.mcp.json` file in the repository, which you can commit. Use **single quotes** so the shell doesn't expand the variable: Claude Code then stores `${SUPAHOST_TOKEN}` literally and expands it each time it starts, so each teammate uses their own token.

```bash
claude mcp add --scope project --transport http supahost \
  "https://mcp.supahost.space/mcp?project=app-one" \
  --header 'Authorization: Bearer ${SUPAHOST_TOKEN}'
```

The resulting `.mcp.json` looks like this, and you can also write it by hand:

```json
{
  "mcpServers": {
    "supahost": {
      "type": "http",
      "url": "https://mcp.supahost.space/mcp?project=app-one",
      "headers": {
        "Authorization": "Bearer ${SUPAHOST_TOKEN}"
      }
    }
  }
}
```

Check the file before committing: it should contain `${SUPAHOST_TOKEN}`, never a real `shp_` token. Claude Code asks each person to approve project-scoped servers the first time.

## 3. Check the connection

Start Claude Code and run:

```
/mcp
```

`supahost` should show as connected, with its tools listed. From a terminal, `claude mcp list` shows the same. If it shows an error, see [MCP server not connecting in your AI tool](/kb/mcp-not-connecting); the most common causes are an unset `SUPAHOST_TOKEN` in the shell that launched Claude Code, and a `project=` value that doesn't match the token.

Then try a first prompt:

> List the tables in my SupaHost project and tell me which ones don't have Row Level Security enabled.

## 4. Add project rules

Claude Code reads `CLAUDE.md` in your repository at the start of every session. Put SupaHost-specific rules there so the agent uses migrations, enables RLS and knows what the platform does and doesn't support. The **AI agents (MCP)** page generates a starting `CLAUDE.md` for your scope; a fuller version is in [Rules and prompts for AI agents](/docs/ai-tools/agent-rules).

Optionally, install Supabase's agent skills, which give Claude Code extra Supabase know-how:

```bash
npx skills add supabase/agent-skills
```

## Useful prompts

- "Create a `recipes` table with a title, ingredients as jsonb and an owner, with RLS so users only see their own rows. Apply it as a migration, then run the advisors."
- "Generate TypeScript types for the public schema and save them to `src/types/database.ts`."
- "Deploy `supabase/functions/ask-chef` with deploy_edge_function, wait until it's active, then show me its last 20 log lines."
- "With a read-only query, list the 10 largest tables and their estimated row counts."

Claude Code asks before each tool call unless you've allowed it. Keep approval on for `execute_sql`, `apply_migration` and deploys, at least against production.

## Manage the server

```bash
claude mcp get supahost      # show its config
claude mcp remove supahost   # remove it (add --scope project for a .mcp.json entry)
```

When you stop using a token, revoke it in *Dashboard → **Access tokens***.

## Related

- [MCP tools reference](/docs/ai-tools/mcp-tools)
- [Access tokens](/docs/platform/access-tokens)
- [Connect Cursor](/docs/ai-tools/cursor)
- [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp)
