# Connect your coding tool

> Give your coding agent scoped access to your Diakrin apps over MCP.

Source: https://diakrin.com/docs/builders

Diakrin’s console and its MCP connection share the same organization and app permissions. Your coding agent works only within the access granted to your identity, and every call is checked again on the server.

```diagram mcp-connection
One personal connection reaches every app you can access. It follows changes to your access immediately and cannot reach another organization.
```

## Works with your coding tool

```cards
Claude Code | /docs/builders#create-your-connection | Add Diakrin as a remote MCP server. | claude
Cursor | /docs/builders#create-your-connection | Add Diakrin in Cursor's MCP settings. | cursor
Codex | /docs/builders#create-your-connection | Use the TOML configuration shown below. | openai
OpenCode | /docs/builders#create-your-connection | Add Diakrin as a remote MCP server in `opencode.json`. | terminal
Terminal and CLI | /docs/cli | The `diakrin` command for terminals and agents. | terminal
```

## Begin with the guided brief

Open your app in **Apps** and go to **Build it with your AI tool**. If your tool is already connected, copy the starter brief and paste it there. The brief includes the exact app, sample-data guidance and required approvals.

The brief appears only when your current app access permits building. Viewing access does not grant building permission. If your tool needs a connection, select **Connect your AI tool** and follow the one-time settings below.

## Connect on a self-hosted installation

Sign in with the CLI first (see [Install and use the Diakrin CLI](/docs/cli#sign-in-to-a-self-hosted-installation)), then print the connection command for your tool:

```sh
diakrin mcp config --client claude
```

Run the line it prints. Use `--client codex` for Codex. The first time your agent uses Diakrin, your browser asks you to **Allow** it.

For OpenCode, `diakrin mcp config --client opencode` prints an `opencode.json` block instead of a command. Add it to your `opencode.json`. OpenCode does not sign in through the browser: the block reads a connection token from `DIAKRIN_MCP_TOKEN`. Create that token in the console under **Settings → AI tools** with **Create connection token**, and put it in OpenCode's local secret environment as `DIAKRIN_MCP_TOKEN`. Keep it out of chat, project files and source control. The token acts as you and does not expire; revoke it in **Settings → AI tools** when you no longer need it.

To check that the tool reaches the right installation as you, run `diakrin doctor --online`. It shows the saved address and your signed-in session and names one next step when something is wrong. It never prints a token.

On installations whose apps are private without sign-in, your first app is the private synthetic workspace: a fixed screen with example data only, never real company records. Its code belongs to the template, so your agent saves it and gets you its private Preview rather than designing screens. Its state shows on the app page in the console.

> [!SELF-HOSTED]
> Claude Code and Codex sign in to your installation directly, so there is no token to create, copy or store for them. Only OpenCode uses a connection token, created on your installation. Nothing is sent to Diakrin's hosted service.

## Create your connection

You need one connection, not one per app. It acts as you: it reaches every app you can access, apps shared with you later and apps you create through it.

1. Sign in to the console and select the correct organization.
2. Open **Settings → AI tools** and select **Create connection token**.
3. Copy the token into the coding tool’s local secret environment as `DIAKRIN_MCP_TOKEN`. Keep it out of chat, project files and source control.
4. Copy the exact MCP configuration shown by the console into your tool’s settings. Use the endpoint it supplies for your environment.
5. Connect from your tool and confirm that it lists the apps you have access to.

The console displays Codex configuration in this form. Replace the example endpoint with the console-supplied value; the example is not a connection test.

```toml
[mcp_servers.diakrin]
url = "https://api.diakrin.com/mcp"
bearer_token_env_var = "DIAKRIN_MCP_TOKEN"
```

For OpenCode, add the same endpoint to `opencode.json` as a remote MCP server. OpenCode substitutes `{env:DIAKRIN_MCP_TOKEN}` from its environment, so the token never appears in the file. On BYOC, copy this block as shown: `diakrin auth pair` creates no installation profile, so `diakrin mcp config` prints this block only on a self-hosted installation you signed in to with `diakrin auth login`.

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "diakrin": {
      "type": "remote",
      "url": "https://api.diakrin.com/mcp",
      "enabled": true,
      "headers": { "Authorization": "Bearer {env:DIAKRIN_MCP_TOKEN}" },
      "oauth": false
    }
  }
}
```

## What the connection can and cannot do

| It can | It cannot |
| --- | --- |
| Reach every app you can access, including apps shared with you later | Do anything your current role and app access do not allow |
| Create apps when your company lets you create them | Reach another organization |
| Request builds, previews and data access for review | Approve its own requests or delete apps |

Every call is checked against your current role and app access, so changes to your access apply immediately.

> [!SAAS]
> Connection tokens do not expire. Your active tokens are listed in **Settings → AI tools** by their last four characters; use **Revoke** when one is no longer needed or may have been exposed, and **Create another token** for another tool or device. Removing membership or changing organization roles also invalidates the connection.

## Start with an app

Ask your tool to select the exact Diakrin app ID, read its requirements, inspect available capabilities and identify missing prerequisites. For example: “Connect to the Team request tracker app and explain its approved capabilities before building.”

Verify the agent’s changes in the console and reload the app. A configured URL or token alone does not establish a working client connection.

For app-specific business questions, the agent uses `app.intent.start`, `app.intent.read` and `app.intent.answer`. These sessions are bound to the selected app and your identity, and cannot be read through another app. The [MCP tool reference](/docs/mcp-tools) lists every tool by task.

## Other tools and plugins

To work from a terminal, or to give your agent a command-line tool, see [Install and use the Diakrin CLI](/docs/cli).

Other MCP-capable tools need support for the server’s Streamable HTTP transport and secure bearer-token configuration. Use the same console-supplied endpoint and a secret store or environment variable supported by the tool.

Native plugin installation and interactive OAuth linking depend on the tool and the deployed Diakrin configuration. If your tool cannot configure the current bearer connection, ask your onboarding contact for the supported setup; do not paste a company SSO session token into an MCP configuration.

See [Troubleshooting and help](/docs/troubleshooting) if your tool reports revoked access or cannot find an app.

## When the app is ready to ship

Saving source, building, previewing and promoting a release are covered in [Preview, approve and deploy](/docs/deploy). To decide who can open the finished app, see [Choose who can open an app](/docs/app-signin#choose-who-can-open-an-app).
