oracle-mcp-server
Supports optional OAuth 2.0/OpenID Connect single sign-on with Keycloak as an identity provider, including admin UI SSO and mapping Keycloak groups or e-mails to default Oracle database connections.
Supports OpenID Connect single sign-on so MCP clients can authenticate with access tokens, with identity-provider groups or e-mails selecting the database connection.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@oracle-mcp-server show me the columns of the employees table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
oracle-mcp-server
Model Context Protocol server that gives AI tools (Claude, Copilot, Cursor and other MCP clients) access to Oracle Database — the Oracle sibling of tommi2day/pg-mcp-server.
Features
20 tools: schema browsing (
list_schemas,list_tables,describe_table), read-onlyquery,executefor DML/DDL/PL/SQL withDBMS_OUTPUT, and performance analysis (execution plans, top SQL, sessions, locks, optimizer statistics, alert log and trace files; ASH/AWR and SQL Monitor only when the packs are licensed) — detailsClaude skills: six ready-made workflows — database status, top sessions and SQL, problem detection, SQL tuning, documentation and error analysis incl. alert and trace logs — details; their steps are tested against a real database (blocking chain, slow statement, deadlock → alert log → trace file)
Safe reads:
queryruns inSET TRANSACTION READ ONLYand is always rolled back, so Oracle itself rejects writes; onlySELECT/WITHare accepted (DDL would commit implicitly); results capped at 200 rows (ORA_MAX_ROWS) to keep the LLM context smallEvery Oracle connection style: host/port/service or SID, TNS alias from
tnsnames.ora, Easy Connect Plus, full descriptors and JDBC URLs; plain TCP or TCPS with wallets, private CAs and server DN pinning; node-oracledb thin mode (no client install) or thick mode (Instant Client image variant)Multi-user: bearer tokens (admin and client), one database connection per token, managed at runtime in a web admin UI (screenshots), REST API or
admincli.sh; DB and wallet passwords encrypted at rest; admin UI with your own logo and colors (branding); optionally clients log in with their own database account or choose the database (client-supplied connections)Single sign-on: optional OAuth 2.0 / OpenID Connect (Microsoft Entra ID, Keycloak, …) — MCP clients send an access token, the admin UI offers SSO, and groups or e-mails choose the default database connection (deny by default) — details
Read-only users:
read_onlyremoves theexecutetool for a token or an OAuth assignment (orORA_READ_ONLYfor everyone), switched at runtime — detailsHardened by default: the HTTP server refuses to start without authentication, sessions are bound to the client that opened them, failed logins are throttled per IP (HTTP 429), the token store is
0600with an scrypt-derived key, the admin UI is served with CSP and no framing, and the Docker image is scanned with Trivy in CI — detailsTraceable in the database: each session carries
MODULE,ACTION= tool andCLIENT_IDENTIFIER= token name or, with SSO, the user's e-mail (Session identification); plus a structured audit log of tool calls, sessions, rejected logins and admin actions (example)Transport & operations: stdio or Streamable HTTP/HTTPS (optional mTLS), Docker image on Docker Hub and the GitHub Container Registry (thin and thick), docker compose with an Oracle Free test database, Helm chart (existing Secrets,
TNS_ADMINfrom Secrets/ConfigMaps, ingress, HPA, non-root); only two runtime dependencies (MCP SDK,oracledb); 400+ tests — unit tests plus integration tests against Oracle Free, Keycloak and a mock OIDC server
When to choose this server
Choose it when several people or AI clients share Oracle access through one central service — with
revocable tokens or your company's single sign-on (Entra ID, Keycloak, …) instead of database passwords in every client
config, group-based access to different databases, TCPS wallets kept on the server, and an audit trail that names
the person in both the log and V$SESSION.
No credentials on laptops. Clients get a token or log in with their corporate account; database users, passwords, wallets and
tnsnames.orastay on the server.Access follows your directory. With OAuth/OIDC an assignment maps an Entra/Keycloak group or e-mail to a database connection (read-only reporting user for most, a DBA account for a few), deny by default; joiners and leavers are handled in the identity provider.
Least privilege per user.
read_onlyremoves theexecutetool for a token, a group or an e-mail pattern (or for everyone withORA_READ_ONLY), also in sessions that are already open — analysts getqueryand the diagnostics, only a few get DML, DDL and PL/SQL. Oracle still enforces it a second time:queryruns in a read-only transaction.Attributable. The shared database account is not what DBAs see:
CLIENT_IDENTIFIERcarries the user's e-mail (or the token name),ACTIONthe tool, next to[AUDIT]log lines for logins, sessions and admin changes.Safe to expose. The HTTP server refuses to start without authentication, a stolen
mcp-session-idcannot be used by another user, repeated failed logins are throttled per IP, and the container image is scanned in CI — see Security hardening.Diagnostics included. Skills and tools for "what is my database doing", locks, top SQL, plans, alert log and trace files — read-only, licence-aware (ASH/AWR/SQL Monitor only when licensed).
Verified against real components. Besides unit tests, CI runs every tool, the skills' workflows, the OAuth path and the read-only enforcement against an Oracle Free container and a real identity provider (Keycloak, login form included).
Local Oracle MCP servers (e.g. SQLcl | oracle-mcp-server | |
Deployment | Process per user on the workstation (stdio) | Central service (Docker / Kubernetes) plus stdio |
Client authentication | Whoever can start it | Bearer tokens, revocable at runtime, or OAuth 2.0 / OIDC single sign-on |
Who may use which database | The user's own saved connections | Per token, or per directory group / e-mail (OAuth assignments), deny by default |
Credentials & wallets | On every client machine | Stay on the server; clients only get a token |
Write access | Whatever the saved connection's database account may do | Same database privileges, plus per token or SSO user the |
Databases per instance | Saved connections of that user | One connection per token, managed centrally |
Exposure as a shared service | Not applicable (local process) | No start without authentication, failed-login throttle, sessions bound to their owner, scanned image |
Audit | Log table | Server log (token or user e-mail, tool, client IP, rejected logins, |
When to choose something else: for a single developer working locally with SQLcl anyway, Oracle's
SQLcl MCP Server
needs no extra service. On Autonomous AI Database, the built-in
Autonomous AI Database MCP Server
exposes Select AI Agent tools with OAuth. For several database engines behind one server, look at
DBHub. oracle-mcp-server focuses on secure, audited, multi-user SQL access to
any Oracle Database (on-premises, cloud, container) — self-hosted, with no Oracle client install needed. It brings
its own authorization (tokens or your identity provider) and does not replace database privileges: whatever the
connection of a token or assignment may do, the client may do — read_only only removes the execute tool, so give
reporting groups a read-only database user as well.
Related MCP server: Universal Database MCP Server
Contents
Tools
Tool | Description |
| Read-only |
| DML, DDL, |
| Tables, views and materialized views of a schema (default: current schema). |
| Columns, Oracle types ( |
| Schemas visible to the user (Oracle-maintained schemas hidden unless |
| Database/PDB name, service, user, server version, driver mode and whether the session uses TCPS. |
Identifiers follow Oracle rules: unquoted names are upper-cased (emp → EMP), "MixedCase" is used verbatim.
A trailing ; on SQL statements and a trailing SQL*Plus / on PL/SQL blocks are stripped automatically.
The
querytool rejects anything that is notSELECT/WITHbecause DDL would implicitly commit and end the read-only transaction. For hard guarantees, connect with a read-only database user.
Performance analysis
Tool | Description | Licence |
| Optimizer plan of a SELECT/WITH/INSERT/UPDATE/DELETE/MERGE ( | – |
| Actual plan of a cached cursor by | – |
| Top statements from | – |
| Active sessions ( | – |
| Table, index and column optimizer statistics incl. staleness, clustering factor and histograms. | – |
| "What is my database doing": instance, load of the last minute, sessions, CPU vs. wait classes, attention points. | – |
| Blocked sessions, root blockers (status, idle time, waiters), locked objects; suggests but never runs | – |
| Alert log via | – (log privileges) |
| ADR incidents ( | – (log privileges) |
| List and read trace files ( | – (log privileges) |
| Active Session History of the last N minutes grouped by sql_id, event, wait class, session or module. | Diagnostics Pack |
| DB time, DB CPU and top wait events between the first and last AWR snapshot of the last N hours. | Diagnostics Pack |
| Recent monitored executions ( | Tuning Pack |
The alert log and trace tools need the optional log privileges (@grant_perf_privileges.sql <user> MINIMAL N N Y,
role MCP_PERF_LOG_ROLE, or SELECT_CATALOG_ROLE); without them they answer with a privilege hint.
The Claude skills combine these tools into ready-made workflows.
Licensed features are disabled by default. Tools that need an Oracle management pack are neither listed to the client nor executable unless enabled:
Switch | Default | Scope |
|
|
|
|
| enables |
|
| enables |
Tokens can override the pack switches for their connection (diagnostics_pack / tuning_pack, admin UI or
admincli.sh add-token … --diagnostics-pack true), so one server can serve licensed and unlicensed databases.
If the database itself has CONTROL_MANAGEMENT_PACK_ACCESS set to NONE, the tools say so when they find no data.
The switches only control this server's tools. The generic
querytool can still read any view the database user is allowed to see — revoke access toV$ACTIVE_SESSION_HISTORY,DBA_HIST_*andV$SQL_MONITORon the database side if pack usage must be prevented technically.
Privileges: the unlicensed tools except explain_plan read dynamic performance views. Run
scripts/sql/grant_perf_privileges.sql <user> [MINIMAL|CATALOG] [diagnostics Y|N] [tuning Y|N] [logs Y|N] as SYS — in
MINIMAL mode it creates separate roles for the unlicensed tools, each pack and the alert log / trace tools, so
licensed views are only reachable where the pack is granted. Errors caused by missing privileges include a hint.
Full documentation of the tools, privileges and the grant script: docs/performance.md. In a PDB, awr_top_events uses the PDB's own snapshots (AWR_PDB_AUTOFLUSH_ENABLED=TRUE) and
otherwise falls back to CDB root snapshots where their statistics are visible.
Internal statements of the performance tools run with ACTION=mcp-perf:<tool> and are excluded from top_sql
(see Session identification).
Quick start
docker compose (with a local Oracle Free test database)
cp .env.example .env # set AUTH_TOKEN (openssl rand -hex 32)
docker compose up -d # Oracle Free 23ai + MCP server on http://localhost:3000
./scripts/test_token.sh "$AUTH_TOKEN"examples/tns_admin/ is mounted as TNS_ADMIN; its tnsnames.ora defines the alias FREE for the test database.
docker run
docker run -d --name oracle-mcp-server -p 3000:3000 \
-e AUTH_TOKEN=$(openssl rand -hex 32) \
-e ORA_CONNECT_STRING='jdbc:oracle:thin:@//db.example.com:1521/ORCLPDB1' \
-e ORA_USER=app -e ORA_PASSWORD=secret \
-v "$PWD/tns_admin:/opt/oracle/network/admin:ro" \
-v oracle-mcp-data:/data \
tommi2day/oracle-mcp-serverThe image (and the -thick variant) is also published to the GitHub Container Registry with the same tags:
docker pull ghcr.io/tommi2day/oracle-mcp-server:latest.
or ./scripts/run.sh (reads .env, generates ./auth_token, mounts ./tns_admin if present).
Local (stdio, Claude Desktop)
npm ci && npm run build
ORA_HOST=localhost ORA_SERVICE_NAME=FREEPDB1 ORA_USER=mcp ORA_PASSWORD=mcp_pw node dist/index.jsConnection methods
The default connection is built from ORA_* environment variables; each token can override it
(see per-token connections). The target is chosen by precedence:
# | Method | Env var(s) | Token field(s) |
1 | Free connect string / JDBC URL |
|
|
2 | TNS alias |
|
|
3 | Host / port / service |
|
|
Credentials: ORA_USER / ORA_PASSWORD (or ORA_PASSWORD_FILE).
Accepted connect strings
Input | Used as |
| Easy Connect |
| Easy Connect Plus (parameters passed through) |
| Connect descriptor |
| TNS alias |
| → Easy Connect |
| legacy SID syntax → descriptor with |
| → Easy Connect Plus (TCPS) |
| → descriptor |
| → alias, |
| credentials extracted (for tokens they are moved into the encrypted password field) |
JDBC-only driver properties (oracle.net.*, oracle.jdbc.*) are ignored with a warning.
TCPS / TLS
TCPS works with every connection method: ORA_PROTOCOL=tcps, a tcps:// connect string or
(PROTOCOL=TCPS) in a descriptor/alias.
Situation | What to provide |
Server certificate from a public CA | nothing — the system CA store is used |
Server certificate from a private CA | CA certificate(s) as |
Mutual TLS / Autonomous Database wallet |
|
Thick mode |
|
How ewallet.pem is used (thin mode):
contains a private key → passed to the driver as wallet (client certificate + trusted CAs)
contains certificates only → added to the process-wide set of trusted CAs (node-oracledb thin cannot load a certificate-only file as wallet)
Server identity checks: host name / SAN matching is on by default (ORA_SSL_SERVER_DN_MATCH=false or
token ssl_server_dn_match: false to disable), ORA_SSL_SERVER_CERT_DN / (SECURITY=(SSL_SERVER_CERT_DN=…))
pins the certificate subject.
Converting wallets for thin mode:
# PKCS#12 wallet (ewallet.p12) → PEM (keeps key and certificates)
openssl pkcs12 -in ewallet.p12 -out ewallet.pem -nodes # unencrypted
openssl pkcs12 -in ewallet.p12 -out ewallet.pem -passout pass:xyz # encrypted → ORA_WALLET_PASSWORD=xyz
# Trust-only: just the CA certificate
cp root-ca.crt tns_admin/ewallet.pemOracle client files (TNS_ADMIN)
In the image TNS_ADMIN=/opt/oracle/network/admin (declared as VOLUME). Mount your files read-only:
tns_admin/
├── tnsnames.ora # aliases (thin + thick)
├── sqlnet.ora # thick mode only (thin mode ignores sqlnet.ora)
├── ewallet.pem # thin mode wallet or trusted CA certificates
└── cwallet.sso # thick mode auto-login walletDocker:
-v ./tns_admin:/opt/oracle/network/admin:ro(files must be readable by uid 1000)Kubernetes: Secret and/or ConfigMap, combined into one directory by the Helm chart:
kubectl -n mcp create secret generic oracle-tns-admin \ --from-file=tnsnames.ora --from-file=sqlnet.ora --from-file=ewallet.pem helm install oracle-mcp ./helm/oracle-mcp-server -n mcp --set tnsAdmin.existingSecret=oracle-tns-admin …
Different tokens can use different client configurations: mount additional directories (Helm
tnsAdmin.extraSecrets) and reference them with the token fields tns_admin / wallet_location
(thin mode). In thick mode the Oracle Client reads only the global TNS_ADMIN.
Thin vs. thick mode
thin (default) | thick ( | |
Image |
|
|
Oracle Client | none | Instant Client (basic lite) |
| ✅ | ✅ |
| ❌ (use | ✅ |
Wallet |
|
|
Per-token | ✅ | ❌ (global |
Native network encryption, DB < 12.1 | ❌ | ✅ |
Outside the image set ORA_CLIENT_LIB_DIR to the Instant Client directory for thick mode.
Configuration reference
All settings are environment variables (Docker -e, docker-compose.yml, Helm values.yaml, or the env block of a
stdio client config). Variables marked (per token) can be overridden per token or OAuth assignment in the admin UI /
token store; the value here is the server default.
Server
Variable | Default | Description |
|
|
|
|
| Listen port of the HTTP(S) server ( |
| – | Admin bearer token: full access to |
|
| JSON token store (tokens, per-token connections, OAuth assignments); created on first write, mount a volume to keep it |
| – | Passphrase; encrypts |
| – |
|
| – |
|
|
| Failed authentications per client IP and window (seconds) before HTTP 429; |
|
| Name announced to MCP clients, shown in the admin UI and written to |
|
|
|
|
|
|
| – | CSS file loaded after the built-in admin UI styles (branding) |
| – | Admin UI logo: file ( |
TLS for the MCP endpoint
Variable | Default | Description |
|
| Serve HTTPS instead of HTTP. Unrelated to |
|
| Server certificate and key (PEM); a self-signed certificate is generated if the files are missing |
| – | CA for client certificates; setting it requires a client certificate (mTLS) on the MCP endpoint |
| – | Extra subject alternative names (comma separated DNS names / IPs) of the generated self-signed certificate |
Oracle
Target precedence: ORA_CONNECT_STRING > ORA_TNS_ALIAS > ORA_HOST/ORA_PORT/service (details).
Variable | Default | Description |
| – | Free connect string: Easy Connect Plus ( |
| – | Alias from |
|
| Database host (used if neither connect string nor alias is set). (per token) |
|
| Listener port. (per token) |
| – | Service name (e.g. the PDB service |
| – | SID, only for old databases without a service name. (per token) |
|
|
|
| – | Default database account for |
| – | Read the password from this file instead of |
| image: | Directory with |
|
| Wallet directory for TCPS (thin: |
| – | Password of an encrypted |
| driver default ( | Verify host name / certificate DN on TCPS; |
| – | Expected DN of the server certificate when it differs from the host name. (per token) |
| – | PEM bundle with additional trusted CA certificates for TCPS (private CAs); added to the process-wide trust store |
|
|
|
| image: | Instant Client directory for thick mode |
|
| Maximum connections per pool; tokens with an identical effective connection share one pool |
|
| Seconds to wait for establishing a connection |
|
| Maximum rows returned by the |
|
|
|
|
|
|
|
|
|
OAuth 2.0 / OIDC
OAUTH_ISSUER switches OAuth on; the other variables tune it. Examples: OAuth section
and docs/oauth.md.
Variable | Default | Description |
| – | Issuer URL ( |
|
| Accepted |
| – | App registration / client used for the admin UI login (and default audience) |
| – | Client secret of the browser login; omit for public clients (PKCE is always used) |
| – | External base URL of this server ( |
|
| Scopes advertised to MCP clients (space or comma separated); right for Entra, use e.g. |
|
| Explicit redirect URI if it must differ |
|
| Scopes requested by the admin UI login |
|
| Claim holding the groups; dotted paths ( |
| – | Claim with the e-mail; default fallback chain |
|
| Accepted |
| discovery | Override single entries of the discovery document (e.g. when the server reaches the provider under another host name than browsers do) |
|
|
|
|
| Lifetime of the admin UI session in seconds |
| – | Comma separated groups / e-mails ( |
| – | Same, but they may also use the admin UI and API |
| – | JSON array of assignments that carry their own connection ( |
Session identification
Every database session used by the server identifies the MCP server and the token, so DBAs can attribute
activity in V$SESSION, ASH, AWR, SQL Monitor and the audit trail:
| Value | Example |
|
|
|
|
|
|
| tool name; |
|
| token name ( |
|
| server name, version and MCP client IP |
|
The attributes are set on every checkout from the pool (tokens with the same effective connection share sessions) and travel with the next database call — no extra round trip. Values are cut to Oracle's limits (MODULE 48, ACTION 32, CLIENT_IDENTIFIER / CLIENT_INFO 64 bytes). An idle pooled session keeps the values of its last use.
SELECT sid, program, module, action, client_identifier, client_info
FROM v$session WHERE module = 'Prod DB (EU)';
-- ASH (Diagnostics Pack): DB time per token
SELECT client_id, COUNT(*) FROM v$active_session_history
WHERE module = 'Prod DB (EU)' GROUP BY client_id;CLIENT_IDENTIFIER also appears in unified auditing (UNIFIED_AUDIT_TRAIL.CLIENT_IDENTIFIER) and can drive
DBMS_MONITOR.CLIENT_ID_TRACE_ENABLE to trace everything a single token does.
Tokens & per-token connections
Tokens are managed in the admin UI (/admin), via the REST API (/admin/tokens, see openapi.json)
or with scripts/admincli.sh (./scripts/admincli.sh help; also manages OAuth assignments). The plaintext token is shown once; only its SHA-256 hash is stored.
export AUTH_TOKEN=<admin token> MCP_URL=http://localhost:3000
./scripts/admincli.sh add-token reporting --host db.example.com --port 2484 --protocol tcps \
--service REPORTS --user report_ro --password secret
./scripts/admincli.sh add-token prod --tns-alias PROD_HIGH --user app --password secret
./scripts/admincli.sh add-token legacy --connect-string 'jdbc:oracle:thin:@dbhost:1521:ORCL' \
--user scott --password tiger
./scripts/admincli.sh set-conn 2 '{"tns_alias":"PROD","tns_admin":"/opt/oracle/wallets/prod","user":"app"}'
./scripts/admincli.sh add-token "reporting" --read-only # token without the execute tool
./scripts/admincli.sh set-read-only <id> true|false # switch it later (open sessions follow)Connection object fields: connect_string, tns_alias, host, port, service_name, sid, protocol,
user, password, tns_admin, wallet_location, wallet_password, ssl_server_dn_match, ssl_server_cert_dn,
diagnostics_pack, tuning_pack.
Merge rules with the default connection:
a token that sets a target (
connect_string,tns_aliasorhost) never inherits target fields of the defaultuser/passwordfall back to the default only if the token sets nousertns_admin, wallet and TLS fields fall back individually
Secrets are write-only: the API returns password_set: true instead of the password, and a PATCH without
password keeps the stored one. Tokens with the same effective connection share one connection pool.
Read-only tokens and assignments
"read_only": true on a token or an OAuth assignment removes the execute tool for its clients: it is no longer
listed and a call is refused ([AUTH] … action="execute" … reason="read-only"). query and the performance tools
keep working; query always runs in SET TRANSACTION READ ONLY, so Oracle itself rejects writes through it.
Scope | How to set it |
One token | Admin UI toggle Read-only, or |
One OAuth assignment | Admin UI, |
Everyone |
|
Changes take effect for open sessions with their next request. The flag limits the MCP tools, it does not replace a least-privilege database account: give the Oracle user only the grants it needs.
Security hardening
Measure | Behaviour |
No unauthenticated HTTP |
|
Sessions bound to their owner | Resuming an |
Failed-login throttle | More than |
Token store | Written with mode |
Admin UI | Served with |
Image | Trivy scans the Docker image in CI and before each release push (fixable HIGH/CRITICAL findings fail the build) |
Client-supplied connections
By default a client always uses the connection of its token (or the server default). The admin can allow the
clients of a token to send their own connection parameters — e.g. so that every user logs in with a personal
database account instead of a shared technical user. The permission is the token field client_connection
(admin UI: Client-supplied connection, admincli.sh add-token … --client-connection / set-client-conn):
| Client may send | Typical use |
| nothing — X-Oracle-* headers are rejected with HTTP 403 | fixed connection |
|
| personal DB accounts on one database |
| additionally the target: | one token for many databases (the server can then reach any host the client names) |
For the AUTH_TOKEN admin token (and anonymous access when auth is disabled) ORA_CLIENT_CONNECTION sets the
same permission (default none).
Call format
The parameters are sent as HTTP headers on the MCP initialize request — the request that opens the MCP
session (no mcp-session-id yet). They apply to the whole session; headers on later requests are ignored. Header
name = X-Oracle- + field name with _ → - (case-insensitive):
Header | Field | Mode |
|
|
|
| Easy Connect, descriptor or JDBC URL ( |
|
| alias from the server's |
|
| host target ( |
|
| TCPS certificate checks |
|
POST /mcp HTTP/1.1
Authorization: Bearer <token>
Content-Type: application/json
Accept: application/json, text/event-stream
X-Oracle-User: jdoe
X-Oracle-Password: s3cret
X-Oracle-Host: db2.example.com
X-Oracle-Service-Name: SALESPDB
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},
"clientInfo":{"name":"my-client","version":"1.0"}}}Client configuration — MCP clients send configured headers with every request, so a static header entry is all that is needed:
// .mcp.json (Claude Code) / any client with Streamable HTTP + headers
{
"mcpServers": {
"oracle-sales": {
"type": "http",
"url": "https://mcp.example.com/mcp",
"headers": {
"Authorization": "Bearer <token>",
"X-Oracle-User": "jdoe",
"X-Oracle-Password": "${ORACLE_PASSWORD}"
}
}
}
}# Claude Code CLI
claude mcp add --transport http oracle-sales https://mcp.example.com/mcp \
--header "Authorization: Bearer <token>" --header "X-Oracle-User: jdoe" --header "X-Oracle-Password: s3cret"
# Claude Desktop and other stdio-only clients via mcp-remote
npx mcp-remote https://mcp.example.com/mcp --header "Authorization: Bearer <token>" \
--header "X-Oracle-User: jdoe" --header "X-Oracle-Password: s3cret"Rules and safeguards:
Client parameters override the token's connection:
user/passwordreplace the token's credentials; a client target replaces the token's target (and itsssl_server_cert_dnpinning). The token'stns_admin, wallet and licence switches (diagnostics_pack,tuning_pack) stay in effect.A client target requires client credentials — the password of the token or server default is never sent to a host chosen by the client.
Server-side files cannot be referenced:
tns_admin,wallet_locationandwallet_passwordare not accepted as headers, and connect strings mentioning a wallet orTNS_ADMINare rejected.Rejected requests get HTTP 403 (not permitted) or 400 (invalid, e.g.
userwithoutpassword) with a JSON-RPC error message, and are logged as[AUTH] result="denied" … reason="client connection: …". A wrong database password shows up as the ORA- error of the first tool call.The permission is re-checked on every request: switching a token back to
noneends the use of client parameters in its open sessions immediately.Sessions with client parameters get their own connection pool, which is closed when the last such session ends. The session start log shows
connection="client" target="…" user="…"(never the password).Passwords travel in HTTP headers — use HTTPS (
TLS_ENABLED=trueor a TLS-terminating ingress).
Admin UI
Open http://<server>:3000/admin, sign in with the server URL and the AUTH_TOKEN value (leave it empty only with
ALLOW_ANONYMOUS=true). The session is kept in sessionStorage and cleared when the browser tab is closed.
Token list — server info with the default connection and enabled performance features, then every token with status, connection (server default, host / service or TNS alias) and last use:

With OAuth configured, Sign in with single sign-on logs in members of an admin group/user, and the section OAuth assignments maps groups or e-mails to a default connection, client-connection mode and the admin role (assignments from environment variables are listed read-only).
Editing a token changes its name, active state or connection; passwords are never shown and stay unchanged when the field is left empty. Deleting a token revokes access immediately.
Admin UI branding
The admin UI can be switched to a corporate design without rebuilding the image:
Variable | Effect |
| Replaces the database icon on the login card and in the header. A file is embedded as data URI ( |
| Stylesheet injected after the built-in styles. Override the CSS variables below; any other CSS rule is allowed, too. |
| Title next to the logo and in the browser tab. |
Both files are read once at startup; an unreadable file is logged as [WARN] [CONFIG] and the built-in design is
used. The design is served to everyone who opens /admin (also before sign-in), so do not put anything
confidential into it.
All colors of the UI are CSS variables in the :root block at the top of admin.html:
Variable | Used for |
| Buttons, links, toggles; hover color; text on primary |
| Focused inputs |
| Top bar and its buttons |
| Gradient of the built-in icon (without |
| Page, cards, table header, rows |
| Text colors |
| Status badges, alerts, delete dialog, switched-off toggles |
| Font stack, corner radius of cards and dialogs |
| Logo height on the login card (40px) and in the header (28px) |
examples/admin-theme/ contains a complete example (fictional "ACME data" design: light
header with accent bar, teal primary color, own logo):
:root {
--primary: #00857c;
--primary-dk: #006b63;
--header-bg: #ffffff;
--header-text: #12333a;
--font: "Segoe UI", Arial, Helvetica, sans-serif;
}
header { border-bottom: 3px solid #f2a900; } /* additional rules are fine */docker run -d -p 3000:3000 \
-v "$PWD/examples/admin-theme:/branding:ro" \
-e ADMIN_THEME_CSS=/branding/theme.css -e ADMIN_LOGO=/branding/logo.svg \
-e MCP_SERVER_NAME="ACME Oracle MCP" … tommi2day/oracle-mcp-serverWith Helm put the files into a ConfigMap and set adminUi.brandingConfigMap, adminUi.themeCss and
adminUi.logo (see values.yaml):
kubectl -n mcp create configmap mcp-branding --from-file=examples/admin-theme/theme.css --from-file=examples/admin-theme/logo.svgOAuth 2.0 / OpenID Connect
Instead of (or next to) bearer tokens, users can authenticate with an OpenID Connect provider — primarily Microsoft
Entra ID, also Keycloak, Okta and others. Set OAUTH_ISSUER; MCP clients then send an OAuth access token (JWT) as
bearer token, which the server validates locally (signature via JWKS, issuer, audience, lifetime).
Authorization by assignment (deny by default): a user may use the server if their e-mail or one of their groups is assigned — via
OAUTH_ALLOWED_GROUPS,OAUTH_ALLOWED_USERS,OAUTH_ADMIN_GROUPS,OAUTH_ADMIN_USERS,OAUTH_ASSIGNMENTSor in the admin UI (OAuth assignments).Default connection by group or e-mail: an assignment can carry an Oracle connection (TNS alias, host/service, user, …) that the user gets; users without one use the server default.
client_connectionlets selected users bring their own database account.Attributable:
CLIENT_IDENTIFIERinV$SESSIONand the[MCP]/[SESSION]log lines carry the user's e-mail;[AUDIT]lines record logins, MCP sessions and admin changes.AUTH_TOKENand file tokens keep working (break-glass admin).
OAUTH_ISSUER=https://login.microsoftonline.com/<tenant-id>/v2.0
OAUTH_CLIENT_ID=<app-id> OAUTH_CLIENT_SECRET=<secret> OAUTH_AUDIENCE=api://<app-id>
OAUTH_PUBLIC_URL=https://mcp.example.com
OAUTH_ADMIN_GROUPS=<admin-group-object-id> OAUTH_ALLOWED_GROUPS=<user-group-object-id>MCP clients can send such a token as a header or log in by themselves (client setup). Full reference, Entra setup steps and security notes: docs/oauth.md.
Users and groups are assigned to connections in the admin UI (OAuth assignments) or with scripts/admincli.sh (below):
Assignments from the command line
export AUTH_TOKEN=<admin token or access token of an OAuth admin> MCP_URL=http://localhost:3000
./scripts/admincli.sh whoami # who am I, is OAuth configured
./scripts/admincli.sh add-assignment --group grp-dba --tns-alias PROD_HIGH --user mcp_dba --password secret
./scripts/admincli.sh add-assignment --email alice@example.com --client-connection credentials
./scripts/admincli.sh add-assignment --email '*@example.com' # access with the default connection
./scripts/admincli.sh add-assignment --group grp-admin --admin # may use the admin UI and API
./scripts/admincli.sh list-assignments
./scripts/admincli.sh set-assignment-conn 2 '{"host":"db2","service_name":"PDB1","user":"ro","password":"…"}'
./scripts/admincli.sh delete-assignment 2admincli.sh takes the same connection options as add-token; --group / --email (e-mail, object id or *@domain) name
who the assignment is for. Assignments from the environment (OAUTH_*) are listed as read-only. help shows all commands.
Logging
All activity goes to stderr (docker logs oracle-mcp-server) in the format [timestamp] [LEVEL] [CATEGORY] …:
tool calls, MCP session start/stop, rejected logins and admin actions. LOG_LEVEL (debug / info / warn /
error, default info) sets the minimum level.
Real output at the default level info — three clients working in parallel (one of them over the TNS alias FREE
with the performance tools), an UPDATE rejected by the read-only database user of reporting-team, and four
rejected logins (disabled token, unknown token, wrong admin token, missing token). SQL text is replaced by its length:

With LOG_LEVEL=debug the full SQL text is logged, plus internals such as pool creation:

Line format, all categories and keys, and ready-to-use Filebeat / Logstash configurations: docs/logging.md.
Kubernetes / Helm
The chart is published as an OCI artifact on GitHub Container Registry (one chart version per release, chart version = app version):
helm install oracle-mcp oci://ghcr.io/tommi2day/charts/oracle-mcp-server --version 1.0.0 -n mcp …
helm show values oci://ghcr.io/tommi2day/charts/oracle-mcp-server --version 1.0.0Or install from a checkout of this repository:
kubectl create namespace mcp
kubectl -n mcp create secret generic oracle-tns-admin --from-file=tnsnames.ora --from-file=ewallet.pem
kubectl -n mcp create secret generic oracle-credentials --from-literal=password='secret'
helm install oracle-mcp ./helm/oracle-mcp-server -n mcp \
--set oracle.tnsAlias=PROD_HIGH --set oracle.user=app \
--set oracle.existingSecret=oracle-credentials \
--set tnsAdmin.existingSecret=oracle-tns-admin \
--set auth.token=$(openssl rand -hex 32) \
--set persistence.enabled=trueKey values (see helm/oracle-mcp-server/values.yaml):
image.tagdefaults to the chart'sappVersion, so each chart version deploys its matching image; for thick mode use<version>-thick(e.g.1.0.0-thick),latestfollows the newest releaseoracle.connectString/oracle.tnsAlias/oracle.host|port|serviceName|sid|protocol,oracle.useroracle.passwordororacle.existingSecret(keyspassword, optionalwalletPassword)oracle.driverMode(thickrequires the-thickimage),oracle.sslServerDnMatch,oracle.sslServerCertDn,oracle.tlsCaFileoracle.perfTools(defaulttrue),oracle.diagnosticsPack/oracle.tuningPack(defaultfalse, enable only when licensed)tnsAdmin.existingSecret,tnsAdmin.existingConfigMap,tnsAdmin.files(inline) → projected read-only volume attnsAdmin.mountPath(mode0440, readable throughfsGroup: 1000)tnsAdmin.extraSecrets→ additional wallet/tnsnames directories for per-token connectionsauth.token/auth.existingSecret,auth.storeEncryptionKey,server.tlsEnabled,tls.*,persistence.*oracle.clientConnection(ORA_CLIENT_CONNECTIONfor the admin token),adminUi.*(branding)
scripts/helm_install.sh wraps a typical install.
Claude skills
The skills/ directory holds Claude Code skills that use the tools above for typical DBA questions.
They are read-only, base every finding on tool output and use licensed tools (ASH/AWR, SQL Monitor) only when the
server lists them.
Skill | Ask for … |
| "What is my database doing?" — health and load at a glance |
| top sessions and top SQL (CPU, time, I/O, executions) |
| locks, deadlocks, waits, saturation, long-running calls |
| why a statement is slow: plan, statistics, indexes, verified recommendations |
| schema / data model documentation (ERD), incident and tuning write-ups |
| ORA- errors: alert log → incident → trace file → cause |
cp -r skills/* ~/.claude/skills/ # all projects; or <project>/.claude/skills/Windows PowerShell: Copy-Item -Recurse skills\* $env:USERPROFILE\.claude\skills\.
The error analysis needs the optional log privileges (grant_perf_privileges.sql <user> MINIMAL N N Y). Details,
required privileges and the safety design: docs/skills.md.
Claude configuration
Remote (HTTP):
{
"mcpServers": {
"oracle": {
"type": "http",
"url": "https://oracle-mcp.example.com/mcp",
"headers": { "Authorization": "Bearer <token>" }
}
}
}With OAuth the client can log in by itself — only the URL is configured, the client
finds the identity provider through the server's /.well-known/oauth-protected-resource and refreshes the token:
{ "mcpServers": { "oracle": { "type": "http", "url": "https://oracle-mcp.example.com/mcp" } } }# Claude Code; the provider needs a pre-registered public client (Entra ID has no dynamic registration)
claude mcp add --transport http --client-id <client-id> oracle https://oracle-mcp.example.com/mcpA static Authorization: Bearer <access token> header works as well, but access tokens expire. Provider
requirements (client registration, audience, scopes) and OAUTH_RESOURCE_SCOPES: docs/oauth.md.
Local (stdio): see example.mcp.json. The file also has inactive examples (block _inactive_examples, ignored by
clients; copy an entry into mcpServers to use it): OAuth login by the client, an OAuth access token as header, and
client-supplied connections with the user's own credentials or a client-chosen database.
Development
npm ci
npm run build # tsc → dist/
npm test # vitest (unit tests, no database needed; integration tests are skipped)
npm run test:integration # against Docker: Oracle Free + OIDC provider, see below
npm run lint
npm run typecheck
./scripts/test.sh # tests in Docker, no local Node.js needed
docker build -t oracle-mcp-server . # thin image
docker build --build-arg ORACLE_THICK=true -t oracle-mcp-server:thick . # with Instant ClientIntegration tests (real Oracle database and a real OIDC provider, skipped unless the variable is set):
docker compose --profile oidc up -d oracle-test oidc-test # wait until oracle-test is healthy
ORA_TEST_HOST=localhost OIDC_TEST_ISSUER=http://localhost:8080/default npm run test:integration
docker compose --profile oidc down
# OIDC tests against a real provider with login form (Keycloak) instead of the mock server:
docker compose --profile keycloak up -d --wait keycloak
OIDC_TEST_ISSUER=http://localhost:8081/realms/oracle-mcp npx vitest run tests/oidc.integration.test.tsTo try the admin UI's single sign-on yourself, docs/oauth.md starts the whole stack with a Keycloak realm (admin console, users and groups included).
They run every MCP tool against sample schemas, the Claude skills on real data (blocking chain,
slow statement and index fix, deadlock → alert log → trace file; tests/skills.test.ts checks without a database that
skills and tool schemas agree), the OAuth path end to end (group / e-mail → schema, V$SESSION
tags, client-supplied credentials, assignment admin API) and the token validation against the provider
(docs/oauth.md).
Source layout: src/oracle.ts (connect strings, JDBC parsing, pool attributes, wallets — pure),
src/lib.ts (logging, auth, token store, admin API), src/oauth.ts / src/oauth-routes.ts (OAuth 2.0 / OIDC), src/perf.ts (performance tools and licence gating),
src/format.ts (result formatting), src/index.ts (MCP tools, HTTP routing, startup).
Log format: see docs/logging.md. Performance tools: docs/performance.md. Claude skills: docs/skills.md.
License
Apache-2.0 © Tommi2Day
Available Tools
17 toolsalert_logA
Read the database alert log through V$DIAG_ALERT_EXT (11.2+): newest entries of the last minutes, optionally only ORA-/TNS- errors or lines containing a text. "Errors in file …" entries show the trace file name to read with trace_content. Needs SELECT on V$DIAG_ALERT_EXT.
Inputs: limit, minutes, contains, errors_only.
db_overviewA
One-shot answer to "what is my database doing right now": instance and uptime, load metrics of the last minute (V$SYSMETRIC), session counts, what active sessions are doing (CPU vs. wait classes) and attention points (blocked sessions, long calls, load above CPU count) with the next tool to use.
Inputs: no named parameters.
describe_tableA
Show columns, types, nullability, defaults, primary key and comments of a table or view
Inputs: table (required), schema.
executeA
Execute a SQL statement (INSERT, UPDATE, DELETE, MERGE, DDL) or a PL/SQL block. Changes are committed. DBMS_OUTPUT of PL/SQL blocks is returned.
Inputs: sql (required), params.
explain_planA
Show the optimizer execution plan (EXPLAIN PLAN + DBMS_XPLAN.DISPLAY) of a SELECT, WITH, INSERT, UPDATE, DELETE or MERGE statement without executing it.
Inputs: sql (required), format.
incidentsA
Diagnostic incidents recorded in the ADR (V$DIAG_INCIDENT / V$DIAG_PROBLEM): time, error code, problem key, signalling component. Incidents with a problem key correspond to alert log entries and trace files.
Inputs: days, limit.
list_schemasB
List all schemas (users) visible to the connected user
Inputs: include_system.
list_tablesB
List tables, views and materialized views in a schema
Inputs: schema.
locksA
Lock analysis: blocked sessions with the blocking and root blocking session and the locked object, the root blockers (status, idle time, SQL, number of waiters) and the locks they hold (V$LOCKED_OBJECT). Suggests, but never executes, ALTER SYSTEM KILL SESSION. Single instance (V$ views).
Inputs: limit.
queryA
Execute a read-only SQL SELECT (or WITH …) query and return the results. At most 200 rows are returned. Bind variables use Oracle syntax (:1, :2 or :name).
Inputs: sql (required), params.
session_activityB
Current user sessions (V$SESSION): status, sql_id, wait event, blocking session, plus the top non-idle wait events since instance startup (V$SYSTEM_EVENT).
Inputs: limit, username, include_idle.
sql_planA
Show the actual execution plan of a cached cursor (DBMS_XPLAN.DISPLAY_CURSOR) by sql_id, e.g. from top_sql or session_activity. Use format 'ALLSTATS LAST' for row source statistics (requires the GATHER_PLAN_STATISTICS hint or STATISTICS_LEVEL=ALL). Needs SELECT on V$SQL, V$SQL_PLAN, V$SQL_PLAN_STATISTICS_ALL.
Inputs: sql_id (required), format, child_number.
table_statsB
Optimizer statistics of a table: rows, blocks, staleness, lock state, indexes (columns, clustering factor, status) and column statistics (distinct values, nulls, histograms).
Inputs: table (required), schema.
test_connectionB
Test the database connection and return server info
Inputs: no named parameters.
top_sqlA
Top SQL statements from the shared pool (V$SQLAREA) by elapsed time, CPU, buffer gets, disk reads or executions, with per-execution averages and sql_id.
Inputs: limit, schema, order_by, sql_text_like, +1 more.
trace_contentA
Read a trace file through V$DIAG_TRACE_FILE_CONTENTS: the last (default) or first lines, optionally only lines containing a text (e.g. ORA-, a sql_id). Use the file name from trace_files or alert_log. Trace files can contain SQL text and data values — handle the output as sensitive.
Inputs: file (required), lines, context, contains, +1 more.
trace_filesA
List trace files of the database diagnostic destination (V$DIAG_TRACE_FILE), newest first, optionally filtered by name (e.g. an ospid, "ora", "pmon", "j00", an incident number).
Inputs: limit, minutes, name_like.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Most tools have clearly distinct purposes: query vs. execute (read-only vs. committed DML/DDL), explain_plan vs. sql_plan (estimated vs. actual cached plan), and the diagnostic chain alert_log → trace_files → trace_content are all well separated in their descriptions. The main soft overlap is db_overview versus session_activity/top_sql, since the overview reports session counts, active-session activity and load that the narrower tools also surface, which could cause an agent to reach for the summary when it wanted detail (or vice versa).
All names are consistently snake_case with no casing chaos, and the vocabulary (sql_id, session, trace, plan) is coherent across the set. The only deviation is verb style: some are verb_noun (list_tables, describe_table, explain_plan, test_connection, list_schemas) while others are bare nouns (locks, incidents, alert_log, top_sql, session_activity, table_stats), so the pattern is predictable in form but not in grammatical shape.
At 17 tools this sits at the upper end but each one maps to a real DBA workflow step (connect, survey, explore schema, run SQL, inspect plans, diagnose incidents/locks/traces), so nothing feels gratuitous. It is slightly heavy for a single server, but the grouping into query, plan and diagnostics clusters keeps it navigable.
The surface covers the full lifecycle for a read-mostly Oracle diagnostics server: connectivity, instance overview, schema discovery, arbitrary read and write execution, plan estimation and actual plan inspection, SQL/session performance, and a complete ADR diagnostics path (alert log, incidents, trace listing, trace content). The one deliberate omission — locks suggests but never executes ALTER SYSTEM KILL SESSION — is an intentional safety boundary rather than a dead end, and execute covers DDL/DML commit paths.
Maintenance
Related MCP Connectors
Paid remote MCP for governed database query review, SQL simulation, approvals, and audits.
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
DBRE-grade SQL analysis inside any MCP client. No connection. No install. Paste a query.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables interaction with Oracle databases through MCP by executing SELECT queries, describing table structures, and listing available tables with secure, read-only access.32ISC
- FlicenseNot gradedqualityDmaintenanceA versatile MCP server that connects to multiple relational databases (MySQL, PostgreSQL, Oracle, SQL Server, SQLite) and enables secure read-only SQL query execution and metadata access.4-
- AlicenseBqualityDmaintenanceMCP server for accessing Oracle databases, enabling schema exploration, query execution, and performance analysis.12MIT
- AlicenseAqualityDmaintenanceMCP server for Oracle Database enabling AI assistants to explore schemas, run queries, write data, and monitor sessions via natural language. Features read-only mode by default and uses Oracle Thin mode for zero-install connectivity.10136 npm2MIT