Oracle Kerberos MCP

Lightweight Oracle Database MCP server with native Kerberos SSO (thick mode) and read-only support.

Documentation

oracle-kerberos-mcp

English | Português (Brasil)

Lightweight, zero-bloat Model Context Protocol (MCP) server for Oracle Database with native Kerberos SSO support (python-oracledb thick mode + externalauth=True), as well as standard username/password authentication.

Exposes the 7 standard Oracle inspection and query tools:

  • execute_sql
  • list_tables
  • list_active_sessions
  • get_query_plan
  • list_top_sql_by_resource
  • list_tablespace_usage
  • list_invalid_objects

Requirements

  • Python 3.10+
  • oracledb (pip install oracledb)
  • For Kerberos SSO:
    • Oracle Instant Client (e.g. ~/.local/oracle/instantclient_23_26)
    • Valid Kerberos ticket (kinit)
    • network/admin/sqlnet.ora configured with SQLNET.AUTHENTICATION_SERVICES=(KERBEROS5)

Installation

pip install -e .

Or run directly with PYTHONPATH=src python3 -m oracle_kerberos_mcp.server.

Configuration (mcp_config.json)

Kerberos SSO Mode

{
  "mcpServers": {
    "oracle-sso": {
      "command": "python3",
      "args": ["-m", "oracle_kerberos_mcp.server"],
      "env": {
        "PYTHONPATH": "/path/to/oracle-kerberos-mcp/src",
        "ORACLE_CONNECTION_STRING": "dbhost.example.com:1521/service_name",
        "ORACLE_SSO": "true",
        "ORACLE_INSTANT_CLIENT_DIR": "/home/user/.local/oracle/instantclient_23_26"
      }
    }
  }
}

Environment Variables

VariableDescription
ORACLE_CONNECTION_STRINGhost:port/service_name (or ORACLE_DATABASE_HOST, ORACLE_DATABASE_PORT, ORACLE_DATABASE_SERVICE_NAME)
ORACLE_SSOSet to true to use Kerberos SSO (externalauth=True). Auto-enabled if ORACLE_USERNAME and ORACLE_PASSWORD are empty.
ORACLE_USERNAME / ORACLE_PASSWORDStandard credentials (used when ORACLE_SSO is not true).
ORACLE_INSTANT_CLIENT_DIRPath to Oracle Instant Client (defaults to ~/.local/oracle/instantclient_*).
ORACLE_TNS_ADMINPath to network/admin containing sqlnet.ora (defaults to <instant_client>/network/admin).
ORACLE_READ_ONLYSet to true to block DML/DDL statements in execute_sql.

Running Tests

PYTHONPATH=src python3 -m unittest discover -s tests -v