# The connector for AI assistants

Rezin Core has a connector that speaks the Model Context Protocol (MCP), so an AI assistant or coding tool that supports MCP can work on your projects: list tables, run SQL, apply migrations, set secrets, read the audit trail, deploy and test functions.

| | |
|---|---|
| Address | `https://api.rezincore.com/mcp` |
| Sign-in | Connect by signing in (OAuth 2.1, the assistant sends you to the console to agree), or a [personal access token](https://rezincore.com/docs/tools/access-tokens.md) as a bearer token: `Authorization: Bearer rzt_…` |
| Transport | Streamable HTTP: one JSON-RPC request per POST, one JSON answer |

## Read this first

> **Important.** An assistant you connect is an outside service. What it reads through the connector (rows, table names, log lines) goes to whoever runs that assistant. Do not connect one to a project that holds health information, or any other data you may not share with that provider.

- **Give it the least it needs.** One project, look only, only the parts it will use. Allow changes or deploying functions only for the session that needs it, then disconnect.
- The connector cannot read a secret's value, cannot reach another client's project, cannot reach the platform's own tables, and cannot do anything your account cannot.
- Everything it does is on the project's **Activity → Record** page under your name, marked as coming through the connector.

## Connect by signing in

Give your assistant the address `https://api.rezincore.com/mcp` and nothing else. An assistant that supports MCP authorization will:

1. Open the Rezin Core console in your browser, where you sign in as usual (including your authenticator code).
2. Show you a page naming the program that is asking, where you choose:
   - **Look only**, or **look and change**.
   - **What it reaches**: chosen companies and projects, or everything you can reach. Nothing is ticked to begin with.
   - **Parts**, each on or off: your account and companies, database, functions, files, secrets, record of activity, documentation.
   - **May deploy functions**: off unless you tick it. It needs "look and change" and the Functions part.
3. Send you back to the assistant when you press **Connect**. **Refuse** sends you back with nothing granted.

The assistant is shown only the tools inside the parts you chose. A tool outside them is not listed and, if called by name, answers "No such tool".

A connection lasts 180 days. Its access token is replaced every hour by the assistant itself. See your connections, when each was last used, and **Disconnect** any of them under **Your account → Connected assistants**. A disconnected assistant stops at once.

Rezin Core staff accounts cannot connect an assistant.

### For people building a client

| | |
|---|---|
| Protected resource metadata | `https://api.rezincore.com/.well-known/oauth-protected-resource/mcp` (also named in the `WWW-Authenticate` header of a `401`) |
| Authorization server metadata | `https://api.rezincore.com/.well-known/oauth-authorization-server` |
| Registration | Dynamic client registration at `POST https://api.rezincore.com/oauth/register`. Public clients only (`token_endpoint_auth_method` `none`) |
| Authorization | `https://console.rezincore.com/oauth/authorize`, authorization code with PKCE (`S256` only) |
| Token | `POST https://api.rezincore.com/oauth/token`: `authorization_code` and `refresh_token`. The refresh token is replaced on every use |
| Revocation | `POST https://api.rezincore.com/oauth/revoke` |
| Return addresses | `https` addresses, `http` on `localhost` or `127.0.0.1` (any port), or an application's own scheme |
| `resource` | `https://api.rezincore.com/mcp`. A token from here works only at the connector |

An authorization code lasts 60 seconds and works once. Showing a code a second time closes the connection it opened.

## Connect with a token

Any MCP client that supports HTTP servers with a bearer token works. The shape most tools use:

```json
{
  "mcpServers": {
    "rezin-core": {
      "type": "http",
      "url": "https://api.rezincore.com/mcp",
      "headers": { "Authorization": "Bearer ${REZIN_TOKEN}" }
    }
  }
}
```

Keep the token in an environment variable or the tool's own secret store, not in a file you commit.

## Tools

| Tool | What it does | Needs |
|---|---|---|
| `list_projects` | The projects the token reaches, with each project's ID, its database schema and the role its application runs as | always |
| `list_tables` | A project's tables with their columns, whether row-level security is on, and how many rules each has | Database |
| `run_sql` | SQL inside one project. Read-only unless `write` is true. At most 1,000 rows come back. | Database; change for `write` |
| `list_migrations` | Migrations already applied, by name | Database |
| `apply_migration` | One migration, in a single transaction, recorded so it is never applied twice | Database, change |
| `list_secret_names` | The names of a project's secrets. Never values. | Secrets |
| `set_secret` | Store or replace a secret. The value cannot be read back. | Secrets, change |
| `get_logs` | The newest entries of the project's audit trail: what happened, when, and to what kind of thing. No statements or values. | Record of activity |
| `list_files` | The files in a storage bucket: names and sizes, not contents | Files |
| `list_functions` | The project's functions: name, whether each is on, its version, timetable, and how its last day of runs went | Functions |
| `get_function` | One function's current code and settings | Functions |
| `deploy_function` | Store new code as a function's next version and make it live, creating the function if new | Functions, change, deploy |
| `update_function` | Change a function's settings | Functions, change, deploy |
| `invoke_function` | Run a function once as a test and return its answer | Functions, change |
| `get_function_logs` | How a function's recent runs ended and what it printed | Functions |
| `delete_function` | Remove a function and all its versions and logs | Functions, change, deploy |
| `whoami` | What this connection may do: its parts, whether it may change things or deploy functions, and when it ends | always |
| `list_companies` | Your companies, your role in each, and how many projects each has | Your account and companies |
| `search_docs` | Search this documentation and get the best matching sections with their addresses | Documentation |
| `read_doc` | One documentation page as Markdown | Documentation |

### Arguments

| Tool | Arguments |
|---|---|
| `list_projects` | none |
| `list_tables` | `project` |
| `run_sql` | `project`, `sql`, `write` (optional, default false) |
| `list_migrations` | `project` |
| `apply_migration` | `project`, `name` (for example `0003_add_orders.sql`), `sql` |
| `list_secret_names` | `project` |
| `set_secret` | `project`, `name` (capitals, digits and underscores), `value`, `description` (optional) |
| `get_logs` | `project`, `limit` (optional, 1 to 500) |
| `list_files` | `project`, `bucket`, `prefix` (optional), `organization` (optional; the project's first if left out) |
| `list_functions` | `project` |
| `get_function` | `project`, `name` |
| `deploy_function` | `project`, `name` (lowercase letters, digits and dashes), `code` (one JavaScript module) |
| `update_function` | `project`, `name`, and any of `enabled`, `requireUser`, `timeoutSeconds` (1 to 60), `everyMinutes` (or null for none), `secrets` (a list of names), `version` |
| `invoke_function` | `project`, `name`, `body` (optional JSON text), `method` (optional; `POST` by default) |
| `get_function_logs` | `project`, `name` |
| `delete_function` | `project`, `name` |
| `whoami`, `list_companies` | none |
| `search_docs` | `query` |
| `read_doc` | `path` (for example `database/row-level-security`) |

`project` is always the project ID: twenty lowercase letters, as `list_projects` gives it.

SQL runs as the project's own confined database role, exactly as the console's SQL workspace does. **A table the assistant creates starts closed to your application until a row-level security rule exists.**

### Exports

Two tools under **Database**, for a connection that was also given **Files** and whose account is an owner: `list_exports`, and `request_export` (read-write), which starts a complete export of a project. The archive itself is downloaded in the console or with `rezin export`, not through the connector. See [Export your project](https://rezincore.com/docs/moving/export.md).

## Technical notes

- Methods: `initialize`, `ping`, `tools/list`, `tools/call`. Notifications are accepted and get no answer.
- Protocol versions `2025-06-18`, `2025-03-26` and `2024-11-05` are accepted.
- No long-lived stream and no session is kept between requests. `GET /mcp` answers `405`.
- A batch of up to 20 requests in one POST is answered in order.
- A missing or wrong token answers HTTP `401` with `WWW-Authenticate: Bearer`.
- A failed tool call comes back as a result with `isError: true` and the reason in words, not as a protocol error.

Try it with `curl`:

```
curl -s https://api.rezincore.com/mcp -H "authorization: Bearer $REZIN_TOKEN" \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_projects","arguments":{}}}'
```
