Provides a bridge to SQLite databases for querying and analyzing data through SQL execution, enabling data exploration a...
Created byApr 23, 2025
SQLite 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](#overview)
[Features](#features)
[Setup and Installation](#setup-and-installation)
- [Creating the Sample SQLite Database](#creating-the-sample-sqlite-database)
- [Creating a Virtual Environment](#creating-a-virtual-environment)
- [Running the MCP Server](#running-the-mcp-server)
- [Installing into Claude Desktop](#installing-into-claude-desktop)
[Usage](#usage)
[Testing](#testing)
[Logging](#logging)
[License](#license)
Overview
The MCP server uses the [MCP Python SDK](https://pypi.org/project/mcp/) (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. 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**
- Reads from `stdin` and writes responses to `stdout`, making integration easy.
**Logging**
- Uses Python s `logging` module to trace activity and debug errors.