oracle-mcp-server
by PaulBe7
README.md
# oracle-mcp-server
[](https://pypi.org/project/oracle-mcp-server/)
[](https://pypi.org/project/oracle-mcp-server/)
[](LICENSE)
[](https://github.com/PaulBe7/oracle-mcp-server/actions/workflows/test.yml)
MCP (Model Context Protocol) Server for Oracle Databases. Enables AI assistants
like Claude, GitHub Copilot, Cursor, and Cline to query Oracle databases, inspect
schemas, analyze performance, and review PL/SQL code.
## Prerequisites
- Python 3.11+
- Access to an Oracle Database (19c+)
- No Oracle Instant Client needed (uses python-oracledb Thin Mode)
## Installation
```bash
pip install oracle-mcp-server
```
## Configuration
Create a `.env` file (or set environment variables):
```env
# Oracle Connection
ORACLE_HOST=localhost
ORACLE_PORT=1521
ORACLE_SERVICE=XEPDB1 # Service Name (preferred)
ORACLE_SID= # Or SID (alternative)
ORACLE_USER=myuser
ORACLE_PASSWORD=mypassword
# Optional: Oracle Wallet (for mTLS / Oracle Cloud)
ORACLE_WALLET_DIR=
ORACLE_WALLET_PWD=
# Connection Pool
ORACLE_POOL_MIN=2
ORACLE_POOL_MAX=10
# Safety & Limits
ORACLE_SAFE_MODE=true # Only SELECT queries allowed (default: true)
ORACLE_MAX_ROWS=500 # Max rows returned per query
ORACLE_SCHEMA= # Optional default schema
```
## Setup with Claude Desktop
Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"oracle": {
"command": "oracle-mcp",
"env": {
"ORACLE_HOST": "your-host",
"ORACLE_PORT": "1521",
"ORACLE_SERVICE": "your-service",
"ORACLE_USER": "your-user",
"ORACLE_PASSWORD": "your-password"
}
}
}
}
```
## Setup with Cursor / Cline
Add to `.cursor/mcp.json` or VS Code MCP settings:
```json
{
"mcpServers": {
"oracle": {
"command": "oracle-mcp"
}
}
}
```
## Available Tools
| Tool | Description |
|------|-------------|
| `execute_query` | Execute SQL queries with table/JSON output |
| `list_tables` | List tables with row counts and comments |
| `get_table_schema` | Full table structure (columns, constraints, indexes) |
| `list_views` | List views with optional SQL text |
| `list_procedures` | List procedures, functions, packages |
| `get_procedure_source` | Get PL/SQL source code |
| `call_procedure` | Call stored procedures (safe mode off only) |
| `get_explain_plan` | Get SQL execution plan via DBMS_XPLAN |
| `get_session_info` | Current session, DB version, NLS settings |
## Resources
| URI | Description |
|-----|-------------|
| `oracle://schema/{schema}` | Table list for a schema |
| `oracle://schema/{schema}/{table}` | Full table definition |
| `oracle://procedure/{schema}/{name}` | PL/SQL source code |
## Prompts
| Prompt | Description |
|--------|-------------|
| **Analyze Query** | Performance analysis and optimization suggestions |
| **Document Table** | Generate comprehensive table documentation |
| **Review PL/SQL** | Code review for PL/SQL objects |
## Security
- **Safe Mode** (default: ON) — only SELECT/WITH queries allowed, `call_procedure` hidden
- **Bind Variables** — all queries use parameterized queries (no SQL injection)
- **SecretStr** — passwords never appear in logs or output
- **Query Timeout** — configurable, default 30 seconds
## Development
```bash
git clone https://github.com/PaulBe7/oracle-mcp-server.git
cd oracle-mcp-server
pip install -e ".[dev]"
# Unit tests (no DB required)
pytest tests/test_query.py tests/test_prompts.py -v
# Live tests (requires Oracle DB — configure .env first)
cp .env.example .env
# Edit .env with your Oracle credentials
python scripts/create_test_data.py # Create test tables & PL/SQL objects
pytest -v
```
See [CONTRIBUTING.md](CONTRIBUTING.md) for code style and PR guidelines.
## License
MIT
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues