# MCP Endpoint

Connect AI agents to Skopik Platform over a single remote Streamable HTTP MCP endpoint.

Skopik Platform exposes a single remote **Model Context Protocol (MCP)** endpoint on the control API server:

```text
https://api.platform.skopik.com/mcp
```

Every platform operation — Workers, Sandboxes, Databases, Buckets, Queues, Topics, Email, Domains, Workspaces, Git links, Secrets, and Usage — is available as an MCP tool with the exact same schemas, permissions, and error codes as the REST API.

## Authentication

Send an organization API key in the `Authorization` header:

```text
Authorization: Bearer <SKOPIK_API_KEY>
```

- **Full-scope keys** can read and mutate all org resources.
- **Read-only keys** (`read` scope) can inspect resources, query Databases, read Sandbox files, and view logs without modifying infrastructure.
- **Person tokens** (with `x-mh-org: <org_id>`) are also accepted and unlock member, invite, and org transfer tools.

> [!TIP]
> Give untrusted or read-only research agents a `read` API key created in **Settings → Keys**.

## Client Configuration

:::tabs
::tab Claude / Cursor / JSON
```json
{
  "mcpServers": {
    "skopik-platform": {
      "url": "https://api.platform.skopik.com/mcp",
      "headers": {
        "Authorization": "Bearer mhk_your_org_api_key"
      }
    }
  }
}
```
::tab curl (initialize)
```bash
curl -X POST https://api.platform.skopik.com/mcp \
  -H "Authorization: Bearer $SKOPIK_API_KEY" \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'
```
:::

## Discovering Tools

Run `skopik tools` from your terminal to list every live tool and its summary, or `skopik <tool_name> --help` to inspect its exact parameters:

```bash
skopik tools
skopik exec_in_sandbox --help
```

## Limits & Long-Running Calls

- **Long commands:** The edge keeps MCP connections open for up to **65 minutes** with TCP keepalives, so long `exec_in_sandbox` calls complete without timing out.
- **File transfers over MCP:** `write_sandbox_file` and `read_sandbox_file` cap payloads at **4 MiB** (UTF-8 or base64). For larger files up to 1 GiB, use the HTTP route `/v1/sandboxes/{id}/files`.
- **Error format:** Errors return the stable control API envelope `{"error": {"code": "...", "message": "..."}}`.
