
用于SQLite文件的MCP服务器。支持兼容Datasette的元数据!
概览
为AI代理提供有用数据,同时不让他们访问外部系统。支持Datasette,适合人类用户使用! - AI 代理可以通过一个命令获取 SQLite 数据库中所有表格和列的结构 - sqlite_get_catalog。- 目录可以通过简单的 YAML 或 JSON 元数据文件丰富表和列的描述。- 同一元数据文件可以包含预设查询给 AI 使用。每个预设查询都会被转换为独立的 MCP 工具sqlite_execute_main_{tool name}。- AI 代理可以执行任意 SQL 查询,并带有 sqlite_execute。 1. 安装 uv。2. 如果你还没有 Visual Studio Code,就安装它。打开 GitHub Copilot。3. 在 VS Code 中打开这个仓库。打开一个 GitHub Copilot 代理模式聊天。检查可用的工具——你应该会看到 MCP Server: sqlite_sample 里有三个可用的工具。 4. 你应该能在特工模式下问副驾驶类似“28岁的泰坦尼克号幸存者”这样的问题,并得到回复。 5.
概述(AI 翻译)
为AI代理提供有用数据,同时不让他们访问外部系统。支持Datasette,适合人类用户使用!
特色
- AI 代理可以通过一个命令 [
sqlite_get_catalog获取 SQLite 数据库中所有表和列的结构。 - 目录可以通过简单的 YAML 或 JSON 元数据文件丰富表和列的描述。
- 同一元数据文件可以包含预设查询,供AI使用。
每个预设查询都会被转换成一个独立的MCP工具
sqlite_execute_main_{tool name}。 - AI 代理可以执行任意 SQL 查询,使用
sqlite_execute。
Visual Studio Code 快速入门
-
安装UV。
-
如果你还没有Visual Studio Code,可以安装它。 打开GitHub Copilot。
-
在 VS Code 中打开该仓库。 打开GitHub Copilot代理模式聊天。 查看可用的工具——你应该会看到MCP Server: sqlite_sample,里面有三个可用的工具。
-
你应该能在特工模式下问副驾驶类似“28岁的泰坦尼克号幸存者”这样的问题,并得到回复。
-
使用示例MCP配置文件mcp.json和示例元数据文件 titanic.yml作为你自己配置的起点。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
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.
Quickstart using Visual Studio Code
-
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.
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 Inspector | Datasette |
|---|---|
![]() |
![]() |
![]() |
![]() |
MCP Inspector
Use the MCP Inspector dashboard to interact with the SQLite database the same way that an AI agent would:
- Install npm.
- 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!
安装
npx @modelcontextprotocol/inspector uvx mcp-sqlite sample/titanic.db --metadata sample/titanic.yml


