sqlite-readonly-mcp
Designed to be deployed behind Nginx with HTTPS, with configuration examples for proxying MCP streamable HTTP endpoints and handling SSE fallback connections for Cursor compatibility.
Provides read-only SQLite database access through MCP tools, enabling AI agents to execute SELECT/WITH/EXPLAIN queries and list non-system tables from a remote SQLite database file.
Click on "Install 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., "@sqlite-readonly-mcplist all tables in the database"
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.
sqlite-readonly-mcp
A read-only SQLite Model Context Protocol service running on remote Linux, using Streamable HTTP (/mcp), authenticated via Bearer Token, and returning query results as JSON text. Designed to be placed behind Nginx (HTTPS), with the upstream listening only on localhost.
Features
Tool
sqlite_query: SingleSELECT/WITH/EXPLAINstatement, returns JSON with{ rows, rowCount }.Tool
list_tables: Lists non-system table names.SQLite:
better-sqlite3readonly + fileMustExist; application-level restrictions on single statements and query prefixes.GET /health: For loopback access only, used for probes (seesrc/server.ts).Transport: Streamable HTTP (
/mcp) + legacy SSE (GET /sse,POST /messages), for easy fallback by Cursor when needed.
Related MCP server: PostgreSQL MCP Server
Environment Variables
Variable | Required | Description |
| Yes | Absolute path to the database file |
| Yes | Static Bearer (also accepts |
| No | Default |
| No | Default |
| No | Comma-separated allowed |
| No | Maximum rows per query, default |
Local Build and Run
npm install
npm run build
export SQLITE_PATH=/path/to/db.sqlite
export BEARER_TOKEN='your-secret-token'
export ALLOWED_HOSTS='127.0.0.1,localhost'
node dist/server.jsDevelopment and debugging: npm run dev
Nginx and systemd
See deploy/nginx.example.conf, deploy/sqlite-readonly-mcp.service, and deploy/sqlite-readonly-mcp.env.example.
Key points: Pass Authorization, Accept, Content-Type, and mcp-session-id to the upstream; disable proxy_buffering for SSE/chunked responses. The examples include **/sse** and **/messages** (legacy SSE fallback), reverse-proxied alongside Streamable HTTP's /mcp.
Running as root (Recommended Example)
To simplify read permission configuration for the SQLite file and parent directory, the example uses root to start the service (the systemd unit does not set User= / Group=, defaulting to root).
Place the code and build artifacts in, for example,
/opt/sqlite-readonly-mcp, and runnpm ci --omit=devandnpm run build.Copy the environment file and fill in the variables:
sudo cp deploy/sqlite-readonly-mcp.env.example /etc/sqlite-readonly-mcp.env
sudo chmod 600 /etc/sqlite-readonly-mcp.envInstall and enable the unit (modify
WorkingDirectoryand the absolute path tonodeinExecStartas needed):
sudo cp deploy/sqlite-readonly-mcp.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now sqlite-readonly-mcp
sudo systemctl status sqlite-readonly-mcpIf you previously added User=mcp yourself, remove that line before running daemon-reload and restart.
Security Note: A compromised root process has a larger impact; please ensure you use HTTPS, Bearer tokens, localhost listening + Nginx, and a firewall. If minimal privileges are required, revert to a dedicated user and configure data file and path permissions separately.
Manual Verification (curl)
MCP requires clients to accept both application/json and text/event-stream:
curl -sS -D - \
-H "Authorization: Bearer $BEARER_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}' \
"https://mcp.example.com/mcp"An incorrect token should return 401.
Cursor Client
In Cursor's MCP settings, configure the HTTPS URL for this remote service (e.g., https://mcp.example.com/mcp). If Bearer is required, check if your current Cursor version supports configuring custom headers for remote MCP; if not, you will need to add a gateway layer locally that includes the fixed Authorization header (see risk documentation).
Operations
See docs/RUNBOOK.md for details.
License
MIT (consistent with @modelcontextprotocol/sdk; subject to individual dependency licenses).
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA lightweight MCP server that provides read-only access to SQLite databases, allowing users to execute SELECT queries, list tables, and describe table schemas.1MIT
- AlicenseNot gradedqualityDmaintenanceA production-ready MCP server that enables safe, read-only SQL SELECT queries against PostgreSQL databases with built-in security validation. It features connection pooling, automatic row limits, and structured logging to ensure secure and reliable database interactions.34ISC
- AlicenseNot gradedqualityFmaintenanceRead-only MCP server for SQL databases (SQL Server, Postgres, SQLite) with multi-server support and three-layer safety using AST validation and linting.MIT
- FlicenseNot gradedqualityCmaintenanceCustom MCP server connected to a read-only SQLite database, exposing a schema resource and a query tool for safe data retrieval.
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Streamable HTTP MCP server for Google Calendar and Sheets with OAuth login.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/dochaocn/sqlite-readonly-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server