About SQLite MCP Server
SQLite MCP Server is a Python MCP server for accessing SQLite databases through an MCP client. It combines read-only SQL queries with schema resources and analysis prompt templates.
Key features
- 01Expose table schemas as resources
- 02Run read-only SQL queries
- 03Allow only SELECT statements
- 04Provide data analysis prompt templates
- 05Communicate over STDIO
Use cases
- 01Query data in a SQLite database
- 02Inspect one or all table schemas
- 03Generate prompts for table analysis
- 04Explain the meaning of SQL queries
MCP support
The MCP server exposes SQLite schemas as resources, read-only queries as a tool, and analysis prompt templates. It communicates with MCP clients over STDIO.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMESQLite MCP Server
This repository contains an MCP (Model Context Protocol) server written in Python that connects to a SQLite database containing startup funding data. The server exposes table schemas as resources, provides a read-only SQL query tool, and offers prompt templates for common data analysis tasks. It is designed to work with MCP clients and language models (LLMs) and communicates via the STDIO protocol.
Table of Contents
Overview
The MCP server uses the MCP Python SDK (with CLI extras) to implement a server that:
- Connects to a SQLite database (e.g., a database with startup funding information).
- Exposes table schemas as MCP resources.
- Provides a tool for executing read-only SQL queries.
- Offers prompt templates that help language models generate data analysis insights.
- Communicates via the STDIO protocol, reading JSON-RPC messages from standard input and writing responses to standard output.
Features
-
Resources
schema://sqlite/{table}: Returns the SQL schema for a specific table.schema://sqlite/all: Returns a JSON mapping of all table schemas.
-
Tools
sql_query: Executes read-only SQL queries. OnlySELECTstatements are permitted.
-
Prompts
analyze_table_prompt: Generates an analysis prompt for a specific table.describe_query_prompt: Generates a prompt explaining a SQL query.
-
STDIO Protocol
- Reads from
stdinand writes responses tostdout, making integration easy.
- Reads from
-
Logging
- Uses Python’s
loggingmodule to trace activity and debug errors.
- Uses Python’s
Setup and Installation
Creating the Sample SQLite Database
Save the following script as create_db.py:
<same as earlier>
Run with:
python create_db.py
Creating a Virtual Environment
python -m venv venv
Activate the environment:
-
macOS/Linux:
source venv/bin/activate -
Windows:
venv\Scripts\activate
Install dependencies:
pip install "mcp[cli]"
Running the MCP Server
- Save your server code as
sqlite_mcp_server.py. - Run the server:
python sqlite_mcp_server.py
Optional (using uv):
uv run sqlite_mcp_server.py
Installing into Claude Desktop
Save the following as install_to_claude.py and run it:
python install_to_claude.py
Update Claude Desktop config with:
{
"mcpServers": {
"sqlite_mcp_server": {
"command": "python",
"args": ["-u", "/absolute/path/to/sqlite_mcp_server.py"]
}
}
}
Restart Claude Desktop afterward.
Usage
- Access Resources:
schema://sqlite/all,schema://sqlite/startups - Invoke Tools:
SELECT * FROM startups WHERE funding_amount > 10000000; - Use Prompts: Generate SQL or explain queries.
Testing
Run the test script:
python sqlite_mcp_client_tests.py sqlite_mcp_server.py
This script tests:
- Listing resources
- Retrieving schemas
- Valid/invalid queries
- Prompt templates
Logging
Modify logging config:
logging.basicConfig(
filename='mcp_server.log',
level=logging.DEBUG,
format="[%(asctime)s] %(levelname)s - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S"
)
Logs print to stderr by default.
License
This project is licensed under the MIT License. See the LICENSE file.
Additional Notes
- Adjust paths in installation/config scripts as needed.
- Ensure the SQLite database is created before running the server.
- Integrates with MCP Inspector or Claude Desktop.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.