Self-Documenting Zero-Knowledge MCP Server
自己文書化ゼロ知識MCPサーバー
Model Context Protocol (MCP) サーバー。文書化されていないレガシーデータベースを自律的にスキャンし、すべてのテーブルに対してCRUDツールを生成し、テーブルの結合方法を説明するプロンプトを作成し、LLMを事前検証済みのSQLテンプレートのみに制限することでゼロ知識セキュリティを適用します。
アーキテクチャ

Related MCP server: sqlite-mcp
MCPを選ぶ理由 — そして実際のエンジニアリングとは何か
MCP(Model Context Protocol)は、ここでのトランスポートおよびインターフェース層です。LLMがツールを呼び出し、パラメータを渡し、結果を受け取る方法を処理します。これは意図的な選択であり、成果そのものではありません。
このプロジェクトの実際のエンジニアリングは、その下に位置するスキーマ内省およびセキュリティパイプラインです。
Database → PRAGMA Introspection → Schema Registry → Template Engine → Security Validator → MCP Tools各段階は次の段階についてゼロ知識です。イントロスペクタはMCPについて何も知りません。テンプレートエンジンはセキュリティについて何も知りません。CRUDジェネレータはSQLについて何も知りません — テンプレートIDを扱うだけです。この厳格な分離により、セキュリティ層のコードを一行も変更することなく、MCPトランスポートをREST APIやgRPCサービスに置き換えることができます。
MCPは、直接のOpenAI関数呼び出しではなく、MCPがトランスポート非依存(ローカル使用にはstdio、ネットワークにはSSE)であり、生のツール呼び出しを超えたリソースとプロンプトをサポートし、LLMツールエコシステム全体で採用されているオープン標準であるため、選択されました。しかし、セキュリティ層 — 事前検証済みテンプレート、多層防御サニタイズ、不変テンプレートレジストリ — は、前面にどのプロトコルが置かれても同じように機能します。
機能
自律的スキーマ発見 — 事前知識ゼロでPRAGMA内省を使用して任意のSQLiteデータベースをスキャン
動的CRUDツール — 発見されたすべてのテーブルに対してCreate、Read、Update、Delete、List、Searchツールを自動生成
結合プロンプト — 外部キー関係を分析し、テーブルの結合方法を説明するプロンプトを生成
ゼロ知識セキュリティ — すべてのSQL実行は事前検証済みのパラメータ化テンプレートに制限
監査ログ — すべてのデータベース操作はタイムスタンプ、テンプレートID、パラメータとともに記録
スキーマリソース — MCPリソースが発見されたスキーマをLLM参照用に公開
クイックスタート
前提条件
Python 3.10以上
pip
インストール
# 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]"デモデータベースのシード
# Create a sample e-commerce legacy database
python server.py --seedこれにより、legacy_store.db が6つのテーブル(categories、customers、orders、order_items、products、reviews)で作成されます — 外部キー関係とサンプルデータ付きです。
サーバーの実行
# 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.dbClaude Desktopへの接続
Claude Desktopの設定(claude_desktop_config.json)に追加します:
{
"mcpServers": {
"zk-database": {
"command": "python",
"args": ["C:/path/to/MCP SERVER/server.py", "--db", "C:/path/to/legacy_store.db"]
}
}
}MCP Inspectorでのテスト
mcp dev server.py生成されるもの
サーバーが起動すると、データベースを内省し、以下を自動生成します:
ツール(テーブルごと)
ツール | 説明 |
| 自動生成されたパラメータドキュメント付きで新しい行を挿入 |
| 主キーで行を読み取り |
| 主キーで行を更新 |
| 主キーで行を削除 |
| limit/offset付きのページネーション一覧 |
| テキスト列全体の全文検索 |
プロンプト
プロンプト | 説明 |
| 2つの関連テーブルの結合方法を説明 |
| 完全なデータベース探索ガイド |
| 自動発見された完全なスキーマ表示 |
リソース
リソースURI | 説明 |
| 完全なスキーマ概要 |
| テーブルごとのスキーマ詳細 |
| 最近のクエリ監査ログ |
| セキュリティ概要レポート |
| 登録済みの全SQLテンプレート |
セキュリティモデル
ゼロ知識セキュリティモデルにより、LLMが生のSQLを構築したり参照したりすることは決してありません:
テンプレートのみの実行 — 事前生成されたテンプレートレジストリのSQLのみが実行可能。生のSQLエンドポイントは存在しません。
パラメータ検証 — すべてのパラメータは実行前に内省されたスキーマに対して型チェックされます。
入力サニタイズ — 多層防御ブロックリストがパラメータ値のSQLインジェクションパターンを捕捉します(パラメータ化クエリがすでにインジェクションを防いでいるにもかかわらず)。
監査証跡 — すべての操作はタイムスタンプ、テンプレートID、パラメータ、成功/失敗ステータスとともに記録されます。
スキーマ操作なし — 既存テーブルに対するSELECT、INSERT、UPDATE、DELETEのみ。DDL操作は一切不可能です。
完全なセキュリティモデル(既知のスコープ境界(トランスポート層認証)を含む)については、SECURITY.mdを参照してください。
SQLiteを選ぶ理由 — そしてスケール時の変更点
SQLiteはこのデモのために意図的に選択されました。理由は3つあります:
ゼロ設定 — 別個のサーバー、認証情報、ネットワーク設定が不要。DBは単一ファイル
ネイティブPRAGMA内省 —
PRAGMA table_info()、PRAGMA foreign_key_list()はゼロ知識発見が依存するまさにそのツール標準ライブラリのみ — ORM依存なし。
import sqlite3はPythonに同梱
本番環境での変更点:
関心事 | 現在(SQLite) | 本番パス |
並行性 | 単一ライター | PostgreSQL + |
内省 | PRAGMAステートメント |
|
監査ログ | インメモリリスト | 追記専用DBテーブルまたは構造化JSONログ |
DBパス設定 | CLIフラグ |
|
マイグレーション | 再シード |
|
アーキテクチャは設計上データベース非依存です — SQLite固有のコードを含むのは src/introspector.py のみです(約80行)。バッキングデータベースの交換はその単一ファイルの置き換えを意味します。セキュリティ層、CRUDジェネレータ、MCP登録は変更されません。
すべてのアーキテクチャ決定記録については、docs/DECISIONS.mdを参照してください。
テストの実行
# 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 -vプロジェクト構造
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 diagramライセンス
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