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 for daily active users last week"
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: grane
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
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Deterministic safety, correctness & cost gate that vets Postgres SQL before your AI agent runs it.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides secure read-only SQL access to PostgreSQL and ClickHouse databases with built-in safety features like read-only enforcement, timeouts, and managed result files.MIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible agents to run governed, read-only analytics queries against Postgres using predefined metrics and dimensions, with safety checks and provenance on every result.7 npmApache 2.0
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to perform read-only data hub queries including table listing, schema details, distinct values, and row-limited SELECT/aggregation, while rejecting free SQL.-
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to query a Postgres data warehouse through a governed, read-only SQL interface with policy enforcement, row limits, schema-level PII isolation, and a full audit trail.1-