mcp-database
Provides read-only access to MariaDB databases, allowing listing tables, describing table structures, and running SELECT/SHOW/DESCRIBE/EXPLAIN/WITH queries with safety measures such as automatic LIMIT and query timeout.
Provides read-only access to MySQL databases, allowing listing tables, describing table structures, and running SELECT/SHOW/DESCRIBE/EXPLAIN/WITH queries with safety measures such as automatic LIMIT and query timeout.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-databaseshow me the structure of the orders table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-database
MCP server read-only untuk MySQL / MariaDB. Memungkinkan Claude melakukan pengecekan data lewat query SQL — tanpa bisa mengubah/menghapus data.
Tools yang disediakan
Tool | Fungsi |
| Menampilkan daftar semua tabel di database |
| Menampilkan struktur kolom sebuah tabel |
| Menjalankan SELECT/SHOW/DESCRIBE/EXPLAIN/WITH (read-only) |
Pengaman (read-only)
Hanya statement baca yang diterima.
INSERT/UPDATE/DELETE/DROP/ALTER/CREATE/...ditolak otomatis.Multi-statement (dipisah
;) ditolak.Komentar SQL (
--,#,/* */) dibersihkan sebelum divalidasi.LIMITotomatis ditambahkan (default 1000 baris) bila query tidak punya.Query punya timeout (default 15 detik).
Sangat disarankan: tetap pakai user MySQL yang hanya punya hak
SELECT, sebagai lapisan keamanan kedua di sisi database.CREATE USER 'readonly_user'@'%' IDENTIFIED BY 'password_kuat'; GRANT SELECT ON nama_database.* TO 'readonly_user'@'%'; FLUSH PRIVILEGES;
Setup
npm install
cp .env.example .env # lalu isi kredensial database
npm run buildIsi .env:
DB_HOST=localhost
DB_PORT=3306
DB_USER=readonly_user
DB_PASSWORD=...
DB_NAME=nama_database
MAX_ROWS=1000
QUERY_TIMEOUT_MS=15000Menghubungkan ke Claude Desktop
Edit file konfigurasi:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Kredensial cukup ditaruh di file .env (server otomatis memuatnya dari folder
proyek). Config-nya jadi sederhana:
{
"mcpServers": {
"database": {
"command": "node",
"args": ["c:\\project\\mcp-database\\dist\\index.js"]
}
}
}⚠️ JANGAN menambahkan blok
envdengan nilai placeholder (localhost,nama_database, dst). Nilai di blokenvakan menimpa.envAnda dan menyebabkan koneksi gagal (ECONNREFUSED). Isi.envsaja.Restart total Claude Desktop (Quit dari tray, lalu buka lagi) setiap kali mengubah config atau melakukan rebuild — bukan sekadar tutup window.
Menghubungkan ke Claude Code (CLI)
claude mcp add database -- node c:\project\mcp-database\dist\index.js(pastikan .env sudah terisi, atau tambahkan --env DB_HOST=... dst.)
Contoh penggunaan di Claude
"Cek ada berapa pengguna yang statusnya aktif di tabel pengguna"
Claude akan memanggil
list_tables→describe_table→run_querydenganSELECT COUNT(*) FROM pengguna WHERE status = 'aktif'.
Pengembangan
npm run dev # tsc --watchResources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AimanFadillah/mcp-database'
If you have feedback or need assistance with the MCP directory API, please join our Discord server