This is going to be a long post, with lots of details. Things that don’t fit well on a corporate blog post, our docs, in a video, or even on powerpoint slides.

TL;DR your AI assistants can now interact directly with the Oracle Database.

Why does that matter?

  • LLMs are good at taking natural language requests and figuring out what SQL/PLSQL needs to be generated to handle those requests
  • your database has your data, and it can be used to tackle important business or organizational challenges
  • time is a limited resource – just ask Arun

Assistants, tools – these are things designed to make our tasks or even lives, easier. So I think the initial appeal is pretty easy to explain and understand. Need an example?

Example: I asked the Claude (sonnet) LLM via Cline to find the worst query in my database and help me tune it. Not shown, the 16 SQL queries Claude wanted to run to do this project, and me reviewing and approving. 100% led by Claude, it ran those queries to get it’s final report and suggestions. The scenario cost me about $0.43. That’s less than two American quarters!

Need more info on just what MCP is, and why we built this?

I highly suggest you consume this Oracle blog post Kris and I recently published.

Blog: Introducing MCP Server for Oracle Database

Our MCP Server isn’t a new product, instead it’s a new feature of Oracle SQLcl.

Not a fan of reading? Watch the movie!

I’ve fast-forwarded the YouTube recording to where Kris, Arno, and Tim do some actual demos that show off using our MCP Server with various AI clients. If you want to get an overview of just what MCP is, or how we’ve implemented it, rewind the video to the beginning.

Step-by-step example of using our MCP Server

MCP Servers are great, but you need a client to get any use out of it. MCP Clients can work with tools, prompts, and resources to help you perform tasks or answer questions. The ‘perform tasks’ bit is more agentic, whereas asking questions solely is more ‘chat’.

#1 VS Code & Copilot

Requirement #1: Ensure you’re on at least version 1.101 of VS Code.

Requirement #2: Ensure you have our SQL Developer Extension for VS Code installed, minVer 25.2.0

Requirement #3: You have at least one Oracle Database connection defined, with the password saved.

Open the Chat panel. To confirm SQLcl’s MCP Tools are available, click here –

Also be sure you’ve toggled Copilot from Chat/Ask to Agent mode.

Note: Licensing for Copilot is between you, your organization, and Microsoft. Oracle isn’t including a Copilot license or endorsing Copilot. We’re just providing an MCP Server for it to uptake.

The LLM is running on MSFT’s Copilot infrastructure. The LLM is generating the code, and evaluating the results. Our MCP Server is only giving the LLM a path to your Oracle Database, and an engine to run queries and commands.

Everything runs through the database connection

Our MCP Server (SQLcl), makes database connections and runs SQL and scripts over that connection at the request of an MCP Client, via the Tools we offer.

EVERYTHING about that connection defines what the LLM is going to be able to DO in your database.

You have a ‘read only’ user? Then a connection using that user isn’t going to be able to create, insert, update, delete, truncate, etc.

You have a ‘god’ user? Then you need to be EXTREMELY vigilant and careful.

Security

AI/LLM/MCP technology amplify the need for security around your database.

Ensure that you are following these best practices:

  • Least privilege principle: use CONNECTIONs tied to database USERs having only the privs to view the data you want to share, and perform the actions you want an Agent to do on your behalf
  • Segregated environments: use databases that have sanitized data, such as development and testing instances. PRODUCTION use should be strictly monitored
  • Do not trust, always verify: use only AI assistants that ask for access to the SQLcl MCP Tools, and always review requested actions before approving them. NEVER enable ‘auto-approve’

Your Oracle Database security features such as Row Level Security, Virtual Private Databases, Redaction, SQL Firewall, & Data Vault are all employed when dealing with database accounts and their connections to the database.

Security and Database transparency

Any LLM interactions in the database, are being marked as such by our MCP Server (SQLcl). All queries being executed include a marker, via a /* comment */

Look for SQLcl-MCP sessions in V$SESSION. Looks for these queries in V$SQL, ASH/AWR, etc.

And all queries being executed via your database connection’s user, is being logged in that schema, via our DBTOOLS$MCP_LOG table –

Just what has my handy little assistant been up to?

My connections

I can define these either in SQLcl or in the SQL Developer Extension for VS Code. I have a ‘fun’ or play account in my Oracle Cloud database. It look like this:

SQL
-- USER SQL
CREATE USER SAFE IDENTIFIED BY "reallyGoodp@ssw0rd1";

-- QUOTAS
ALTER USER SAFE QUOTA 1M ON "DATA";

-- ROLES
GRANT "CONNECT" TO SAFE;
GRANT "RESOURCE" TO SAFE;

-- SYSTEM PRIVILEGES

GRANT CREATE MATERIALIZED VIEW TO SAFE;
GRANT CREATE VIEW TO SAFE;
GRANT CREATE TABLE TO SAFE;
GRANT CREATE TYPE TO SAFE;
GRANT CREATE SYNONYM TO SAFE;
GRANT CREATE SEQUENCE TO SAFE;
GRANT CREATE PROCEDURE TO SAFE;

