SQLite
STDIOMCP server providing AI agents secure SQLite database access with metadata support
MCP server providing AI agents secure SQLite database access with metadata support
  
Provide useful data to AI agents without giving them access to external systems. Compatible with Datasette for human users!
sqlite_get_catalog.
sqlite_execute_main_{tool name}.sqlite_execute.Install uv.
Install Visual Studio Code if you don't already have it. Turn on GitHub Copilot.
Open this repo in VS Code. Open a GitHub Copilot agent mode chat. Check the available tools - you should see MCP Server: sqlite_sample with three available tools.

You should be able to ask Copilot in agent mode a question like "Get Titanic survivors of age 28" and get a response.

Use the sample MCP configuration file mcp.json and the sample metadata file titanic.yml as a starting point for your own configuration.
The same database and metadata files can be used to explore the data interactively with MCP Inspector and Datasette.
| MCP Inspector | Datasette | 
|---|---|
![]()  | ![]()  | 
![]()  | ![]()  | 
Use the MCP Inspector dashboard to interact with the SQLite database the same way that an AI agent would:
npx @modelcontextprotocol/inspector uvx mcp-sqlite sample/titanic.db --metadata sample/titanic.yml
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-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!usage: mcp-sqlite [-h] [-m METADATA] [-p PREFIX] [-v] sqlite_file
CLI command to start an MCP server for interacting with SQLite data.
positional arguments:
  sqlite_file           Path to SQLite file to serve the MCP server for.
options:
  -h, --help            show this help message and exit
  -m, --metadata METADATA
                        Path to Datasette-compatible metadata YAML or JSON file.
  -p, --prefix PREFIX   Prefix for MCP tools. Defaults to no prefix.
  -v, --verbose         Be verbose. Include once for INFO output, twice for DEBUG output.
Hiding a table with hidden: true will hide it from the catalog returned by the MCP tool sqlite_get_catalog().
However, note that the table will still be accessible by the AI agent!
Never rely on hiding a table from the catalog as a security feature.
Canned queries are each turned into a separate callable MCP tool by mcp-sqlite.
For example, a query named my_canned_query will become a tool my_canned_query.
The canned queries functionality is still in active development with more features planned for development soon:
| Datasette query feature | Supported 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) |