MariaDB MCP Server
MariaDB / MySQL データベースアクセス MCP サーバー
この MCP サーバーは、MariaDB / MySQL データベースへのアクセスを提供します。
これにより、次のことが可能になります。
利用可能なデータベースの一覧
データベース内のテーブルを一覧表示する
テーブルスキーマを説明する
SQLクエリを実行する
セキュリティ機能
読み取り専用アクセス デフォルト: SELECT、SHOW、DESCRIBE、EXPLAIN
クエリ検証: SQLインジェクションを防ぎ、データ変更の試みをブロックします
クエリタイムアウト: 長時間実行されるクエリがリソースを消費するのを防ぎます
行制限: 過剰なデータ返送を防止
Related MCP server: MySQL MCP Server
インストール
オプション1: ソースからビルドする
# Clone the repository
git clone https://github.com/bretoreta/mariadb-mcp-server.git
cd mariadb-mcp-server
# Install dependencies and build
pnpm install
pnpm run build2. 環境変数を設定する
サーバーには次の環境変数が必要です。
MARIADB_HOST: データベースサーバーのホスト名
MARIADB_PORT: データベースサーバポート(デフォルト: 3306)
MARIADB_USER: データベースのユーザー名
MARIADB_PASSWORD: データベースパスワード
MARIADB_DATABASE: デフォルトのデータベース名(オプション)
MARIADB_ALLOW_INSERT: 偽
MARIADB_ALLOW_UPDATE: 偽
MARIADB_ALLOW_DELETE: 偽
MARIADB_TIMEOUT_MS: 10000
MARIADB_ROW_LIMIT: 1000
3. MCP設定に追加
MCP 設定ファイルに次の構成を追加します。
ソースからビルドした場合:
{
"mcpServers": {
"mariadb": {
"command": "node",
"args": ["/path/to/mariadb-mcp-server/dist/index.js"],
"env": {
"MARIADB_HOST": "your-host",
"MARIADB_PORT": "3306",
"MARIADB_USER": "your-user",
"MARIADB_PASSWORD": "your-password",
"MARIADB_DATABASE": "your-default-database",
"MARIADB_ALLOW_INSERT": "false",
"MARIADB_ALLOW_UPDATE": "false",
"MARIADB_ALLOW_DELETE": "false",
"MARIADB_TIMEOUT_MS": "10000",
"MARIADB_ROW_LIMIT": "1000",
},
"disabled": false,
"autoApprove": []
}
}
}利用可能なツール
データベース一覧
MariaDB / MySQLサーバー上のアクセス可能なすべてのデータベースを一覧表示します。パラメータ: なし
例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"sessionId": "session_id from /sse call",
"name": "list_databases"
}
}リストテーブル
指定されたデータベース内のすべてのテーブルを一覧表示します。
パラメータ:
database(オプション): データベース名(指定されていない場合はデフォルトを使用)
例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"sessionId": "session_id from /sse call",
"name": "list_tables",
"database": "my_database_name"
}
}テーブルの説明
特定のテーブルのスキーマを表示します。
パラメータ:
database(オプション): データベース名(指定されていない場合はデフォルトを使用)table(必須): テーブル名
例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"sessionId": "session_id from /sse call",
"name": "describe_table",
"database": "my_database_name",
"table": "my_table_name"
}
}クエリ実行
SQL クエリを実行します。
パラメータ:
query(必須): SQLクエリdatabase(オプション): データベース名(指定されていない場合はデフォルトを使用)
例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"sessionId": "session_id from /sse call",
"name": "execute_query",
"query": "SELECT * FROM my_table LIMIT 10"
}
}テスト
サーバーは MariaDB を自動的にテストし、MariaDB セットアップの機能性を検証します。
トラブルシューティング
問題が発生した場合:
サーバーログでエラーメッセージを確認してください
MariaDBの資格情報と接続の詳細を確認する
MariaDBユーザーに適切な権限があることを確認する
クエリが読み取り専用であり、適切にフォーマットされていることを確認してください
インスピレーション https://github.com/rjsalgado/mariadb-mcp-server
ライセンス
このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。
Available Tools
4 toolsdescribe_tableB
Show the schema for a specific table
Inputs: table (required), database.
execute_queryC
Execute a SQL query
Inputs: query (required), database.
list_databasesB
List all accessible databases on the MariaDB server
Inputs: no named parameters.
list_tablesC
List all tables in a specified database
Inputs: database.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose with no overlap: describe_table shows table schemas, execute_query runs SQL queries, list_databases enumerates databases, and list_tables lists tables within a database. The boundaries are well-defined, preventing agent misselection.
All tool names follow a consistent verb_noun pattern (describe_table, execute_query, list_databases, list_tables) with clear, descriptive verbs. There are no deviations in style or convention, making the set predictable and readable.
Four tools is reasonable for a MariaDB server, covering core operations like listing databases/tables, describing schemas, and executing queries. It feels slightly thin as it lacks CRUD operations (e.g., create_table, insert_data), but it's well-scoped for basic database inspection and query execution.
The tools provide good coverage for database inspection and query execution, but there are notable gaps in CRUD operations (e.g., no create_table, update_data, or delete_table). Agents can work around this using execute_query, but the surface is incomplete for full database management workflows.
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables interaction with MariaDB databases through secure read-only operations. Supports database exploration, schema inspection, and SQL query execution with comprehensive logging and connection pooling.52MIT
- FlicenseNot gradedqualityDmaintenanceEnables safe interaction with MySQL databases through SELECT queries, table structure inspection, and database schema exploration. Provides read-only access to query data and examine database metadata.1-
- AlicenseAqualityDmaintenanceEnables read-only MySQL database access, allowing listing databases, tables, describing schemas, and executing SELECT/SHOW/DESCRIBE/EXPLAIN queries.745 npm4MIT
- AlicenseAqualityDmaintenanceProvides read-only MySQL query execution, database/table browsing, and table structure inspection with SQL safety validation.5MIT