MariaDB Shell for VS Code
MariaDB Shell UI and MariaDB AI Plugin Copilot integration.
The extension drives the MariaDB Shell backend through its
MCP plugin,
which exposes the backend functions over the Model Context Protocol.
Features
Connections view in the activity bar: browse your configured
connections, their schemas, and the tables, views, functions,
procedures, sequences, triggers and events in each.
Add, edit and delete connections from the view's + button and each
connection's context menu, in a dialog with the host, protocol, port,
user, default schema, socket, SSL and compression settings a MariaDB
Shell connection URI can carry. Passwords go to the operating system's
secret store, never into the URI, and Test Connection tries the
credentials before anything is saved.
MCP access is a checkbox on each connection. Ticked, it goes in the
shared MCP connection list, which any MCP client on this machine - an AI
assistant, say - can open; the Connections view marks those MCP.
Unticked, it belongs to this extension alone.
Run SQL from any .sql file, with a connection picker and a run
button in the editor toolbar (Ctrl/Cmd+Enter).
MariaDB SQL highlighting: .sql files open as MariaDB SQL, with a
grammar that follows the server's lexer and knows its keywords and
functions, as well as REST SQL. A "..." is coloured as an identifier
where the file's connection runs with ANSI_QUOTES in its sql_mode, and
running SQL splits statements the same way. When a script changes the
sql_mode, the highlighting and the next run follow it.
New SQL Editor, beside Connect on a connection in the tree, opens an
unsaved .sql file already bound to that connection.
Results docked in the bottom panel, beside Problems and Output, with
an output log and a tab per result set. A dropdown picks which
connection's results are shown, the output accumulates until you clear
it, and each output row can jump to the result set it produced.
General Actions - a sandbox deploy, a REST Daemon's steps - are shown
among every connection's, a row with more to tell offers its log (a
failure's, or a mariadb-restd install's), and the actions are kept for
the next session.
A result that comes from a single table with a primary key can be
edited in place — change cells, add and remove rows — and
Preview SQL shows exactly the statements Apply would run, with a
click on any of them taking you to the row it came from.
Default connection, set from a connection's context menu and
remembered in your workspace settings.
MariaDB REST Service: a connection with REST metadata shows its
REST services, schemas, views, procedures, functions, MRS scripts,
content sets, authentication apps, users and REST Daemons in the tree.
Dialogs configure the service and add or edit each of them - a REST
view's data mapping included - and the context menus copy or dump their
REST SQL, export the client SDK, and upload a folder as a content set,
whose files then take the set's Requires Auth setting, also when it
is edited later. Deploy OpenAPI Web UI... on a REST service serves
its OpenAPI UI (Swagger UI, downloaded once and patched for the service)
at /openApiUi, open to everyone: signing in is the UI's own Authorize.
MariaDB REST Daemons, which serve the REST services over HTTPS:
- New Sandbox can set up the MariaDB REST Service with the sandbox:
a REST Daemon, the
MRS authentication app with a REST user, and a
published REST service, ready to try. The daemon follows the sandbox
as it is started, stopped and deleted.
- Set Up MariaDB REST Daemon... on a connection's context menu sets
one up for any server, installing
mariadb-restd first where it is
missing or older than the release the extension needs - that release
exactly, as it does the MariaDB Shell. The install is logged in the
MariaDB output channel, as the shell's is, and the setup's row in
the Actions tab offers the log too.
- Every daemon serves one HTTPS certificate, signed by a local
certificate authority. Both dialogs offer to have the system trust it
once, so browsers accept every daemon's
https://localhost address.
- The REST Daemons view lists them, running or stopped, with Start,
Stop, Delete, Open Log and Open in Browser. A tree row's REST URLs go
to the daemon of its own server.
Expanding a connection opens it, so browsing a database takes one
click. Set mariadb.connections.connectMode to explicit to go back to
connecting with the button on the row.
Dump and Load, on the context menu of a connection, a schema or a
table:
- dump the whole server, schemas or tables to a folder, and load such a
dump back;
- export a table to a file, and import files into a table;
- copy the server, schemas or tables to another connection.
A dialog asks for the folder and the options. The work then runs in the
background, with a notification that shows its progress and can cancel
it. The Tasks view lists what ran; click a task for its own log,
which can be watched while it runs and is kept after it ended, failed
or not. Each task is also a row of its connection's Actions in the
MariaDB panel, with what it reported under it.
GitHub Copilot gets the MariaDB agent skills and the MariaDB Shell's
MCP server, with nothing to set up. The skills - the same ones the
MariaDB AI plugins
give Claude Code, Codex, OpenCode and Pi - teach it MariaDB SQL, the
connectors and the REST Service; the MariaDB server in VS Code's MCP
server list gives it the db.* and other tools to act on a database.
The server runs in agent mode: it opens only the connections with
MCP access ticked, and asks before touching a file outside its
allowed paths. Starting it the first time installs the MariaDB Shell if
there is none. mariadb.copilot.enabled turns both off.
Requirements
MariaDB Shell 26.11.2 or newer, with at least one connection configured
via mariadb-shell -- mcp setup.
The extension takes care of the shell on its own. The first time it needs
the server it looks for a suitable shell and, if there is none, installs
one:
- A
mariadb-shell on your PATH is used if it is new enough.
- Otherwise a local installation under
~/.local/share/mariadb-shell/<version> (macOS, Linux) or
%LOCALAPPDATA%\Programs\mariadb-shell\<version> (Windows) is used.
- Otherwise the official installer is run, with the download and
extraction shown in a progress notification.
Set MARIADB_SHELL_PREFIX to install and look somewhere else.
Settings
| Setting |
Description |
mariadb.defaultConnection |
The connection URI new SQL editors run on. |
mariadb.connections.connectMode |
Whether expanding a connection in the Connections view opens it (onOpen, the default) or only the Connect button does (explicit). |
mariadb.mrs.restDaemonUrl |
Where REST requests go for a server no local REST Daemon serves: the Open ... Request Path in Web Browser commands and the client SDK's default service URL start with it. Default https://localhost:8443. |
mariadb.copilot.enabled |
Whether Copilot gets the MariaDB skills and MCP server (on by default). |
mariadb.sql.ansiQuotes |
Whether "..." in a SQL file is an identifier or a string: as the file's connection's sql_mode says (auto, the default), always an identifier (on), or always a string (off). The identifier colouring needs editor.semanticHighlighting.enabled, which the built-in themes turn on. |
Commands
| Command |
Description |
| MariaDB: Add Connection |
Opens the connection editor on a new connection. |
| MariaDB: Run SQL |
Runs the selection, or the whole .sql file. |
| MariaDB: Select Connection for this SQL File |
Pins this file to a connection. |
| MariaDB: Restart MCP Server |
Closes the connections and starts the server again. |
| MariaDB: Show MCP Server Log |
Opens the MariaDB output channel. |
Development
npm install # install the toolchain
npm run build # fetch the Copilot skills, bundle the extension and the result panel
npm run package # build, then pack the .vsix (what CI keeps as its artifact)
npm run sync:skills # only fetch the pinned ai-plugins release's skills into skills/
npm test # run the Vitest suite
npm run pretest # type check and lint
npm run grammar:build # rebuild the SQL grammar from syntaxes/words.json
npm run grammar:check # fail if the grammar was not rebuilt after an edit
npm run grammar:sync -- --server <mariadb-server> --shell <mariadb-shell>
reads the keyword, function and REST SQL word lists from checkouts of those
two repositories into syntaxes/words.json; run grammar:build after it.
Press F5 to launch an extension host. The Run Extension
configuration builds the result panel and then starts the extension
watcher, so nothing else is needed. To watch from a terminal instead, run
npm run watch for the extension and npm run watch:webview for the
result panel - npm run watch covers the extension only.
Open Extension.code-workspace to get the recommended extensions along
with the folder's launch and task configuration; opening the repository as
a plain folder works too.
python3 tools/update_version/update_version.py bumps the shell version
the extension requires to the one on the shell repository's main branch,
as part of preparing a release (--version X.Y.Z sets a given one
instead); --dry-run shows the change without writing it. python3 tools/check_openapi_ui_pins.py checks that the
Swagger UI release and request path the OpenAPI UI dialog names are the
ones the mrs plugin pins; CI runs it on every change.
The extension is bundled with Vite, the result panel is
Preact, and both are tested with
Vitest. See
.claude/PROJECT_CONTEXT.md
for the layout and the behaviour in detail.
The Copilot skills come from the
ai-plugins release
that aiPlugins.release in package.json pins. npm run build downloads
it into skills/ - a gitignored cache, fetched again only when the pin
moves - and keeps contributes.chatSkills in step with it. To take a newer
release, run npm run sync:skills -- --latest (or --release vX.Y.Z)
and commit the changed package.json; to change a skill, change it in ai-plugins.
Licensing
The MariaDB Shell for VS Code extension is a part of the MariaDB Shell and licensed
under the GPLv2. See
LICENSE
for more details.
| |