Oracle DB MCP
Read-only MCP server that lets coding AI agents inspect Oracle Database schema through live metadata.
README
Oracle DB MCP
Read-only MCP server that lets coding AI agents inspect an Oracle Database schema through live metadata.
It connects with node-oracledb Thin mode, usually through an Oracle wallet, and exposes schema, source, DDL, synonym, sequence, grant, and optional ORDS metadata as MCP tools.
This server does not expose arbitrary SQL execution.
What This Gives Your Agent
After connecting this MCP server, an AI coding agent can answer questions like:
- What columns, constraints, and indexes does this table have?
- Which tables reference this table?
- Where is this table, column, package, or procedure used?
- What is the DDL for this view or object?
- Which triggers run on this table?
- Which synonyms point to this object?
- Which grants exist for this table?
- Which ORDS handler serves this route?
The agent discovers this information live from Oracle dictionary views instead of relying on stale exported schema files.
Requirements
- Node.js 18+
- Access to an Oracle Database user
- Oracle wallet files for Thin mode:
tnsnames.oraewallet.pem
- A dedicated read-only Oracle user is strongly recommended
Install And Build
Clone the repo, install dependencies, and build:
git clone https://github.com/your-org/oracle-db-mcp.git
cd oracle-db-mcp
npm install
npm run build
Extract your Oracle wallet outside the repo, for example:
C:\secure\oracle-wallets\example
or:
/Users/me/secure/oracle-wallets/example
Copy .env.example to .env and fill in your connection settings:
ORACLE_USER=ORACLE_MCP_READONLY
ORACLE_PASSWORD=replace-with-db-password
ORACLE_CONNECT_STRING=your_tns_alias_low
ORACLE_CONFIG_DIR=C:\secure\oracle-wallets\example
ORACLE_WALLET_LOCATION=C:\secure\oracle-wallets\example
ORACLE_WALLET_PASSWORD=
ORACLE_DEFAULT_SCHEMA=APP_SCHEMA
ORACLE_POOL_MIN=1
ORACLE_POOL_MAX=4
ORACLE_POOL_INCREMENT=1
ORACLE_CONNECT_TIMEOUT_SECONDS=20
ORACLE_TRANSPORT_CONNECT_TIMEOUT_MS=10000
ORACLE_QUEUE_TIMEOUT_MS=60000
ORACLE_CONNECT_STRING should be a TNS alias from tnsnames.ora. Leave ORACLE_WALLET_PASSWORD blank if your wallet does not have a password.
Verify the connection:
npm run check:oracle
Connect An AI Agent
Most MCP-compatible coding agents support a stdio server config with command, args, and optionally env.
Use the built server entrypoint:
node /absolute/path/to/oracle-db-mcp/dist/index.js
Option A: Use .env
If you created .env in the repo root, your MCP client config only needs to start the server.
Windows example:
{
"mcpServers": {
"oracle-db": {
"command": "node",
"args": [
"C:\\path\\to\\oracle-db-mcp\\dist\\index.js"
]
}
}
}
macOS/Linux example:
{
"mcpServers": {
"oracle-db": {
"command": "node",
"args": [
"/path/to/oracle-db-mcp/dist/index.js"
]
}
}
}
Option B: Put Env Vars In The MCP Config
Some teams prefer keeping the repo without a .env file and passing secrets through the MCP client environment.
{
"mcpServers": {
"oracle-db": {
"command": "node",
"args": [
"/path/to/oracle-db-mcp/dist/index.js"
],
"env": {
"ORACLE_USER": "ORACLE_MCP_READONLY",
"ORACLE_PASSWORD": "replace-with-db-password",
"ORACLE_CONNECT_STRING": "your_tns_alias_low",
"ORACLE_CONFIG_DIR": "/secure/oracle-wallets/example",
"ORACLE_WALLET_LOCATION": "/secure/oracle-wallets/example",
"ORACLE_WALLET_PASSWORD": "",
"ORACLE_DEFAULT_SCHEMA": "APP_SCHEMA"
}
}
}
}
The exact file where this JSON goes depends on your AI client. Look for a setting named MCP servers, tools, connectors, or external tools, then add a stdio MCP server using the same shape.
Verify From Your Agent
Restart your AI client after adding the MCP config, then ask:
Use the oracle-db MCP server to ping Oracle.
Then try:
Use oracle-db to list tables in the default schema.
or:
Use oracle-db to describe the CUSTOMERS table and show its constraints.
If the server is connected correctly, your agent should call tools such as ping_oracle, list_tables, and describe_table.
Available Tools
Connection and schema:
ping_oracle: verifies the wallet connection withSELECT ... FROM DUAL.list_tables: lists table metadata fromALL_TABLES.describe_table: lists column metadata fromALL_TAB_COLUMNS.get_table_summary: returns table metadata and counts.get_table_constraints: returns primary key, foreign key, unique, and check constraints.get_table_indexes: returns indexes and indexed columns.get_table_comments: returns table and column comments.get_table_relationships: returns declared FK links where a table is a child or parent.get_schema_relationships: returns declared FK links touching a schema.
Objects, source, and DDL:
search_objects: searchesALL_OBJECTSby name, type, status, and owner.get_object_metadata: returns metadata for one object fromALL_OBJECTS.search_source: searchesALL_SOURCEwith capped context snippets.get_object_source: returns full ordered source lines for a PL/SQL object.get_table_triggers: returns triggers on a table with source previews.find_object_dependencies: returns objects referenced by a database object.find_object_dependents: returns objects that reference a database object.list_views: lists view metadata fromALL_VIEWS.get_view_definition: returns view metadata plus DDL fromDBMS_METADATA.GET_DDL.get_object_ddl: returns object DDL fromDBMS_METADATA.GET_DDL.
Synonyms, sequences, and grants:
list_synonyms: lists synonyms fromALL_SYNONYMS.resolve_synonym: resolves one synonym, preferring the configured schema beforePUBLIC.list_sequences: lists sequence metadata fromALL_SEQUENCES.get_sequence: returns one sequence fromALL_SEQUENCES.get_object_grants: returns grants on one object fromALL_TAB_PRIVS.get_grants_to_user: returns grants whereGRANTEEmatches a user or role.
ORDS:
list_ords_modules: lists current-schema ORDS modules.get_ords_module: returns one ORDS module with templates, handlers, and parameters.search_ords_handlers: searches ORDS handlers by module, URI, method, source type, or source text.get_ords_handler: returns one ORDS handler with parameters and full source.
ORDS tools auto-detect whether USER_ORDS_* metadata views are available. If not, they return available: false with a clear reason instead of failing the MCP server.
Security Notes
- Use a dedicated read-only Oracle user.
- Keep
.envand wallet files out of git. - Grant only the dictionary/object privileges needed for your agent’s use case.
- DDL extraction depends on Oracle privileges. If
DBMS_METADATA.GET_DDLcannot read an object, the tool returns a structurederrorobject. - This MCP server is metadata-focused and does not provide arbitrary SQL execution.
Troubleshooting
Run the smoke test first:
npm run check:oracle
Common issues:
- Missing
tnsnames.oraorewallet.pem: checkORACLE_CONFIG_DIRandORACLE_WALLET_LOCATION. - TNS alias not found: verify
ORACLE_CONNECT_STRINGexists intnsnames.ora. - Agent cannot see tools: restart the AI client after changing MCP config.
- DDL returns an error: the Oracle user may not have permission to read that object through
DBMS_METADATA. - ORDS tools return
available: false: the database/user does not expose theUSER_ORDS_*metadata views.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.