MCP-Oracle
MCP-Oracle
Español | English
MCP(Model Context Protocol)サーバーで、AIエージェントをOracleデータベースに接続します。
スキーマの探索、PL/SQLソースの読み取り、SQLの実行を行うツールを公開します。読み取り専用モードで起動し、書き込みとストアドプロシージャの呼び出しはORACLE_ALLOW_WRITE=trueで有効になります。
公式Python SDK(mcp)とpython-oracledbを使用します。Instant Client(またはORACLE_HOMEのlib/ディレクトリ)が見つかった場合はthickモードを有効にし、それ以外の場合はthinモードを使用します。thickモードは、thinモードでサポートされていないパスワードベリファイアを使用する古いインスタンス(10g/11g)で必要です。
このプロジェクトは、Oracle公式のMCPスイート(oracle/mcp)ではありません。そのリポジトリはOracle Cloudやその他のOracle製品を対象としています。このサーバーはお使いのデータベースリスナーに直接接続します。
ツール
ツール | 説明 | 書き込み |
| 表示可能なテーブルを一覧表示します。任意の | いいえ |
| 列、型、NULL許容性、コメント、PK。 | いいえ |
| テーブルのPK、FK、一意制約。 | いいえ |
| PACKAGE、PROCEDURE、FUNCTION、TRIGGER、VIEWのソース。 | いいえ |
|
| いいえ |
|
| はい |
| ストアドPL/SQLプロシージャを呼び出し+コミット。 | はい |
run_queryとexecute_dmlはバインド変数(:name)を受け付けるため、SQLに値を連結する必要はありません。
Related MCP server: Oracle DB MCP Server
要件
Python 3.9以上
Oracleインスタンスへのアクセス(ユーザー、パスワード、ホスト、ポート、
service_name)Oracle 10g/11g(またはthinモードが失敗する場合):Oracle Instant Clientまたは
ORACLE_HOMEのlib/ディレクトリ
ローカル使用と本番環境
このREADMEはローカル使用を対象としています。CursorまたはClaude Desktopがお使いのマシンでstdio経由でserver.pyを起動します(HTTPポートは開きません)。
MCPをサーバー上で実行し続け、クライアントがネットワーク経由で接続する場合:
インストール
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt環境テンプレートをコピーして、値を入力してください:
cp .env.example .envサーバーは.envを自動的に読み込みません。これらの変数はMCPクライアント設定(Cursor、Claude Desktopなど)で渡す必要があります。.envファイルはローカル参照用です。コミットしないでください。
環境変数
変数 | 必須 | デフォルト | 説明 |
| はい | — | データベースユーザー |
| はい | — | パスワード |
|
|
| リスナーホスト |
|
|
| リスナーポート |
|
| — | サービス名(例: |
| いいえ | — | 設定すると、host/port/service_nameを置き換えます。TNSエイリアスやEasy Connect Plusに便利です |
| いいえ |
|
|
| いいえ |
|
|
| いいえ |
| Instant Clientフォルダまたは |
thickモードとthinモード
起動時にサーバーはORACLE_CLIENT_LIB_DIR(または~/oracle/instantclient)をチェックします。そのフォルダが存在する場合、oracledb.init_oracle_client()を呼び出してthickモードを使用します。
例:
# Instant Client (zip / RPM)
ORACLE_CLIENT_LIB_DIR=/Users/your_user/oracle/instantclient
# ORACLE_HOME 19c
ORACLE_CLIENT_LIB_DIR=/apps/oracle/product/19c/libネイティブクライアントがない場合は、thinモードで実行されます(ほとんどの場合Oracle 12.1以上)。
Cursorでの使用
Cursorで、サーバーをMCP設定に追加します(例:~/.cursor/mcp.jsonまたはプロジェクト設定):
{
"mcpServers": {
"oracle-mcp": {
"command": "/Users/your_user/Development/oracle-mcp/.venv/bin/python",
"args": ["/Users/your_user/Development/oracle-mcp/server.py"],
"env": {
"ORACLE_USER": "my_user",
"ORACLE_PASSWORD": "my_password",
"ORACLE_HOST": "127.0.0.1",
"ORACLE_PORT": "1521",
"ORACLE_SERVICE_NAME": "ORCLPDB1",
"ORACLE_ALLOW_WRITE": "false",
"ORACLE_MAX_ROWS": "200"
}
}
}
}.venvのPythonへの絶対パスを使用して、クライアントがmcpとoracledbを見つけられるようにします。
Cursorを再起動(またはMCPサーバーをリロード)して、oracle-mcpがツールリストに表示されることを確認します。
Claude Desktopでの使用
claude_desktop_config.json内:
{
"mcpServers": {
"oracle-mcp": {
"command": "/Users/your_user/Development/oracle-mcp/.venv/bin/python",
"args": ["/Users/your_user/Development/oracle-mcp/server.py"],
"env": {
"ORACLE_USER": "my_user",
"ORACLE_PASSWORD": "my_password",
"ORACLE_HOST": "127.0.0.1",
"ORACLE_PORT": "1521",
"ORACLE_SERVICE_NAME": "ORCLPDB1",
"ORACLE_ALLOW_WRITE": "false",
"ORACLE_MAX_ROWS": "200"
}
}
}
}手動での実行
ローカルでは、サーバーはstdio経由でMCPを話します(HTTPポートは開きません)。本番サーバーではトランスポートはHTTPです。ローカル使用と本番環境を参照してください。
source .venv/bin/activate
export ORACLE_USER=my_user
export ORACLE_PASSWORD=my_password
export ORACLE_HOST=127.0.0.1
export ORACLE_PORT=1521
export ORACLE_SERVICE_NAME=ORCLPDB1
python server.pystdin/stdoutにMCPクライアントが接続されていない場合、対話型プロンプトは表示されません。これは想定どおりです。
セキュリティ
デフォルトでは
ORACLE_ALLOW_WRITE=false:execute_dmlとcall_procedureはPermissionErrorで失敗します。run_queryはINSERT、UPDATE、DELETE、MERGE、DROP、ALTER、TRUNCATE、CREATE、GRANT、REVOKEで始まるステートメントを拒否します。execute_dmlはINSERT、UPDATE、DELETE、MERGEのみを受け付けます。SQLに値を補間する代わりに、バインド変数(
:id)を使用してください。スキーマの探索のみが必要な場合は、最小権限のユーザーで接続してください。
バージョン管理された
mcp.jsonに.envや資格情報をコミットしないでください。
依存関係
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityBmaintenanceProvides flexible access to Oracle databases for AI assistants like Claude, supporting SQL queries across multiple schemas with comprehensive database introspection capabilities.69510MIT
- AlicenseAqualityCmaintenanceEnables AI tools to interact with Oracle databases through query execution, schema browsing, stored procedure calls, and transaction management. Supports multiple database connections with safety features like read-only mode and dangerous query detection.16MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to execute read-only queries and DML operations on Oracle and PostgreSQL databases, and to list or describe database tables.151MIT
- FlicenseNot gradedqualityBmaintenanceProvides AI assistants with secure, structured access to Oracle Database through MCP, enabling SQL execution, metadata exploration, and stored procedure execution.
Related MCP Connectors
Read-only bank access for your AI agent. Connects Claude, ChatGPT, Cursor, Gemini, Codex.
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Runtime permission, approval, and audit layer for AI agent tool execution.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/VasquezNodier/mcp-oracle'
If you have feedback or need assistance with the MCP directory API, please join our Discord server