Skip to main content
Glama
Oracle Schema Explorer MCP Server

Oracle Schema Explorer MCP Server

Oracle Schema Explorer MCP Server

License: MIT Python 3.10+ MCP

A universal, strictly read-only Model Context Protocol (MCP) server for inspecting and exploring Oracle database schemas, tables, columns, and foreign-key relationships across any Oracle Database version (Oracle 10g, 11g, 12c, 18c, 19c, 21c, and 23ai).

Compatible with any AI agent or IDE: Claude Desktop, Cursor, Google Antigravity, VS Code (Cline / Roo Code), Windsurf, and custom LLM agent frameworks.


Key Features

  • Universal Oracle Compatibility:

    • Thin Mode for Oracle Database 12.1 through 23ai (pure Python, zero C-libraries/Instant Client required).

    • Automatic Fallback to local SQL*Plus execution for legacy Oracle instances (Oracle 10g, 11g) or environments with older Oracle Client libraries (e.g. 12.1), completely eliminating ODPI-C version mismatch errors (DPY-3010, DPI-1050).

    • Standard dictionary views (ALL_TABLES, ALL_TAB_COLUMNS, ALL_CONSTRAINTS, ALL_CONS_COLUMNS) and universal ROWNUM query wrapping.

  • Strictly Read-Only Guarantee:

    • Enforces safety at the protocol layer, allowing only SELECT and WITH statements.

    • Automatically rejects data mutation (INSERT, UPDATE, DELETE, MERGE) and schema modifications (DROP, ALTER, TRUNCATE, CREATE).

  • Deep Relationship Discovery:

    • Explores incoming and outgoing foreign keys.

    • Generates full schema Entity-Relationship diagrams formatted in Mermaid.js.

  • Zero Hardcoded Credentials:

    • Works with a blank default configuration. Connection strings can be passed dynamically in chat or configured via environment variables.


Related MCP server: Database MCP Server

Directory Structure

oracle-mcp-server/
├── server.py                 # Core FastMCP / MCPServer implementation
├── run.bat                   # Universal Windows batch launcher
├── run.ps1                   # Universal PowerShell launcher
├── requirements.txt          # Python package dependencies
├── pyproject.toml            # Python package specifications
├── mcp-config-examples.json  # Configuration snippets for all clients
├── LICENSE                   # MIT License
└── README.md                 # Documentation

Installation & Prerequisites

  1. Python 3.10+: Ensure Python is installed.

  2. Install dependencies:

    pip install -r requirements.txt

    (Or using uv: uv pip install -r requirements.txt)


Configuration

The server ships 100% credential-free. You can supply connection strings in two ways:

Keep ORACLE_CONNECTION_STRING empty. In any AI chat session, simply instruct your agent:

"Connect to Oracle DB: username/password@hostname:1521/service_name"

The server's set_connection tool validates and activates the session on the fly.

Method 2: Pre-configured Environment Variable

Set the ORACLE_CONNECTION_STRING environment variable in your MCP client's configuration file.

Supported Connection Formats:

  • EzConnect: username/password@host:port/service_name

  • URL Syntax: oracle://username:password@host:port/service_name

  • TNS Descriptor: user/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=...)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=...)))


Client Integration Examples

Claude Desktop

Add to %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "oracle-schema-explorer": {
      "command": "C:\\path\\to\\oracle-mcp-server\\run.bat",
      "env": {
        "ORACLE_CONNECTION_STRING": ""
      }
    }
  }
}

Cursor

  1. Go to Settings -> Features -> MCP Servers.

  2. Click Add New MCP Server:

    • Name: oracle-schema-explorer

    • Type: command

    • Command: C:\path\to\oracle-mcp-server\run.bat

VS Code (Cline / Roo Code / Windsurf)

Add to your client's MCP configuration settings:

{
  "mcpServers": {
    "oracle-schema-explorer": {
      "command": "cmd.exe",
      "args": ["/c", "C:\\path\\to\\oracle-mcp-server\\run.bat"]
    }
  }
}

Google Antigravity

Add to ~/.gemini/config/mcp_config.json:

{
  "mcpServers": {
    "oracle-schema-explorer": {
      "command": "cmd.exe",
      "args": ["/c", "C:/path/to/oracle-mcp-server/run.bat"],
      "env": {
        "ORACLE_CONNECTION_STRING": ""
      }
    }
  }
}

