Oracle DB MCP Server

Oracle DB MCP Server

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.

Category
Visit Server

README

Oracle DB MCP Server

A Model Context Protocol (MCP) server for Oracle Database connectivity. This server enables AI tools like Cursor, Claude Desktop, and other MCP-compatible clients to interact with Oracle databases.

Features

  • Multiple Database Connections: Configure and manage multiple named Oracle database connections
  • Thin & Thick Mode Support: Works with Oracle's thin driver (no client required) or thick mode (with Oracle Instant Client)
  • Query Execution: Execute SELECT queries with result formatting
  • DML Operations: Execute INSERT, UPDATE, DELETE with safety checks
  • PL/SQL Support: Execute PL/SQL blocks, create procedures/functions
  • Schema Browsing: List tables, views, procedures, describe table structures
  • Stored Procedures: Execute stored procedures with input/output parameters
  • Transaction Management: Commit and rollback support
  • Safety Features: Read-only mode, dangerous query detection, automatic warnings

Installation

Using npx (Recommended)

No installation required. Configure your MCP client to run:

npx -y oracle-db-mcp

Local Installation

npm install -g oracle-db-mcp

Then run:

oracle-db-mcp

Configuration

Configuration File (connections.json)

Create a configuration file with your database connections:

{
  "oracleClient": {
    "mode": "thin"
  },
  "settings": {
    "defaultMaxRows": 100,
    "queryTimeout": 30
  },
  "connections": [
    {
      "name": "dev",
      "host": "dev-server.company.com",
      "port": 1521,
      "serviceName": "DEVDB",
      "username": "dev_user",
      "password": "dev_password",
      "mode": "readwrite"
    },
    {
      "name": "prod",
      "host": "prod-server.company.com",
      "port": 1521,
      "serviceName": "PRODDB",
      "username": "report_user",
      "passwordEnv": "PROD_DB_PASSWORD",
      "mode": "readonly"
    }
  ]
}

Connection Options

Each connection supports:

Option Description
name Unique identifier for the connection
host Database server hostname
port Port number (default: 1521)
serviceName Oracle service name
sid Oracle SID (alternative to serviceName)
connectionString Full connection string (alternative to host/port/service)
username Database username
password Database password (direct)
passwordEnv Environment variable containing password
mode readonly or readwrite

Configuration File Locations

The server searches for configuration in this order:

  1. ORACLE_MCP_CONFIG environment variable
  2. ./config/connections.json
  3. ./connections.json
  4. ~/.oracle-mcp/connections.json

Environment Variables

For simple single-connection setup:

export ORACLE_CONNECTION_NAME=mydb
export ORACLE_HOST=localhost
export ORACLE_PORT=1521
export ORACLE_SERVICE=XEPDB1
export ORACLE_USER=scott
export ORACLE_PASSWORD=tiger
export ORACLE_MODE=readonly

MCP Client Configuration

Cursor

Add to your Cursor MCP settings (.cursor/mcp.json):

{
  "mcpServers": {
    "oracle-db": {
      "command": "npx",
      "args": ["-y", "oracle-db-mcp"],
      "env": {
        "ORACLE_MCP_CONFIG": "/path/to/connections.json"
      }
    }
  }
}

Claude Desktop

Add to your Claude Desktop config:

{
  "mcpServers": {
    "oracle-db": {
      "command": "npx",
      "args": ["-y", "oracle-db-mcp"],
      "env": {
        "ORACLE_MCP_CONFIG": "/path/to/connections.json"
      }
    }
  }
}

Available Tools

Connection Management

Tool Description
list_connections List all configured connections with status
test_connection Test connectivity and get database info
connect Establish a connection
disconnect Close a connection

Query Execution

Tool Description
execute_query Execute SELECT queries
execute_dml Execute INSERT/UPDATE/DELETE
execute_plsql Execute PL/SQL blocks or DDL
execute_procedure Call stored procedures

Schema Browsing

Tool Description
list_tables List tables and views
describe_table Get column, constraint, index info
list_procedures List procedures, functions, packages
get_procedure_source Get source code of PL/SQL objects
get_procedure_params Get procedure parameters
explain_query Get query execution plan

Transaction Management

Tool Description
commit Commit current transaction
rollback Rollback current transaction

Safety Features

Read-Only Mode

Connections configured as readonly:

  • Block all DML operations (INSERT, UPDATE, DELETE)
  • Block PL/SQL execution
  • Allow only SELECT queries

Dangerous Query Detection

The server warns or blocks:

  • DROP statements
  • TRUNCATE statements
  • UPDATE/DELETE without WHERE clause
  • ALTER SYSTEM commands

Oracle Client Modes

Thin Mode (Default)

No Oracle client installation required. Works with:

  • Oracle Database 12.1 and later
  • Oracle Cloud databases

Thick Mode

Requires Oracle Instant Client. Enable in config:

{
  "oracleClient": {
    "mode": "thick",
    "path": "/path/to/instantclient"
  }
}

Required for:

  • Oracle Database versions before 12.1
  • Advanced features (LDAP, Kerberos, etc.)
  • Some data types (BFILE, etc.)

Development

Building from Source

git clone https://github.com/titan213/oracle-db-mcp
cd oracle-db-mcp
npm install
npm run build

Running in Development

npm run dev

Testing

npm test

License

MIT

Author

Gihan Sundarapperuma gihan213@gmail.com

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured