Skip to main content
Oracle Database MCP Toolkit is a Model Context Protocol server that provides both custom tool framework and built-in tools for Oracle Database operations, analysis, and machine learning features.
This is a community-driven toolkit separate from the Oracle SQLcl MCP Server, which is Oracle’s fully supported product with MCP capabilities.

Architecture

MCP Toolkit Architecture The toolkit consists of:
  • Custom Tool Framework: Define SQL-based tools using YAML configuration
  • Built-in Tools: Pre-built tools for log analysis, vector search, and performance tuning
  • Flexible Deployment: stdio, HTTP, or Docker with TLS and OAuth2 support
  • Connection Pooling: UCP (Universal Connection Pool) for efficient resource management

Key Features

1. YAML-Based Custom Tools

Define your own MCP tools without writing Java code:
tools:
  hotels-by-name:
    dataSource: prod-db
    description: Returns hotel details by name including capacity, rating and address
    parameters:
      - name: name
        type: string
        description: Hotel name to search for
        required: false
    statement: SELECT * FROM hotels WHERE name LIKE '%' || :name || '%'
Learn more about Custom Tools →

2. Oracle JDBC Log Analysis

Analyze JDBC thin client logs:
  • get-jdbc-stats: Performance statistics, error counts, packet/byte counts
  • get-jdbc-queries: All executed SQL queries with timestamps
  • get-jdbc-errors: Server and client errors
  • get-jdbc-connection-events: Connection lifecycle events
  • jdbc-log-comparison: Compare two log files
  • list-log-files-from-directory: List available log files

3. RDBMS/SQLNet Trace Analysis

Parse Oracle RDBMS and SQLNet trace files:
  • get-rdbms-errors: Extract errors from trace files
  • get-rdbms-packet-dumps: Extract packet dumps by connection ID
similarity_search: Perform semantic search using Oracle’s vector features:
  • Uses VECTOR_EMBEDDING for text-to-vector conversion
  • Uses VECTOR_DISTANCE for similarity calculation
  • Configurable table, columns, and models
  • Returns top-K similar results with scores

5. SQL Execution Plan Analysis

explain_plan: Generate and analyze Oracle execution plans:
  • Static mode: Uses EXPLAIN PLAN (estimated, doesn’t execute)
  • Dynamic mode: Uses DBMS_XPLAN.DISPLAY_CURSOR (actual runtime plan)
  • Returns formatted plan + LLM-ready prompt for tuning suggestions

Deployment Modes

stdio (Default)

The MCP client spawns the JVM process and communicates via stdin/stdout. Use for: Claude Desktop, local development, single-user scenarios

HTTP

The server runs as an HTTP service with optional TLS and OAuth2. Use for: Remote access, multi-user environments, production deployments Features:
  • HTTPS with PKCS12 certificates
  • OAuth2 introspection-based authentication
  • Token-based auth for development
  • CORS configuration

Docker

Containerized deployment using Podman or Docker. Use for: Cloud deployments, microservices architectures, CI/CD pipelines Learn more about Deployment →

Prerequisites

  • JDK 17+
  • Maven 3.9+ (for building from source)
  • Oracle Database access (for database tools)
  • Database credentials or token-based authentication
  • MCP client (Claude Desktop, Cline, etc.)

Quick Start

1. Build the JAR

mvn clean package
Output: target/oracle-db-mcp-toolkit-1.0.0.jar

2. Configure for Claude Desktop

{
  "mcpServers": {
    "oracle-db-mcp-toolkit": {
      "command": "java",
      "args": [
        "-Ddb.url=jdbc:oracle:thin:@your-host:1521/your-service",
        "-Ddb.user=your_user",
        "-Ddb.password=your_password",
        "-jar",
        "/path/to/oracle-db-mcp-toolkit-1.0.0.jar"
      ]
    }
  }
}

3. Start Using

"Analyze JDBC log file at /logs/app.log"
"Search for similar documents about 'database performance tuning'"
"Explain the execution plan for: SELECT * FROM orders WHERE status = 'PENDING'"

Configuration Options

System Properties

PropertyDescriptionExample
db.urlJDBC URLjdbc:oracle:thin:@host:1521/service
db.userDatabase usernameADMIN
db.passwordDatabase passwordsecretpass
toolsComma-separated tool allow-listget-jdbc-stats,similarity_search
configFilePath to YAML config/opt/mcp/config.yaml
transportTransport mode (stdio/http)http
ojdbc.ext.dirDirectory for extra JARs/opt/oracle/ext-jars
View all configuration options →

