<!-- source: https://www.secondlayer.tools/docs/mcp/remote -->

# Remote Server

Any client that speaks Streamable HTTP connects with the URL alone.

```json .mcp.json
{
  "mcpServers": {
    "secondlayer": {
      "type": "http",
      "url": "https://api.secondlayer.tools/mcp"
    }
  }
}
```

## Credentials

| Credential | When |
| --- | --- |
| Browser sign-in (OAuth) | The default. The client registers itself and opens the consent page. |
| `Authorization: Bearer <sk-sl_ key>` | A client without OAuth support. |

- `initialize` and `tools/list` need no sign-in; a tool call without one is a `401` naming the OAuth metadata.
- Reads use your credits, like reads made with a key.
- Subgraph and webhook reads never start a stopped stack. Start it with any write, or a read with `wake=1` using a key.
- Tools marked "Local only" on [Tools](https://www.secondlayer.tools/docs/mcp/tools.md) are not on the hosted server: use the [local server](https://www.secondlayer.tools/docs/mcp/local.md).
- What an app can do, and how to revoke it: [Sign-in and Permissions](https://www.secondlayer.tools/docs/mcp/permissions.md).

## Read next

- [Tools](https://www.secondlayer.tools/docs/mcp/tools.md)
- [Local Server](https://www.secondlayer.tools/docs/mcp/local.md)
- [Sign-in and Permissions](https://www.secondlayer.tools/docs/mcp/permissions.md)

## Notes for agents

- Remote URL: https://api.secondlayer.tools/mcp (Streamable HTTP, type 'http'). OAuth by default; a client without OAuth sends 'Authorization: Bearer sk-sl_*'.
- The hosted server has 18 read-only tools (Index, Streams tip, Contracts, Proofs, subgraphs_list, subgraphs_status, subgraphs_query, webhooks_list, webhooks_deliveries, account_whoami, billing_status). Reads never start a stopped stack. Subgraph tests and deploys need the stdio server (/docs/mcp/local); webhook management is the CLI with --json.

## Setup

Ensure setup once, skipping any step already done:
- CLI: `bun add -g @secondlayer/cli`
- Instance: `secondlayer init` writes `INSTANCE_TOKEN`. Loopback `/v1` reads need no key.
- Hosted reads: export `SECONDLAYER_API_KEY` (`sk-sl_*`) or buy credits with `secondlayer credits buy` (`balance`, `refill`), then `secondlayer whoami`
