ContextGuard SQL Agent MCP Server
The project mentions it does not connect to MySQL or production databases, but references MySQL as a business-like value context; not an actual integration target.
Provides read-only SQL analysis against a local synthetic SQLite database, with safeguards such as query_only mode, SQLite authorizer, and restrictions on writes, DDL, and SELECT *.
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., "@ContextGuard SQL Agent MCP Serverwhy did sales decline this period? analyze using DataHub schema"
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.
ContextGuard SQL Agent
A metadata-guided, read-only SQL analysis MVP for DataHub.
Demo video (2:44): https://youtu.be/btmJJWMFe4g
The video shows a real local self-hosted DataHub MCP run with a Reader-only identity, seven read-only tools, a deterministic planner, local read-only synthetic SQLite, and zero mutation or proposal calls. All business data shown is synthetic.
ContextGuard answers a narrow analytical question without turning an agent into a database writer. It uses DataHub metadata through the official MCP server to find a synthetic asset, inspect schema and lineage, generate bounded SQL, and run that SQL only against a local synthetic SQLite database.
The problem
Analytical agents need more than table names. They need trustworthy schema, ownership, tags, lineage, and safe query boundaries. Without them, an agent can select an unsuitable asset, expose sensitive fields, scan too broadly, or issue write operations.
Related MCP server: sql-explorer-mcp
Architecture
flowchart LR
DH[DataHub] --> MCP[Official MCP Server]
MCP --> AD[Read-only Adapter]
AD --> PL[Deterministic Planner]
PL --> SL[SQL Safety Layer]
SL --> DB[Local Synthetic SQLite]
DB --> EA[Evidence-backed Analysis]
EA --> RA[Redacted Audit]The planner is deterministic. This MVP does not claim to use an external LLM.
What is real, and what is synthetic
The project was validated locally against a self-hosted DataHub instance and
the official mcp-server-datahub. The DataHub reads, MCP protocol, client
adapter, SQLite safeguards, and end-to-end execution are real.
All business-like values, names, markets, emails, assets, and results in this repository are fictional synthetic demo data. The project does not connect to company MySQL, production databases, or external network databases.
DataHub MCP integration
The client accepts only these Reader-safe tools:
searchget_entitieslist_schema_fieldsget_lineageget_lineage_paths_betweenwhen exposed by the serverget_dataset_queriesget_me
Mutation, proposal, administrator, and token-management tools are hard-blocked in the client before any server call. The local MCP process is additionally configured with mutations disabled.
SQLite read-only safeguards
Opens the local fixture with
mode=ro.Enables
PRAGMA query_onlyand an SQLite authorizer.Rejects writes, DDL,
ATTACH,DETACH, extension loading, writable PRAGMA, multiple statements,SELECT *, andalias.*.Requires explicit allowed fields, a numeric
LIMIT, and date bounds for larger synthetic assets.
Installation
Python 3.11+ is recommended.
python -m venv .venv
# Windows: .venv\Scripts\activate
# Linux/macOS: source .venv/bin/activate
python -m pip install -r requirements.txtLocal offline mode
pytest tests -q
python -m app.cli offline-demoOffline mode uses a fixture strictly for local testing. It is not presented as a real DataHub integration.
Real DataHub mode
Real mode requires a locally running self-hosted DataHub and an official MCP executable. Put any Reader credential in a private, user-owned environment file outside this repository. Never place a token in a command line, Git, screenshots, or logs.
DATAHUB_GMS_URL=http://localhost:8080
DATAHUB_GMS_TOKEN=<reader-token>
CONTEXTGUARD_SQLITE_PATH=<path-to-synthetic-db>Then provide the MCP command through the local private environment and run:
python -m app.cli real --question "Why did sales decline this period?" \
--period-start 2026-07-13 --period-end 2026-07-20 --limit 20Real mode fails closed if the MCP command is unavailable; it never falls back to an offline fixture.
Example result
For the synthetic weekly sales scenario, building sets explain most of the fictional decline: CNY 900 of the CNY 950 period-over-period decrease. See the example analysis.
Demo and tests
The project has 29 offline tests covering read-only policy enforcement, no-fallback behavior, token/error redaction, subprocess cleanup, and SQLite database-layer controls. The real MCP MVP was validated locally against a self-hosted DataHub instance; raw runtime logs are intentionally not public.
Known limitations
Local MVP only; not a production authorization design.
Deterministic planner for one synthetic sales-decline scenario.
No public deployment or UI is included.
get_dataset_queriesmay honestly return an empty set because the demo does not import query history.
No-mutation guarantee
This public MVP does not support metadata write-back. It does not call DataHub mutation or proposal tools.
Hackathon submission status
The local technical MVP has completed its real read-only acceptance. This repository is a publication candidate only: it has no remote configured, has not been pushed, and has not been submitted to Devpost.
License
Licensed under Apache License 2.0.
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
- AlicenseAqualityAmaintenanceSecure MCP server for safe, read-only DB access by AI agents, with SQL guardrails, table allowlists, PII masking, and audit logsLast updated6497MIT
- Alicense-qualityFmaintenanceRead-only MCP server for SQL databases (SQL Server, Postgres, SQLite) with multi-server support and three-layer safety using AST validation and linting.Last updatedMIT
- AlicenseAqualityBmaintenanceSafe, read-only SQL analytics for AI agents over MCP, enabling exploration, profiling, and querying of data without mutation risk.Last updated5MIT
- Flicense-qualityCmaintenanceA governed analytics MCP server that provides LLM agents with safe, read-only access to data warehouses through a layered safety pipeline including AST validation, column/row governance, PII masking, cost limits, and audit.Last updated
Related MCP Connectors
The grounded data layer for any LLM: governed SQL, metrics, lineage and catalog over your data.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
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/ivan0912/contextguard-datahub-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server