Available MCP Tools

Tool

Parameters

Description

set_connection

connection_string: str

Connects or switches database dynamically. Tests connection and returns database banner.

get_connection_info

None

Returns connection status, current schema/user, database name, and version banner.

list_schemas

None

Lists all accessible schemas and their table counts (filters out internal Oracle system accounts).

list_tables

schema: str = ""

Lists all tables and views in the schema with approximate row counts.

describe_table

table_name: str, schema: str = ""

Returns detailed column definitions: data types, precision, scale, nullability, primary key indicators, and comments.

get_table_connections

table_name: str, schema: str = ""

Inspects table topology: lists parent tables referenced (outgoing FKs) and child tables that reference this table (incoming FKs).

get_schema_relationships

schema: str = ""

Generates full Entity-Relationship graph for the schema with a renderable Mermaid ER diagram.

execute_readonly_query

sql_query: str, max_rows: int = 50

Executes read-only queries (SELECT/WITH) safely capped by ROWNUM. Blocks mutation operations.


Security & Safety

  • Read-Only Enforcement: Query sanitization inspects all queries before execution, blocking all DDL and DML operations.

  • Resource Protection: Result sets are constrained with automatic pagination (ROWNUM <= max_rows, capped at 500) to protect database memory and client context windows.

  • System Schema Filtering: Internal accounts (SYS, SYSTEM, DBSNMP, MDSYS, CTXSYS, etc.) are hidden by default to keep context clean and focused on application data.


License

This project is licensed under the MIT License.

Available Tools

8 tools
describe_tableA

Retrieves full column metadata for a table: data types, lengths, nullability, PK status.

Args: table_name: Name of the table. schema: Optional schema/owner name.

Inputs: table_name (required), schema. Returns: result

execute_readonly_queryA

Executes a strictly READ-ONLY query (SELECT/WITH) with automatic ROWNUM capping.

Args: sql_query: A SELECT or WITH query to execute. max_rows: Maximum number of rows to return (1-500, default 50).

Inputs: sql_query (required), max_rows. Returns: result

get_connection_infoA

Checks current database connection status, Oracle version, and session details.

Inputs: no named parameters. Returns: result

get_schema_relationshipsB

Generates the complete Entity-Relationship diagram for tables in a schema.

Inputs: schema. Returns: result

get_table_connectionsC

Explores how a table is connected to other tables (Outgoing and Incoming Foreign Keys).

Args: table_name: Table name. schema: Optional schema/owner name.

Inputs: table_name (required), schema. Returns: result

list_schemasA

Lists accessible schemas in the Oracle database with table counts.

Inputs: no named parameters. Returns: result

list_tablesB

Lists tables and views in a specified schema with row counts.

Args: schema: Name of schema/owner (defaults to current user).

Inputs: schema. Returns: result

set_connectionB

Sets or switches the active Oracle database connection string dynamically.

Args: connection_string: Oracle connection string (e.g. 'user/password@host:1521/service_name').

Inputs: connection_string (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action: connection management, schema listing, table listing, column metadata, table-level foreign keys, schema-wide ER relationships, and read-only queries. The closest pair, get_table_connections and get_schema_relationships, is clearly differentiated by table-level vs schema-wide scope.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern: set_connection, get_connection_info, list_schemas, list_tables, describe_table, get_table_connections, get_schema_relationships, execute_readonly_query. Verb choices are varied but conventional and predictable.

    Tool Count5/5

    Eight tools is well-scoped for a schema exploration server, with no redundant or filler operations. Each tool covers a meaningful step in the exploration workflow.

    Completeness4/5

    The surface covers connection setup/status, schema and table discovery, column metadata, foreign-key relationships, ER diagrams, and ad-hoc read-only querying, which supports core exploration workflows. Minor gaps include object search/filtering and index or non-PK constraint inspection, though these can be partially worked around via execute_readonly_query.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables 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.
      16
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with relational databases such as MySQL, PostgreSQL, SQLite, SQL Server, and Oracle. Provides tools for querying, data inspection, and schema analysis with optional read-only mode.
      13 npm
      1
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables read-only exploration of Oracle databases through natural language, providing schema inspection and safe bounded SQL query execution.
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to connect to Oracle databases for schema exploration, PL/SQL source inspection, and read-only SQL queries, with optional write operations when explicitly enabled.
      -