mcpField
S
SQLite MCP Server

SQLite MCP Server

Local
github.com/isaacgountonDatabases1Updated 15w ago

About SQLite MCP Server

SQLite MCP Server provides SQLite database operations to MCP clients over stdio or Streamable HTTP. It includes table management, schema resources, business insight tracking, and validation for SQL inputs.

Key features

  1. 01Run read and write queries
  2. 02Create, drop, and inspect tables
  3. 03Expose database schema as a resource
  4. 04Record business insights
  5. 05Support stdio and Streamable HTTP
  6. 06Validate SQL and block stacked statements

Use cases

  1. 01Query or update SQLite through MCP
  2. 02Inspect tables, columns, indexes, and foreign keys
  3. 03Connect remote clients to a database service
  4. 04Accumulate business insights from analysis

MCP support

The server exposes SQL query and table-management tools, along with database schema and insight memo resources through MCP. It supports stdio and Streamable HTTP transports.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"sqlite": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"build"
]
}
}
}
Run commanddocker run -i --rm build

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
ocibuild

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

SQLite MCP Server

CI License: ISC smithery badge

A Model Context Protocol (MCP) server that provides SQLite database operations. Supports both stdio (for Claude Desktop, Cursor, etc.) and Streamable HTTP (for remote clients) transports.

Features

  • In-memory or file-based SQLite database
  • Dual transport: stdio and Streamable HTTP
  • SQL operations with input validation and injection protection
  • Table management (CREATE, DROP, LIST, DESCRIBE)
  • Database schema exposed as an MCP resource
  • Business insights memo tracking
  • Docker support

Quick Start

Stdio (Claude Desktop, Cursor, etc.)
npm install && npm run build
node build/index.js

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "sqlite": {
      "command": "node",
      "args": ["/path/to/sqlite-mcp-server/build/index.js"]
    }
  }
}

With a file-based database:

{
  "mcpServers": {
    "sqlite": {
      "command": "node",
      "args": ["/path/to/sqlite-mcp-server/build/index.js", "/path/to/database.db"]
    }
  }
}
Streamable HTTP (remote clients)
node build/index.js --http

The server exposes a single endpoint at http://localhost:3000/mcp following the MCP Streamable HTTP specification. By default it binds to 127.0.0.1. To reach it from another host or a container, set HOST=0.0.0.0 — but read the Security section first: the HTTP transport has no authentication.

Docker
docker build -t sqlite-mcp-server .
docker run -d -p 3000:3000 -e HOST=0.0.0.0 --name sqlite-mcp sqlite-mcp-server

HOST=0.0.0.0 is required so the server is reachable through the published port. Connecting from the host via localhost:3000 works out of the box; to reach it under any other hostname, add that host to MCP_ALLOWED_HOSTS.

Configuration

OptionDescriptionDefault
--httpUse Streamable HTTP transport instead of stdiostdio
First non-flag argumentPath to SQLite database file:memory:
SQLITE_DB_PATHDatabase path (env var alternative):memory:
PORTHTTP server port (HTTP mode only)3000
HOSTInterface to bind in HTTP mode. Use 0.0.0.0 to expose beyond localhost127.0.0.1
MCP_ALLOWED_HOSTSComma-separated Host header allow-list for DNS-rebinding protectionlocalhost:$PORT,127.0.0.1:$PORT
MCP_AUTH_TOKENBearer token required on all /mcp requests (HTTP mode). Unset = auth disabled(none)

Examples:

# In-memory database on stdio
node build/index.js

# File-based database on stdio
node build/index.js ./data.db

# HTTP mode with custom port
PORT=8080 node build/index.js --http ./data.db

# Using environment variable
SQLITE_DB_PATH=./data.db node build/index.js --http

Available Tools

ToolDescription
read_queryExecute SELECT, WITH (CTE), or EXPLAIN queries
write_queryExecute INSERT, UPDATE, DELETE, or REPLACE queries
create_tableCreate a new table with a CREATE TABLE statement
drop_tableDrop a table (irreversible)
list_tablesList all user-created tables
describe_tableGet table schema: columns, indexes, and foreign keys
append_insightAdd a business insight to the memo resource

Resources

URIDescription
sqlite://{db}/schemaFull schema (CREATE statements) for all tables
memo://insightsAccumulated business insights from analysis

Prompts

NameDescription
mcp-demoGuided walkthrough: creates tables, inserts sample data, runs queries for a given topic

Remote Connection

Streamable HTTP

Connect any MCP-compatible client to http://your-host:3000/mcp. The server supports:

  • POST /mcp — send MCP messages (session created on initialize)
  • GET /mcp — SSE stream for session resumability
  • DELETE /mcp — terminate a session
  • GET /health — health check endpoint

Sessions are managed via the Mcp-Session-Id header.

Authentication

Set MCP_AUTH_TOKEN to require a bearer token on every /mcp request (/health stays open):

MCP_AUTH_TOKEN=$(openssl rand -hex 32) HOST=0.0.0.0 node build/index.js --http

Clients then send Authorization: Bearer <token>. When MCP_AUTH_TOKEN is unset, authentication is disabled — fine for a localhost-only bind, but do not expose the server publicly without it.

Security

  • Query validation: each tool only accepts its intended SQL statement type
  • Multi-statement injection blocked: stacked statements are rejected, with string literals and comments stripped before the check
  • Table names validated against ^[a-zA-Z_][a-zA-Z0-9_]*$
  • Foreign keys enabled by default
  • HTTP transport binds to 127.0.0.1 by default, with DNS-rebinding protection (MCP_ALLOWED_HOSTS)
  • Optional bearer-token auth on the HTTP transport via MCP_AUTH_TOKEN (timing-safe check)

Set MCP_AUTH_TOKEN before exposing the HTTP transport beyond localhost. For production, also front it with a reverse proxy that terminates TLS. See SECURITY.md for the full model and how to report a vulnerability.

Development

npm install
npm run build
npm test           # build + run the validator test suite
npm start          # stdio mode
npm run start:http # HTTP mode

License

ISC

Comments

Markdown supported

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.