Skip to main content
Glama
ofershap

mcp-server-sqlite

by ofershap

mcp-server-sqlite

npm version npm downloads CI TypeScript License: MIT

Query SQLite databases, inspect schemas, and explain queries from your AI assistant. Read-only by default for safety.

npx mcp-sqlite-server

Works with Claude Desktop, Cursor, VS Code Copilot, and any MCP client. Reads local .db files, no auth needed.

MCP server for querying SQLite databases and inspecting schemas

Demo built with remotion-readme-kit

Why

SQLite is everywhere. It's the default database for mobile apps, Electron apps, local-first tools, and increasingly for server-side projects too (Turso, Cloudflare D1, Bun's built-in SQLite). The official MCP reference includes a basic SQLite server, but it's Python-only. If you're working in a TypeScript/Node.js environment and want to ask your assistant "what tables are in this database?" or "run this query and show me the results," this server handles that. It opens the database read-only by default so you can explore safely, and you can opt into write mode when you need it.

Related MCP server: mcp-database

Tools

Tool

What it does

query

Execute SQL (SELECT, PRAGMA, EXPLAIN, WITH). Returns results as a table.

schema

Get full schema: all tables with columns, types, and row counts.

table_info

Detailed info for a single table: columns, constraints, row count.

explain

Run EXPLAIN QUERY PLAN to optimize queries.

list_databases

List .db, .sqlite, .sqlite3 files in a directory.

Quick Start

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": ["mcp-sqlite-server"]
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": ["mcp-sqlite-server"]
    }
  }
}

VS Code

Configure the MCP server in your VS Code settings to run npx mcp-sqlite-server.

Example prompts

  • "Show me the schema of my database at ./data.db"

  • "Query the users table: SELECT * FROM users LIMIT 10"

  • "Explain the query plan for this complex join"

  • "What tables are in this database?"

  • "Find all .db files in the current directory"

Safety

Read-only by default. The query tool accepts only SELECT, PRAGMA, EXPLAIN, and WITH in readonly mode. Set readonly=false in the tool args to enable INSERT, UPDATE, DELETE, etc.

Development

npm install
npm run typecheck
npm run build
npm test
npm run format
npm run lint

See also

More MCP servers and developer tools on my portfolio.

Author

Made by ofershap

LinkedIn GitHub


README built with README Builder

License

MIT © 2026 Ofer Shapira

Available Tools

5 tools
explainC

Explain the query plan for a SQL query (EXPLAIN QUERY PLAN). Helps optimize queries.

ParametersJSON Schema
NameRequiredDescriptionDefault
dbYesPath to the .db or .sqlite file
sqlYesSQL query to explain

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool explains query plans and helps optimize queries, but doesn't describe what the output looks like (e.g., textual explanation, structured data), whether it's read-only or has side effects, or any constraints like file access permissions or rate limits. For a tool with no annotations, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, consisting of two sentences that directly state the purpose and benefit. There's no wasted verbiage, and it efficiently communicates the core functionality. However, it could be slightly improved by integrating usage guidance more seamlessly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of SQL query analysis and the lack of annotations and output schema, the description is incomplete. It doesn't explain the return format, potential errors, or behavioral traits, leaving gaps for an agent to understand how to interpret results. For a tool with no structured output and no annotations, more descriptive context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear documentation for both parameters ('db' as path to file, 'sql' as SQL query). The description adds no additional parameter semantics beyond what the schema provides, such as format details or examples. With high schema coverage, the baseline score of 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Explain the query plan for a SQL query (EXPLAIN QUERY PLAN).' It specifies the verb ('explain') and resource ('query plan'), and adds the helpful context 'Helps optimize queries.' However, it doesn't explicitly differentiate from sibling tools like 'query' or 'schema,' which could handle similar SQL-related tasks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'Helps optimize queries,' which implies usage for performance tuning, but doesn't specify scenarios, prerequisites, or exclusions compared to siblings like 'query' or 'schema.' This lack of explicit when/when-not guidance limits its utility for an agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_databasesB

List all SQLite database files (.db, .sqlite, .sqlite3) in a directory.

ParametersJSON Schema
NameRequiredDescriptionDefault
directoryNoDirectory path to scan (default: current directory).

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists files but does not describe how it behaves—e.g., whether it recursively scans subdirectories, handles errors like inaccessible paths, returns file metadata or just names, or has any rate limits. This leaves significant gaps in understanding the tool's operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly communicates what the tool does, making it easy to parse and understand quickly. Every part of the sentence earns its place by specifying file types and location.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally complete but lacks depth. It covers the basic purpose and resource but omits behavioral details and usage context. For a simple listing tool, this might be adequate, but it does not fully compensate for the absence of annotations or output schema, leaving room for improvement.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, documenting the single parameter 'directory' with its type, default, and purpose. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Given the high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('List') and resource ('SQLite database files (.db, .sqlite, .sqlite3) in a directory'), distinguishing it from sibling tools like 'explain', 'query', 'schema', and 'table_info' which perform different operations on databases rather than listing files. It precisely defines what the tool does without being vague or tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention any prerequisites, exclusions, or comparisons to sibling tools, leaving the agent to infer usage based on the purpose alone. This lack of explicit context reduces its helpfulness for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

queryA

Execute a SQL query against a SQLite database. Returns results as a formatted table. Read-only by default.

ParametersJSON Schema
NameRequiredDescriptionDefault
dbYesPath to the .db or .sqlite file
sqlYesSQL query to execute
readonlyNoIf true, only SELECT/PRAGMA/EXPLAIN allowed

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: the tool executes SQL queries, returns formatted tables, and is 'Read-only by default' (implying safety and restrictions). However, it could add more context, such as error handling, performance implications, or specific limitations beyond the default read-only mode.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, consisting of two concise sentences that directly convey the tool's purpose and key behavior. Every sentence earns its place by providing essential information without redundancy or unnecessary details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (SQL execution), no annotations, and no output schema, the description is mostly complete. It covers the core functionality, default behavior, and output format. However, it could improve by addressing error cases, result limitations (e.g., large datasets), or more details on the 'readonly' parameter's enforcement, which would enhance completeness for a tool with no structured output documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters ('db', 'sql', 'readonly') with descriptions. The description adds minimal value beyond the schema, as it doesn't provide additional syntax, format details, or usage examples for parameters. The baseline score of 3 is appropriate since the schema handles most of the parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Execute a SQL query'), target resource ('against a SQLite database'), and output format ('Returns results as a formatted table'). It distinguishes from siblings like 'explain' (query analysis), 'list_databases' (database enumeration), 'schema' (structure overview), and 'table_info' (table metadata) by focusing on direct query execution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('Execute a SQL query against a SQLite database') and implicitly suggests alternatives through sibling tool names (e.g., use 'explain' for query analysis, 'schema' for structure). However, it lacks explicit guidance on when NOT to use it or detailed comparisons with alternatives, such as when to prefer 'explain' over 'query' for debugging.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

schemaA

Get the schema of a SQLite database: all tables with columns and row counts.

ParametersJSON Schema
NameRequiredDescriptionDefault
dbYesPath to the .db or .sqlite file

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses the tool's behavior as a read operation that returns schema information, but doesn't mention error handling, performance characteristics, or output format details. It adequately describes what the tool does without contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that immediately states the tool's purpose and scope. Every word earns its place with no redundancy or unnecessary elaboration, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter read tool with no annotations and no output schema, the description provides adequate context about what the tool does. However, it doesn't describe the return format or structure, which would be helpful given the lack of output schema. The description is complete enough for basic understanding but could be more comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents the single parameter 'db' as a path to a database file. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get the schema') and resource ('SQLite database'), with precise scope ('all tables with columns and row counts'). It distinguishes from sibling tools like 'query' (executes queries) and 'table_info' (likely provides detailed table metadata) by focusing on comprehensive schema retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when needing database structure information, but doesn't explicitly state when to use this tool versus alternatives like 'table_info' or 'explain'. It provides basic context (SQLite databases) but lacks explicit guidance on prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

table_infoA

Get detailed info about a single table: columns, types, constraints, and row count.

ParametersJSON Schema
NameRequiredDescriptionDefault
dbYesPath to the .db or .sqlite file
tableYesTable name

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It describes the tool's behavior (retrieving metadata) and output content (columns, types, constraints, row count), but lacks details on permissions, error handling, or performance characteristics. It doesn't contradict any annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose and lists specific metadata retrieved. Every word earns its place with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only metadata tool with no annotations and no output schema, the description adequately covers what information is returned. However, it lacks details on output format (e.g., structured JSON), error cases, or limitations, which would be helpful given the absence of structured fields.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters (db path and table name). The description adds no additional parameter semantics beyond what the schema provides, maintaining the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('detailed info about a single table'), specifying what information is retrieved (columns, types, constraints, row count). It distinguishes from sibling tools like 'list_databases' (lists databases) and 'schema' (likely shows overall schema), but doesn't explicitly differentiate from 'explain' or 'query'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when detailed table metadata is needed, but provides no explicit guidance on when to use this versus alternatives like 'schema' (which might show broader schema info) or 'query' (which retrieves data). No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.0.0
    • First observedexplain
    • First observedlist_databases
    • First observedquery
    • First observedschema
    • First observedtable_info

TDQS

A3.5/5.0
Disambiguation3/5

The tools have some overlap that could cause confusion, particularly between 'schema' and 'table_info', which both provide table structure information. However, 'explain', 'list_databases', and 'query' are clearly distinct in purpose, and descriptions help differentiate the overlapping tools.

Naming Consistency4/5

The naming is mostly consistent with a verb_noun pattern (e.g., 'list_databases', 'table_info'), but 'explain' and 'query' deviate as standalone verbs without nouns. This minor inconsistency does not severely impact readability or predictability.

Tool Count5/5

With 5 tools, the server is well-scoped for SQLite database operations. Each tool serves a clear and necessary function, such as listing databases, querying, and inspecting schemas, making the count appropriate without being too sparse or bloated.

Completeness4/5

The toolset covers core SQLite operations like listing databases, querying, and schema inspection, with minor gaps such as the lack of write operations (e.g., insert, update, delete) and database management tools (e.g., create, delete). Agents can work around these gaps for read-only use cases.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A lightweight MCP server that provides read-only access to SQLite databases, allowing users to execute SELECT queries, list tables, and describe table schemas.
    1
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    MCP server for querying and managing multiple databases (SQLite, PostgreSQL, MySQL) with read-only mode and schema inspection.
    13
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server that provides SQLite database operations. Allows AI assistants to query, modify and manage SQLite databases through the Model Context Protocol.
    -
  • A
    license
    C
    quality
    A
    maintenance
    An MCP server for interacting with SQLite databases, enabling SQL query execution, schema inspection, and CRUD operations.
    7
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ofershap/mcp-server-sqlite'

If you have feedback or need assistance with the MCP directory API, please join our Discord server