Self-Documenting Zero-Knowledge MCP Server
Provides dynamic CRUD tools, join prompts, and schema resources for SQLite databases, enabling reading, writing, and exploring data in legacy SQLite databases.
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., "@Self-Documenting Zero-Knowledge MCP Servershow me the schema and audit log for the legacy_store 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.
Self-Documenting Zero-Knowledge MCP Server
A Model Context Protocol (MCP) server that autonomously scans an undocumented legacy database, generates CRUD tools for every table, creates prompts explaining how to join tables, and enforces Zero-Knowledge security by restricting the LLM to pre-validated SQL templates only.
Architecture

Related MCP server: sqlite-mcp
Why MCP — and What the Real Engineering Is
MCP (Model Context Protocol) is the transport and interface layer here — it handles how the LLM calls tools, passes parameters, and receives results. It is a deliberate choice, not the achievement.
The actual engineering in this project is the schema-introspection and security pipeline that sits underneath:
Database → PRAGMA Introspection → Schema Registry → Template Engine → Security Validator → MCP ToolsEach stage has zero knowledge of the next. The introspector knows nothing about MCP. The template engine knows nothing about security. The CRUD generator knows nothing about SQL — it only works with template IDs. This strict separation means you could swap the MCP transport for a REST API or a gRPC service without touching a single line of the security layer.
MCP was chosen over direct OpenAI function-calling because MCP is transport-agnostic (stdio for local use, SSE for network), supports resources and prompts beyond raw tool calls, and is the open standard being adopted across the LLM tooling ecosystem. But the security layer — pre-validated templates, defense-in-depth sanitization, immutable template registry — works identically regardless of what protocol sits in front of it.
Features
Autonomous Schema Discovery — Scans any SQLite database using PRAGMA introspection with zero prior knowledge
Dynamic CRUD Tools — Auto-generates Create, Read, Update, Delete, List, and Search tools for every discovered table
Join Prompts — Analyzes foreign key relationships and generates prompts explaining how to join tables
Zero-Knowledge Security — All SQL execution is restricted to pre-validated parameterized templates
Audit Logging — Every database operation is logged with timestamp, template ID, and parameters
Schema Resources — MCP resources expose the discovered schema for LLM reference
Quick Start
Prerequisites
Python 3.10+
pip
Installation
# Clone the repository
git clone https://github.com/shubhtiwari65/Self-Documenting-Zero-Knowledge-MCP-Server.git
cd "MCP SERVER"
# Install dependencies
pip install -r requirements.txt
# Or install in editable mode with dev tools (recommended)
pip install -e ".[dev]"Seed the Demo Database
# Create a sample e-commerce legacy database
python server.py --seedThis creates legacy_store.db with 6 tables: categories, customers, orders, order_items, products, reviews — complete with foreign key relationships and sample data.
Run the Server
# Run with stdio transport (default — for Claude Desktop)
python server.py
# Run with SSE transport (for network access)
python server.py --transport sse --port 8080
# Use a custom database
python server.py --db /path/to/your/database.dbConnect with Claude Desktop
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"zk-database": {
"command": "python",
"args": ["C:/path/to/MCP SERVER/server.py", "--db", "C:/path/to/legacy_store.db"]
}
}
}Test with MCP Inspector
mcp dev server.pyWhat Gets Generated
When the server starts, it introspects the database and auto-generates:
Tools (per table)
Tool | Description |
| Insert a new row with auto-generated parameter docs |
| Read a row by primary key |
| Update a row by primary key |
| Delete a row by primary key |
| Paginated listing with limit/offset |
| Full-text search across text columns |
Prompts
Prompt | Description |
| Explains how to join two related tables |
| Complete database exploration guide |
| Full auto-discovered schema display |
Resources
Resource URI | Description |
| Full schema overview |
| Per-table schema details |
| Recent query audit log |
| Security summary report |
| All registered SQL templates |
Security Model
The Zero-Knowledge security model ensures the LLM never constructs or sees raw SQL:
Template-Only Execution — Only SQL from the pre-generated template registry can be executed. No raw SQL endpoint exists.
Parameter Validation — All parameters are type-checked against the introspected schema before execution.
Input Sanitization — Defense-in-depth blocklist catches SQL injection patterns in parameter values (even though parameterized queries already prevent injection).
Audit Trail — Every operation is logged with timestamp, template ID, parameters, success/failure status.
No Schema Manipulation — Only SELECT, INSERT, UPDATE, DELETE on existing tables. No DDL operations are possible.
See SECURITY.md for the full security model, including known scope boundaries (transport-layer auth).
Why SQLite — and What Changes at Scale
SQLite was chosen deliberately for this demo for three reasons:
Zero configuration — no separate server, credentials, or network config; the DB is a single file
Native PRAGMA introspection —
PRAGMA table_info(),PRAGMA foreign_key_list()are the exact tools the zero-knowledge discovery depends onstdlib only — no ORM dependency;
import sqlite3ships with Python
What would change in production:
Concern | Current (SQLite) | Production path |
Concurrency | Single-writer | PostgreSQL + |
Introspection | PRAGMA statements |
|
Audit log | In-memory list | Append-only DB table or structured JSON logs |
DB path config | CLI flag |
|
Migrations | Re-seed |
|
The architecture is database-agnostic by design — only src/introspector.py contains SQLite-specific code (~80 lines). Swapping the backing database means replacing that single file; the security layer, CRUD generator, and MCP registration are untouched.
See docs/DECISIONS.md for all architectural decision records.
Running Tests
# Run all tests
python -m pytest
# Run with coverage report
python -m pytest --cov=src --cov-report=term-missing
# Run specific test files
python -m pytest tests/test_security.py -v
python -m pytest tests/test_introspector.py -vProject Structure
MCP SERVER/
├── .github/workflows/ci.yml # CI pipeline (pytest + ruff + coverage)
├── .gitignore # Git ignore rules
├── .env.example # Environment variable template
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # Dev setup and contribution guide
├── Makefile # Developer convenience commands
├── README.md # Project documentation
├── SECURITY.md # Security model + transport scope boundary
├── server.py # Main MCP server entry point
├── requirements.txt # Python dependencies
├── pyproject.toml # Project metadata, ruff + pytest + coverage config
├── src/
│ ├── __init__.py
│ ├── introspector.py # PRAGMA-based schema discovery
│ ├── schema_registry.py # In-memory schema registry
│ ├── sql_templates.py # Pre-validated SQL template engine
│ ├── security.py # Zero-Knowledge security validator
│ ├── crud_generator.py # Dynamic MCP tool generator
│ └── join_analyzer.py # FK analysis & prompt generator
├── sample_data/
│ └── seed_legacy_db.py # Demo legacy database seeder
├── tests/
│ ├── conftest.py # Shared pytest fixtures
│ ├── demo_client.py # Standalone verification demo
│ ├── test_introspector.py # Schema discovery tests
│ ├── test_crud.py # CRUD operation tests
│ ├── test_security.py # Security validation tests
│ └── test_joins.py # Join analysis tests
└── docs/
├── APPROACH.md # Full technical approach write-up
├── DECISIONS.md # Architectural Decision Records (ADRs)
└── MCP_architecture.png # Architecture diagramLicense
MIT
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
- FlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI assistants to query and interact with SQLite databases through natural language. It includes built-in security guardrails such as PII redaction, SQL injection blocking, and query rate limiting.
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enables AI agents to interact with SQLite databases by querying schemas, executing SQL, and inspecting table metadata. It supports safe database access through configurable read-only modes, query timeouts, and dry-run execution plans.MIT
- AlicenseAqualityDmaintenanceA zero-config MCP server that enables AI to access, analyze, and manage local SQLite databases with secure read-only querying and automatic schema discovery.8MIT
- AlicenseCqualityAmaintenanceAn MCP server for interacting with SQLite databases, enabling SQL query execution, schema inspection, and CRUD operations.7MIT
Related MCP Connectors
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
GibsonAI MCP server: manage your databases with natural language
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
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/lavishshakya/Self-Documenting-Zero-Knowledge-MCP-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server