> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/ai-totsru/aikido-mcp/token-authentication.md).

# 代替トークン認証

トークン認証は、デフォルトのブラウザベースのログインフローの代替です。次の場合に使用します：

* Aikido MCP を CI/CD パイプラインやその他のヘッドレス環境で実行している場合
* セットアップでブラウザを開けない場合（例：リモートサーバー、Docker コンテナ）
* 認証情報を環境変数で明示的に管理したい場合

ローカルマシンでの対話的な利用では、ブラウザベースのログインフローのほうが簡単で推奨されます。

## トークンの作成

Aikido で次へ移動します： [Settings → Integrations → IDE → MCP](https://app.aikido.dev/settings/integrations/ide/mcp) そして Personal Access Token (PAT) を作成します。安全な場所にコピーしてください。

## エージェントによるセットアップ

### Claude Code

セットアップスキルにトークンを引数として渡します：

```
/aikido:setup your-PAT-here
```

これにより、トークンが Claude Code のユーザー設定に保存され、MCP サーバーが自動的に登録されます。

代わりに、次を設定します： `AIKIDO_API_KEY` Claude Code を起動する前に、環境で次を設定します：

{% tabs %}
{% tab title="macOS / Linux" %}

```shellscript
export AIKIDO_API_KEY=your-token-here
claude
```

{% endtab %}

{% tab title="Windows PowerShell" %}

```powershell
$env:AIKIDO_API_KEY="your-token-here"
claude
```

{% endtab %}
{% endtabs %}

### Cursor

Aikido を次から追加する場合： [Cursor Marketplace](https://cursor.com/marketplace/aikido)、トークンを次として設定します： `AIKIDO_API_KEY` インストール中に求められたら、環境変数として入力します。

手動でセットアップする場合は、トークンを Cursor MCP 設定に追加します：

```json
{
  "mcpServers": {
    "aikido": {
      "command": "npx",
      "args": ["-y", "@aikidosec/mcp@latest"],
      "env": {
        "AIKIDO_API_KEY": "your-token-here"
      }
    }
  }
}
```

### OpenAI Codex CLI

トークンを次を介して渡します： `--env` MCP サーバーを登録するときに、フラグを使用します：

```shellscript
codex mcp add aikido \
  --env AIKIDO_API_KEY=your-token-here \
  -- npx -y @aikidosec/mcp@latest
```

### Gemini CLI

```shellscript
gemini mcp add aikido \
  --env AIKIDO_API_KEY=your-token-here \
  npx -y @aikidosec/mcp@latest
```

### JetBrains

トークンを次に追加します： `environment` MCP サーバーの JSON 設定（Settings | Tools | AI Assistant | Model Context Protocol）のブロックに：

```json
{
  "mcpServers": {
    "aikido": {
      "command": "npx -y @aikidosec/mcp@latest",
      "args": [],
      "environment": {
        "AIKIDO_API_KEY": "your-token-here"
      }
    }
  }
}
```

### IDE 内の GitHub Copilot

トークンを次に追加します： `env` のブロックに `mcp.json`:

```json
{
  "servers": {
    "aikido": {
      "command": "npx",
      "args": ["-y", "@aikidosec/mcp@latest"],
      "env": {
        "AIKIDO_API_KEY": "your-token-here"
      }
    }
  }
}
```

### GitHub Copilot Cloud Agents

GitHub Copilot は、名前が次で始まる場合にのみ、秘密情報を MCP 設定に公開します： `COPILOT_MCP_`。リポジトリのシークレットを作成します：

`次のようなシークレットを作成します:` COPILOT\_MCP\_AIKIDO\_API\_KEY

その後、Settings → Copilot → Coding agent の下にある MCP 設定でその変数名を使用します：

```json
{
  "mcpServers": {
    "aikido": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@aikidosec/mcp@latest"],
      "tools": ["aikido_full_scan", "aikido_sast_scan", "aikido_secrets_scan"],
      "env": {
        "AIKIDO_API_KEY": "COPILOT_MCP_AIKIDO_API_KEY"
      }
    }
  }
}
```

### Mistral Vibe

トークンを環境変数として次に追加します： `~/.vibe/config.toml`:

```toml
[[mcp_servers]]
name = "aikido"
transport = "stdio"
command = "sh"
args = ["-c", "AIKIDO_API_KEY='your-token-here' npx -y @aikidosec/mcp@latest"]
```

### OpenCode

トークンを次に追加します： `environment` のブロックに `~/.config/opencode/opencode.json`:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "aikido": {
      "type": "local",
      "command": ["npx", "-y", "@aikidosec/mcp@latest"],
      "enabled": true,
      "environment": {
        "AIKIDO_API_KEY": "your-token-here"
      }
    }
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/ai-totsru/aikido-mcp/token-authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
