> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/ja/org/developer/oauth-applications.md).

# OAuth アプリケーション

組織で OAuth アプリケーションを作成し、Claude などの MCP クライアントが OAuth 認可で MaiAgent MCP に接続できるようにします。メンバーは API Key を設定ファイルに貼り付ける必要がありません。作成、シークレットの再生成、エンドポイント情報、組織ごとの上限を説明します。

OAuth アプリケーションを使うと、Claude などの MCP クライアントが標準の OAuth 2.1 認可フローで [MaiAgent MCP](https://docs.maiagent.ai/tech/mcp/maiagent-mcp) に接続できます。管理者が組織内でアプリケーションを作成して Client ID を取得し、メンバーは MCP クライアントに Client ID を入力したうえで、ブラウザーで MaiAgent にログインして「認可」を押せば接続が完了します。API Key を設定ファイルに貼り付ける必要はありません。

**API Key との違い**：

| 項目        | OAuth アプリケーション                                                                       | API Key                           |
| --------- | ------------------------------------------------------------------------------------ | --------------------------------- |
| メンバーの作業   | ブラウザーでログインして「認可」を押す                                                                  | キーを作成し、クライアントの設定ファイルまたはヘッダーに貼り付ける |
| 操作する身分    | 認可を完了したメンバー                                                                          | キーが紐づけられたメンバー                     |
| 操作する組織    | アプリケーションが属する組織                                                                       | キーが属する組織                          |
| 認証情報の有効期間 | アクセストークンは 1 時間で、クライアントが自動的に更新します。認可が取り消された場合、アプリケーションが削除された場合、メンバーが無効化された場合は再認可が必要です | キーの有効期限に従います                      |
| 一括で取り消す方法 | アプリケーションを削除すると、すべてのメンバーの認可がすぐに無効になります                                                | キーを 1 本ずつ取り消します                   |

どちらの方法でも、操作できる範囲はメンバー自身のロール権限によって決まります。API Key の管理方法は [API Key 管理](https://docs.maiagent.ai/maiagent-user-guide/ja/org/developer/api-keys.md) を参照してください。

## 利用できるユーザー <a href="#permissions" id="permissions"></a>

| 操作                                                                                                             | 必要な条件                                                                                                                                                                                                                     |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <mark style="color:blue;">OAuth アプリケーション</mark> ページに入り、アプリケーション一覧と <mark style="color:blue;">接続情報</mark> を表示する | ロール権限 <mark style="color:blue;">組織概要権限</mark>                                                                                                                                                                             |
| アプリケーションの作成、編集、削除、Client Secret の再生成                                                                           | ロール権限 <mark style="color:blue;">組織権限</mark> の下にある「OAuth アプリケーション管理権限」（組織オーナーはデフォルトで持っています。設定方法は [ロール権限を編集](https://docs.maiagent.ai/maiagent-user-guide/ja/org/roles/role-permission.md#edit-role-permissions) を参照してください） |
| アプリケーションを通じて MCP クライアントを認可する                                                                                   | アプリケーションが属する組織の有効なメンバーで、パスワードで MaiAgent にログインできること（[SSO のみでログインするメンバー](#sso-only-members) を参照）                                                                                                                            |

管理権限のないメンバーがページに入った場合は閲覧のみ可能です。編集アイコンは閲覧（目）アイコンに変わり、削除ボタンはクリックできません。

## アクセス方法 <a href="#how-to-enter" id="how-to-enter"></a>

左側のメニューで <mark style="color:blue;">組織設定</mark> → <mark style="color:blue;">組織概要</mark> をクリックし、<mark style="color:blue;">管理操作</mark> エリアで <mark style="color:blue;">OAuth アプリケーション</mark> をクリックします。

ページ上部には <mark style="color:blue;">接続情報</mark> があり、MCP クライアントの設定に必要な 3 つのエンドポイントが表示されます。それぞれ <mark style="color:blue;">コピー</mark> でコピーできます：

| エンドポイント                                               | 用途                                                                            |
| ----------------------------------------------------- | ----------------------------------------------------------------------------- |
| <mark style="color:blue;">Discovery エンドポイント</mark>    | OAuth 2.0 Authorization Server Metadata に対応したクライアントは、ここから他のエンドポイントを自動的に取得できます |
| <mark style="color:blue;">認可エンドポイント（Authorize）</mark> | メンバーがログインして認可するページです                                                          |
| <mark style="color:blue;">Token エンドポイント</mark>        | クライアントがアクセストークンを交換・更新するためのエンドポイントです                                           |

{% hint style="info" %}
認可フローでは PKCE（S256）を使用する必要があります。Redirect URI は完全一致で照合され、ワイルドカードには対応していません。
{% endhint %}

下のアプリケーション一覧には、<mark style="color:blue;">名前</mark>、<mark style="color:blue;">Client ID</mark>、<mark style="color:blue;">タイプ</mark>、<mark style="color:blue;">認可済みメンバー</mark>（このアプリケーションを通じて認可したメンバー数）、<mark style="color:blue;">作成日時</mark> の列があります。

## アプリケーションを作成する <a href="#create-application" id="create-application"></a>

1. <mark style="color:blue;">アプリケーションを作成</mark> をクリックし、<mark style="color:blue;">OAuth アプリケーションを作成</mark> ウィンドウを開きます。
2. <mark style="color:blue;">名前</mark> を入力します。例：`Claude`
3. <mark style="color:blue;">アプリケーションタイプ</mark> を選択します（作成後は変更できません。変更が必要な場合は、削除してから作成し直してください）：

   | タイプ                                           | 適した場面                                                      |
   | --------------------------------------------- | ---------------------------------------------------------- |
   | <mark style="color:blue;">Public</mark>       | MCP クライアント（Claude など）向けです。PKCE で認可し、Client Secret は発行されません |
   | <mark style="color:blue;">Confidential</mark> | サーバーサイドの連携向けです。Client Secret が発行されます                       |
4. <mark style="color:blue;">Redirect URIs</mark> を入力します。認可の完了後にリダイレクトを許可する URL で、たとえば Claude の `https://claude.ai/api/mcp/auth_callback` です。複数の URL が必要な場合は <mark style="color:blue;">Redirect URI を追加</mark> を押します。受け付けるのは `https://` のみで、`http://` はローカル開発用の `localhost`、`127.0.0.1`、`::1` に限られます。
5. 確定して作成すると、画面に <mark style="color:blue;">Client ID</mark> が表示されます。Confidential アプリケーションでは <mark style="color:blue;">Client Secret</mark> も表示されます。

{% hint style="warning" %}
Client Secret が表示されるのはこの 1 回だけで、閉じた後は再取得できません。コピーして保管してから <mark style="color:blue;">保存しました。閉じる</mark> を押してください。保存し忘れた場合は、[Secret を再生成](#regenerate-secret) するしかありません。
{% endhint %}

1 つの組織で作成できる OAuth アプリケーションは最大 20 個です。上限に達すると <mark style="color:blue;">アプリケーションを作成</mark> ボタンはクリックできなくなり、「組織の OAuth アプリケーションの上限（20 個）に達しました」と表示されます。

## メンバーが OAuth で MaiAgent MCP に接続する <a href="#connect-mcp-client" id="connect-mcp-client"></a>

1. 管理者は、アプリケーションの <mark style="color:blue;">Client ID</mark>（Confidential の場合は Client Secret も）と、MaiAgent MCP のサービスエンドポイント（[MaiAgent MCP](https://docs.maiagent.ai/tech/mcp/maiagent-mcp#what-is-maiagent-mcp) を参照）をメンバーに伝えます。
2. メンバーは MCP クライアントでカスタムコネクタを追加します。サーバー URL に MaiAgent MCP のサービスエンドポイントを入力し、OAuth 設定に Client ID（と Client Secret）を入力します。クライアントの Redirect URI は、アプリケーションに登録したものとまったく同じである必要があります。
3. クライアントがブラウザーを開き、メンバーは会社のメールアドレスとパスワードで MaiAgent にログインします。組織で LDAP のアカウント・パスワードによるログインが有効な場合、パスワードは企業のパスワードです。
4. 認可ページには、「アプリケーション名 を認可しますか？」、現在ログインしているアカウント、およびこのアプリケーションが属する組織が表示されます。内容を確認したら「認可」を押します。
5. MCP クライアントに戻ると、接続が完了しています。以降の再接続では、認可が有効である限り認可ページは表示されません。

{% hint style="info" %}
OAuth で接続した場合、すべての操作は**アプリケーションが属する組織**に対して行われ、権限はそのメンバーが組織内で持つロール権限と同じです。メンバーが複数の組織に所属している場合は、操作したい組織で作成されたアプリケーションを使用してください。
{% endhint %}

### SSO のみでログインするメンバー <a href="#sso-only-members" id="sso-only-members"></a>

認可ページのログイン画面には Email とパスワードの入力しかなく、SSO ログインボタンはありません。SSO のみでログインしていて MaiAgent のパスワードを持たないメンバーは、現時点では認可を完了できません。代わりに [API Key](https://docs.maiagent.ai/maiagent-user-guide/ja/org/developer/api-keys.md) で MaiAgent MCP に接続してください。

## アプリケーションを管理する <a href="#manage-applications" id="manage-applications"></a>

### 編集 <a href="#edit-application" id="edit-application"></a>

一覧の編集アイコンをクリックすると、<mark style="color:blue;">名前</mark> と <mark style="color:blue;">Redirect URIs</mark> を変更できます。<mark style="color:blue;">アプリケーションタイプ</mark> は変更できません。ウィンドウの上部に <mark style="color:blue;">Client ID</mark> が表示され、そのままコピーできます。

### Secret の再生成 <a href="#regenerate-secret" id="regenerate-secret"></a>

Client Secret を持つのは Confidential アプリケーションだけです。編集ウィンドウで <mark style="color:blue;">Secret を再生成</mark> を押して確認すると：

* 古い Client Secret はすぐに無効になります。それを使用しているすべてのサーバーサイド設定を更新してください。
* すでに接続しているメンバーには影響しません。影響するのは、以降のトークン交換のみです。
* 新しい Client Secret も、表示されるのは 1 回だけです。

### 削除 <a href="#delete-application" id="delete-application"></a>

一覧の削除アイコンをクリックして確認すると、このアプリケーションを通じて接続しているすべてのメンバーのトークンがすぐにすべて無効になります。この操作は元に戻せません。メンバーは、その後は別のアプリケーションで再認可する必要があります。

## よくある質問 <a href="#faq" id="faq"></a>

#### Q：<mark style="color:blue;">アプリケーションを作成</mark> ボタンがクリックできません。 <a href="#faq-create-disabled" id="faq-create-disabled"></a>

原因は 2 つ考えられます。「OAuth アプリケーション管理権限」がない場合（ボタンにカーソルを合わせると「OAuth アプリケーション管理権限がありません。組織の管理者にお問い合わせください」と表示されます）、または組織にすでに 20 個のアプリケーションがある場合です。

#### Q：Redirect URI を保存できません。 <a href="#faq-redirect-uri-invalid" id="faq-redirect-uri-invalid"></a>

受け付けるのは `https://` の URL のみで、`http://` は `localhost`、`127.0.0.1`、`::1` にしか使えません。URL は、MCP クライアントが実際にリダイレクトする URL と、パスやポートも含めて完全に一致している必要があります。

#### Q：接続後、期待していた Agent やナレッジベースが見つかりません。 <a href="#faq-wrong-organization" id="faq-wrong-organization"></a>

OAuth 接続が操作するのは、アプリケーションが属する組織です。メンバーが使用している Client ID が正しい組織のものであること、そしてメンバーがその組織で持つロールにこれらのリソースへのアクセス権限があることを確認してください。

#### Q：Client Secret を保存し忘れました。 <a href="#faq-lost-secret" id="faq-lost-secret"></a>

システムは再表示できません。編集ウィンドウで <mark style="color:blue;">Secret を再生成</mark> を押して新しい Secret を取得し、サーバーサイドの設定を更新してください。


---

# 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://docs.maiagent.ai/maiagent-user-guide/ja/org/developer/oauth-applications.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.
