Read-only Analytics MCP Server
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., "@Read-only Analytics MCP ServerRun a read-only query to show total signups per week for the last 90 days."
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.
Read-only Analytics MCP Server
A clean-room core for exposing warehouse queries as a guarded Model Context Protocol tool. It validates read-only SQL, injects a conservative row limit, requires JSON responses from the upstream API, and returns audit metadata without leaking authentication material.
This repository contains no production account locator, warehouse name, access token, table name, schema, query history, or employer configuration.
What it demonstrates
MCP tool design for analytics agents
Read-only SQL validation
SQL API request construction
Required content negotiation headers
Row and statement limits
Secret-safe error handling
Auditable query fingerprints
Related MCP server: FastAPI Database MCP Server
Safety model
Only one
SELECT,SHOW, orDESCRIBEstatement is accepted.Mutating keywords, comments, and multiple statements are rejected.
SELECTqueries receive a maximum row limit when one is not already present.Tokens are accepted by the transport boundary but never returned or logged.
Run the tests
python -m unittest discover -s tests -vRun the optional MCP adapter
python -m pip install -e '.[mcp]'
export ANALYTICS_SQL_API_URL='http://localhost:9000/query'
export ANALYTICS_SQL_API_TOKEN='development-placeholder'
python -m readonly_analytics_mcp.mcp_serverThe example values are local placeholders. Never commit a real token or private endpoint.
Production extensions
Replace the lightweight keyword guard with an AST-based SQL parser.
Add per-tool table allowlists and policy-service authorization.
Add a streamable-HTTP deployment option alongside the included stdio adapter.
Add pagination, query cancellation, and structured observability.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Query OneLens cloud-cost data in natural language: breakdowns, trends, cost centers. Read-only.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceProvides a read-only PostgreSQL SQL surface for LLM agents via MCP, with defense-in-depth security layers for safe database queries.3MIT
- FlicenseNot gradedqualityFmaintenanceProvides read-only SQL query access to Postgres and DuckDB databases via MCP tools, with extensive security hardening for public endpoints.1-
- FlicenseNot gradedqualityCmaintenanceEnables running read-only SQL queries and exploring DuckDB databases through MCP tools like listing tables, describing schemas, and fetching paginated data.-

MCP DB Gatewayofficial
AlicenseNot gradedqualityBmaintenanceProvides governed, read-only PostgreSQL access for AI agents via MCP. Enforces schema/table allowlists, query limits, and audit events.MIT