How to Configure OpenHands MariaDB MCP Server
You set up an openhands mariadb mcp server by linking the agent to your database. You give the server process a database user role and login keys. Most teams start by using one shared database account for the agent. This setup is fast, but broad roles create big risks. An AI agent with write access can drop tables or change live rows. It can also pull sensitive data into its prompt history. How the openhands mariadb mcp server workflow runs OpenHands is an AI coding agent that runs tasks insi
Kubernetes API Server Access + End-to-End Encryption: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up an openhands mariadb mcp server by linking the agent to your database. You give the server process a database user role and login keys. Most teams start by using one shared database account for the agent. This setup is fast, but broad roles create big risks. An AI agent with write access can drop tables or change live rows. It can also pull sensitive data into its prompt history.
How the openhands mariadb mcp server workflow runs
OpenHands is an AI coding agent that runs tasks inside a workspace. The Model Context Protocol lets this agent talk to outside data tools. When you add the MariaDB server tool, the agent gains database skills. It can list tables, inspect schemas, and run SQL queries by itself.
First, the engineer puts database login details into the agent workspace settings. When a task starts, OpenHands launches the MCP server in the background. The MCP server uses those saved keys to log in to MariaDB. Next, the AI model reads the user prompt and writes a query. It sends that query through the MCP link to the database. MariaDB checks the role of the login user and runs the command. The database sends the matching rows back to the AI agent.
Native database roles and what they miss
MariaDB offers built-in grants to limit what a user account can do. You should create a read-only database role for the AI agent. This native rule stops the agent from deleting tables or changing data. You can also restrict that role to specific schemas or safe views.
Native roles check who logs in at the start of a session. They do not inspect what each query does while it runs. A read-only role still lets the agent pull millions of customer rows. If a table holds emails, phone numbers, or card numbers, the agent gets them. Those raw values go straight into the model context and chat logs.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Why static keys create risk in agent workspaces
Putting plain database passwords inside an agent workspace creates another huge problem. OpenHands can run shell commands and read local files during a task. If a prompt goes wrong, the agent might read its own settings file. It could print the database password into a log or a pull request.
Shared accounts also ruin your database audit logs. Every query from every developer agent shows up under one database user name. When a bad query slows down the server, you cannot trace the person. Teams need a way to tie every agent query to a real user. They also need data masking that rewrites matched fields in results on the fly.
Add wire guardrails and masking beside MySQL
Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev runs beside the database as a sidecar for your MySQL. It keeps your login setup and drivers as they are while checking queries on the wire.
With hoop.dev MySQL support, guardrails refuse bad queries before they run and return a readable MySQL error. Data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.
Frequently asked questions
Can OpenHands run write queries through the MariaDB MCP server?
Yes, the agent can run any query allowed by its database role. If you grant write rules, the agent can insert, update, or delete rows.
How do I keep the AI agent from reading sensitive columns?
You can limit the MariaDB user role to safe database views only. You can also use data masking to rewrite emails and card numbers in results.
Where do the database login keys live in a standard setup?
In a basic setup, the keys sit in the local agent settings file. You should replace static keys with user identity checks and per-query rules.
Related guides
In this post