{
  "markdown": "# LintBase\n\n> **Ground Truth for AI Coding Agents.**\n> LintBase gives AI agents real-time knowledge of your database schema, security rules, and architecture so they stop hallucinating your codebase.\n\n```bash\nnpx lintbase export-context firestore --key ./service-account.json\n```\n\n[![npm version](https://img.shields.io/npm/v/lintbase.svg)](https://www.npmjs.com/package/lintbase)\n[![npm downloads](https://img.shields.io/npm/dm/lintbase.svg)](https://www.npmjs.com/package/lintbase)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n---\n\n## Why LintBase?\n\nDevelopers are constantly feeding context files to AI tools like Cursor, Windsurf, Copilot Workspace, and Claude Code.\nIf your agent doesn't understand your *real* database schema, it writes code that fails in production.\n\nLintBase acts as the bridge. It connects directly to your database, reads the **ground truth** of your live documents, and generates structured context optimized for AI.\n\n- 🤖 **Stops AI Hallucinations** — Generates exact schema, field presence rates, and types.\n- 📐 **Catches Schema Drift** — CI protection with `lintbase check` against schema snapshots.\n- 🔒 **Security Context** — Highlights missing rules or exposed PII before your AI writes queries.\n- 💸 **Cost Awareness** — Prevents AI from writing unbounded queries on 2M+ document collections.\n- 🍃 **Universal NoSQL** — Works effortlessly with Firestore and MongoDB.\n\n### Why not just let the agent read the code?\n\nBecause in document databases, the code lies. The real schema is whatever your live documents actually contain, and that drifts away from the code with every half-finished migration, every renamed field, and every previous AI session that wrote in a hurry. An agent inferring the schema from TypeScript interfaces writes plausible queries against a database that no longer exists. The failure is silent: empty results, undefined values, a new field variant living alongside the old one. LintBase reads the documents, not the code.\n\n### Limitations (honest ones)\n\n- Firestore and MongoDB only. Postgres is the obvious gap and it is next.\n- Large collections are sampled, not fully scanned. Presence rates are estimates on multi-million-document collections.\n- The MCP server is newer than the CLI. Expect rough edges there first.\n\n---\n\n## 🤖 AI Context Export (For Cursor, Claude, Windsurf)\n\nThe fastest way to give your AI agent perfect database knowledge.\n\n```bash\nnpx lintbase export-context firestore --key ./service-account.json\n```\n\n**Output:**\n```\n/lintbase-context/\n├── database-schema.md\n├── collections.md\n├── security-rules.md\n├── architecture.md\n└── risk-report.md\n```\n\nDrop the `lintbase-context` folder into your AI's context window, or mention it in `.cursorrules`. Your agent will now write perfect, drift-free database queries.\n\n---\n\n## Quick Start\n\n### 1. Get a service account key\n\nFirebase Console → Project Settings → Service Accounts → **Generate new private key**\n\nSave the JSON file. **Never commit it to git.**\n\n### 2. CI Pipeline Protection (Schema Drift)\n\nLintBase acts as \"Version Control for your Schema\". Run the snapshot command to create a baseline:\n\n```bash\nnpx lintbase snapshot firestore --key ./service-account.json\n```\nCommit `.lintbase/schema.json` to your repository. Then, add the check command to your CI/CD pipeline (GitHub Actions, GitLab CI):\n\n```bash\nnpx lintbase check firestore --key ./service-account.json --fail-on error\n```\nIf a query or deployment accidentally deletes a critical field or changes a type (e.g., `string` to `number`), **your CI build will fail instantly.**\n\n### 3. Run a general scan\n\n```bash\nnpx lintbase scan firestore --key ./service-account.json\n```\n\nYou'll see a full report in your terminal:\n\n```\n LintBase — Firestore Scan\n ─────────────────────────────────────────────\n Collections scanned:  12\n Documents sampled:    847\n Issues found:         23  (4 errors · 11 warnings · 8 infos)\n Risk score:           67 / 100  [HIGH]\n\n ERRORS\n ✖  users         no-auth-check        Documents readable without authentication\n ✖  orders        missing-index        Query on `status` + `createdAt` has no composite index\n ✖  debug_logs    large-collection     Collection has 2.4M docs — estimated $340/mo in reads\n\n WARNINGS\n ⚠  products      schema-drift         Field `price` found as both Number and String\n ⚠  sessions      ttl-missing          No expiry field — stale docs accumulate indefinitely\n ...\n```\n\n### 3. Save to your dashboard (optional)\n\nTrack your database health over time at [lintbase.com](https://lintbase.com):\n\n```bash\nnpx lintbase scan firestore \\\n  --key ./service-account.json \\\n  --save https://www.lintbase.com \\\n  --token <your-api-token>\n```\n\nGet your token at **[lintbase.com/dashboard/settings](https://www.lintbase.com/dashboard/settings)**.\n\n---\n\n## Supported Databases\n- **Firestore**: `npx lintbase scan firestore --key ./sa.json`\n- **MongoDB**: `npx lintbase scan mongodb --uri mongodb+srv://user:pass@cluster.mongodb.net/test`\n\n---\n\n## 🤖 AI Agent Integration (MCP)\n\nUsing **Cursor, Claude Desktop, or Windsurf**? Install [`lintbase-mcp`](https://www.npmjs.com/package/lintbase-mcp) to give your AI agent real-time Firestore schema context — so it stops hallucinating field names.\n\nAdd to `.cursor/mcp.json`:\n```json\n{\n  \"mcpServers\": {\n    \"lintbase\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"lintbase-mcp\"]\n    }\n  }\n}\n```\n\nNow when you ask your AI *\"add a field to users\"*, it will check your **real** schema first before writing a line of code.\n\n→ **[Full setup guide & tools reference](https://www.npmjs.com/package/lintbase-mcp)**\n\n---\n\n## What it catches\n\n### 🔒 Security\n| Rule | What it detects |\n|---|---|\n| `no-auth-check` | Collections readable/writable without auth |\n| `exposed-pii` | Email, phone, SSN fields without encryption markers |\n| `world-readable` | Documents with overly permissive security rules |\n\n### 💸 Cost\n| Rule | What it detects |\n|---|---|\n| `large-collection` | Collections with 100k+ docs and high read cost |\n| `unbounded-query` | Queries without `limit()` that scan entire collections |\n| `missing-index` | Filter combinations that fall back to full collection scans |\n| `debug-collection` | Collections that look like temporary data that was never cleaned up |\n\n### 📐 Schema Drift\n| Rule | What it detects |\n|---|---|\n| `type-inconsistency` | Field stored as different types across documents |\n| `missing-required-field` | Field present in 90%+ of docs but absent in some |\n| `nullable-id` | Reference fields that are sometimes null |\n\n### ⚡ Performance\n| Rule | What it detects |\n|---|---|\n| `deep-nesting` | Document fields nested > 3 levels deep |\n| `large-document` | Documents approaching the 1MB Firestore limit |\n| `hot-document` | Single document updated by many users simultaneously |\n| `no-pagination` | Collections without a standard pagination field |\n\n---\n\n## Options\n\n```bash\nlintbase <command> <database> [options]\n\nCommands:\n  scan <database>             Scan a database and print diagnostic report\n  export-context <database>   Export schema to markdown/JSON for AI agents\n  snapshot <database>         Generate local schema snapshot for CI comparison\n  check <database>            Run in headless CI mode (fails on schema drift)\n\nOptions:\n  --key <path>      Path to Firebase service account JSON \n  --uri <uri>       MongoDB connection URI\n  --limit <n>       Max documents to sample per collection     [default: 100]\n  --max-depth <n>   Firestore: tiers to recurse into subcollections\n                    (1 = top-level only)                       [default: 2]\n  --fail-on <lvl>   Fail pipeline if issues exceed severity (error, warning, info)\n  --save <url>      Dashboard URL to save results\n  --token <token>   API token for dashboard (from lintbase.com)\n  --collections     Comma-separated list of collections to scan\n  -h, --help        Show help\n```\n\n---\n\n## Dashboard\n\nThe CLI is free forever. The [dashboard](https://lintbase.com) visualizes your scan results as an **interactive schema map** — your credentials never leave your machine.\n\n**What Pro gets you via `--save`:**\n\n- **⬡ Schema Map** — every collection as a draggable card, with real field names, types, presence rates, and issue badges\n- **◎ Health Radar** — per-collection spider chart across Schema, Security, Performance, and Cost axes\n- **⊕ Priority Quadrant** — 2×2 bubble chart of Impact vs. Ease of Fix — tells you what to fix first\n- **≋ Drift Timeline** — stored history across scans so you can replay your schema architecture over time.\n\n**CLI Local Tooling:** 100% Free · **Pro:** $39/month — unlimited history, dashboards, and shared team workflow.\n\n---\n\n## Security\n\n- Your service account key **never leaves your machine** — it is only read locally\n- Document sampling is hard-capped at `--limit` (default 100) to prevent accidental read costs\n- The `--save` flag only sends the scan summary and issue list — never raw document data\n\n---\n\n## License\n\nMIT © [Mamadou Dia](https://github.com/lintbase)\n",
  "bytes": 9064,
  "sha": "9e33f7522d7168a2461d60702dfa628beded50bb107c4711bd534d525b4c099c",
  "repo_slug": "lintbase/lintbase",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_madia333_lintbase_mcp_7969f82f/readme"
}