# Integrate Kosuke

Connect your coding agent to Kosuke, and Sensei runs the execution while you keep the decisions. One URL adds the MCP server, the CLI and an API key cover agents with no browser, and one prompt tells your agent the rest.

## Connect the MCP server

Sensei hosts the MCP server, so there is nothing to install or keep running. Add this URL to your client. The first time your client calls Sensei, it opens your browser so you can sign in and allow the app.

```text
https://app.kosuke.ai/api/mcp
```

**Claude Code**

Run this once:

```sh
claude mcp add --transport http kosuke https://app.kosuke.ai/api/mcp
```

Start Claude Code and type `/mcp` to sign in. The list then shows `kosuke` as connected.

**Codex**

Run:

```sh
codex mcp add kosuke --url https://app.kosuke.ai/api/mcp
codex mcp login kosuke
```

To check it, run `codex mcp list`. It shows `kosuke` with its URL.

**Claude**

1. Open Settings, then **Connectors**, then **Add custom connector**.
2. Name it `Sensei` and paste `https://app.kosuke.ai/api/mcp` as the URL.
3. Connect it, and sign in when Sensei asks.

**Cursor and others**

Any MCP client that supports Streamable HTTP and OAuth needs only the URL. It opens your browser to sign in at the first call.

In ChatGPT, open Settings, then **Developer mode**, then **Add server**, and paste `https://app.kosuke.ai/api/mcp` as the URL.

[Connect your coding agent](https://kosuke.ai/docs/interfaces/mcp.md) covers the consent screen, the toolsets and the options you can add to the URL.

## Install the CLI

You need Node.js 22.18 or later.

```sh
npm install -g @kosuke-ai/kosuke
kosuke auth login
```

`kosuke auth login` asks for an API key, created as below, and keeps what you type hidden. Sensei checks the key and saves it. In CI or any script that runs without a person, skip the login and set the `KOSUKE_API_KEY` environment variable instead. See [Sensei CLI](https://kosuke.ai/docs/interfaces/cli.md).

## Create an API key

The CLI, a script and an MCP client with no browser sign in with an API key.

1. In the web app, open Settings > You > API keys.
2. Type a name for the key, such as `laptop-cli`.
3. Under **Access**, tick **Tasks and sessions**.
4. Pick an end date: 30 days, 90 days or 1 year.
5. Press **Create API key**.
6. Press **Copy**. Sensei shows the key only once.

Export it:

```bash
export KOSUKE_API_KEY=kosuke_...
```

The CLI reads the same variable. An MCP client with no browser sends the key as a bearer token:

```http
Authorization: Bearer kosuke_...
```

Each tool call is checked against the key's access, so a tool outside it is refused with 403 `API_KEY_SCOPE`. [Without a browser](https://kosuke.ai/docs/interfaces/mcp.md#without-a-browser) shows the key on the Claude Messages API and the OpenAI Responses API, and [Authentication](https://kosuke.ai/docs/api/authentication.md) says what a key can reach.

## Paste this into your agent

```text
Read https://kosuke.ai/llms.txt, then connect to Kosuke for me.
1. Add the MCP server https://app.kosuke.ai/api/mcp and sign me in when the browser opens.
2. If you cannot open a browser, send the API key in KOSUKE_API_KEY as a bearer token, or install the CLI with npm install -g @kosuke-ai/kosuke, which reads the same variable.
3. Follow the rules in https://kosuke.ai/docs/api/build-an-agent.md: follow every turn to its end, answer the agent's questions, and stop when I or the credit limit stop you.
```

## What your agent should know

- Follow each turn to its end, answer the agent's Clarifications, and stop when a person or the credit limit stops you. See [Build an agent on Sensei](https://kosuke.ai/docs/api/build-an-agent.md).
- The API is described by an OpenAPI 3.1 document at `https://app.kosuke.ai/api/openapi.json`, which needs no API key.
- Every docs page has a Markdown copy, and `https://kosuke.ai/llms.txt` lists them all.

## Next steps

- [Connect your coding agent](https://kosuke.ai/docs/interfaces/mcp.md)
- [Sensei CLI](https://kosuke.ai/docs/interfaces/cli.md)
- [Build an agent on Sensei](https://kosuke.ai/docs/api/build-an-agent.md)
