MCP SQLite Server

MCP SQLite Server

Query, explore, and manage SQLite databases through the Model Context Protocol. Connect any MCP-compatible AI client to your databases.

Category
Visit Server

README

šŸ—„ļø MCP SQLite Server

Query, explore, and manage SQLite databases through the Model Context Protocol. Connect any MCP-compatible AI client to your databases — Claude Desktop, Cursor, VS Code, and more.

License: MIT Python 3.10+


✨ Features

  • šŸ” 3 Tools: query, execute, list_tables — full database interaction
  • šŸ“„ 2+ Resources: sqlite://tables (full schema), sqlite://{table}/schema (per-table)
  • šŸ’¬ 1 Prompt: database_analyst(question) — guided analysis workflow
  • šŸ”’ Security-First: Read-only by default, explicit --allow-write flag for mutations
  • šŸ“Š WAL Mode: Write-Ahead Logging for better concurrent access
  • šŸ–„ļø Dual Transport: stdio (local) and Streamable HTTP (remote)
  • šŸŽ² Sample Data: Seed script included for instant testing

šŸš€ Quick Start

# 1. Setup
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# 2. Create sample database
python seed_data.py --db-path /tmp/sample.db

# 3. Start server (read-only mode)
python sqlite_server.py --db-path /tmp/sample.db

šŸ› ļø Tools

query(sql: str) -> str

Execute a SELECT query. Only SELECT and PRAGMA statements are allowed.

Example: query("SELECT name, price FROM products WHERE category = 'Electronics'")

execute(sql: str) -> str

Run INSERT, UPDATE, or DELETE. Requires --allow-write flag.

Example (with --allow-write):
  execute("INSERT INTO products (name, price, category, stock) VALUES ('Webcam 4K', 129.99, 'Electronics', 50)")

list_tables() -> str

List all tables with row counts.


šŸ”’ Security Model

Feature Default With --allow-write
SELECT/PRAGMA queries āœ… Allowed āœ… Allowed
INSERT/UPDATE/DELETE āŒ Blocked āœ… Allowed
DROP/ALTER/CREATE āŒ Blocked āŒ Blocked
Row factory protection āœ… Enabled āœ… Enabled

āš ļø Production tip: Always use read-only mode for public-facing or shared databases. Only enable --allow-write in trusted environments.


šŸ“„ Resources

sqlite://tables

Returns complete database schema with column types, nullability, defaults, and primary keys.

sqlite://{table}/schema

Returns schema for a specific table.


šŸ’¬ Prompts

database_analyst(query_question: str)

Creates a structured prompt for analyzing database data.


šŸ”Œ Connecting to Clients

Claude Desktop

{
  "mcpServers": {
    "sqlite": {
      "command": "python",
      "args": ["/ABSOLUTE/PATH/mcp-sqlite-server/sqlite_server.py", "--db-path", "/tmp/sample.db"]
    }
  }
}

Cursor

Settings → Features → MCP → Add Server:

  • Name: sqlite
  • Type: command
  • Command: python /ABSOLUTE/PATH/mcp-sqlite-server/sqlite_server.py --db-path /tmp/sample.db

šŸ“ Project Structure

mcp-sqlite-server/
ā”œā”€ā”€ sqlite_server.py      # Main server (FastMCP)
ā”œā”€ā”€ seed_data.py          # Sample database creator
ā”œā”€ā”€ requirements.txt
ā”œā”€ā”€ setup.sh
ā”œā”€ā”€ README.md
└── .gitignore

šŸ“œ License

MIT

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

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.

Official
Featured