# Use the Relyt One MCP server with Claude Code

> Connect Claude Code to Relyt One's remote MCP server with OAuth or an API key, see every tool it exposes grouped by read, write and destructive, and learn what each permission allows.

[Canonical page (HTML)](https://relyt.one/docs/mcp)

Relyt One runs a remote MCP (Model Context Protocol) server, so Claude Code can manage your organizations, projects, branches and managed auth, and inspect your databases with read-only SQL, without leaving the terminal. Add the server once with OAuth (you sign in with your browser) or with an API key.

## Server URL

```
https://mcp.relyt.one/mcp
```

The server uses the Streamable HTTP transport. Requests without a valid OAuth token or API key get `401 Unauthorized` with a `WWW-Authenticate` header that points MCP clients to the sign-in flow.

## Connect with OAuth (recommended)

Claude Code discovers the Relyt One sign-in page from the server, so there is no key to copy or store.

1. Add the server:

   ```bash
   claude mcp add --transport http relyt https://mcp.relyt.one/mcp
   ```

2. In Claude Code, run `/mcp`, select `relyt` and choose **Authenticate**. Your browser opens Relyt One; sign in if you need to.
3. On the consent page, choose the organization the application may reach and its permissions: read only, or read and write. Then select **Allow**.
4. Back in Claude Code, `/mcp` shows `relyt` as connected.

You can revoke access at any time in the [Relyt One console](https://relyt.one/console) under Organization settings → Authorized applications.

## Connect with an API key

Use an API key when you can't open a browser, for example on a remote machine or in CI.

1. In the [Relyt One console](https://relyt.one/console), open Organization settings → API Keys and create a key. Pick the organization it can reach, **Read-only** or **Read and write** access, and an expiration. Copy the key: it is shown only once.
2. Put the key in the `RELYT_API_KEY` environment variable and add the server:

   ```bash
   claude mcp add --transport http relyt https://mcp.relyt.one/mcp \
     --header "Authorization: Bearer $RELYT_API_KEY"
   ```

Your shell expands `$RELYT_API_KEY` when you run the command, and Claude Code saves the header in its configuration. To stop using the key, delete it in the console and run `claude mcp remove relyt`.

## Check the connection

Run `claude mcp list` in a terminal, or `/mcp` inside Claude Code: `relyt` should be connected. Then ask Claude something like "List my Relyt One organizations" or "Which regions can I create a project in?" to call a read tool.

## Permissions

- Tools only reach organizations you belong to, and only the organization you picked on the consent page or that the API key is limited to (unless you chose all organizations).
- Read-only access (a read-only API key, or an OAuth token without the write scope) lists only the 13 read tools. The 10 write and destructive tools are not listed, and calling one directly is rejected with `403`.
- Every tool carries MCP annotations: `readOnlyHint` for read tools and `destructiveHint` for destructive tools, so Claude Code can tell them apart. Claude Code asks before it runs an MCP tool unless you have allowed that tool; read destructive calls carefully before you approve them.
- The SQL tools (`list_tables`, `describe_table`, `run_sql_readonly`) connect with a dedicated read-only database role. They can't change data, and tables with row-level security return only the rows their policies allow.
- `create_project` never returns the database owner password. Reset it in the console when you want to connect with a Postgres client.

## Tools

The server exposes 23 tools. This list is generated from the server's own tool definitions, so it always matches what `tools/list` returns. Parameters marked with ? are optional.

### Read tools (13)

Look up resources and query data without changing anything. Read-only API keys and OAuth tokens with only the read scope see just these tools.

- `list_organizations` (List organizations): List the Relyt One organizations the API key's user is a member of.
- `list_projects` (List projects): List the projects in an organization. Parameters: `org_id`.
- `describe_project` (Describe project): Show a project's details, including its organization and branches. Parameters: `project_id`.
- `list_branches` (List branches): List the branches of a project (the default branch first). Parameters: `project_id`.
- `describe_branch` (Describe branch): Show a branch's details, including its parent branch and computes. Parameters: `project_id`, `branch_id`.
- `list_computes` (List computes): List the computes of a project, optionally limited to one branch. Parameters: `project_id`, `branch_id?`.
- `list_regions` (List regions): List the regions a project can be created in.
- `get_auth_config` (Get auth config): Show a branch's managed auth (Preview) status and settings: status, authUrl (the auth endpoint your app talks to), jwksUrl (public keys for verifying tokens), login methods and the claimsVersion that update_auth_config needs. No secrets are returned. When the status is not ready (not_enabled, provisioning, needs_upgrade, disabled, deleting) the result says what to do next in nextStep. To use it in an app, verify tokens with the @relyt/auth SDK (npm install @relyt/auth; https://github.com/relytcloud/relyt-auth-js) against jwksUrl; a complete example app is in https://github.com/relytcloud/relyt-auth-examples. Parameters: `project_id`, `branch_id`.
- `list_auth_users` (List auth users): List the end users who signed up through a branch's managed auth, newest first. Pass nextCursor from the previous page as cursor to get the next page. Requires auth to be ready on the branch. Parameters: `project_id`, `branch_id`, `limit?`, `cursor?`.
- `list_databases` (List databases): List the databases on a branch's primary compute. The SQL tools (list_tables, describe_table, run_sql_readonly) query the relytdb database; queryable marks it. Parameters: `project_id`, `branch_id`.
- `list_tables` (List tables): List the tables, views, materialized views and foreign tables in the branch's relytdb database, optionally limited to one schema. Runs against the branch's primary compute, database relytdb, as the dedicated read-only role relyt_mcp_ro (no BYPASSRLS: tables with row-level security return only the rows their policies allow). Platform schemas (relyt_*) and system schemas are not included. readable tells whether run_sql_readonly can read the object. At most 1000 objects are returned (truncated is set when there are more). Parameters: `project_id`, `branch_id`, `schema?`.
- `describe_table` (Describe table): Describe a table, view or materialized view in the branch's relytdb database: columns (type, nullability, default), primary key, indexes, whether row-level security is enabled, and the view definition for views. Runs against the branch's primary compute, database relytdb, as the dedicated read-only role relyt_mcp_ro (no BYPASSRLS: tables with row-level security return only the rows their policies allow). Platform schemas (relyt_*) and system schemas are not included. Parameters: `project_id`, `branch_id`, `table`, `schema?`.
- `run_sql_readonly` (Run read-only SQL): Run one read-only SQL query on the branch's relytdb database and return the rows. Only a single SELECT (WITH, VALUES, TABLE and UNION included) or EXPLAIN without ANALYZE is accepted; anything else (DML, DDL, SET, transaction control, multiple statements, SELECT INTO, FOR UPDATE, session-changing functions) is rejected before it reaches the database. Runs against the branch's primary compute, database relytdb, as the dedicated read-only role relyt_mcp_ro (no BYPASSRLS: tables with row-level security return only the rows their policies allow). Platform schemas (relyt_*) and system schemas are not included. The query runs in a read-only transaction with a 15 s statement timeout. Results are truncated at 1000 rows or 1 MB (truncated and truncationReason are set); add LIMIT or aggregate for large tables. Unqualified names resolve in the public schema. Values are returned as PostgreSQL text; very long values are cut on the server (cutRows is set). Parameters: `project_id`, `branch_id`, `sql`.

### Write tools (5)

Create resources or change settings. They need a read-and-write API key or an OAuth token with the write scope.

- `create_project` (Create project): Create a project (with a default branch and its primary compute) in an organization. The database owner password is generated by the server and is not returned; reset it in the console to connect. Parameters: `org_id`, `name`, `region`.
- `create_branch` (Create branch): Create a branch in a project, from the default branch or from the given parent branch. Parameters: `project_id`, `name`, `parent_branch_id?`.
- `enable_auth` (Enable managed auth): Turn on managed auth (Preview) for a branch: sets up the auth schema in the branch database and an auth endpoint (authUrl) with public signing keys (jwksUrl). Requires the owner or admin role; safe to repeat. Returns within about 25 seconds: if setup is not finished yet the result has status "provisioning" (not an error) and a nextStep; call enable_auth again after retryAfterSeconds, or poll get_auth_config, until the status is ready. Email and password sign-in is on by default; social login needs configure_auth_provider and update_auth_config. To use it in an app, verify tokens with the @relyt/auth SDK (npm install @relyt/auth; https://github.com/relytcloud/relyt-auth-js) against jwksUrl; a complete example app is in https://github.com/relytcloud/relyt-auth-examples. Parameters: `project_id`, `branch_id`.
- `update_auth_config` (Update auth config): Change a branch's managed auth settings: trusted origins, allowed callback URLs, which login methods are on, and access control roles. Pass expected_claims_version = the current claimsVersion from get_auth_config (a concurrent change makes the call fail; read again and retry). Only the fields you pass change. A social provider can only be turned on after configure_auth_provider stored its credentials, and at least one login method must stay on. Requires the owner or admin role and auth to be ready. Parameters: `project_id`, `branch_id`, `expected_claims_version`, `trusted_origins?`, `allowed_callback_urls?`, `providers?`, `access_control?`.
- `configure_auth_provider` (Configure social login provider): Store your own OAuth app credentials (client id and client secret) for a social login provider on a branch. The client secret is stored encrypted and is never returned. Register the returned callbackUrl in your OAuth app, then turn the provider on with update_auth_config. Requires the owner or admin role; auth must be enabled on the branch. Parameters: `project_id`, `branch_id`, `provider`, `client_id`, `client_secret`.

### Destructive tools (5)

Delete resources, remove sign-in providers, rotate signing keys or revoke sessions. These actions can't be undone. They need a read-and-write API key or an OAuth token with the write scope.

- `delete_branch` (Delete branch): Delete a branch and its computes. The default branch and branches with child branches cannot be deleted. Parameters: `project_id`, `branch_id`.
- `delete_project` (Delete project): Delete a project with all of its branches and computes. Requires the owner or admin role in the organization. Parameters: `project_id`.
- `remove_auth_provider` (Remove social login provider): Delete the stored OAuth credentials of a social login provider on a branch. The provider must be turned off first with update_auth_config. Requires the owner or admin role. Parameters: `project_id`, `branch_id`, `provider`.
- `rotate_auth_jwks` (Rotate auth signing keys): Rotate a branch's token signing key. New tokens are signed with the new key; the old key stays in the public JWKS for a grace period, so tokens already issued keep verifying until they expire. Limited to a few rotations per grace period. Requires the owner or admin role and auth to be ready. Parameters: `project_id`, `branch_id`.
- `revoke_auth_user_sessions` (Revoke an auth user's sessions): Sign one end user out everywhere: deletes all of that user's sessions on the branch. Tokens already issued stay valid until they expire (at most 15 minutes). Requires the owner or admin role and auth to be ready. Parameters: `project_id`, `branch_id`, `user_id`.

## FAQ

### Claude Code says the server needs authentication. What should I do?

Run `/mcp`, select `relyt` and choose **Authenticate** again. This happens when the access was revoked or has expired. With an API key, check in the console that the key still exists and has not expired.

### Why can't I see the create or delete tools?

Your API key is read-only, or you didn't grant the write permission on the consent page. Create a read-and-write key, or revoke the application under Authorized applications and authenticate again with read and write selected.

### Can I limit Claude to one organization?

Yes. Pick a single organization on the consent page, or create an API key limited to that organization.

### Does it work with other MCP clients?

The server follows the MCP specification: Streamable HTTP transport and OAuth discovery through protected resource metadata. Clients that support remote MCP servers with OAuth, or with a custom `Authorization` header, can use the same URL. This guide covers Claude Code, the client we test with.

### How do I disconnect?

Run `claude mcp remove relyt`. Then revoke the application under Organization settings → Authorized applications, or delete the API key, so the old credentials stop working too.
