SQL MCP Server
Provides read-safe access to a SQLite database, enabling schema exploration, SELECT queries, and sample data retrieval through five MCP tools.
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., "@SQL MCP Serversummarize the database schema"
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.
SQL MCP Server
A Model Context Protocol (MCP) server that exposes a SQLite database to any MCP-compatible client — including Claude Desktop, Claude Code, and custom agents.
What it does
Gives an AI assistant structured, read-safe access to a relational database through five tools. The assistant can explore the schema, run SELECT queries, and retrieve sample data — without any risk of writes or destructive operations.
Related MCP server: mcp-sqlite
Schema
Five tables with realistic foreign-key relationships:
users ──< orders ──< order_items >── products
│
└──< support_ticketsTable | Description |
| 20 registered customers |
| 30-item product catalog with categories and stock levels |
| 30 purchase records linked to users |
| ~55 line items linking orders to specific products |
| 35 support requests with status and priority |
MCP Tools
Tool | Description |
| Returns all table names in the database |
| Returns column metadata — name, type, nullability, defaults, PK flag |
| Executes a SELECT query and returns rows as JSON. Non-SELECT statements are rejected. |
| Returns up to 100 sample rows from any table |
| Returns a plain-English summary of all 5 tables — columns, types, and FK relationships — in one call |
Security
run_querychecks the first SQL token and rejects anything that isn'tSELECTMulti-statement queries (containing
;) are blockedTable name parameters are validated against
[A-Za-z_][A-Za-z0-9_]*before interpolation
Setup
1. Install dependencies
pip install -r requirements.txt2. Seed the database
python seed.pyThis creates test.db in the same directory with all 5 tables populated.
3. Run the server
python server.pyThe server communicates over stdio using the MCP protocol.
Claude Desktop Integration
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"sql-mcp": {
"command": "python3",
"args": ["/absolute/path/to/server.py"]
}
}
}Config file locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Restart Claude Desktop after saving.
Verify Tools (without Claude Desktop)
test_tools.py connects to the server via stdio and exercises all 5 tools:
python test_tools.pyExpected output confirms:
All 5 tools are registered
Each tool returns correct results
run_queryrejects non-SELECT statements
Project Structure
.
├── server.py # MCP server — 5 tools
├── seed.py # Creates and populates test.db
├── test_tools.py # Stdio client verification script
├── requirements.txt # mcp, aiosqlite
└── .gitignoreRequirements
Python 3.10+
mcp— MCP server frameworkaiosqlite— async SQLite driver
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.
Latest Blog Posts
- 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/apoorva183/MCP_for_SQL'
If you have feedback or need assistance with the MCP directory API, please join our Discord server