# Connecting your agent to Osyrin

> `osy setup claude` connects Claude Code to Osyrin in one command: the Osyrin skills for every project, and Osyrin's Admin registered as an MCP server (`https://admin.osyrin.app/mcp`) — `codex` and `cursor` do the same for those agents. Then the agent can read, as tools, who you are, your organizations, their apps (address, served version, Admin link), each app's environments, its last deployments and its recent errors, and your organization's policy floor. Every tool only reads, and answers exactly what Admin and the REST API show you — nothing of an organization you are not in. You sign in in your browser, on Osyrin's own page.

<!-- id: local-connecting-your-agent · area: local · stability: preview · html: https://osysharp.com/reference/local/connecting-your-agent/ -->

## Summary        {#summary}

Run `osy setup claude` once. It puts the Osyrin skills where Claude Code reads them in every project, and registers
Osyrin's Admin as an MCP server with Claude Code's own `claude mcp add`. The first time the agent uses the tools, your
browser opens Osyrin's sign-in page — the same one `osy login` uses. From then on the agent can answer *"which of my apps
failed to deploy today?"* or *"what errors did billing log in the last hour?"* by itself, as you, without running a
command. The tools only read: deploying, inviting people, setting secrets and restoring stay with `osy` and `osyrin`, where
Claude asks you first.

The installer runs `osy setup claude` for you, and `osy login` offers it. The Osy# plugin for Claude carries the same
skills and the same MCP server, so with the plugin there is nothing to set up.

## Signature      {#signature}

```console
osy setup claude|codex|cursor [--server <URL>] [--remove] [--json]
```

## Description    {#description}

**What it does.** Three things, and it says each in a line:

| agent | the Osyrin skills go to | Osyrin's MCP server is registered with |
|---|---|---|
| `claude` | `~/.claude/skills` (or `$CLAUDE_CONFIG_DIR/skills`) | `claude mcp add --transport http --scope user osyrin <url>` — for every project |
| `codex` | `~/.codex/skills` (or `$CODEX_HOME/skills`) | `codex mcp add osyrin --url <url>` |
| `cursor` | `~/.cursor/skills` | an `osyrin` entry with that `url` in `~/.cursor/mcp.json`, merged into what the file holds |

- **The server** is the one every `osy` verb addresses: `--server`, else the project's `osyrin.json`, else the one you
  signed in to last, else `https://osyrin.app`. The address registered is that installation's Admin plus `/mcp` —
  `https://admin.osyrin.app/mcp` on Osyrin Cloud.
- **No secret is written anywhere.** Only the address is registered. The agent signs in in your browser and keeps its own
  ticket, which it renews by itself for 30 days.
- **Run again, nothing changes**: skills that are current are left as they are, and a server already registered at that
  address is not touched. A server registered at another address (another `--server`) is pointed at the new one.
- **`--remove` undoes it**: the Osyrin skills come out (anything else in that folder stays) and the `osyrin` server is
  unregistered. Your `osy login` sign-in is kept; `osy logout` ends it.
- Without Claude Code on this computer `osy setup claude` still installs the skills, so they are there when you install it,
  and says to run it again then. `codex` and `cursor` write nothing unless that agent is on the computer.
- **The skills stay current by themselves.** The first run of a new `osy` — after `osy upgrade`, `brew upgrade` or any other
  way — rewrites the installed copies that differ from its own text. One you removed is not added back.

**The tools.** Two catalogs. Each tool runs as the account you signed in with and reads only what that account may read in
Admin's pages and REST API.

