# Connect MCP servers

Many services run their own MCP server: Linear, Notion, Atlassian, Sentry, Stripe, Cloudflare, Vercel, Supabase and dozens more. Press **Connect** in [app.kosa8.com → Integrations](https://app.kosa8.com/app#integrations), sign in on the service's own page, and you are back, connected. There is no key to paste. kosa8 keeps the sign-in for your organization, and your agents, sandboxes and scripts use the server through the kosa8 MCP gateway, which adds the token on the way out.

## How Connect works

kosa8 follows the MCP authorization spec, the same way Claude's connectors do:

1. It asks the server how it signs in: the server's `WWW-Authenticate` challenge, its protected-resource metadata (RFC 9728) and its authorization server's metadata (RFC 8414).

2. It gets a client ID there. Most servers let kosa8 register itself (RFC 7591), some take kosa8's Client ID Metadata Document, and a few need an app the kosa8 team registered with them.

3. You sign in on the service's page. kosa8 uses PKCE (S256) and asks for a token for that one server (the `resource` parameter, RFC 8707). A token issued for another service is refused.

4. Back at `https://app.kosa8.com/oauth/mcp/callback`, the sign-in is checked against a short-lived cookie that binds it to your browser and to you, and you must still be an owner or admin. The token is tried once, then stored encrypted (AES-GCM) for your organization.

kosa8 refreshes the token a minute before it expires. If the service refuses (you revoked kosa8 there, or the sign-in expired), the card says **Reconnect**. **Disconnect** revokes the token at the service when it supports that, and forgets it. No page, API answer, log or sandbox ever gets the token. Connect, disconnect and every refresh are in the audit log (`mcp.connect`, `mcp.disconnect`, `mcp.refresh`), and so is every tool call through the gateway (`mcp.call`, with the server and tool, never the arguments).

Some servers take an API key instead (Render), or offer one as an alternative (GitHub, Linear, Stripe, Supabase, Neon, Cloudflare). The card shows a key field; the key is sealed the same way. Some need no sign-in at all (AWS Knowledge, Microsoft Learn, DeepWiki, Cloudflare Docs, Hugging Face, Context7). Servers that run on your computer (filesystem, git, Playwright and other local servers) keep **Add**: see the [MCP server catalog](https://docs.kosa8.com/guides/mcp-catalog/).

Any other remote MCP server works too: **Add by URL** on Integrations, or `POST /v1/mcp/connections {"url": "https://…"}`. The URL must be public https; kosa8 does not reach private addresses or follow more than one redirect while it finds how the server signs in.

## Use a connected server

**From any MCP client**, with your kosa8 Cloud API key (a key with `sandboxes:write`):

```
claude mcp add --transport http linear https://api.kosa8.com/v1/mcp/gw/linear \
  --header "Authorization: Bearer $KOSA8_API_KEY"
```

**In a sandbox**, name the servers on create (or `"mcp": true` for every connected one). The sandbox's egress broker holds a gateway token for them; the sandbox gets `KOSA8_MCP_URL`, a placeholder `KOSA8_MCP_TOKEN`, `KOSA8_MCP_SERVERS` and `KOSA8_MCP_JSON`, an `mcpServers` config for Claude Code, Cursor and others. Like [secrets](https://docs.kosa8.com/guides/cloud-secrets/), this needs a sized sandbox that never sleeps.

```
curl -s -X POST https://api.kosa8.com/v1/sandboxes \
  -H "Authorization: Bearer $KOSA8_API_KEY" -H 'Content-Type: application/json' \
  -d '{"size": "2x4", "mcp": ["linear", "sentry"], "egress": {"presets": ["common"]}}'
# inside the sandbox
echo "$KOSA8_MCP_JSON" > .mcp.json
```

**From the CLI**:

```
$ kosa8 cloud mcp connect linear        # opens the sign-in in your browser
$ kosa8 cloud mcp connections           # what is connected, and how to use it
$ kosa8 cloud mcp tools linear
$ kosa8 cloud mcp disconnect linear
```

A connect started from the API or the CLI answers `open_url`: open it in a browser signed in to app.kosa8.com as the same person. It works once, for ten minutes.

## API

| Call | Who | What |
|---|---|---|
| `GET /v1/mcp/connectors` | any member | The catalog, with what Connect does for each here. |
| `GET /v1/mcp/connections` | any member | Connected servers: status, account, tool count, gateway URL. Never a token. |
| `POST /v1/mcp/connections/{id}/connect` | owner, admin | Start a sign-in (`url`, `open_url`), or connect at once with `{"key": …}` or when none is needed. |
| `POST /v1/mcp/connections` | owner, admin | The same for a server by URL. |
| `POST /v1/mcp/connections/{id}/refresh` | developer and up | Refresh its token now. |
| `POST /v1/mcp/connections/{id}/test` | developer and up | Initialize and list its tools. |
| `DELETE /v1/mcp/connections/{id}` | owner, admin | Revoke and forget. |
| `POST\|GET\|DELETE /v1/mcp/gw/{id}` | developer and up | The gateway: MCP Streamable HTTP, proxied. |

Errors carry a code the web app explains: `denied`, `expired`, `state_mismatch`, `invalid_grant`, `audience_mismatch`, `token_rejected`, `needs_client`, `registration_failed`, `ssrf_blocked`, `reconnect` and others. The full reference is in the [OpenAPI document](https://api.kosa8.com/openapi.json) under *MCP connections*.

---
Source: https://docs.kosa8.com/guides/mcp-connect/
