mcp-sql-query
An MCP server providing SQLite database access for AI agents, enabling SQL execution, schema inspection, CRUD operations, and data export.
README
MCP SQL Query — SQLite Database Operations for AI Agents
An MCP server that gives AI agents SQLite database access: execute SQL, inspect schemas, CRUD operations, export to JSON/CSV — 13 tools, zero dependencies, pure Python stdlib.
Features
- 13 MCP Tools:
execute_sql,execute_batch,list_tables,table_schema,create_table,insert_row,insert_batch,select_rows,update_rows,delete_rows,export_json,export_csv,database_info - Zero dependencies — pure Python stdlib (sqlite3, json, re, os)
- SQL injection prevention — table name validation with regex
- Batch transactions — execute multiple statements atomically with rollback
- Data export — JSON array or CSV string output
- In-memory or file-based — use
:memory:for ephemeral DBs or file paths for persistence - STDIO JSON-RPC mode — drop-in for Claude Desktop, Hermes, or any MCP client
Quick Start
python -m src.server --stdio # STDIO mode
python -m src.server --manifest # Print manifest
Use as a library
from src.server import MCPSQLQueryServer
import json
server = MCPSQLQueryServer()
# Create a table
server.handle_tool_call("create_table", {
"table_name": "users",
"columns": [
{"name": "id", "type": "INTEGER", "primary_key": True},
{"name": "name", "type": "TEXT", "not_null": True},
{"name": "email", "type": "TEXT", "unique": True}
]
})
# Insert rows
server.handle_tool_call("insert_row", {
"table_name": "users",
"data": {"name": "Alice", "email": "alice@example.com"}
})
# Query
result = server.handle_tool_call("select_rows", {
"table_name": "users",
"where": "name = 'Alice'"
})
# Export
server.handle_tool_call("export_csv", {"table_name": "users"})
MCP Tool Reference
| Tool | Description | Required Params |
|---|---|---|
execute_sql |
Raw SQL execution | sql |
execute_batch |
Transactional batch | statements |
list_tables |
List all tables | — |
table_schema |
Column/types/indexes | table_name |
create_table |
Create with columns | table_name, columns |
insert_row |
Insert one row | table_name, data |
insert_batch |
Insert multiple | table_name, rows |
select_rows |
SELECT with WHERE/LIMIT | table_name |
update_rows |
UPDATE with WHERE | table_name, set_values, where |
delete_rows |
DELETE with WHERE | table_name, where |
export_json |
Export as JSON | table_name |
export_csv |
Export as CSV | table_name |
database_info |
DB metadata | — |
Tests
python -m pytest tests/ -v # 33 tests, all passing
License
MIT
Author
AMEOBIUS — github.com/AMEOBIUS
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.