Oracle Database MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Oracle Database MCP Server
A Model Context Protocol (MCP) server that enables AI assistants to execute SQL queries and explore Oracle databases through a standardized interface.
A Model Context Protocol (MCP) server that provides direct SQL query execution capabilities for Oracle databases. This server enables AI assistants and MCP clients to interact with Oracle databases through a standardized interface, allowing for database exploration, query execution, and performance analysis.
š Core Features
SQL Query Execution
Execute any SQL query (SELECT, INSERT, UPDATE, DELETE) against Oracle databases
Support for parameterized queries to prevent SQL injection
Automatic result formatting with configurable row limits
Transaction handling with automatic commit for DML operations
Database Schema Exploration
Table Discovery: List all tables in the database or specific schemas
Table Structure: Get detailed column information including data types, constraints, and defaults
Foreign Key Relationships: Discover table relationships and dependencies
Query Performance Analysis: Generate and analyze execution plans for query optimization
MCP Protocol Integration
Full Model Context Protocol (MCP) compliance
Tool-based interface for database operations
Resource-based schema information access
Async/await support for concurrent operations
Comprehensive error handling and logging
Related MCP server: Oracle DB MCP Server
š Requirements
Python 3.8+
Oracle Database (11g, 12c, 18c, 19c, 21c)
Oracle Client Libraries (Instant Client or full client)
MCP-compatible client (Cursor, Claude Desktop, etc.)
š ļø Quick Start
Clone the repository:
git clone https://github.com/yourusername/oracle-mcp-server.git cd oracle-mcp-serverRun the setup script (recommended):
python setup.pyThis will:
Check Python version compatibility
Install required dependencies
Create
config.jsonfrom exampleVerify Oracle client availability
Install Oracle Client Libraries (if not already installed):
Option A: Oracle Instant Client (Recommended)
Download Oracle Instant Client from Oracle website
Extract to a directory (e.g.,
C:\oracle\instantclient_21_3)Add the directory to your PATH environment variable
Option B: Using thick mode with oracledb
pip install oracledb[thick]Configure database connection:
# Edit config.json with your database details # Use your preferred editor to modify config.jsonRun the server:
python mcp_server.py
š Project Structure
SQLHelp/
āāā schema/ # Schema and database structure files
ā āāā db_index.json # Main schema index with table relationships
ā āāā tables/ # Individual table schema files (JSON)
ā āāā database_tables/ # HTML documentation for tables
ā āāā catalogs/ # CSV catalog files
ā āāā docs/ # Schema documentation
āāā mcp_server.py # Main MCP server implementation
āāā config.json # Server configuration
āāā config.example.json # Example configuration
āāā requirements.txt # Python dependencies
āāā setup.py # Setup script
āāā README.md # This fileāļø Configuration
The server uses config.json for configuration. Copy config.example.json to config.json and update with your Oracle database details:
{
"database": {
"host": "your-oracle-host",
"port": 1521,
"username": "your-username",
"password": "your-password",
"sid": "your-sid",
"service_name": null
},
"mcp": {
"server_name": "oracle-sql-helper",
"version": "1.0.0",
"description": "Oracle Database MCP Server for SQL query execution",
"max_results": 1000,
"timeout_seconds": 30
},
"logging": {
"level": "INFO",
"file": "mcp_server.log"
}
}Configuration Options
database: Oracle database connection details
host: Database server hostname/IPport: Database port (usually 1521)username: Database usernamepassword: Database passwordsid: Database SID (Service Identifier)service_name: Alternative to SID (use one or the other)
mcp: MCP server settings
max_results: Maximum number of rows to return (default: 1000)timeout_seconds: Query timeout in seconds (default: 30)
logging: Logging configuration
level: Log level (DEBUG, INFO, WARNING, ERROR)file: Log file name
š ļø Available Tools
The MCP server provides the following tools:
1. execute_sql
Execute SQL queries against the Oracle database.
Parameters:
query(required): SQL query to executeparams(optional): Array of parameters for parameterized queries
Example:
SELECT customer_name, account_balance
FROM account a
JOIN customer_node c ON a.customer_node_id = c.customer_node_id
WHERE account_balance > 10002. describe_table
Get detailed table structure and column information.
Parameters:
table_name(required): Name of the table to describeschema(optional): Schema name
Example:
Table: ACCOUNT
Column Name | Data Type | Length | Precision | Scale | Nullable | Default
ACCOUNT_ID | NUMBER | | 10 | 0 | N |
CUSTOMER_NODE_ID | NUMBER | | 10 | 0 | Y |
ACCOUNT_TYPE_ID | NUMBER | | 10 | 0 | Y |
ACCOUNT_BALANCE | NUMBER | | 15 | 2 | Y | 03. list_tables
List all tables in the database or specific schema.
Parameters:
schema(optional): Schema name to filter tablespattern(optional): Pattern to match table names
4. get_table_relationships
Get foreign key relationships for a table.
Parameters:
table_name(required): Name of the tableschema(optional): Schema name
5. analyze_query_plan
Get execution plan for SQL query performance analysis.
Parameters:
query(required): SQL query to analyze
Resources
The server also provides these resources:
oracle://database/schema: Complete database schema information (JSON)oracle://database/tables: List of all database tables with metadata (JSON)
š MCP Client Configuration
To use this server with an MCP client, add the following to your MCP client configuration:
{
"mcpServers": {
"oracle-sql-helper": {
"command": "python",
"args": ["path/to/oracle-mcp-server/mcp_server.py"],
"env": {}
}
}
}š Security Features
Secure credential management via configuration files
Parameterized query support to prevent SQL injection
Configurable result limits to prevent memory issues
Comprehensive logging for audit trails
Connection timeout and error handling
š Performance Features
Configurable result set limits (default: 1000 rows)
Query timeout protection (default: 30 seconds)
Execution plan analysis for query optimization
Efficient connection management
Async operation support
š Troubleshooting
Common Issues
Oracle client not found:
Ensure Oracle Instant Client is installed and in PATH
Try installing
oracledb[thick]package
Connection timeout:
Verify database host and port are correct
Check network connectivity
Verify database is running and accepting connections
Authentication failed:
Verify username and password
Check if account is locked or expired
Ensure proper privileges are granted
TNS errors:
Verify SID or service_name is correct
Check Oracle listener is running
Verify network configuration
Debugging
Enable debug logging by setting log level to "DEBUG" in config.json:
{
"logging": {
"level": "DEBUG",
"file": "mcp_server.log"
}
}Check the log file mcp_server.log for detailed error messages.
š Sample Queries
Here are some sample queries you can try:
Basic Account Information
SELECT account_id, account_balance, created_date
FROM account
WHERE account_balance > 100
ORDER BY account_balance DESCCustomer Account Summary
SELECT c.customer_name, COUNT(a.account_id) as account_count,
SUM(a.account_balance) as total_balance
FROM customer_node c
LEFT JOIN account a ON c.customer_node_id = a.customer_node_id
GROUP BY c.customer_name
HAVING COUNT(a.account_id) > 0
ORDER BY total_balance DESCAccount History Analysis
SELECT ah.account_id, ah.transaction_type, ah.amount, ah.transaction_date
FROM account_history ah
WHERE ah.transaction_date >= SYSDATE - 30
ORDER BY ah.transaction_date DESCā” Performance Tips
Use Indexes: Ensure proper indexes exist for your queries
Limit Results: Use the
max_resultsconfiguration to prevent memory issuesParameterized Queries: Use parameters to prevent SQL injection and improve performance
Query Analysis: Use the
analyze_query_plantool to optimize slow queriesConnection Pooling: Consider implementing connection pooling for high-load scenarios
š¤ Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Support
For issues and questions:
Check the troubleshooting section
Review the log files
Verify Oracle client installation
Test database connectivity outside of MCP
Open an issue on GitHub
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Query your org's data in natural language ā read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- AlicenseAqualityCmaintenanceExecute SQL queries, browse schemas, and analyze Oracle Database performance through an AI-compatible Model Context Protocol server.84MIT
- AlicenseAqualityDmaintenanceEnables 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.16MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI applications to run SQL queries and retrieve results from Oracle Database.8-
- AlicenseNot gradedqualityDmaintenanceProvides AI assistants with secure, structured access to Oracle Database through MCP, enabling SQL execution, metadata exploration, and stored procedure execution.MIT