更新:2026年4月2日 - Autonomous AI Database向けの構築手順を集約
Oracle DatabaseにリモートMCPサーバーを実装し、Claude DesktopやOpenAI ChatGPTから呼び出せる環境を作成します。Oracle Cloudの無料枠で使用できるAlways FreeのAutonomous AI DatabaseおよびVM.Standard.E2.1.Microのコンピュート・インスタンスを使用します。
本記事の作業を完了すると、認証なしでアクセスできるリモートMCPサーバーが作成されます。この環境を元に、Entra ID、Okta Integrator、Auth0またはOracle IAMを使ったユーザー認証を構成できます。
Autonomous AI Databaseの作成
リモートMCPサーバーは、Oracle REST Data ServicesのRESTモジュールとして作成されます。今回の作業では、サンプルとなるRESTモジュールとしてsampleserverを作成します。このRESTモジュールをホストするデータベースを作成します。
今回はリモートMCPサーバーをホストするデータベースとして、Autonomous AI Lakehouseの19cを使用します。実装要件は、Oracle APEXおよびOracle REST Data Servicesがインストールされていることだけであり、19cと26ai、オンプレミスとクラウドのどれでもリモートMCPサーバーをホストするデータベースとして使用できます。
Oracle CloudのコンソールよりAutonomous AI Databaseを開き、Autonomous AI Databaseの作成を開始します。
[テナント識別子]-[データベース名].adb.[リージョン].oraclecloudapps.com
ウォレットにパスワードを設定し、ダウンロードを実行します。ここで設定したパスワードは、今回の作業では使用しません。
データベース名をSALESADBとしているため、ウォレットはWallet_SALESADB.zipとしてダウンロードされます。
リモートMCPサーバー・フレームワークのインストール
データベースSALESADBに管理者ユーザーADMINで接続し、スキーマWKSP_APEXDEVへ必要な設定を行います。
sql -cloudconfig Wallet_SALESADB.zip admin@salesadb_low
mcp-salesadb % sql -cloudconfig Wallet_SALESADB.zip admin@salesadb_low
SQLcl: 木 4月 02 11:51:19 2026のリリース25.4 Production
Copyright (c) 1982, 2026, Oracle. All rights reserved.
パスワード (**********?) ****************
Last Successful login time: 木 4月 02 2026 11:51:50 +09:00
接続先:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.1.0
SQL>
スキーマWKSP_APEXDEVをREST有効に切り替えます。p_url_mapping_patternは(スキーマ名ではなく)作成したワークスペース名を英語文字で指定します。今回の作業例ではapexdevです。
begin
ords_admin.enable_schema(
p_schema => 'WKSP_APEXDEV',
p_url_mapping_pattern => 'apexdev'
);
commit;
end;
/SQL> begin
2 ords_admin.enable_schema(
3 p_schema => 'WKSP_APEXDEV',
4 p_url_mapping_pattern => 'apexdev'
5 );
6 commit;
7 end;
8* /
PL/SQLプロシージャが正常に完了しました。
SQL>
SQL> grant create any context to wksp_apexdev;
Grantが正常に実行されました。
SQL>
grant execute on cs_session to wksp_apexdev;
grant select on dba_xs_sessions to wksp_apexdev;
grant select on v$session to wksp_apexdev;
SQL> grant execute on cs_session to wksp_apexdev;
Grantが正常に実行されました。
SQL> grant select on dba_xs_sessions to wksp_apexdev;
Grantが正常に実行されました。
SQL> grant select on v$session to wksp_apexdev;
Grantが正常に実行されました。
SQL>
SQL> exit
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.1.0から切断されました
mcp-salesadb %
mcp-salesadb % git clone https://github.com/United-Codes/uc_ai.git
Cloning into 'uc_ai'...
remote: Enumerating objects: 2723, done.
remote: Counting objects: 100% (441/441), done.
remote: Compressing objects: 100% (304/304), done.
remote: Total 2723 (delta 187), reused 222 (delta 123), pack-reused 2282 (from 1)
Receiving objects: 100% (2723/2723), 6.28 MiB | 8.01 MiB/s, done.
Resolving deltas: 100% (1780/1780), done.
mcp-salesadb %
sql -cloudconfig ../Wallet_SALESADB.zip wksp_apexdev@salesadb_low
mcp-salesadb % cd uc_ai
uc_ai % sql -cloudconfig ../Wallet_SALESADB.zip wksp_apexdev@salesadb_low
SQLcl: 木 4月 02 12:04:52 2026のリリース25.4 Production
Copyright (c) 1982, 2026, Oracle. All rights reserved.
パスワード (**********?) ****************
接続先:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.1.0
SQL>
SQL> @install_with_logger.sql
Installing UC AI with logger
_____________________________________________________________________________
User has all required privileges, installation will continue.
_____________________________________________________________________________
PL/SQLプロシージャが正常に完了しました。
tables/logger_logs.sql
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
tables/logger_prefs.sql
PL/SQLプロシージャが正常に完了しました。
Trigger BIU_LOGGER_PREFSがコンパイルされました
TRIGGER BIU_LOGGER_PREFSでエラーが発生しました:
LINE/COL ERROR
-------- ------------------------------------------------------
6/5 PLS-00049: バインド変数NEW.PREF_TYPEが正しくありません。
6/29 PLS-00049: バインド変数NEW.PREF_TYPEが正しくありません。
9/11 PLS-00049: バインド変数NEW.PREF_TYPEが正しくありません。
19/13 PLS-00049: バインド変数NEW.PREF_TYPEが正しくありません。
30/13 PLS-00049: バインド変数NEW.PREF_TYPEが正しくありません。
40/13 PLS-00049: バインド変数NEW.PREF_TYPEが正しくありません。
Trigger BIU_LOGGER_PREFSが変更されました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
[中略]
Package Body UC_AIがコンパイルされました
Running post-installation scripts...
Logger package detected. Setting USE_LOGGER flag to TRUE.
Successfully compiled uc_ai_logger package with USE_LOGGER flag.
PL/SQLプロシージャが正常に完了しました。
===================================================
UC AI installation complete!
Refer to the documentation for usage instructions: https://www.united-codes.com/products/uc-ai/docs/
===================================================
Installation Complete!
SQL>
SQL> exit
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.1.0から切断されました
uc_ai% cd ..
mcp-salesadb %
git clone https://github.com/ujnak/mcp-app.git
mcp-salesadb % git clone https://github.com/ujnak/mcp-app.git
Cloning into 'mcp-app'...
remote: Enumerating objects: 515, done.
remote: Counting objects: 100% (110/110), done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 515 (delta 63), reused 67 (delta 33), pack-reused 405 (from 1)
Receiving objects: 100% (515/515), 213.40 KiB | 6.10 MiB/s, done.
Resolving deltas: 100% (298/298), done.
mcp-salesadb %
sql -cloudconfig ../Wallet_SALESADB.zip wksp_apexdev@salesadb_low
mcp-salesadb % cd mcp-app
mcp-app % sql -cloudconfig ../Wallet_SALESADB.zip wksp_apexdev@salesadb_low
SQLcl: 木 4月 02 12:14:50 2026のリリース25.4 Production
Copyright (c) 1982, 2026, Oracle. All rights reserved.
パスワード (**********?) ****************
接続先:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.1.0
SQL>
@install-all-adb
SQL> @install-all-adb
Sessionが変更されました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
Table OJ_MCP_UI_RESOURCESは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Table OJ_MCP_UI_CSP_DOMAINSは作成されました。
Commentは作成されました。
Commentは作成されました。
Index IX_OJ_MCP_UI_CSP_RESOURCE_IDは作成されました。
Table OJ_MCP_UI_PERMISSIONSは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Table OJ_MCP_TOOLS_EXTRASは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Commentは作成されました。
Table OJ_MCP_TOOLS_EXTRASが変更されました。
Table OJ_MCP_TOOLS_EXTRASが変更されました。
View OJ_MCP_UC_AI_TOOLSは作成されました。
Package OJ_MCP_RAS_CTXがコンパイルされました
Package Body OJ_MCP_RAS_CTXがコンパイルされました
Package OJ_MCP_JSONRPC_UTILSがコンパイルされました
Package Body OJ_MCP_JSONRPC_UTILSがコンパイルされました
Package OJ_MCP_APP_UTILSがコンパイルされました
Package Body OJ_MCP_APP_UTILSがコンパイルされました
Package OJ_MCP_APP_METHODSがコンパイルされました
Package Body OJ_MCP_APP_METHODSがコンパイルされました
Package OJ_MCP_APP_SERVERがコンパイルされました
Package Body OJ_MCP_APP_SERVERがコンパイルされました
Procedure OJ_MCP_POST_HANDLERがコンパイルされました
Procedure OJ_MCP_DELETE_HANDLERがコンパイルされました
Procedure OJ_MCP_RAS_POST_HANDLERがコンパイルされました
Procedure OJ_MCP_RAS_DELETE_HANDLERがコンパイルされました
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
Function GET_SCHEMAがコンパイルされました
Function RUN_SQLがコンパイルされました
Function GET_CURRENT_USERがコンパイルされました
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
PL/SQLプロシージャが正常に完了しました。
Table AUTH_USERSは作成されました。
Package OJ_MCP_RAS_CONFIGがコンパイルされました
Package Body OJ_MCP_RAS_CONFIGがコンパイルされました
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.31.0.1.0から切断されました
mcp-app %
サンプルMCPサーバーsampleserverの作成
npx @modelcontextprotocol/inspector
コンピュート・インスタンスの作成
OpenRestyによるリバース・プロキシの実装
mcp-salesadb % ssh -i ssh-key-2026-04-02.key ubuntu@************
The authenticity of host '********** (***.***.***.***)' can't be established.
ED25519 key fingerprint is: SHA256:mQqH+aeUis/MSCksdArWr/krK22SlQd+mx+zEOsNsY8
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '************' (ED25519) to the list of known hosts.
Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 6.17.0-1007-oracle x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, you can run the 'unminimize' command.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
ubuntu@proxy-salesadb:~$
curl -O https://raw.githubusercontent.com/ujnak/mcp-app/refs/heads/main/nginx/prepare-ubuntu.sh
export IS_ADB=true
sh prepare-ubuntu.sh
ubuntu@proxy-salesadb:~$ curl -O https://raw.githubusercontent.com/ujnak/mcp-app/refs/heads/main/nginx/prepare-ubuntu.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5757 100 5757 0 0 37374 0 --:--:-- --:--:-- --:--:-- 37627
ubuntu@proxy-salesadb:~$ export IS_ADB=true
ubuntu@proxy-salesadb:~$ sh prepare-ubuntu.sh
IS_ADB = true
INSTALL_APEX = false
55 packages can be upgraded. Run 'apt list --upgradable' to see them.
The following NEW packages will be installed:
hwdata libnuma1 libpython3.12t64 libslang2 libtraceevent1
linux-headers-6.17.0-1009-oracle linux-image-6.17.0-1009-oracle
linux-modules-6.17.0-1009-oracle linux-modules-extra-6.17.0-1009-oracle
linux-oracle-6.17-headers-6.17.0-1009 linux-oracle-6.17-tools-6.17.0-1009
linux-tools-6.17.0-1009-oracle linux-tools-common wireless-regdb
The following upgrades have been deferred due to phasing:
fwupd libfwupd2 libnetplan1 netplan-generator netplan.io python3-netplan
The following packages will be upgraded:
bsdutils coreutils curl eject fdisk intel-microcode libblkid1
libcurl3t64-gnutls libcurl4t64 libfdisk1 libfreetype6 libmount1 libnftables1
libnss3 libpam-systemd libpython3.12-minimal libpython3.12-stdlib
libsmartcols1 libssh-4 libsystemd-shared libsystemd0 libudev1 libuuid1
linux-base linux-headers-oracle linux-image-oracle linux-oracle mount
nftables openssh-client openssh-server openssh-sftp-server pollinate
python3-cryptography python3-jwt python3.12 python3.12-minimal snapd sudo
systemd systemd-dev systemd-resolved systemd-sysv systemd-timesyncd tzdata
ubuntu-drivers-common udev util-linux xxd
49 upgraded, 14 newly installed, 0 to remove and 6 not upgraded.
44 standard LTS security updates
Need to get 278 MB of archives.
After this operation, 333 MB of additional disk space will be used.
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 48840 files and directories currently installed.)
Preparing to unpack .../bsdutils_1%3a2.39.3-9ubuntu6.5_amd64.deb ...
Unpacking bsdutils (1:2.39.3-9ubuntu6.5) over (1:2.39.3-9ubuntu6.4) ...
Setting up bsdutils (1:2.39.3-9ubuntu6.5) ...
(Reading database ... 48840 files and directories currently installed.)
Preparing to unpack .../coreutils_9.4-3ubuntu6.2_amd64.deb ...
Unpacking coreutils (9.4-3ubuntu6.2) over (9.4-3ubuntu6.1) ...
Setting up coreutils (9.4-3ubuntu6.2) ...
(Reading database ... 48840 files and directories currently installed.)
Preparing to unpack .../util-linux_2.39.3-9ubuntu6.5_amd64.deb ...
Unpacking util-linux (2.39.3-9ubuntu6.5) over (2.39.3-9ubuntu6.4) ...
Setting up util-linux (2.39.3-9ubuntu6.5) ...
fstrim.service is a disabled or a static unit not running, not starting it.
(Reading database ... 48840 files and directories currently installed.)
Preparing to unpack .../0-mount_2.39.3-9ubuntu6.5_amd64.deb ...
Unpacking mount (2.39.3-9ubuntu6.5) over (2.39.3-9ubuntu6.4) ...
Preparing to unpack .../1-python3.12_3.12.3-1ubuntu0.12_amd64.deb ...
Unpacking python3.12 (3.12.3-1ubuntu0.12) over (3.12.3-1ubuntu0.11) ...
Preparing to unpack .../2-libpython3.12-stdlib_3.12.3-1ubuntu0.12_amd64.deb ...
Unpacking libpython3.12-stdlib:amd64 (3.12.3-1ubuntu0.12) over (3.12.3-1ubuntu0.11) ...
Preparing to unpack .../3-python3.12-minimal_3.12.3-1ubuntu0.12_amd64.deb ...
Unpacking python3.12-minimal (3.12.3-1ubuntu0.12) over (3.12.3-1ubuntu0.11) ...
Preparing to unpack .../4-libpython3.12-minimal_3.12.3-1ubuntu0.12_amd64.deb ...
Unpacking libpython3.12-minimal:amd64 (3.12.3-1ubuntu0.12) over (3.12.3-1ubuntu0.11) ...
[中略]
Setting up libgdbm6t64:amd64 (1.23-5.1build1) ...
Setting up libgdbm-compat4t64:amd64 (1.23-5.1build1) ...
Setting up openresty-zlib (1.3.2-1~noble1) ...
Setting up perl-modules-5.38 (5.38.2-3.2ubuntu0.2) ...
Setting up libperl5.38t64:amd64 (5.38.2-3.2ubuntu0.2) ...
Setting up openresty-pcre2 (10.47-1~noble1) ...
Setting up openresty-openssl3 (3.5.5-1~noble1) ...
Setting up openresty (1.29.2.3-1~noble1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/openresty.service → /usr/lib/systemd/system/openresty.service.
Setting up perl (5.38.2-3.2ubuntu0.2) ...
Setting up openresty-resty (1.29.2.3-1~noble1) ...
Setting up openresty-opm (1.29.2.3-1~noble1) ...
Processing triggers for libc-bin (2.39-0ubuntu8.7) ...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1606 100 1606 0 0 7831 0 --:--:-- --:--:-- --:--:-- 7834
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 774 100 774 0 0 6143 0 --:--:-- --:--:-- --:--:-- 6192
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 81 100 81 0 0 453 0 --:--:-- --:--:-- --:--:-- 455
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 202 100 202 0 0 831 0 --:--:-- --:--:-- --:--:-- 834
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2518 100 2518 0 0 18229 0 --:--:-- --:--:-- --:--:-- 18246
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1994 100 1994 0 0 12611 0 --:--:-- --:--:-- --:--:-- 12620
Rules updated
Rules updated (v6)
Rules updated
Rules updated (v6)
Rules updated
Rules updated (v6)
Firewall is active and enabled on system startup
Firewall reloaded
ubuntu@proxy-salesadb:~$
sudo shutdown -r now
ubuntu@proxy-salesadb:~$ sudo shutdown -r now
Broadcast message from root@proxy-salesadb on pts/1 (Thu 2026-04-02 05:05:21 UTC):
The system will reboot now!
ubuntu@proxy-salesadb:~$ Connection to **********.**.** closed by remote host.
Connection to **********.**.** closed.
client_loop: send disconnect: Broken pipe
mcp-salesadb %
ubuntu@proxy-salesadb:~$ sudo -s
root@proxy-salesadb:/home/ubuntu# cd ~
root@proxy-salesadb:~#
以下の実行例ではホスト名にords.example.comを指定していますが、作業の際には割り当てているホスト名に置き換えます。
certbot certonly --standalone -d ホスト名
root@proxy-salesadb:~# certbot certonly --standalone -d ords.example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel): メール・アドレス
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.6-August-18-2025.pdf. You must agree
in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Account registered.
Requesting a certificate for ords.example.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/ords.example.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/ords.example.com/privkey.pem
This certificate expires on 2026-07-01.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
root@proxy-salesadb:~#
/etc/nginx/conf.d/01-server.confのホスト名をリバース・プロキシが動作しているホスト名に変更します。
root@proxy-salesadb:~# sed -i 's/ords.example.com/ホスト名/g' /etc/nginx/conf.d/01-server.conf
root@proxy-salesadb:~#
systemctl start openresty
root@proxy-salesadb:~# systemctl enable openresty
Synchronizing state of openresty.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable openresty
root@proxy-salesadb:~# systemctl start openresty
root@proxy-salesadb:~#
以上でOpenRestyによるリバース・プロキシの構成は完了です。
リモートMCPサーバーの動作確認
select * from sh.customers fetch first 10 rows only





































