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.
The MCP server uses the MCP Python SDK (with CLI extras) to implement a server that:
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. Only SELECT
statements 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
stdin
and writes responses to stdout
, making integration easy.Logging
logging
module to trace activity and debug errors.Save the following script as create_db.py
:
<same as earlier>
Run with:
python create_db.py
python -m venv venv
Activate the environment:
macOS/Linux:
source venv/bin/activate
Windows:
venv\Scripts\activate
Install dependencies:
pip install "mcp[cli]"
sqlite_mcp_server.py
.python sqlite_mcp_server.py
Optional (using uv
):
uv run sqlite_mcp_server.py
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.
schema://sqlite/all
, schema://sqlite/startups
SELECT * FROM startups WHERE funding_amount > 10000000;
Run the test script:
python sqlite_mcp_client_tests.py sqlite_mcp_server.py
This script tests:
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.
This project is licensed under the MIT License. See the LICENSE
file.
{
"mcpServers": {
"sqlite_mcp_server": {
"env": {},
"args": [
"-u",
"/absolute/path/to/sqlite_mcp_server.py"
],
"command": "python"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.