Skip to main content
Glama
SQLite MCP Server

SQLite MCP Server

by aktnk

sqlite-mcp-server

A Model Context Protocol (MCP) server that enables MCP-compatible clients (e.g., Claude Desktop) to query and visualize SQLite databases using natural language.

Features

  • list_data — Execute a SELECT query and return results as JSON

  • export_csv — Execute a SELECT query and return results as CSV

  • visualize_data — Execute a SELECT query and render a bar, line, or scatter chart as a PNG image

Related MCP server: NL-to-SQL MCP

Requirements

  • Python 3.12+

  • uv

Installation

git clone https://github.com/aktnk/sqlite-mcp-server.git
cd sqlite-mcp-server
uv sync

MCP Client Setup

Copy config.sample.json to config.json and update the paths:

{
  "mcpServers": {
    "sqlite-explorer": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/sqlite-mcp-server",
        "run",
        "main.py"
      ],
      "env": {
        "SQLITE_MCP_ALLOWED_DIRS": "/path/to/your/databases"
      }
    }
  }
}

Then add the contents to your MCP client's configuration file.

Claude Desktop:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Configuration

Environment Variable

Default

Description

SQLITE_MCP_ALLOWED_DIRS

Current working directory

Colon-separated list of directories the server is allowed to access (e.g., /data:/tmp/dbs)

Development

# Create a sample database for testing
uv run setup_db.py

# Run the server directly
uv run main.py

# Run with MCP Inspector (interactive tool testing)
uv run mcp dev main.py

Security

All database access is strictly read-only. The following protections are in place:

Layer

What it prevents

Read-only connection (?mode=ro)

INSERT / UPDATE / DELETE / DROP

SQLite authorizer (set_authorizer)

ATTACH DATABASE, schema changes, load_extension

Path validation

Path traversal (../), access outside allowed directories, non-.db files

Row limit (10,000 rows)

Denial-of-service via large result sets

License

MIT License © 2026 Akira Tanaka

Available Tools

3 tools
export_csvA
SQLiteからデータを取得し、CSV文字列として返します。
- db_path: .dbファイルのフルパス(許可ディレクトリ内のみ)
- sql: 実行するSELECTクエリ(最大10,000件)

Inputs: sql (required), db_path (required). Returns: result

list_dataB
SQLiteからデータを取得し、JSON形式のリストで返します。
- db_path: .dbファイルのフルパス(許可ディレクトリ内のみ)
- sql: 実行するSELECTクエリ(最大10,000件)

Inputs: sql (required), db_path (required). Returns: result

visualize_dataB
SQLiteからデータを取得し、グラフを生成して画像として返します。
- db_path: .dbファイルのフルパス(許可ディレクトリ内のみ)
- sql: 実行するSELECTクエリ(最大10,000件)
- x_col: X軸にするカラム名
- y_col: Y軸にするカラム名
- chart_type: 'bar' (棒), 'line' (折れ線), 'scatter' (散布図)

Inputs: sql (required), x_col (required), y_col (required), db_path (required), +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 3 tools

    Disambiguation4/5

    All three tools execute a SELECT query against the same database, but their output formats are clearly distinct: JSON list, CSV string, and chart image. An agent could still hesitate between list_data and export_csv for simple data retrieval, but the descriptions make the intended use cases reasonably clear.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern: list_data, export_csv, visualize_data. There are no mixed conventions or vague names.

    Tool Count4/5

    Three tools is on the low end but appropriate for a focused read/export/visualize SQLite server. Each tool has a distinct output role, though the surface is minimal.

    Completeness3/5

    The server covers querying, CSV export, and visualization, but lacks schema/table introspection and any write operations. Agents cannot discover table structures or modify data, which are notable gaps for a general SQLite server.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP server enabling natural-language querying of SQLite databases via schema discovery, GraphRAG retrieval, and safely guarded read-only SQL execution.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language querying of SQLite databases through a secure MCP server that writes, runs, and explains SQL with a three-layer read-only guarantee.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that translates natural-language questions into SQL, validates every query structurally, and executes approved read-only queries against a SQLite database, returning results and rejections.
      MIT