local-data-mcp
Exposes a local SQLite database as structured read-only tools, enabling table listing, schema inspection, ad-hoc SELECT/WITH/EXPLAIN queries, product search, customer lookup with order history, and sales summaries, plus access to the database schema as a resource.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@local-data-mcpShow me last month's sales by category"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
local-data-mcp
An MCP server that exposes a local SQLite database to LLM clients (Claude Desktop, Claude Code, MCP Inspector, …) as structured, read-only tools.
Every tool returns a Pydantic model, so clients get both an outputSchema up front and typed
structuredContent in each result (plus a JSON text fallback for older clients).
Quick start
uv sync
uv run local-data-mcp --seed # creates data/store.db with sample store data
uv run pytest # 16 tests, incl. a real stdio round-trip
uv run local-data-mcp # serve over stdioPoint it at your own database with --db path/to/file.db or LOCAL_DATA_DB=.... The generic tools
(list_tables, describe_table, run_query) work on any SQLite file. The domain tools assume the
sample schema, so replace them with ones that fit your data (see "Adapting" below).
Related MCP server: Read-Only SQLite Shop Database MCP Server
What it exposes
Kind | Name | Purpose |
tool |
| Tables + row counts |
tool |
| Columns, FKs, row count, 3 sample rows |
tool |
| Ad-hoc read-only SQL ( |
tool |
| Filter by name, category, price range, stock |
tool |
| Customer by id/email + lifetime value + recent orders with items |
tool |
| Revenue/units/orders grouped by month, category or product, with a date range |
resource |
| Full DDL |
prompt |
| Canned analysis workflow using the tools above |
All tools carry readOnlyHint / idempotentHint annotations.
Safety model
Connections open the file with
mode=ro, so SQLite itself refuses writes.run_queryalso installs a SQLite authorizer that denies everything except SELECT/READ/FUNCTION/RECURSIVE. That covers cases likeWITH x AS (...) DELETE ...,ATTACHand pragmas.Only one statement is allowed per call, and results are capped at
limit(max 1000), with atruncatedflag.Table names in
describe_tableare checked againstsqlite_masterand never interpolated from raw input.Bad input becomes a tool error (
isError: true) that the model can read and recover from, not a crash.
Connect a client
Claude Code
claude mcp add local-data -- uv --directory /ABSOLUTE/PATH/local-data-mcp run local-data-mcpClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"local-data": {
"command": "uv",
"args": ["--directory", "/ABSOLUTE/PATH/local-data-mcp", "run", "local-data-mcp"],
"env": { "LOCAL_DATA_DB": "/ABSOLUTE/PATH/local-data-mcp/data/store.db" }
}
}
}MCP Inspector (interactive debugging)
npx @modelcontextprotocol/inspector uv run local-data-mcpOver HTTP: uv run local-data-mcp --transport streamable-http serves at http://127.0.0.1:8000/mcp.
In stdio mode, stdout carries the protocol. Never
print()to stdout in server code; log to stderr.
Layout
src/local_data_mcp/
__init__.py CLI entry point (--db, --seed, --transport)
server.py MCPServer: tools, resource, prompt
models.py Pydantic output models -> outputSchema / structuredContent
db.py read-only SQLite access + authorizer
seed.py deterministic sample database
tests/ in-memory client tests + stdio end-to-end testAdapting to your own data
Swap
Databaseindb.pyfor your source (CSV viacsv/DuckDB, a JSON folder, Postgres, …).Model each answer shape in
models.py.Add one
@mcp.tool()per question the model should be able to answer. Give each a clear docstring (it becomes the tool description) andAnnotated[..., Field(description=...)]parameters (they become the input schema).
This server cannot be deployed
Maintenance
Related MCP Connectors
Astra DB tools for agents: schema, find, vector search, guarded writes, and interactive views.
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceExposes a SQLite database to AI assistants with structured, read-safe access. Includes five tools for schema exploration, querying, and sampling data.-
- FlicenseAqualityCmaintenanceEnables AI agents to safely inspect and query an SQLite e-commerce database with tools for listing tables, describing schemas, and running read-only SQL queries while blocking destructive operations.4-
- FlicenseAqualityCmaintenanceEnables AI agents to read-only query an online store's SQLite database, listing tables, inspecting schemas, and running SELECT queries over customers, products, orders, and order items.3-
- FlicenseAqualityBmaintenanceGives AI agents read-only analytical access to an e-commerce SQLite database (customers, orders, order_items, products) via SQL queries, table listing, and schema inspection.3-