lintbase-mcp 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -2
- package/skill/SKILL.md +173 -0
- package/skill/install-skill.js +28 -0
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lintbase-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"mcpName": "io.github.Madia333/lintbase-mcp",
|
|
5
5
|
"description": "MCP server for LintBase — give AI coding agents real-time database schema context.",
|
|
6
6
|
"main": "dist/server.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"lintbase-mcp": "dist/server.js"
|
|
8
|
+
"lintbase-mcp": "dist/server.js",
|
|
9
|
+
"lintbase-mcp-install-skill": "skill/install-skill.js"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
12
|
"dist/**/*",
|
|
13
|
+
"skill/**/*",
|
|
12
14
|
"README.md"
|
|
13
15
|
],
|
|
14
16
|
"engines": {
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lintbase
|
|
3
|
+
description: >
|
|
4
|
+
Use this skill whenever you are about to read from, write to, query, or modify
|
|
5
|
+
a Firestore database. LintBase gives you ground-truth schema context (real field
|
|
6
|
+
names, types, presence rates) directly from production documents so you never
|
|
7
|
+
hallucinate field names or create schema drift.
|
|
8
|
+
|
|
9
|
+
Trigger automatically when the user asks you to:
|
|
10
|
+
- Add, update, or delete fields in a Firestore collection
|
|
11
|
+
- Write Firestore queries or security rules
|
|
12
|
+
- Refactor database-related code
|
|
13
|
+
- Debug data inconsistencies or runtime errors tied to Firestore
|
|
14
|
+
- Audit the database before a deploy or major change
|
|
15
|
+
license: MIT
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# LintBase — Firestore Schema Context for AI Agents
|
|
19
|
+
|
|
20
|
+
LintBase gives you real-time, ground-truth Firestore schema context so you write
|
|
21
|
+
code that matches what is actually in production — not what you assume is there.
|
|
22
|
+
|
|
23
|
+
## Core Rule
|
|
24
|
+
|
|
25
|
+
> **NEVER write Firestore code (reads, writes, queries, rules) without first
|
|
26
|
+
> calling `lintbase_get_schema` for the relevant collection.**
|
|
27
|
+
|
|
28
|
+
This is not optional. Firestore is schemaless — documents in the same collection
|
|
29
|
+
can have completely different fields. If you do not check first, you WILL
|
|
30
|
+
hallucinate field names and cause silent bugs or schema drift.
|
|
31
|
+
|
|
32
|
+
## When to Use Each Tool
|
|
33
|
+
|
|
34
|
+
### `lintbase_get_schema` — Use this first, always
|
|
35
|
+
Call this before writing ANY database-related code.
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
lintbase_get_schema({
|
|
39
|
+
keyPath: "./service-account.json", // ask user if not specified
|
|
40
|
+
collection: "users", // omit to get ALL collections
|
|
41
|
+
sampleSize: 50 // default is fine
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Read the output carefully:**
|
|
46
|
+
- ✅ Fields with `100%` presence and a single type are stable — safe to use
|
|
47
|
+
- ⚠️ Fields with `<80%` presence should be treated as **optional** — always use null checks
|
|
48
|
+
- ⚠️ Fields with multiple types have **type drift** — use defensive type guards
|
|
49
|
+
- Fields not in the output **do not exist** — do not invent them
|
|
50
|
+
|
|
51
|
+
### `lintbase_get_issues` — Use before any major change
|
|
52
|
+
Call this before a refactor, deploy, or when the user reports unexpected behavior.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
lintbase_get_issues({
|
|
56
|
+
keyPath: "./service-account.json",
|
|
57
|
+
severity: "error", // start with errors only
|
|
58
|
+
collection: "users" // scope to relevant collection
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Filter options:
|
|
63
|
+
- `severity`: `"error"` | `"warning"` | `"info"`
|
|
64
|
+
- `collection`: any collection name
|
|
65
|
+
- `rule`: `"schema/"` | `"security/"` | `"perf/"` | `"cost/"`
|
|
66
|
+
|
|
67
|
+
### `lintbase_scan` — Use for full audits
|
|
68
|
+
Call this when the user wants a complete database health check.
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
lintbase_scan({
|
|
72
|
+
keyPath: "./service-account.json",
|
|
73
|
+
sampleSize: 100
|
|
74
|
+
})
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Returns a risk score (0-100) and all issues across schema, security,
|
|
78
|
+
performance, and cost analyzers.
|
|
79
|
+
|
|
80
|
+
## Standard Workflow
|
|
81
|
+
|
|
82
|
+
Follow this sequence every time you touch Firestore code:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
1. Call lintbase_get_schema for the target collection(s)
|
|
86
|
+
2. Read the field list — note presence rates and types
|
|
87
|
+
3. Write code using ONLY the fields that appear in the output
|
|
88
|
+
4. Mark optional fields (<80% presence) with null checks
|
|
89
|
+
5. If making structural changes, run lintbase_get_issues first
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Reading Schema Output
|
|
93
|
+
|
|
94
|
+
Example output:
|
|
95
|
+
```
|
|
96
|
+
## users (47 docs sampled)
|
|
97
|
+
| Field | Type | Presence | Stable |
|
|
98
|
+
|-------------|-----------|----------|--------|
|
|
99
|
+
| uid | string | 100% | ✅ |
|
|
100
|
+
| email | string | 100% | ✅ |
|
|
101
|
+
| createdAt | timestamp | 100% | ✅ |
|
|
102
|
+
| plan | string | 95% | ✅ |
|
|
103
|
+
| displayName | string | 62% | ⚠️ |
|
|
104
|
+
| legacyRole | string | 18% | ⚠️ |
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**How to write this in code:**
|
|
108
|
+
```typescript
|
|
109
|
+
// ✅ Safe — 100% presence
|
|
110
|
+
const { uid, email, createdAt, plan } = userData;
|
|
111
|
+
|
|
112
|
+
// ✅ Correct — optional field, null check required
|
|
113
|
+
const displayName = userData.displayName ?? userData.email;
|
|
114
|
+
|
|
115
|
+
// ✅ Correct — sparse legacy field, guard it
|
|
116
|
+
if (userData.legacyRole) {
|
|
117
|
+
// handle legacy role migration
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ❌ Wrong — "name" does not exist in this schema
|
|
121
|
+
const name = userData.name;
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Security Notes
|
|
125
|
+
|
|
126
|
+
- LintBase runs **100% locally** — your service account key never leaves your machine
|
|
127
|
+
- Only **read operations** are performed on Firestore
|
|
128
|
+
- Never commit `service-account.json` to git — always check `.gitignore`
|
|
129
|
+
- If the user has not set up a service account key, guide them:
|
|
130
|
+
1. Firebase Console → Project Settings → Service Accounts
|
|
131
|
+
2. Click "Generate new private key"
|
|
132
|
+
3. Save as `service-account.json` in project root
|
|
133
|
+
4. Verify `.gitignore` includes `service-account.json`
|
|
134
|
+
|
|
135
|
+
## Setup (if lintbase-mcp is not yet configured)
|
|
136
|
+
|
|
137
|
+
If the MCP tools are not available, help the user set up lintbase-mcp:
|
|
138
|
+
|
|
139
|
+
**For Cursor** — add to `.cursor/mcp.json`:
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"mcpServers": {
|
|
143
|
+
"lintbase": {
|
|
144
|
+
"command": "npx",
|
|
145
|
+
"args": ["-y", "lintbase-mcp"]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**For Claude Desktop** — add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"mcpServers": {
|
|
155
|
+
"lintbase": {
|
|
156
|
+
"command": "npx",
|
|
157
|
+
"args": ["-y", "lintbase-mcp"]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Restart the IDE after adding, then verify with: `npx lintbase-mcp --help`
|
|
164
|
+
|
|
165
|
+
## Common Mistakes to Avoid
|
|
166
|
+
|
|
167
|
+
| ❌ Wrong | ✅ Right |
|
|
168
|
+
|---|---|
|
|
169
|
+
| Writing code before checking schema | Always call `lintbase_get_schema` first |
|
|
170
|
+
| Using a field not in the output | Only use fields that appear in the schema report |
|
|
171
|
+
| Treating all fields as required | Fields with `<80%` presence MUST have null checks |
|
|
172
|
+
| Assuming type consistency | Fields with multiple types need type guards |
|
|
173
|
+
| Skipping the audit before deploy | Run `lintbase_get_issues` with `severity: "error"` first |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// install-skill.js — CommonJS compatible
|
|
3
|
+
// Installs the LintBase SKILL.md into the current project's .agent/skills/ directory.
|
|
4
|
+
// Run via: npx lintbase-mcp-install-skill
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
const SKILL_SRC = path.join(__dirname, 'SKILL.md');
|
|
10
|
+
const TARGET_DIR = path.join(process.cwd(), '.agent', 'skills', 'lintbase');
|
|
11
|
+
const TARGET_FILE = path.join(TARGET_DIR, 'SKILL.md');
|
|
12
|
+
|
|
13
|
+
// Create target directory if it doesn't exist
|
|
14
|
+
fs.mkdirSync(TARGET_DIR, { recursive: true });
|
|
15
|
+
|
|
16
|
+
// Copy SKILL.md
|
|
17
|
+
fs.copyFileSync(SKILL_SRC, TARGET_FILE);
|
|
18
|
+
|
|
19
|
+
console.log('');
|
|
20
|
+
console.log('✅ LintBase skill installed to:');
|
|
21
|
+
console.log(' ' + TARGET_FILE);
|
|
22
|
+
console.log('');
|
|
23
|
+
console.log('Your AI agent will now automatically check the real Firestore schema');
|
|
24
|
+
console.log('before writing any database code.');
|
|
25
|
+
console.log('');
|
|
26
|
+
console.log('Make sure lintbase-mcp is configured in your IDE:');
|
|
27
|
+
console.log(' → https://www.npmjs.com/package/lintbase-mcp');
|
|
28
|
+
console.log('');
|