Setting up the Oracle Autonomous
AI Database (ADB) MCP server involves a straightforward workflow that moves
from the Oracle Cloud Infrastructure (OCI) console into the database and
finally to your chosen AI client.
The following steps detail the setup process for Setting up the Oracle Autonomous AI Database (ADB) MCP server
1.
Enable the MCP Server in OCI
The server is a built-in feature
that you activate using OCI free-form tags.
- Permissions:
Ensure your OCI user has the necessary permissions to update the database
configuration.
- Tagging:
Navigate to your ADB instance in the OCI console and add a free-form tag
with the following details:
- Tag Key:
ADB$feature
- Tag Value:
MCP_SERVER:true
- Monitoring:
After applying the tag, the database state will change to "Updating".
You can monitor the progress through the Work Requests section in
the OCI console. Once finished, the database exposes an MCP server
endpoint bound to your database's OCID.
2.
Create and Register AI Tools
A new database has no tools
predefined for security reasons; you must explicitly create exactly what
you want to expose.
- Tool Framework:
Use the DBMS_CLOUD_AI_AGENT PL/SQL package to register tools.
- Define Backend Logic: Create the underlying PL/SQL functions that the tools will execute (e.g., a function to list schemas or query specific tables). Ensure the database user has the required privileges to run these functions.
- Registration: Use the create_tool procedure to define the tool name, attributes (detailed instructions for the LLM), and typed interfaces (parameter names and data types).
COMPLETE Source code is available at Oracle Link https://tinyurl.com/y7zbydyp
- Verification:
You can verify your setup by querying the user_ai_agent_tools
view to see all available and enabled tools.
3.
Authenticate and Configure the Client
Once the server and tools are ready,
you must connect an MCP-compatible client, such as VS Code (with the
Cline extension), Claude Desktop, or the OCI AI Agent.
- Generate a Bearer Token: Use a curl command to generate an access token for authentication.
Configure
below curl command as per your credentials.
|
·
curl
--location
'https://dataaccess.adb.{region-identifier}.oraclecloudapps.com/adb/auth/v1/databases/{database-ocid}/token'
\ ·
--header 'Content-Type: application/json' \ ·
--header 'Accept: application/json' \ ·
--data '{ ·
"grant_type":"password", ·
"username":"<db-username>", ·
"password":"<db-password>" ·
}' ·
|
Replace the placeholders with your actual information:
1. {region-identifier}: The specific Oracle Cloud region
2. {database-ocid}:
The OCID of your Autonomous AI Database
3. <db-username>: Your database username
4. <db-password>: Your database password
This API returns an access_token in
the response. The token is valid for 1 hour. Use the token in your
MCP server configuration ( Below Step)for
authentication.
- Client Configuration:
Edit your client's configuration file to include the MCP server
endpoint and the authorization header containing your bearer
token.
|
{ "mcpServers":
{ "sales-database":
{ "timeout":
300, "type": "streamableHttp", "url": "https://dataaccess.adb.{region-identifier}.oraclecloudapps.com/adb/mcp/v1/databases/{database-ocid}", "headers":
{ "Authorization":"Bearer <your-token>" } } } } |
sales-database:
Specify a name for your MCP server.
timeout: Set the maximum time
to wait for a response after a tool call to the MCP server.
type: The transport
protocol used for communication.
url: The URL of remote
MCP server for Autonomous AI Database.
Authorization:
The bearer token used for authentication (that’s output of previous step).
Below is Sample from my VS Code
- Restart Client:
If necessary, restart your MCP client application to apply the new
configuration.
4.
Start Prompting
Once configured, the client will automatically
discover the tools you registered. You can then begin using natural
language prompts to invoke these tools, such as asking the agent to "list
the schemas" or "show the top customers by revenue".
Note on Security: All interactions through the MCP server are governed by the database's existing security policies, including role-based access controls (RBAC) and auditing. Additionally, while clones require manual enablement, the MCP setting is automatically included on standby instances for Disaster Recovery (DR).