Skip to main content
Glama
Oracle MCP Server

Oracle MCP Server

Oracle MCP Server

A standalone Model Context Protocol (MCP) server for Oracle Database operations, built following the Deer Flow configuration standards.

Features

  • Query Execution: Execute SQL queries with result streaming

  • Schema Discovery: List schemas, tables, and describe table structures

  • Stored Procedures: Execute Oracle stored procedures and functions

  • Statistics: Get table and index statistics

  • Connection Pooling: Efficient connection management

  • Security: Optional read-only mode and query validation

  • Configuration: Flexible YAML and environment-based configuration

Related MCP server: Database MCP Server

Installation

Prerequisites

  • Python 3.12 or higher

  • Oracle Database (11g or higher)

  • Oracle Instant Client (optional, for thick mode)

# Clone the repository
git clone <repository-url>
cd oracle-mcp-server

# Install dependencies
uv sync

# Copy configuration files
cp .env.example .env
cp conf.yaml.example conf.yaml

# Edit configuration
nano .env  # or your preferred editor
nano conf.yaml

Using pip

pip install -e .

Configuration

Environment Variables (.env)

The server can be configured using environment variables:

ORACLE_DB_CONNECTION_STRING=system/password@localhost:1521/XEPDB1
ORACLE_DB_READ_ONLY=false
ORACLE_DB_MAX_ROWS=1000

See .env.example for all available options.

YAML Configuration (conf.yaml)

For more detailed configuration, use the YAML file:

database:
  connection_string: system/password@localhost:1521/XEPDB1
  pool:
    min: 1
    max: 5
  read_only: false

tools:
  enabled:
    - query_database
    - describe_table
    - list_tables

See conf.yaml.example for all available options.

Usage

Running the Server

Stdio Mode (Default)

# Using uv
uv run oracle-mcp-server

# Or directly
python -m oracle_mcp.server

SSE Mode (HTTP Server)

uv run oracle-mcp-server --mode sse --port 3000

Integration with Deer Flow

Add to your Deer Flow MCP settings:

{
  "mcp_settings": {
    "servers": {
      "oracle-db": {
        "transport": "stdio",
        "command": "uv",
        "args": ["run", "oracle-mcp-server"],
        "env": {
          "ORACLE_DB_CONNECTION_STRING": "user/pass@host:1521/service"
        },
        "enabled_tools": [
          "query_database",
          "describe_table",
          "list_tables"
        ],
        "add_to_agents": ["researcher", "coder"]
      }
    }
  }
}

Integration with Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "oracle": {
      "command": "uv",
      "args": ["run", "oracle-mcp-server"],
      "env": {
        "ORACLE_DB_CONNECTION_STRING": "system/password@localhost:1521/XEPDB1"
      }
    }
  }
}

Available Tools

1. query_database

Execute SQL queries and return results.

Parameters:

  • query (string): SQL query to execute

  • max_rows (optional, int): Maximum rows to return

Example:

SELECT * FROM employees WHERE department_id = 10

2. describe_table

Get detailed information about a table structure.

Parameters:

  • table_name (string): Name of the table

  • schema_name (optional, string): Schema name

Example:

EMPLOYEES

3. list_tables

List all tables in a schema.

Parameters:

  • schema_name (optional, string): Schema name (defaults to current user)

  • pattern (optional, string): Filter tables by pattern

Example:

schema_name: HR
pattern: EMP%

4. list_schemas

List all schemas accessible to the current user.

5. execute_procedure

Execute Oracle stored procedures and functions.

Parameters:

  • procedure_name (string): Name of the procedure/function

  • parameters (optional, dict): Input parameters

6. get_table_stats

Get statistics for a table (row count, size, indexes).

Parameters:

  • table_name (string): Name of the table

  • schema_name (optional, string): Schema name

Security Considerations

Read-Only Mode

Enable read-only mode to prevent DDL/DML operations:

database:
  read_only: true

Connection Security

  • Use strong passwords

  • Configure Oracle network encryption

  • Use Oracle Wallet for credential management

  • Restrict network access with firewalls

Query Validation

The server validates queries to prevent:

  • SQL injection attempts

  • Dangerous operations in read-only mode

  • Excessive resource consumption

Development

Running Tests

# Install dev dependencies
uv sync --extra dev

# Run tests
pytest

# Run with coverage
pytest --cov=src/oracle_mcp --cov-report=term-missing

Code Formatting

# Format code
ruff format .

# Lint code
ruff check .

Troubleshooting

Connection Issues

  1. Verify Oracle Database is running

  2. Check connection string format

  3. Ensure network access to database server

  4. Verify Oracle client installation

Thick Mode Issues

If using thick mode:

# Install Oracle Instant Client
# Download from: https://www.oracle.com/database/technologies/instant-client.html

# Set environment variable
export ORACLE_DB_THICK_LIB_DIR=/path/to/instantclient

Performance Issues

  • Adjust connection pool settings

  • Enable connection pooling

  • Optimize queries

  • Use result pagination

License

MIT License - See LICENSE file for details

Contributing

Contributions are welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests

  5. Submit a pull request

References

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with Microsoft SQL Server databases through query execution, schema discovery, CRUD operations, stored procedures, and data export with built-in safety controls.
      18
      64 PyPI
      Apache 2.0
    • 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.
      1
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to inspect schemas, analyze performance, check security, and troubleshoot SQL Server 2019+ databases through a safe, controlled interface.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to securely query and administer SQL Server databases, with read-only access by default and permission-based write capabilities.
      30 PyPI
      MIT