# Connect with MCP

MCP gives an agent structured tools for Site Star operations. Connect to:

```text
https://api.sitestar.io/mcp/v1
```

Use an HTTP-capable MCP client and send your Site Star credential in the authorization header. A generic client configuration looks like:

```json
{
  "mcpServers": {
    "sitestar": {
      "url": "https://api.sitestar.io/mcp/v1",
      "headers": {"Authorization": "Bearer YOUR_API_KEY"}
    }
  }
}
```

Client configuration formats vary. Store the actual key in the client's secret settings rather than committing this file with a credential.

## Discover and call tools

Initialize the MCP connection with your client, then use `tools/list`. The response supplies tool names, descriptions, and input schemas for the credential. Use `tools/call` to invoke one:

```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "create_site",
    "arguments": {"name":"Acme Plumbing","hostingMode":"managed"}
  }
}
```

Use an account-level API key for `create_site`, and a site credential for an agent dedicated to one website. A site-bound `get_site` call needs no `id`; the server supplies it from the credential. HTTP returns raw operation JSON; MCP has its own content wrapping: inspect the tool result's content and error indicator through your MCP client.

## Suggested agent workflow

1. Read the site and its current status.
2. Read relevant configuration, tasks, or changes before proposing a mutation.
3. Call the narrowest tool that expresses the requested action.
4. Keep the returned IDs and reuse supported idempotency keys on retries.
5. Read the resulting state before reporting completion.

Initial drafts use `approve_build` / `request_build_revision`; ongoing changes use `decide_change`. All require the credential to carry a user identity. Task creation requests work. Change approval can initiate a merge. Launch confirmation can charge the account. Distinguish those outcomes in the agent's response.

See the [full tool catalog](/reference/mcp) and [agent documentation](/guide/agent-docs).
