# MCP server

> The Sysnee MCP server at https://mcp.sysnee.com/mcp lets a coding agent list, deploy and create resources in your account, with OAuth and scopes.

## Address

```text
https://mcp.sysnee.com/mcp
```

- **Streamable HTTP** transport, stateless. There is no local (stdio) version to install.
- Sign-in through **OAuth 2.1** in the browser. The agent discovers the authorization server on its own (RFC 9728), registers through a Client ID Metadata Document or dynamic registration, and uses PKCE.
- It only accepts OAuth tokens issued for this address. A personal token (`sysnee_pat_…`) is refused: for scripts, use the [API](https://docs.sysnee.com/en/api.md) or the [CLI](https://docs.sysnee.com/en/cli.md).

To set it up in your agent, see [Connect your agent](https://docs.sysnee.com/en/agents.md).

## What you approve at sign-in

The consent screen at `cloud.sysnee.com` shows the app's name, where it returns to, and the permissions it asks for. You choose:

- **Scopes:** read scopes come checked. You check deploy and databases. Delete scopes never come checked. See [Tokens and scopes](https://docs.sysnee.com/en/tokens.md).
- **Projects:** all of them or only some.

Write permissions ask for your second factor. Creating databases needs account level 3.

The access is listed in **Console → Security → Authorized apps**, with scopes, projects and last use, and can be revoked there. The **Activity** tab shows every action the agent took.

## Tools

| Tool | Scope | What it does |
|---|---|---|
| `whoami` | any | User, organization, scopes and projects of this connection. The agent calls it first |
| `list_projects` | `account:read` | The organization's projects |
| `list_sites` | `sites:read` | Sites, optionally in one project |
| `get_site` | `sites:read` | Address, domains, active deployment and Git |
| `list_deployments` | `sites:read` | A site's deployments, newest first |
| `get_deployment_logs` | `sites:read` | Build log from an `offset`, in `untrusted_log` |
| `list_domains` | `sites:read` | Domains, the DNS records they need, and status |
| `create_site` | `sites:deploy` | Create an empty site at `<name>.sysnee.app` |
| `create_upload_url` | `sites:deploy` | One-time URL (15 minutes) to upload the build's `.zip` |
| `redeploy_site` | `sites:deploy` | New build of a Git-connected site's branch |
| `activate_deployment` | `sites:deploy` | Serve an earlier deployment again (rollback) |
| `update_site` | `sites:deploy` | Turn SPA mode or visitor analytics on or off |
| `add_domain` | `sites:deploy` | Add a domain and get its DNS records |
| `verify_domain` | `sites:deploy` | Check the DNS now |
| `list_databases` | `databases:read` | PostgreSQL databases, without passwords |
| `get_database` | `databases:read` | State and connection details, without the password |
| `create_database` | `databases:write` | Create a database; returns a link for you to see the password |
| `stop_database` | `databases:write` | Stop the database (compute stops being billed) |
| `start_database` | `databases:write` | Start a stopped database |
| `request_deletion` | `sites:delete` or `databases:delete` | File a deletion request; deletes nothing |
| `get_usage` | `billing:read` | This month's usage and estimated cost |

A tool outside the connection's scopes answers with an error naming the missing scope. To get it, reconnect and approve again.

`create_database`, `stop_database`, `start_database` and `request_deletion` are for the organization's owner only.

## Deploying a site

1. `create_site` (or `list_sites` to find an existing one).
2. The agent runs the build and zips the output folder (for example `dist/`), with `index.html` at its root.
3. `create_upload_url` returns a `curl` command with a signed URL, valid for 15 minutes and for one use. The agent runs it.
4. The deployment starts when the upload ends. The agent follows it with `list_deployments` and `get_deployment_logs`.

## What the agent never gets

- **Database passwords.** `create_database` has Sysnee generate the password and returns a `reveal_url`. You open the link signed in to the console. It shows the password once, for 15 minutes, and only to the same user. The connection string has `<PASSWORD>` in its place. To have the agent write the password straight into `.env` without seeing it, use the [CLI](https://docs.sysnee.com/en/cli.md) (`sysnee db create --dotenv .env`).
- **Immediate deletions.** `request_deletion` returns a `confirm_url`. Nothing is deleted until you open it, type the resource's name and, for databases, pass your second factor. The request expires after 30 minutes if nobody confirms it.
- **Tokens.** The agent uses its client's own OAuth token. No tool returns tokens or keys.

## Untrusted content

Build logs, commit messages, resource names and error output are written by people or builds. The server:

- returns logs inside the `untrusted_log` field;
- strips control characters and invisible sequences from text;
- tells the agent never to follow instructions found in those fields.

Still, review what the agent proposes to do after reading a log.

## Limits

- 120 requests per minute per token.
- 30 uploads per hour per token.
- The account's limits for creating sites and databases (see [Sites](https://docs.sysnee.com/en/sites.md) and [PostgreSQL](https://docs.sysnee.com/en/postgres.md)).

## Audit

Every tool that changes something records an event (`mcp.<tool>`) with the app, the token, the resource, the IP and the result. Reads are not recorded. Events are kept for 365 days in **Console → Security → Activity**.
