Skip to main content

Model Context Protocol server to access Oracle databases, supporting Oracle 11g and above.

Project description

Oracle11g MCP Server

PyPI version Python 3.12+

Model Context Protocol (MCP) server for Oracle databases, supporting Oracle 11g and above. This server enables AI models to interact with Oracle databases through a standardized protocol.

Features

  • Database Operations: List tables, describe table structures, execute SQL queries
  • DDL Support: Execute Data Definition Language statements (CREATE, ALTER, DROP, etc.)
  • Security: Built-in protections against dangerous operations
  • Connection Pooling: Efficient database connection management
  • Async Support: Full asynchronous operation support

Installation

Using uvx (Recommended)

uvx oracle11g-mcp-server

Using pip

pip install oracle11g-mcp-server

Prerequisites

  • Python 3.12 or higher
  • Oracle Instant Client
  • Oracle database (11g or higher)

Configuration

Environment Variables

Create a .env file or set the following environment variables:

  • ORACLE_CONNECTION_STRING: Your Oracle database connection string
    • Format: username/password@hostname:port/service_name
  • LIB_DIR: Path to your Oracle Instant Client directory
  • DQL_LIMITS_ROWS: Maximum rows returned by SELECT queries (default: 10)
  • DDL_ENABLE: Enable DDL operations (Y/N, default: N)

MCP Configuration

Add this to your MCP client configuration (e.g., Cursor's mcp.json):

{
  "mcpServers": {
    "oracle11g-mcp-server": {
      "command": "uvx",
      "args": ["oracle11g-mcp-server"],
      "env": {
        "ORACLE_CONNECTION_STRING": "username/password@hostname:port/service_name",
        "LIB_DIR": "/path/to/instantclient",
        "DQL_LIMITS_ROWS": "1000",
        "DDL_ENABLE": "Y"
      }
    }
  }
}

Available Tools

  • list_tables: Get a list of all tables in the database
  • describe_table: Get detailed information about a table's structure
  • execute_DQL: Execute SELECT queries to read data
  • execute_DDL: Execute DDL statements (CREATE, ALTER, DROP, etc.) - requires DDL_ENABLE=Y

Security Features

  • DDL Protection: DDL operations are disabled by default. Set DDL_ENABLE=Y to enable them.
  • Dangerous Operation Prevention: Blocks potentially harmful operations like DROP DATABASE, DROP TABLESPACE, DROP USER.
  • Query Validation: Validates SQL syntax and prevents non-DDL queries from being executed via DDL endpoint.
  • Connection Pooling: Uses secure connection pooling to manage database connections efficiently.

Development

Setup

# Clone the repository
git clone https://github.com/yourusername/oracle11g-mcp-server.git
cd oracle11g-mcp-server

# Install dependencies
uv pip install -e .

# Install Node.js dependencies for inspector
pnpm install

Running

# Development mode with hot reload
uv run dev

# Production mode
uv run main

Testing

# Run MCP inspector
pnpm run inspector

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oracle11g_mcp_server-1.0.8.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oracle11g_mcp_server-1.0.8-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file oracle11g_mcp_server-1.0.8.tar.gz.

File metadata

  • Download URL: oracle11g_mcp_server-1.0.8.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for oracle11g_mcp_server-1.0.8.tar.gz
Algorithm Hash digest
SHA256 15ce5431f65dc883708b873749e862dd8f32ba84eba676552bc94d6d477bb4fc
MD5 e804fcef915024c84d7f9733b4beac22
BLAKE2b-256 3406029e0e53419d41051070030efa390f8bb10bc1d354457b44740e4c8f5083

See more details on using hashes here.

File details

Details for the file oracle11g_mcp_server-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for oracle11g_mcp_server-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ba397eff98f94ee2501f971e4ae165d5ec1ab7c4a2bb48ce8ad84a0d7d117854
MD5 0a0192e33e5bebe10e2ff4fa8c6e189d
BLAKE2b-256 d22ff295e885cf0cb3bce27fd89c5ec5ad9100b41fbaa3bb0fda1b447d29720b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page