# 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's page from **Apps**. It shows your app as it takes shape: a first look, the steps to your private preview, and **Open your app** once the preview is ready. If your coding agent stopped before it finished, choose **Copy the prompt** and paste it there. The prompt 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 coding agent** and follow the one-time settings below.

## Connect on a self-hosted installation

With the Diakrin plugin that IT built for your installation, your AI tool is already pointed at it: the first time your agent uses Diakrin, your browser asks you to **Allow** it. Without the plugin, add your installation's MCP address (your Diakrin address followed by `/mcp`) in your tool:

```sh
claude mcp add --transport http diakrin https://diakrin.example.com/mcp      # Claude Code
codex mcp add diakrin --url https://diakrin.example.com/mcp && codex mcp login diakrin   # Codex
```

Claude Code and Codex sign in through your browser. For OpenCode, add the same address to `opencode.json` as a remote MCP server whose `Authorization` header reads `Bearer {env:DIAKRIN_MCP_TOKEN}`. OpenCode does not sign in through the browser: create that connection token in the console under **Settings → AI assistants**: open **Connecting a script or a tool without sign-in?** and select **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 assistants** when you no longer need it.

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 assistants**, open **Connecting a script or a tool without sign-in?** 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. Claude Code and Codex (and the Diakrin plugin for Claude Code, Cursor and Codex) sign in through your browser instead, so they need no connection token.

```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 assistants** 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).
