ORDS MCPサーバーから接続するデータベースおよびORDSのコンテナの準備は、記事「ORDS 26.2のMCPサーバーを構成する - Auth0編」と同じです。ORDS MCPサーバーが動作するコンテナを実行しAuth0の構成を始める直前まで、Auth0の記事にそって作業を進めます。
- ORDS MCPサーバーは、アクセス・トークンの"scope"クレームにグローバル・スコープ "urn:oracle:dbtools:ords:mcpserver:all" が含まれることを期待しているようです。Microsoft Entra IDが発行するアクセス・トークンは"scp"クレームにグローバル・スコープを含みます。Oktaも同様の仕様ですが、Oktaではカスタム・クレームとして"scope"を追加できました。Entra IDではClaims Mapping Policyで対応できる可能性はありますが、検証で使用しているFreeライセンスでは確認できません。
- ORDS MCPサーバーは、アクセス・トークンの"aud"クレームの値がMCPサーバーのエンドポイントURLであることを期待しているようです。Microsoft Entra IDが発行するアクセス・トークンの"aud"クレームの値は、アプリケーション(クライアント)IDになります。アクセス・トークンのバージョンを1にすると対応できるかもしれませんが、その場合は、アプリケーションIDのURIにhttp://localhost:8585/mcpを設定できません。
WWW-Authenticateヘッダーのワークアラウンド
確認のために実行したcurlコマンドです。
ords-mcp2 % curl -v -X POST http://localhost:8585/mcp |& grep WWW-Authenticate:
< WWW-Authenticate: Bearer error="invalid_request", resource_metadata="http://localhost:8585/.well-known/oauth-protected-resource/mcp", scope="urn:oracle:dbtools:ords:mcpserver:all"
ords-mcp2 %
ords-mcp2 % docker exec -it ords-mcp bash
[oracle@a7bdb9847eb3 ~]$ vi /usr/local/openresty/nginx/conf/nginx.conf
# Temporary workaround for Microsoft Entra ID
more_set_headers -s '401'
'WWW-Authenticate: Bearer error="invalid_request", resource_metadata="http://localhost:8585/.well-known/oauth-protected-resource/mcp", scope="http://localhost:8585/mcp/urn:oracle:dbtools:ords:mcpserver:all"';
[oracle@a7bdb9847eb3 ~]$ exit
exit
ords-mcp2 % docker restart ords-mcp
ords-mcp
ords-mcp2 %
ords-mcp2 % curl -v -X POST http://localhost:8585/mcp |& grep WWW-Authenticate:
< WWW-Authenticate: Bearer error="invalid_request", resource_metadata="http://localhost:8585/.well-known/oauth-protected-resource/mcp", scope="http://localhost:8585/mcp/urn:oracle:dbtools:ords:mcpserver:all"
ords-mcp2 %
Microsoft Entra IDのアプリケーション構成
値はORDS_MCP_HR、説明はSample Schema Human Resourcesと記述します。
このアプリロールを有効にしますか?をチェックし、適用をクリックします。
作成したアプリロールORDS_MCP_HRをEntra IDのユーザーに割り当てます。
ユーザーへのアプリロールの割り当ては、エンタープライズアプリケーションに移動して実施します。
概要から、ローカルディレクトリでのマネージドアプリケーションのリンクを開きます。
管理のユーザーとグループを開き、ユーザーまたはグループの追加をクリックします。
割り当てるロール「Sample Schema Human Resources」(値はORDS_MCP_HR)は、すでに選択されています。
割り当てをクリックします。
以上でユーザーにアプリロールORDS_MCP_HRが割り当てられました。
アクセス許可としてアプリロールORDS_MCP_HRが表示されます。このORDS_MCP_HRをチェックして、アクセス許可の追加を実行します。
アクセス許可にORDS_MCP_HRが追加されました。
アクセス許可の追加を再度クリックします。
先ほどと同様に、所属する組織で使用しているAPIを開き、ORDS MCP2を探して選択します。
今度は委任されたアクセス許可を選択し、アクセス許可として表示されたORDS MCPサーバーのグローバル・スコープ urn:oracle:dbtools:ords:mcpserver:all をチェックして、アクセス許可の追加を実行します。
以上でアクセス許可の設定ができました。
トークン構成を開き、オプションの要求の追加をクリックします。
トークンの種類にアクセスを選択し、要求に含まれるupnをチェックします。これはOAuth2のアクセス・トークンに、クレームとしてupnを追加するという作業です。
以上で追加をクリックします。
必ずしも必要ではないようですが、IDトークンについても同様の操作を行い、クレームとしてupnを追加します。
次にクライアントに対応したアプリケーションを作成します。
規定のディレクトリの管理のアプリの登録を開き、新規登録を実行します。
作成するアプリケーションの名前はORDS MCP2 Clientとします。リダイレクトURIは複数のURIを設定するため、ここでの設定は省略します。
以上で登録します。
アプリケーションORDS MCP2 Clientが作成されます。
後ほどAPIのアプリケーションORDS MCP2への紐付けに使うため、アプリケーション(クライアント)IDをコピーしておきます。その後に、リダイレクトURIを追加するのリンクを開きます。
リダイレクトURIを構成します。
リダイレクトURIの追加をクリックし、MCP InspectorのリダイレクトURIを追加します。
mcp.security.jwt.profile.jwk.url = https://login.microsoftonline.com/[テナントID]/discovery/v2.0/key
グローバル・プロパティmcp.security.jwt.profile.audienceの値はhttp://localhost:8585/mcpです。
グローバル・プロパティmcp.security.jwt.profile.role.claim.nameの値は/rolesです。
ORDS MCPサーバーの構成
ORDSの構成に移ります。
docker exec -it ords-mcp bash
ords-mcp2 % docker exec -it ords-mcp bash
[oracle@a7bdb9847eb3 ~]$
ords --config /etc/ords/config config set --global feature.mcp true
ords --config /etc/ords/config config set --global mcp.security.jwt.profile.issuer https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx/v2.0
ords --config /etc/ords/config config set --global mcp.security.jwt.profile.audience http://localhost:8585/mcp
ords --config /etc/ords/config config set --global mcp.security.jwt.profile.jwk.url https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx/discovery/v2.0/keys
ords --config /etc/ords/config config set --global mcp.security.jwt.profile.authorization.server.url https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx/v2.0
ords --config /etc/ords/config config set --global mcp.security.jwt.profile.role.claim.name /roles
ロールによるアクセス制御を行うため、mcp.roleにORDS_MCP_HRを設定しています。
ords --config /etc/ords/config config --db-pool mcp-hr set db.connectionType basic
ords --config /etc/ords/config config --db-pool mcp-hr set db.hostname host.docker.internal
ords --config /etc/ords/config config --db-pool mcp-hr set db.port 1521
ords --config /etc/ords/config config --db-pool mcp-hr set db.servicename freepdb1
ords --config /etc/ords/config config --db-pool mcp-hr set db.username HR
ords --config /etc/ords/config config --db-pool mcp-hr set db.description "Sample Schema Human Resources"
ords --config /etc/ords/config config --db-pool mcp-hr set mcp.role ORDS_MCP_HR[oracle@aeba9d22c0f9 ~]$ ords --config /etc/ords/config config --db-pool mcp-hr secret db.password
ORDS: Release 26.2 Production on Wed Jul 08 06:44:35 2026
Copyright (c) 2010, 2026, Oracle.
Configuration:
/etc/ords/config
Enter the database password: ********
Confirm password: ********
[oracle@aeba9d22c0f9 ~]$
exit
docker restart ords-mcp
[oracle@a7bdb9847eb3 ~]$ exit
exit
ords-mcp2 % docker restart ords-mcp
ords-mcp
ords-mcp2 %
MCP Inspectorによる接続確認
MCP Inspectorを起動し、MCPサーバーに接続します。
npx @modelcontextprotocol/inspector
ORDS MCPサーバーに接続するにあたって、以下を設定します。
Transport Type: Streamable HTTP
URL; http://localhost:8585/mcp
Connection Type: Direct
OAuth2 2.0 Flow Client ID: アプリケーションORDS MCP2 Clientのアプリケーション(クライアント)ID
OAuth2 2.0 Flow Client IDに設定する値は、アプリケーションORDS MCP2 Clientの概要にあるアプリケーション(クライアント)IDから取得します。
























































