No DBA role, no GRANTs for SELECT or UPDATE on any tables not present in it’s own schema.

Defining a connection for this user in the CLI or the GUI looks like this –

SQL
SQL> conn -save mcp_demo -savepwd jeff/oracle@localhost:1521/freepdb1
Name: mcp_demo
Connect String: localhost:1521/freepdb1
User: jeff
Password: ******
Connected.
SQL> cm list
.
├── Cloud
│   └── AutonomousFunDemo🍻
├── Local
│   └── hr 🟢
└── mcp_demo
SQL> 

In VS Code –

I’m going to assume your connection ‘works,’ so let’s go straight over to Copilot and try this out.

list-connections

The MCP Server provides a list of tools for an LLM to take advantage of. One of these is very specific of our MCP Server, and that’s the ability to get a list of connections.

what databases do I have available to work with?

ChatGPT is able to ascertain my request might be suitable for the list-connection’s tool on the SQLcl (MCP Server).

It then basically asks for confirmation, which I can say ‘sure’ by clicking on ‘Continue,’ with a few options.

‘Always Allow’ – not recommended.

The ChatGPT, in Agent mode, via Copilot, then issues the actual list-connections command. We can see the input values included in the request, plus the raw response.

So this is a good sign. We have something to work with.

connect

connect to my mcp_demo database and tell me about my schema

The LLM says OK, let’s try that connect command.

But again, we have to give our OK to that request.

The highlighted text, that’s instructions we provide to the MCP Client, if it wants to use the connect tool. We are asking for it to identify itself (name of LLM and version, and the MCP Client).

We also see the inputs that are going to be included, and we can confirm that the right connection, ‘mcp_demo,’ is in play.

After connecting, it immediately wants to run some SQL. Because remember, my prompt was a double-request, ‘connect AND tell me…’

Here is the SQL it wants to run. It’s going to ask for a list of tables.

Man, that’s kind of boring.

Quis custodiet ipsos custodes?

Remember that little spiel from earlier, where I talked about how we ID the MCP work being done in the database? Here’s what that looks like from this last connect and run-sql scenario.

My schema is really boring, maybe we can fix that

this looks really boring. can you create me a new table for storing music, modeled after how Spotify might store data?

And the LLM comes back with, OK, let’s create a table for you.

Let’s review the DDL before we say ‘Continue.’

JSON
{
  "mcp_client": "oracle-sqlcl",
  "model": "claude-sonnet-4",
  "sql": "CREATE /* LLM in use is claude-sonnet-4 */ TABLE music_tracks (\n    track_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,\n    title VARCHAR2(200) NOT NULL,\n    artist VARCHAR2(150) NOT NULL,\n    album VARCHAR2(150),\n    genre VARCHAR2(100),\n    release_date DATE,\n    duration_seconds NUMBER(5),\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n)"
}

I’m actually OK with this. And bonus points to Claude (sonnet) for using our built-in sequence feature (IDENTITY).

Clicks, ‘Continue.’

Great! And yes, I want to see some data in my table!

yes, please generate some test data, with GENRE set to ‘Hair Metal,’ and try to use some bands and songs from the 1980’s from this popular genre like Skid Row and Cinderella.

I’m just going to let it go and do it’s thing. If I don’t like the data, I can always truncate or even drop the schema.

One last thing…ORDS?

awesome, i love this table now. Can you check to see if ORDS is available in this database, and if it is, rest enable the MUSIC_TRACKS table? and be sure to alias it as ‘spotify’

The results were, mixed.

The good

  • the LLM knew how to see if ORDS was installed in the DB
  • the LLM knew it needed to REST enable the schema
  • the LLM knew how to REST enable the table

The not so good

  • I had to correct the LLM, twice
  • once to get the ENABLE_SCHEMA correct
  • against to get the ENABLE_OBJECT correct – both times it got confused with USER input for schema, vs using the actual user name, ‘JEFF
  • I asked it to alias the table as, ‘spotify,’ and it got close, but I gave up

It’s very possible this would have worked perfectly, the first time I tried, if I only I used a better LLM. However.

With a couple of prods from me, I did get here!

This has been a very long post

I wanted to show how to get this going with a different MCP Client, not named VS Code Copilot, but that’s for another post.

But before I go, let’s do the needful.

Summary and homework

Now you know that your Oracle Database is available for your local AI assistants (coding and otherwise!) via our MCP Server, SQLcl.

Me mindful of security.

Review what is being proposed before saying ‘Continue.’

We didn’t start from scratch with this technology. We used our existing ‘kit’ to deliver this feature. SQLcl has everything we need to bring a very powerful, but secure interface for your MCP Clients. And we’re going to be doing a lot more – releasing new MCP Tools every month, stay tuned!

Some additional reading you might find intersting.

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Write A Comment