Oraclemcp
A Model Context Protocol (MCP) server for Oracle databases, written in Go. Enables LLMs to inspect schemas and execute read-only queries.
Installation
npx oraclemcpAsk AI about Oraclemcp
Powered by Claude Β· Grounded in docs
I know everything about Oraclemcp. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Oracle MCP Server (Go)
This is a Model Context Protocol (MCP) server for Oracle databases, written in Go. It allows LLMs (like Claude) to interact with your Oracle database to inspect schemas, view PL/SQL source code, and execute read-only queries.
It uses the standard Stdio transport, meaning it is designed to be run directly by an MCP client (like Claude Desktop or an MCP-enabled IDE extension).
π Security Note
This server is strictly READ-ONLY. It is designed with data safety as the top priority.
β What This Server CAN Do:
- Execute
SELECTqueries against your data - Read Oracle's data dictionary views (
ALL_*,DBA_*,V$*) - View PL/SQL source code from
ALL_SOURCE - Retrieve DDL scripts using
DBMS_METADATA.GET_DDL - Generate execution plans (stores temporary data in
PLAN_TABLE, then cleans up)
β What This Server CANNOT Do:
- No INSERT, UPDATE, DELETE β Cannot modify any table data
- No CREATE, ALTER, DROP β Cannot change database schema
- No EXECUTE β Cannot run stored procedures or functions
- No GRANT, REVOKE β Cannot change privileges
- No TRUNCATE, MERGE β Cannot perform any data manipulation
π‘οΈ How We Ensure Read-Only Safety:
- Query Validation: The
sql-selecttool explicitly validates that queries start withSELECTorWITHbefore execution - Dictionary Views Only: All other tools query Oracle's read-only data dictionary views
- No DDL Execution: DDL is only retrieved as text, never executed
- Temporary Data Cleanup: Any temporary data (like execution plans) is immediately deleted after use
Note: For additional security, you can connect with a database user that only has
SELECTprivileges on the required dictionary views. This provides defense-in-depth at the database level.
Features
π Table & Schema Tools
| Tool | Description |
|---|---|
sql-select | Execute arbitrary SELECT or WITH queries (limited to 1000 rows) |
list-tables | List all accessible tables (excluding system schemas) |
get-table-schema | Get column definitions for a specific table |
list-constraints | List all constraints for a table (PK, FK, Unique, Check) |
get-constraint-columns | Get the columns that make up a constraint |
π§ PL/SQL Objects Tools
| Tool | Description |
|---|---|
list-objects | List Oracle objects by type (PROCEDURE, FUNCTION, PACKAGE, TYPE, etc.) |
get-object-source | Get PL/SQL source code for procedures, functions, packages, types, triggers |
describe-object | Get comprehensive info about any Oracle object (like SQL*Plus DESCRIBE) |
π Scheduler Jobs Tools
| Tool | Description |
|---|---|
list-jobs | List all Oracle Scheduler jobs |
get-job-details | Get detailed information about a specific job |
π Dependencies Tools
| Tool | Description |
|---|---|
list-dependencies | List what objects depend on or are used by a given object |
ποΈ Views Tools
| Tool | Description |
|---|---|
list-views | List all views accessible to the current user |
get-view-definition | Get the SQL definition of a view |
π Index Tools
| Tool | Description |
|---|---|
list-indexes | List all indexes, optionally filtered by table |
get-index-columns | Get the columns that make up an index |
π’ Sequence Tools
| Tool | Description |
|---|---|
list-sequences | List all sequences accessible to the current user |
β‘ Trigger Tools
| Tool | Description |
|---|---|
list-triggers | List all triggers, optionally filtered by table |
π·οΈ Type Tools
| Tool | Description |
|---|---|
list-types | List all user-defined types (object types, collection types) |
get-type-attributes | Get the attributes (fields) of a user-defined type |
π Synonym Tools
| Tool | Description |
|---|---|
list-synonyms | List all synonyms accessible to the current user |
π Search & Analysis Tools
| Tool | Description |
|---|---|
search-source | Search for text within PL/SQL source code to find where tables, columns, or variables are used |
search-columns | Search for column names across all tables (find all tables with a specific column) |
get-ddl | Get the full SQL CREATE script (DDL) for any object using DBMS_METADATA |
explain-plan | Get the execution plan for a SQL query to analyze performance |
get-table-stats | Get optimizer statistics for a table (row count, last analyzed, size) |
list-invalid-objects | List all database objects with INVALID status that need recompilation |
π Documentation Tools
| Tool | Description |
|---|---|
get-table-comments | Get comments/documentation for a table and its columns |
get-table-relationships | Get all foreign key relationships for a table (incoming and outgoing) |
π Monitoring Tools
| Tool | Description |
|---|---|
list-sessions | List active database sessions (requires V$SESSION privilege) |
get-job-run-history | Get execution history of a scheduler job (status, duration, errors) |
Prerequisites
- Go (1.18+): To build the application.
- Oracle Database: Access to an Oracle instance.
- No Instant Client Required: Uses
go-ora, a pure Go driver.
Configuration
The application requires the following environment variables:
ORACLE_USER: Database username.ORACLE_PASSWORD: Database password.ORACLE_CONNECT_STRING:host:port/service_name.
Building
Quick Build
go build -o mcp_oracle.exe .
Build & Release to GitHub
To create a new release with the executable uploaded to GitHub:
# Interactive mode - prompts for version
.\release.ps1
# Specify version directly
.\release.ps1 -Version "v1.2.0"
# Create as draft release
.\release.ps1 -Version "v1.2.0" -Draft
Prerequisites for releasing:
- GitHub CLI (
gh) installed and authenticated - Run
gh auth loginif not already authenticated
Usage with Claude Desktop
To use this with the Claude Desktop app, add the following to your configuration file (typically %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"oracle-db": {
"command": "c:/path/to/your/mcp_oracle.exe",
"args": [],
"env": {
"ORACLE_USER": "your_user",
"ORACLE_PASSWORD": "your_password",
"ORACLE_CONNECT_STRING": "localhost:1521/XEPDB1"
},
"disabled": false,
"autoApprove": [
"sql-select",
"list-tables",
"get-table-schema",
"list-constraints",
"get-constraint-columns",
"list-objects",
"get-object-source",
"describe-object",
"list-jobs",
"get-job-details",
"list-dependencies",
"list-views",
"get-view-definition",
"list-indexes",
"get-index-columns",
"list-sequences",
"list-triggers",
"list-types",
"get-type-attributes",
"list-synonyms",
"search-source",
"search-columns",
"get-ddl",
"explain-plan",
"get-table-stats",
"list-invalid-objects",
"get-table-comments",
"get-table-relationships",
"list-sessions",
"get-job-run-history"
]
}
}
}
Make sure to replace the paths and credentials with your actual values.
Usage with VS Code (Extension)
If you are developing a VS Code extension that acts as an MCP client:
- Spawn the
mcp_oracle.exeprocess. - Set the environment variables in the process options.
- Communicate via
stdinandstdoutusing the MCP JSON-RPC protocol.
Tool Examples
Query Data
Tool: sql-select
Arguments: {"query": "SELECT * FROM employees WHERE department_id = 10"}
List All Procedures
Tool: list-objects
Arguments: {"object_type": "PROCEDURE", "owner": "HR"}
Get Source Code
Tool: get-object-source
Arguments: {"object_name": "CALCULATE_SALARY", "object_type": "PROCEDURE", "owner": "HR"}
List Jobs
Tool: list-jobs
Arguments: {"owner": "MYSCHEMA"}
Find Dependencies
Tool: list-dependencies
Arguments: {"object_name": "MY_PACKAGE", "direction": "used_by"}
Get Table Constraints
Tool: list-constraints
Arguments: {"table_name": "EMPLOYEES", "owner": "HR"}
Manual Testing (CLI)
You can verify the server starts by running it, but it will hang waiting for JSON-RPC input on stdin.
$env:ORACLE_USER="user"
$env:ORACLE_PASSWORD="password"
$env:ORACLE_CONNECT_STRING="localhost:1521/xe"
.\mcp_oracle.exe
MCP Protocol
This server implements the Model Context Protocol (MCP) specification:
- Transport: Stdio (stdin/stdout)
- Protocol: JSON-RPC 2.0
- Discovery: Supports
tools/listfor automatic tool discovery - Execution: Supports
tools/callfor tool execution
When an AI agent connects, it will automatically discover all available tools via the tools/list method.
