> 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).

# 代替トークン認証

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

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

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

## トークンの作成

Aikido で、次へ移動します [設定 → 統合 → 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"
      }
    }
  }
}
```

### GitHub Copilot — IDE

トークンを `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 は、名前が `COPILOT_MCP_`で始まる場合にのみ、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.
