Generic SQL MCP Server
Provides read-only SQL database interaction for MySQL, allowing listing tables, inspecting schemas, and executing SELECT queries.
Provides read-only SQL database interaction for PostgreSQL, allowing listing tables, inspecting schemas, and executing SELECT queries.
Provides read-only SQL database interaction for SQLite, allowing listing tables, inspecting schemas, and executing SELECT queries.
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., "@Generic SQL MCP ServerShow me the schema of the students 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.
Generic SQL MCP Server
A configurable, database-agnostic Model Context Protocol (MCP) server that enables Large Language Models (LLMs) to safely interact with SQL databases.
Overview
This project is a Proof of Concept (POC) that demonstrates how a Model Context Protocol (MCP) server can securely expose SQL database capabilities to AI assistants while maintaining a clean and configurable architecture.
Rather than connecting directly to a production database, this project uses a local demonstration database to validate the overall architecture. The design allows the same MCP server to connect to different SQL databases simply by changing configuration files, without modifying application code.
The project serves as a foundation for future integration with enterprise databases such as ERP systems.
Objectives
The primary objectives of this project are:
Demonstrate how an MCP server communicates with SQL databases.
Support multiple SQL database engines through configuration.
Keep the implementation database-agnostic.
Expose generic database capabilities to LLMs.
Allow only safe, read-only SQL operations.
Build a modular and extensible architecture.
Features
Configurable database connections
SQLite, MySQL and PostgreSQL support
Generic SQL database tools
Read-only SQL execution
SQL validation layer
Modular architecture
Configuration-driven design
Logging and error handling
MCP-compliant implementation
Project Architecture
User
│
▼
MCP Client
(Claude Desktop, etc.)
│
▼
MCP Server
│
MCP Tools
│
Database Service
│
Database Adapter
│
SQLAlchemy
│
SQL DatabaseProject Structure
sql-mcp-server/
├── CLAUDE.md
├── README.md
├── requirements.md
├── architecture.md
├── tasks.md
│
├── app/
│ ├── server.py
│ ├── config.py
│ ├── database/
│ ├── tools/
│ ├── security/
│ └── utils/
│
├── configs/
│ ├── sqlite.yaml
│ ├── mysql.yaml
│ └── postgres.yaml
│
├── demo_db/
│ ├── schema.sql
│ ├── seed.sql
│ └── school.db
│
├── tests/
│
├── requirements.txt
│
└── .env.exampleSupported Databases
Database | Status |
SQLite | ✅ Supported |
MySQL | ✅ Supported |
PostgreSQL | ✅ Supported |
SQLite is used as the primary demonstration database.
Supported MCP Capabilities
The MCP server provides generic database functionality rather than business-specific operations.
Examples include:
List available tables
Inspect table schemas
Execute read-only SQL queries
Retrieve database metadata
This allows the server to work with virtually any SQL database.
Security
The server operates in read-only mode.
Allowed SQL:
SELECT
Blocked SQL:
INSERT
UPDATE
DELETE
DROP
ALTER
CREATE
TRUNCATE
Every SQL statement is validated before execution.
Technology Stack
Related MCP server: sqldb-mcp-server
Language
Python 3.12+
Core Libraries
Official Python MCP SDK
SQLAlchemy
Pydantic
PyYAML
python-dotenv
Database Drivers
SQLite
PyMySQL
psycopg2-binary
Getting Started
1. Clone the Repository
git clone <repository-url>
cd sql-mcp-server2. Create a Virtual Environment
python -m venv .venvActivate it.
Windows
.venv\Scripts\activateLinux / macOS
source .venv/bin/activate3. Install Dependencies
pip install -r requirements.txt4. Configure the Database
Choose one configuration from the configs/ directory.
Example:
database:
type: sqlite
database: demo_db/school.db5. Start the MCP Server
python app/server.py6. Connect an MCP Client
Connect the server using any MCP-compatible client such as:
Claude Desktop
Claude Code
MCP Inspector
Other MCP-compatible clients
Demonstration
Example interactions:
List all tables.
Describe the students table.
Show all records from teachers.
Find students older than 15.
Show the schema of attendance.Future Improvements
Possible future enhancements include:
Authentication
Role-based authorization
Query auditing
Connection pooling
Dynamic tool generation
Enterprise ERP integration
Production deployment
Multi-database connections
Advanced SQL validation
Documentation
Additional project documentation:
CLAUDE.md— Instructions and development guidelines for Claude Coderequirements.md— Functional requirementsarchitecture.md— Technical architecturetasks.md— Development roadmap
Project Status
Current Status
🚧 Proof of Concept (POC)
The project is under active development and is intended to validate the feasibility of using MCP as a secure interface between LLMs and SQL databases.
License
This project is intended for internal evaluation and demonstration purposes.
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
- Flicense-qualityDmaintenanceAn MCP server that provides safe, read-only access to SQLite databases through MCP. This server is built with the FastMCP framework, which enables LLMs to explore and query SQLite databases with built-in safety features and query validation.Last updated107
- AlicenseAqualityAmaintenanceA read-only MCP server that exposes SQL database access to LLMs, supporting multiple database types, compact columnar results, pagination, and file export.Last updated628MIT
- Alicense-qualityBmaintenanceMCP server for safely exposing SQL Server database capabilities to LLM clients, with read-only mode, security features, and observability.Last updated28MIT
- Alicense-qualityCmaintenanceA read-only MCP server that enables LLMs to safely explore and query any SQLite database via natural language. It exposes tools for listing tables, describing schemas, and executing SELECT/WITH queries with built-in safety guards like write prevention and row limits.Last updatedMIT
Related MCP Connectors
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
MCP server for managing Prisma Postgres.
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/Ayushedunext/DB-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server