A powerful Model Context Protocol (MCP) server that provides contextual database schema information for large Oracle databases, enabling AI assistants to understand and work with databases containing thousands of tables.
The MCP Oracle DB Context server solves a critical challenge when working with very large Oracle databases: how to provide AI models with accurate, relevant database schema information without overwhelming them with tens of thousands of tables and relationships.
By intelligently caching and serving database schema information, this server allows AI assistants to:
To use this MCP server with GitHub Copilot in VSCode Insiders, follow these steps:
In VSCode Insiders, go to your user or workspace settings.json
file and add the following:
"mcp": {
"inputs": [
{
"id": "db-password",
"type": "promptString",
"description": "Oracle DB Password",
"password": true,
}
],
"servers": {
"oracle": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"ORACLE_CONNECTION_STRING",
"-e",
"TARGET_SCHEMA",
"-e",
"CACHE_DIR",
"-e",
"THICK_MODE",
"dmeppiel/oracle-mcp-server"
],
"env": {
"ORACLE_CONNECTION_STRING":"<db-username>/${input:db-password}@<host>:1521/<service-name>",
"TARGET_SCHEMA":"",
"CACHE_DIR":".cache",
"THICK_MODE":"" // Optional: set to "1" to enable thick mode
}
}
}
}
This option requires installing and setting up the project locally:
oracledb
Python package)Install UV
```shell
curl -LsSf https://astral.sh/uv/install.sh | sh
irm https://astral.sh/uv/install.ps1 | iex
```
Project Setup
```shell
git clone https://github.com/yourusername/oracle-mcp-server.git
cd oracle-mcp-server
uv venv
source .venv/bin/activate
.venv\Scripts\activate
uv pip install -e .
```
Configure VSCode Settings
json
"mcp": {
"inputs": [
{
"id": "db-password",
"type": "promptString",
"description": "Oracle DB Password",
"password": true,
}
],
"servers": {
"oracle": {
"command": "/path/to/your/.local/bin/uv",
"args": [
"--directory",
"/path/to/your/oracle-mcp-server",
"run",
"main.py"
],
"env": {
"ORACLE_CONNECTION_STRING":"<db-username>/${input:db-password}@<host>:1521/<service-name>",
"TARGET_SCHEMA":"",
"CACHE_DIR":".cache",
"THICK_MODE":"" // Optional: set to "1" to enable thick mode
}
}
}
}
To run the MCP server directly:
uv run main.py
For development and testing:
# Install the MCP Inspector
uv pip install mcp-cli
# Test with MCP Inspector
mcp dev main.py
# Or install in Claude Desktop
mcp install main.py
When connected to an AI assistant like GitHub Copilot in VSCode Insiders or Claude, the following tools will be available:
get_table_schema
Get detailed schema information for a specific table including columns, data types, nullability, and relationships. Example:
Can you show me the schema for the EMPLOYEES table?
get_tables_schema
Get schema information for multiple tables at once. More efficient than calling get_table_schema multiple times. Example:
Please provide the schemas for both EMPLOYEES and DEPARTMENTS tables.
search_tables_schema
Search for tables by name pattern and retrieve their schemas. Example:
Find all tables that might be related to customers and show their schemas.
rebuild_schema_cache
Force a rebuild of the schema cache. Use sparingly as this is resource-intensive. Example:
The database structure has changed. Could you rebuild the schema cache?
get_database_vendor_info
Get information about the connected Oracle database version and schema. Example:
What Oracle database version are we running?
search_columns
Search for tables containing columns that match a specific term. Useful when you know what data you need but aren't sure which tables contain it. Example:
Which tables have columns related to customer_id?
get_pl_sql_objects
Get information about PL/SQL objects like procedures, functions, packages, triggers, etc. Example:
Show me all stored procedures that start with 'CUSTOMER_'
get_object_source
Retrieve the source code for a PL/SQL object. Useful for debugging and understanding database logic. Example:
Can you show me the source code for the CUSTOMER_UPDATE_PROC procedure?
get_table_constraints
Get all constraints (primary keys, foreign keys, unique constraints, check constraints) for a table. Example:
What constraints are defined on the ORDERS table?
get_table_indexes
Get all indexes defined on a table, helpful for query optimization. Example:
Show me all indexes on the CUSTOMERS table.
get_dependent_objects
Find all objects that depend on a specified database object. Example:
What objects depend on the CUSTOMER_VIEW view?
get_user_defined_types
Get information about user-defined types in the database. Example:
Show me all custom types defined in the schema.
get_related_tables
Get all tables that are related to a specified table through foreign keys, showing both incoming and outgoing relationships. Example:
What tables are related to the ORDERS table?
This MCP server employs a three-layer architecture optimized for large-scale Oracle databases:
The database connector supports two connection modes:
By default, the connector uses Oracle's thin mode, which is a pure Python implementation. This mode is:
For scenarios requiring advanced Oracle features or better performance, you can enable thick mode:
THICK_MODE=1
in the Docker environment variablesTHICK_MODE=1
environment variable and ensure Oracle Client libraries, compatible with your system architecture and database version, are installedWe welcome contributions! Please see our Contributing Guidelines for details.
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions: