Oracle 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 MCP Server
A Model Context Protocol (MCP) server for Oracle 19c databases. This server enables AI agents (like Claude) to interact with Oracle databases through MCP, allowing them to execute queries, inspect schemas, and retrieve data directly.
Features
Execute SQL Queries: Run SELECT queries and get results in JSON format
Schema Inspection: List tables, describe table structures, and preview data
TNS Alias Support: Works with your existing Oracle TNS configuration
Connection Pooling: Efficient database connection management
Read-Only Mode: Optional safety mode that restricts operations to SELECT queries only
Secure Configuration: Environment-based credential management
Related MCP server: Oracle DB MCP Server
Prerequisites
Python 3.10 or higher
Oracle 19c database (or compatible version)
Oracle TNS configuration (tnsnames.ora) or direct connection string
Installation
From PyPI (once published)
pip install oracle-mcpFrom Source
# Clone the repository
git clone https://github.com/yourusername/oracle-mcp.git
cd oracle-mcp
# Install in development mode
pip install -e .Configuration
1. Set up Environment Variables
Create a .env file in your project directory or set environment variables:
# Required
ORACLE_USER=your_username
ORACLE_PASSWORD=your_password
ORACLE_DSN=your_tns_alias # e.g., FC1070 or hostname:1521/service_name
# Optional
ORACLE_POOL_MIN=2
ORACLE_POOL_MAX=10
QUERY_TIMEOUT=30
READ_ONLY_MODE=falseFor TNS Alias (Recommended):
If you're using TNS aliases (like in SQL Developer), set ORACLE_DSN to your TNS alias name (e.g., FC1070). Ensure your tnsnames.ora file is properly configured and accessible.
For Direct Connection:
Alternatively, use a direct connection string: hostname:1521/service_name
2. Configure MCP Client
You can invoke the server in two ways:
python -m oracle_mcp(recommended) — portable, works whenever Python is on PATH. No reliance on theScripts/directory being resolved by your MCP client.oracle-mcp— the console script entry point. Only works if the PythonScripts/directory (e.g.%APPDATA%\Python\Python3XX\Scriptson Windows) is on PATH and your MCP client inherits that PATH.
If oracle-mcp gives you errors like oracle-mcp required by oracle-mcp is not found, use the python -m oracle_mcp form instead.
Claude Desktop
Edit the config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"oracle": {
"command": "python",
"args": ["-m", "oracle_mcp"],
"env": {
"ORACLE_USER": "your_username",
"ORACLE_PASSWORD": "your_password",
"ORACLE_DSN": "FC1070"
}
}
}
}GitHub Copilot (VS Code)
Create or edit .vscode/mcp.json in your workspace (or add to user settings):
{
"servers": {
"oracle": {
"type": "stdio",
"command": "python",
"args": ["-m", "oracle_mcp"],
"env": {
"ORACLE_USER": "your_username",
"ORACLE_PASSWORD": "your_password",
"ORACLE_DSN": "FC1070"
}
}
}
}Security Note: For better security, use environment variables instead of hardcoding credentials:
{
"mcpServers": {
"oracle": {
"command": "python",
"args": ["-m", "oracle_mcp"],
"env": {
"ORACLE_USER": "${ORACLE_USER}",
"ORACLE_PASSWORD": "${ORACLE_PASSWORD}",
"ORACLE_DSN": "${ORACLE_DSN}"
}
}
}
}Then set these environment variables in your system.
Usage
Once configured, the Oracle MCP server provides the following tools to AI agents:
Tools
execute_query - Execute SELECT queries
Execute a SQL query: SELECT * FROM employees WHERE department = 'IT'list_tables - List all tables and views
Show me all tables in the databasedescribe_table - Get table structure
Describe the structure of the employees tablepreview_table - Get sample data from a table
Show me a preview of the employees tableexecute_dml - Execute INSERT/UPDATE/DELETE (if read-only mode is disabled)
Insert a new employee record
Resources
oracle://connection - View database connection information
oracle://schema - View schema metadata
Example Interactions
With the MCP server running, you can ask Claude (or any MCP-compatible AI agent):
"What tables are available in the database?"
"Show me the structure of the EMPLOYEES table"
"Run a query to find all employees in the IT department"
"Get a sample of data from the ORDERS table"
"What's the total count of records in CUSTOMERS?"
The AI agent will use the appropriate MCP tools to interact with your Oracle database and provide results.
Development
Project Structure
oracle-mcp/
├── src/oracle_mcp/
│ ├── __init__.py # Package initialization
│ ├── server.py # MCP server implementation
│ ├── oracle_client.py # Oracle database client
│ └── config.py # Configuration management
├── tests/ # Test files
├── pyproject.toml # Package configuration
└── README.md # This fileRunning Tests
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytestBuilding for Distribution
# Install build tools
pip install build
# Build the package
python -m buildTroubleshooting
TNS Configuration Issues
If you encounter "TNS:could not resolve the connect identifier" errors:
Verify your
tnsnames.orafile locationCheck that
ORACLE_DSNmatches an entry in yourtnsnames.oraEnsure
TNS_ADMINenvironment variable points to the directory containingtnsnames.oraTry using a direct connection string instead:
hostname:1521/service_name
Connection Errors
Verify database credentials are correct
Check that the database is accessible from your network
Ensure Oracle database is running and accepting connections
Review firewall rules if connecting remotely
Permission Issues
Ensure the database user has appropriate SELECT permissions
For DML operations, ensure write permissions are granted
Check that the user can access the required schemas
Security Best Practices
Never commit credentials - Use environment variables or secure vaults
Use read-only mode when possible - Set
READ_ONLY_MODE=trueLimit database permissions - Grant only necessary privileges to the database user
Use dedicated database users - Create specific users for AI agent access
Monitor queries - Review query logs regularly
Set query timeouts - Prevent long-running queries with
QUERY_TIMEOUT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Built with the Model Context Protocol SDK
Uses python-oracledb for Oracle connectivity
Support
For issues, questions, or contributions, please visit the GitHub repository.
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.
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Astra DB tools for agents: schema, find, vector search, guarded writes, and interactive views.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides flexible access to Oracle databases for AI assistants like Claude, supporting SQL queries across multiple schemas with comprehensive database introspection capabilities.611MIT
- 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 read-only exploration of Oracle databases through natural language, providing schema inspection and safe bounded SQL query execution.-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to connect to Oracle databases for schema exploration, PL/SQL source inspection, and read-only SQL queries, with optional write operations when explicitly enabled.-