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 "Deploy 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: SQLite Explorer
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 deployed
Maintenance
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Astra DB tools for agents: schema, find, vector search, guarded writes, and interactive views.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
- OleanderOAuthdev.oleander
The all-in-one data stack for agents. Upload files, run SQL, evolve tables, and render charts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables SQLite database interactions including querying, updating, and schema management through structured tools.3MIT
- AlicenseNot gradedqualityCmaintenanceEnables exploring and querying SQLite databases through natural language, with tools to list tables, describe table structures, and run SELECT queries.MIT
- FlicenseNot gradedqualityCmaintenanceExposes any SQLite database as read-only MCP tools for AI assistants, enabling listing tables, describing schemas, and running SELECT queries with filtering, ordering, and pagination.-
- FlicenseAqualityCmaintenanceEnables AI agents to safely inspect and query a SQLite database through read-only MCP tools for listing tables, describing schemas, and running paginated SELECT queries.3-