# MCP server: let your AI agent do the install

GalaxyIDX runs a remote MCP server (Streamable HTTP) at:

```
https://mcp.galaxyidx.com/mcp
```

It authenticates with your **secret key** as a bearer token. Every tool works only inside your own account.

## Connect

Claude Code:

```bash
claude mcp add --transport http galaxyidx https://mcp.galaxyidx.com/mcp --header 'Authorization: Bearer ${IDX_SECRET_KEY}'
```

Use **single quotes**. They store the reference `${IDX_SECRET_KEY}`, which the client expands when it connects.
Double quotes make your shell paste the real key into the saved MCP config, and with `--scope project` that config
is a `.mcp.json` file that gets committed. Never save a config that holds a literal key.

Any client that takes a JSON config (keep the key in an environment variable, not in the file):

```json
{
  "mcpServers": {
    "galaxyidx": {
      "type": "http",
      "url": "https://mcp.galaxyidx.com/mcp",
      "headers": { "Authorization": "Bearer ${IDX_SECRET_KEY}" }
    }
  }
}
```

Check your client's docs for how it expands environment variables in headers.

## Tools

| Tool | What it does |
|---|---|
| `install_instructions(framework)` | The compliant install steps for `wordpress`, `nextjs`, `astro` or `other`, your sites, and the env vars to set. Call first |
| `search_listings(site_id, …)` | Search the listings a site may show (objective filters) |
| `get_listing(listing_key, site_id)` | One listing, with `home_site` / `is_home` |
| `get_market_stats(area_slug, site_id)` | Area metrics with period and source |
| `create_search_page(framework, site_id)` | Page spec + ready files for `/homes/` and listing pages |
| `create_area_page(framework, site_id, area_slug)` | Page spec + files for an area page |
| `list_leads(site_id?, since?)` | Your leads and their delivery status |
| `get_lead_settings(site_id?)` | Who receives new-lead emails |
| `set_lead_email(email_to, email_cc?, site_id? \| account_default: true)` | Change who receives new-lead emails for one site, or (with `account_default: true`) the account default. CRM and webhook delivery are kept; confirm the addresses with the user first |

Generated files read the key from `IDX_SECRET_KEY` and the site from `IDX_SITE_ID`. They never contain a key.

## Protocol

MCP revision `2026-07-28` (stateless, per-request `_meta`, `server/discover`), with fallback for clients on `2025-11-25`, `2025-06-18` and `2025-03-26` (`initialize`). POST only. Rate-limited per key and per client IP; repeated rejected keys from one IP are refused for a minute.

## Site-scoped keys

A secret key can be limited to one site. With such a key the tools see only that site and its leads, and
`set_lead_email` can change only that site's route. The account default route needs a tenant-wide key or the
dashboard. The API enforces this (403); it is not just a client-side check.
