io.github.Madia333/lintbase-mcp

编码与调试

by lintbase

为 AI 编码代理提供实时 Firestore schema 上下文,避免字段名 hallucination。

什么是 io.github.Madia333/lintbase-mcp

为 AI 编码代理提供实时 Firestore schema 上下文,避免字段名 hallucination。

README

LintBase

Ground Truth for AI Coding Agents. LintBase gives AI agents real-time knowledge of your database schema, security rules, and architecture so they stop hallucinating your codebase.

bash
npx lintbase export-context firestore --key ./service-account.json

npm version npm downloads License: MIT


Why LintBase?

Developers are constantly feeding context files to AI tools like Cursor, Windsurf, Copilot Workspace, and Claude Code. If your agent doesn't understand your real database schema, it writes code that fails in production.

LintBase 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.

  • 🤖 Stops AI Hallucinations — Generates exact schema, field presence rates, and types.
  • 📐 Catches Schema Drift — CI protection with lintbase check against schema snapshots.
  • 🔒 Security Context — Highlights missing rules or exposed PII before your AI writes queries.
  • 💸 Cost Awareness — Prevents AI from writing unbounded queries on 2M+ document collections.
  • 🍃 Universal NoSQL — Works effortlessly with Firestore and MongoDB.

🤖 AI Context Export (For Cursor, Claude, Windsurf)

The fastest way to give your AI agent perfect database knowledge.

bash
npx lintbase export-context firestore --key ./service-account.json

Output:

code
/lintbase-context/
├── database-schema.md
├── collections.md
├── security-rules.md
├── architecture.md
└── risk-report.md

Drop 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.


Quick Start

1. Get a service account key

Firebase Console → Project Settings → Service Accounts → Generate new private key

Save the JSON file. Never commit it to git.

2. CI Pipeline Protection (Schema Drift)

LintBase acts as "Version Control for your Schema". Run the snapshot command to create a baseline:

bash
npx lintbase snapshot firestore --key ./service-account.json

Commit .lintbase/schema.json to your repository. Then, add the check command to your CI/CD pipeline (GitHub Actions, GitLab CI):

bash
npx lintbase check firestore --key ./service-account.json --fail-on error

If a query or deployment accidentally deletes a critical field or changes a type (e.g., string to number), your CI build will fail instantly.

3. Run a general scan

bash
npx lintbase scan firestore --key ./service-account.json

You'll see a full report in your terminal:

code
 LintBase — Firestore Scan
 ─────────────────────────────────────────────
 Collections scanned:  12
 Documents sampled:    847
 Issues found:         23  (4 errors · 11 warnings · 8 infos)
 Risk score:           67 / 100  [HIGH]

 ERRORS
 ✖  users         no-auth-check        Documents readable without authentication
 ✖  orders        missing-index        Query on `status` + `createdAt` has no composite index
 ✖  debug_logs    large-collection     Collection has 2.4M docs — estimated $340/mo in reads

 WARNINGS
 ⚠  products      schema-drift         Field `price` found as both Number and String
 ⚠  sessions      ttl-missing          No expiry field — stale docs accumulate indefinitely
 ...

3. Save to your dashboard (optional)

Track your database health over time at lintbase.com:

bash
npx lintbase scan firestore \
  --key ./service-account.json \
  --save https://www.lintbase.com \
  --token <your-api-token>

Get your token at lintbase.com/dashboard/settings.


Supported Databases

  • Firestore: npx lintbase scan firestore --key ./sa.json
  • MongoDB: npx lintbase scan mongodb --uri mongodb+srv://user:pass@cluster.mongodb.net/test

🤖 AI Agent Integration (MCP)

Using Cursor, Claude Desktop, or Windsurf? Install lintbase-mcp to give your AI agent real-time Firestore schema context — so it stops hallucinating field names.

Add to .cursor/mcp.json:

json
{
  "mcpServers": {
    "lintbase": {
      "command": "npx",
      "args": ["-y", "lintbase-mcp"]
    }
  }
}

Now when you ask your AI "add a field to users", it will check your real schema first before writing a line of code.

Full setup guide & tools reference


What it catches

🔒 Security

RuleWhat it detects
no-auth-checkCollections readable/writable without auth
exposed-piiEmail, phone, SSN fields without encryption markers
world-readableDocuments with overly permissive security rules

💸 Cost

RuleWhat it detects
large-collectionCollections with 100k+ docs and high read cost
unbounded-queryQueries without limit() that scan entire collections
missing-indexFilter combinations that fall back to full collection scans
debug-collectionCollections that look like temporary data that was never cleaned up

📐 Schema Drift

RuleWhat it detects
type-inconsistencyField stored as different types across documents
missing-required-fieldField present in 90%+ of docs but absent in some
nullable-idReference fields that are sometimes null

⚡ Performance

RuleWhat it detects
deep-nestingDocument fields nested > 3 levels deep
large-documentDocuments approaching the 1MB Firestore limit
hot-documentSingle document updated by many users simultaneously
no-paginationCollections without a standard pagination field

Options

bash
lintbase <command> <database> [options]

Commands:
  scan <database>             Scan a database and print diagnostic report
  export-context <database>   Export schema to markdown/JSON for AI agents
  snapshot <database>         Generate local schema snapshot for CI comparison
  check <database>            Run in headless CI mode (fails on schema drift)

Options:
  --key <path>      Path to Firebase service account JSON 
  --uri <uri>       MongoDB connection URI
  --limit <n>       Max documents to sample per collection     [default: 100]
  --fail-on <lvl>   Fail pipeline if issues exceed severity (error, warning, info)
  --save <url>      Dashboard URL to save results
  --token <token>   API token for dashboard (from lintbase.com)
  --collections     Comma-separated list of collections to scan
  -h, --help        Show help

Dashboard

The CLI is free forever. The dashboard visualizes your scan results as an interactive schema map — your credentials never leave your machine.

What Pro gets you via --save:

  • ⬡ Schema Map — every collection as a draggable card, with real field names, types, presence rates, and issue badges
  • ◎ Health Radar — per-collection spider chart across Schema, Security, Performance, and Cost axes
  • ⊕ Priority Quadrant — 2×2 bubble chart of Impact vs. Ease of Fix — tells you what to fix first
  • ≋ Drift Timeline — stored history across scans so you can replay your schema architecture over time.

CLI Local Tooling: 100% Free · Pro: $39/month — unlimited history, dashboards, and shared team workflow.


Security

  • Your service account key never leaves your machine — it is only read locally
  • Document sampling is hard-capped at --limit (default 100) to prevent accidental read costs
  • The --save flag only sends the scan summary and issue list — never raw document data

License

MIT © Mamadou Dia

常见问题

io.github.Madia333/lintbase-mcp 是什么?

为 AI 编码代理提供实时 Firestore schema 上下文,避免字段名 hallucination。

相关 Skills

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描114.1k

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描114.1k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描114.1k

相关 MCP Server

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
83.4k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
52.2k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
46.3k

评论