| tool | answers |
|---|---|
| `WhoAmI` | your email, your name, whether you are a platform operator, and your organizations with your role in each |
| `MyOrganizations` | your organizations: slug, name, your role (Owner, Admin, Member) and the organization's page in Admin |
| `AppsOf(organizationSlug)` | the organization's apps you can see: slug, name, address, the version its users are served, the environment serving it, its page in Admin |
| `EnvironmentsOf(appSlug)` | the environments of the app's organization, production first: rank, kind, whether a deploy needs an approval, and whether the app is placed there with its served version, state and address |
| `DeploymentsOf(appSlug, environmentSlug, last)` | the last 1–20 deployments into that environment, newest first: version, the version before, state, who started it, when, and why it failed |
| `SlowQueriesOf(appSlug, environmentSlug, hours)` | the app's top 20 statements by total time over the last 1–48 hours (24 by default) in that environment: calls, total and mean milliseconds, rows, the statement's shape with no values and its index suggestion (`Suggestion`: the `[Index(…)]` to declare with its file and entity, a platform-table line, or that an index already serves it), plus the zone the database runs on and what that zone sends (`full`; below it no statement is sent). The app's zone reads them from `pg_stat_statements` every fifteen minutes and Admin keeps them 48 hours. The app's Owners and Admins, its organization's app managers and platform operators only (not a Developer on its team) |
| `RecentErrorsOf(appSlug)` | the app's error lines of the last hour (at most 50), newest first, each with its correlation id — or, when they cannot be read from here, why |
| `AppPolicyFloorOf(appSlug)` | the organization's policy as it binds this app, for its builders — read it before adding a host, a package or a secret ([Your organization's policy: what each kind of rule affects, what its refusal says, and how to ask](https://osysharp.com/reference/project/organization-policy/)) |
| `OrgFloorOf(organizationSlug)` | the organization's policy floor, area by area |

The platform's own `whoami`, `list_types`, `watch`, `changes` and `unwatch` come with every session; `watch` re-reads a tool's
answer when what it read changes.

A third catalog, `release`, is listed only to the platform's release machine principal: it holds the calls a release makes, so
the platform organization's `mcp.toolSets` rule can name them. A person is never listed it.

**What you see is what Admin shows you.** The tools read the same rows the REST API reads for you, with the same rules:

- A member of one organization sees nothing of another's. Asking about an organization or app you cannot see is answered *"No
  organization you can see has the slug '…'"* or *"No application you can see has the slug '…'"* (`RecentErrorsOf`: *"No
  application has that slug, or you cannot see it."*), whether or not it exists.
- In your own organization, an Owner or Admin sees every app; a member sees the apps whose team they are on.
- A seat on an app's team counts only while your membership of its organization is active.
- Your organization's policy decides what its policy tools show you, as on its policy pages.
- A machine principal's key sees what that key sees over the REST API — for a platform operator's machine, every organization.

**Read-only.** No tool creates, changes or deletes anything. The platform checks each tool's code before a `watch` runs it and
refuses one that could write; every tool here passes that check.

**Errors are per app, not per environment.** An app's log store keeps the lines of all its environments together, so
`RecentErrorsOf` takes the app only. `osyrin app logs --app <slug> --corr <id>` follows one request's other lines.

**Signing in.** The connection uses Admin's own sign-in: your client is sent to Osyrin's sign-in page, and keeps a ticket that it
renews by itself for 30 days. The ticket stays in the client's own store; `osy setup` registers only the address. A person's own
API key works too, unless your Osyrin installation allows only machine keys; a machine principal's key always does, for
automation.

**Another client.** Any MCP client that speaks streamable HTTP and OAuth connects the same way: give it the URL
`https://admin.osyrin.app/mcp` (your installation's Admin address plus `/mcp`).

## Examples       {#examples}

```console
# Connect Claude Code to Osyrin: the skills and the tools. Then, in Claude, run /mcp and pick osyrin to sign in.
osy setup claude

# The same for Codex (then `codex mcp login osyrin`) or Cursor (then turn osyrin on in its MCP settings).
osy setup codex
osy setup cursor

# Another installation of Osyrin.
osy setup claude --server https://admin.example.com

# Undo it.
osy setup claude --remove
```

By hand, any MCP client that speaks streamable HTTP and OAuth takes the address:

```json syntax
{ "mcpServers": { "osyrin": { "type": "http", "url": "https://admin.osyrin.app/mcp" } } }
```

## See also       {#see-also}

- [Signing in to Osyrin](https://osysharp.com/reference/local/signing-in-to-osyrin/) — `osy login`, the CLI's sign-in.
- [Asking Claude to run your Osyrin account](https://osysharp.com/reference/local/asking-claude-to-run-your-osyrin-account/) — the skills that drive `osy` and `osyrin`, writes included.
- [Upgrading the toolchain](https://osysharp.com/reference/local/upgrading-the-toolchain/) — a new `osy`, whose first run brings the installed skills up to date.
- [Your organization's policy: what each kind of rule affects, what its refusal says, and how to ask](https://osysharp.com/reference/project/organization-policy/) — what the policy tools read.