YAML Configuration

Define datasources and custom tools:
dataSources:
  prod-db:
    url: jdbc:oracle:thin:@prod-host:1521/ORCLPDB1
    user: ${user}
    password: ${password}

tools:
  my-custom-query:
    dataSource: prod-db
    description: Custom query description
    statement: SELECT * FROM my_table WHERE id = :id
    parameters:
      - name: id
        type: number
        description: Record ID
        required: true
Learn more about YAML configuration →

Built-in Tools Overview

Log Analysis Tools

No database connection required:
  • JDBC log parsing and statistics
  • RDBMS/SQLNet trace file analysis
  • Log file comparison
  • Error extraction
View Built-in Tools →

Database-Powered Tools

Require database connection:
  • Vector similarity search
  • SQL execution plan analysis
  • Custom YAML-defined SQL tools

DataSource Resolution

When executing a tool, the server determines which datasource to use:
  1. Tool-specific datasource: If the tool specifies a datasource in YAML
  2. System properties: db.url, db.user, db.password (highest priority)
  3. YAML default: First datasource defined in the YAML file
  4. Error: If no datasource can be resolved for SQL-based tools
Log analysis tools don’t require database configuration. You can run the server with only -Dtools=get-jdbc-stats,get-jdbc-queries without setting db.url.

Security Features

Authentication Options

  • Database authentication: Username/password
  • Token-based auth: IAM tokens via ojdbc.ext.dir JARs
  • OAuth2: Introspection-based authentication for HTTP mode
  • Development tokens: UUID tokens for testing

Network Security

  • TLS/SSL: PKCS12 certificate support
  • HTTPS: Configurable port
  • CORS: Configurable allowed origins
  • Token validation: OAuth2 introspection endpoint
Learn more about Security →

Use Cases

Performance Analysis

"Compare JDBC logs from before and after the optimization"
"Get performance statistics from the application log"
"Explain the execution plan for the slow query and suggest improvements"

Troubleshooting

"Extract all errors from the JDBC log file"
"Show me connection events in the last hour"
"Get packet dumps for connection ID 12345"
"Find documents similar to 'Oracle Database backup strategies'"
"Search for knowledge base articles about performance tuning"

Custom Business Logic

"Get customer details by email address" (custom YAML tool)
"List all orders pending shipment" (custom YAML tool)
"Find hotels near a specific location" (custom YAML tool)

Comparison: Toolkit vs SQLcl MCP Server

FeatureOracle DB ToolkitSQLcl MCP Server
SupportCommunityOfficial Oracle Product
Custom ToolsYAML-basedNot available
Log AnalysisJDBC + RDBMS tracesNot available
Vector SearchBuilt-inVia SQL
Execution PlansBuilt-in with LLM promptsVia SQL
Deploymentstdio, HTTP, Dockerstdio
AuthenticationDB, OAuth2, tokensDatabase only
LanguageJavaJava

Example Workflows

Performance Tuning Workflow

# Step 1: Analyze logs
"Get JDBC statistics from /logs/app.log"

# Step 2: Identify slow queries
"Get all queries from the JDBC log"

# Step 3: Analyze execution plan
"Explain the execution plan for: SELECT * FROM large_table WHERE date > SYSDATE - 7"

# Step 4: Get tuning suggestions
# (The explain_plan tool returns an LLM-ready prompt)

Semantic Search Integration

# Step 1: Set up vector embeddings (run SQL directly)
CREATE TABLE knowledge_base (
  id NUMBER PRIMARY KEY,
  text CLOB,
  embedding VECTOR
);

# Step 2: Search using similarity_search tool
"Find knowledge base articles similar to 'database connection pooling'"

# Step 3: Retrieve top results
# Returns JSON with similar documents and scores

Custom Tool Development

# Define in config.yaml
tools:
  customer-orders:
    description: Get all orders for a customer by email
    parameters:
      - name: email
        type: string
        description: Customer email address
        required: true
    statement: |
      SELECT o.id, o.order_date, o.total, o.status
      FROM orders o
      JOIN customers c ON o.customer_id = c.id
      WHERE c.email = :email
      ORDER BY o.order_date DESC
Then use it:
"Get all orders for customer [email protected]"

Next Steps

Custom Tools

Create YAML-based SQL tools

Built-in Tools

Explore log analysis and database tools

Deployment

Deploy with stdio, HTTP, or Docker

Compare to MySQL

Compare database servers

Build docs developers (and LLMs) love