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.)
  • DML Support: Execute Data Manipulation Language statements (INSERT, UPDATE, DELETE, MERGE, 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)
  • DML_ENABLE: Enable DML 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",
        "DML_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
  • execute_DML: Execute DML statements (INSERT, UPDATE, DELETE, MERGE, etc.) - requires DML_ENABLE=Y

Security Features

  • DDL Protection: DDL operations are disabled by default. Set DDL_ENABLE=Y to enable them.
  • DML Protection: DML operations are disabled by default. Set DML_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.1.0.tar.gz (32.1 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.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oracle11g_mcp_server-1.1.0.tar.gz
  • Upload date:
  • Size: 32.1 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.1.0.tar.gz
Algorithm Hash digest
SHA256 0aaa1c5bfbb090009c19269b0a803c9925f7626ab70ca9251b69020f7ead202e
MD5 f49e8a419c3776c4c98759780e2d445d
BLAKE2b-256 7a41a048751bd43462424c639e7c2f88490c5e3162a6f6b1bbd5355c309f105f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oracle11g_mcp_server-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3841637ccaca845db661d708d3d2e82cea6dae76d37c5050c1799ffbc869a820
MD5 e177b9dbe74d1406190132edccad1230
BLAKE2b-256 3cb40d568d2a53ac2035a439666665e0b392d9ca01c4add967cb0bbbc55dcc71

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