> 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 設定の block に（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` = Aikidoトークン

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

```json
{
  "mcpServers": {
    "aikido": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@aikidosec/mcp@latest"],
      "tools": ["aikido_scan_paths", "aikido_full_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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
