Simon Griffiths

Focusing on Data, Architecture and AI

Simon Griffiths architects data-first systems, and is sceptical about the rest.

Drawing on long experience across enterprise data, architecture, and AI, he prefers platforms designed for reality, not just the latest narrative.

Oracle SQL and MCP

All of the main LLMs are pretty good at generating SQL, and they also have a pretty good understanding of the Oracle Data Dictionary. This means that if you can connect your LLM chat to an Oracle database, you can query, manage and even tune your Oracle database through simple language rather than needing to actually write any SQL.

With the newest agent enabled chats, this becomes even more power with multi-step processes – you can ask a LLM chat do some pretty complex stuff on a database with just one prompt.

This is the first in a set of articles exploring what you can do when you combine an LLM chat with an Oracle database

Let’s get it set up

First of all, you will need something more than just the web-based chat. You’ll need Codex, Claude Code, Claude Cowork or similar. Then you’ll need an MCP Server (there are a few options here) that makes the connection to the Oracle database.

I’ll be mostly using Codex, but I’ll include extra notes on how to do this on Claude Code/Codex too. Here are instructions on installing Codex or Claude Code

I’ll be using Oracle’s official MCP server built into SQLcl as it’s free, fully supported and simple to install. If you are on Windows or Linux, you can install from a zip but I’m on macOS and I use Homebrew so :

brew install sqlcl

To make everything super-easy, I always add the sqlcl binary folder to my path in my $HOME/.zshrc file with the following line (you’ll probably need to change the version number to match what you have downloaded)

export PATH=/opt/homebrew/Caskroom/sqlcl/25.4.0.346.1855/sqlcl/bin:"$PATH"

So now you should be able to start sqlcl from the command line

 sql -V~


So, now everything you need is installed

Connecting to your Oracle database

First test that sqlcl can connect to your database :

sql user@//host:1521/service

Or if you are using autonomous database with a wallet :

sqlcl /NOLOG
set cloudconfig {wallet_file}
connect user@service

Ok, so now that you know that you can connect, it makes it much easier to save that connection for future use, so in sqlcl, once you have successfully connected :

conn -save myconnection -savepwd

now you can log into sqlcl without a connection and then connect with :

sqlcl /nolog
connect -name my connection

This is really useful now because when we startup sqlcl as an MCP server, it will remember that connection.

Setting up the sqlcl map server in you LLM chat

In Codex

Edit your ${HOME}.codex/config.toml file and add :

[mcp_servers.sqlcl]
command = "sql"
args = ["-mcp"]

That’s it – just restart codex

In Claude Code

You can see the full instructions here

but the bottom line is that you add the following to your claude_desktop_config.json file :

{
{
"mcpServers":
    "sqlcl": {
      "command": "PATH/bin/sql",
      "args": ["-mcp"]
    }
  }
}

Giving it a try

Now that’s all set up you can give it a try. You can use the appropriate cli or use within an editor. I’m using zed which includes codex out-of-the-box.

Type in something like :

list the tables in my oracle database`

… and you’ll be prompted with the list of connections that you have set up in sqlcl, and you can just say which one to use!

In future articles, I’ll look at how this can all be used to get access to your data and more.

More reading

Getting Started with our MCP Server for Oracle Database

Oracle SQLcl

Leave a comment

Navigation

About

Simon Griffiths architects data-first systems, sceptical about the rest. Drawing on long experience across enterprise data, architecture, and AI, he prefers platforms designed for reality, not just the latest narrative.