MCP Database Server
Planned integration to replace SQLite with PostgreSQL via SQLAlchemy for future data storage.
Provides read-only access to SQLite databases with an allowlist of tables and stored procedures, secured via SQLite's authorizer.
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 Database Serverdescribe the invoices 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 Server
Pillar: Protocols & Interoperability
Status: Month 1 - essential
Python MCP server to expose schemas, safe queries, and stored procedures to LLM clients.
Problem
LLMs need to consult corporate databases without receiving broad credentials or the freedom to execute destructive SQL.
Related MCP server: DB Insights MCP Server
MVP
MCP server with FastMCP
Listing of allowed schemas
Read-only queries
Allowlist of stored procedures
Audit of calls
Architecture
MCP server (
mcp.server.MCPServer, tools registered via@mcp.tool())Schema registry (allowlist of tables/columns,
db.py)Read-only authorizer (
sqlite3.Connection.set_authorizer,security.py)Audit logger (trail in memory of each tool call,
audit.py)
Diagram
flowchart LR
A0[MCP client] --> A1[MCP server: list_tables / describe_table / run_readonly_query]
A1 --> A2[SQLite authorizer: allowlist + read-only]
A2 --> A3[SQLite: invoices]
A1 --> A4[Audit log]Stack
Python
mcp(official Model Context Protocol SDK)SQLite (
sqlite3from the stdlib, withset_authorizerfor access control)unittest
Docker Compose
How to run
Real implementation with the official MCP SDK. Access control does not use regex over SQL (easy to bypass) — it uses SQLite's own set_authorizer, which approves or denies each table/column read and each statement type before any row runs. To run the MCP server:
python3.12 -m venv .venv && source .venv/bin/activate
pip install -e .
python -m mcp_database_server # sobe o servidor MCP via stdio
python -m unittest discover -s testsTests
test_security.py: authorizer blocks INSERT/UPDATE/DROP/ALTER, ATTACH, tables outside the allowlist (e.g.,sqlite_master), and stacked statements (SELECT 1; DROP TABLE ...).test_server.py: logic of each tool called directly (without protocol), including that every call generates an audit event.test_integration.py: startspython -m mcp_database_serveras a real subprocess and talks to it viamcp.client.stdio+ClientSession— proves the server actually speaks MCP, not just that the Python functions work.
Risks and decisions
SQL injection and excessive permissions: solved via
set_authorizerat the driver level, not regex.A single SQLite connection is not thread-safe; the MCP server dispatches each tool call into a worker thread, so
ServerState.lockserializes access (real bug found and fixed during implementation, covered bytest_integration.py).MCP tools return
ValueErrorwith a clear message to the LLM client instead of leaking a stack trace.
Next steps
Replace SQLite with PostgreSQL via SQLAlchemy when real data is involved.
Add per-client authentication/allowlist (today any connected MCP client has access to the tools).
Persist the audit log outside the process (today it is only in memory).
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides secure, read-only access to Microsoft SQL Server with multi-layer protection, enabling safe query execution, schema discovery, and SQL script analysis through natural language.1
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to query SQL databases safely with read-only access, allowing schema discovery and SELECT queries while blocking writes and DDL operations.
- AlicenseNot gradedqualityBmaintenanceEnables LLM clients to query SQL databases via natural language with read-only, AST-validated, and capped queries, ensuring safety guarantees.2MIT
- AlicenseNot gradedqualityBmaintenanceProvides read-only access to databases for MCP-compatible AI tools, allowing schema exploration and SELECT queries without exposing credentials or risking data changes.923MIT
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Runtime permission, approval, and audit layer for AI agent tool execution.
Read-only access to your VortexIQ store data: audits, KPIs, alerts, Brand DNA, reports, Ask VIQ.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- 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/oliverhubtech-source/mcp-database-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server