Oracle MCP Gateway
by RockyCott
README.md
# Oracle MCP Gateway
**One MCP endpoint for multiple Oracle databases and multiple users.**
Connect an AI assistant to an allowlisted set of Oracle databases. Each user
works under their own database credentials. Administrators can review access
and audit events in a web portal. SQL reads run inside read-only transactions,
and changes use a separate approval workflow.
| Feature | What it gives you |
|---|---|
| Multiple targets | Explicit connection IDs for each operation, with per-target schemas, limits and policies |
| User isolation | Credentials, sessions and connection pools scoped to the authenticated user |
| Three sign-in modes | Keycloak OAuth, Oracle-backed browser sign-in, or a personal loopback bearer |
| Database exploration | Schema and object discovery, bounded queries, plan inspection and structural comparisons |
| Controlled changes | Prepare, review, approve and execute a change at most once |
| Browser portal | Link accounts, review sessions, manage permissions and inspect the audit log |
```mermaid
flowchart LR
Client["MCP client"] --> Gateway["Oracle MCP Gateway"]
Browser["Browser portal"] --> Gateway
Identity["Keycloak or Oracle sign-in"] --> Gateway
Gateway --> State[("PostgreSQL audit and state")]
Gateway --> Development[("Oracle development")]
Gateway --> Production[("Oracle production")]
```
## Try it with synthetic data
You need Python 3.12, [uv](https://docs.astral.sh/uv/) and Docker with Compose.
The lab runs on loopback and uses disposable Oracle Free targets.
```bash
uv sync --all-groups --frozen
uv run python scripts/bootstrap_local.py
docker compose -f infra/keycloak/compose.yaml up -d --wait
E2E_ENCRYPTION_KEYS=unused docker compose --env-file infra/keycloak/.env \
-f infra/testing/compose.yaml up -d --wait oracle-develop oracle-production
docker compose -f compose.yaml -f compose.keycloak.yaml -f compose.synthetic.yaml \
up -d --build --wait
scripts/smoke-test.sh http://localhost:8010
```
Open [the portal](http://localhost:8010) as `local-developer`. The generated
Keycloak password is `LOCAL_USER_PASSWORD` in the private file
`infra/keycloak/.env`. In **My Oracle accounts**, link the synthetic development
account `ADA` with password `Synthetic_ada_1`.
```bash
uv run python scripts/mcp_client.py login
uv run python scripts/mcp_client.py connections
uv run python scripts/mcp_client.py query --connection oracle-develop \
--sql 'SELECT 1 AS HEALTH_CHECK FROM DUAL'
```
The MCP endpoint is `http://localhost:8010/mcp`. See the
[authentication and deployment guide](docs/authentication.md) for direct Oracle
OAuth, a personal instance, or an external Keycloak realm.
## How access works
| Mode | Client presents | Database credentials |
|---|---|---|
| `keycloak` | A Keycloak OAuth access token | Each user links their Oracle account in the portal |
| `oracle` | An access token issued after browser sign-in to a registered Oracle target | The verified Oracle login supplies a session-bound credential for that target |
| `local` | A separate loopback bearer configured by the operator | An environment-supplied account for one read-only target |
Targets are configured by the operator. Clients pass a connection ID, and Oracle
privileges determine what the underlying account can do. The
[operations guide](docs/operations.md) explains SQL validation, approvals and
production safeguards.
## Quality checks
```bash
uv run ruff check .
uv run ruff format --check .
uv run mypy src
uv run pytest
uv run python scripts/run_integration_tests.py
```
The [test guide](infra/testing/README.md) describes the optional Oracle Free
acceptance suite. See [CONTRIBUTING](CONTRIBUTING.md) for contribution guidelines
and [SECURITY](SECURITY.md) for reporting vulnerabilities. [MIT License](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues