Labsco
panasenco logo

SQLite

โ˜… 23

from panasenco

MCP server for SQLite files. Supports Datasette-compatible metadata!

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

mcp-sqlite

Provide useful data to AI agents without giving them access to external systems. Compatible with Datasette for human users!

Features

  • AI agents can get the structure of all tables and columns in the SQLite database in one command - sqlite_get_catalog.
    • The catalog can be enriched with descriptions for the tables and columns using a simple YAML or JSON metadata file.
  • The same metadata file can contain canned queries to the AI to use. Each canned query will be turned into a separate MCP tool sqlite_execute_main_{tool name}.
  • AI agents can execute arbitrary SQL queries with sqlite_execute.

Interactive exploration with MCP Inspector and Datasette

The same database and metadata files can be used to explore the data interactively with MCP Inspector and Datasette.

MCP InspectorDatasette

MCP Inspector

Use the MCP Inspector dashboard to interact with the SQLite database the same way that an AI agent would:

  1. Install npm.
  2. Run:
    npx @modelcontextprotocol/inspector uvx mcp-sqlite sample/titanic.db --metadata sample/titanic.yml

Datasette

Since mcp-sqlite metadata is compatible with the Datasette metadata file, you can also explore your data with Datasette:

uvx datasette serve sample/titanic.db --metadata sample/titanic.yml

Compatibility with Datasette allows both AI agents and humans to easily explore the same local data!

MCP Tools provided by mcp-sqlite

  • sqlite_get_catalog(): Tool the agent can call to get the complete catalog of the databases, tables, and columns in the data, combined with metadata from the metadata file. In an earlier iteration of mcp-sqlite, this was a resource instead of a tool, but resources are not as widely supported, so it got turned into a tool. If you have a usecase for the catalog as a resource, open an issue and we'll bring it back!
  • sqlite_execute(sql): Tool the agent can call to execute arbitrary SQL. The table results are returned as HTML. For more information about why HTML is the best format for LLMs to process, see Siu et al.
  • {canned query name}({canned query args}): A tool is created for each canned query in the metadata, allowing the agent to run predefined queries without writing any SQL.

Roadmap

Datasette query featureSupported in mcp-sqlite?
Displayed in catalogโœ…
Executableโœ…
Titlesโœ…
Descriptionsโœ…
Parametersโœ…
Explicit parametersโŒ (planned)
Hide SQLโœ…
Write restrictions on canned queriesโœ…
PaginationโŒ (planned)
Cross-database queriesโŒ (planned)
FragmentsโŒ (not planned)
Magic parametersโŒ (not planned)