secufusion-mcp 1.0.3 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +498 -140
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SecuFusion MCP Server
1
+ # SecuFusion MCP Server
2
2
 
3
3
  > **Developer workflow tooling for the SecuFusion platform** — enforces zero-trust architecture standards, tracks task specs, and gates PRs with automated guardrail checks.
4
4
 
@@ -10,306 +10,664 @@
10
10
 
11
11
  ## What is this?
12
12
 
13
- `secufusion-mcp` is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that plugs into AI coding assistants (Claude Desktop, Cursor, Cline, Antigravity, etc.) and gives them three powerful tools to enforce SecuFusion's engineering standards throughout the development lifecycle.
13
+ `secufusion-mcp` is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that plugs into AI coding assistants (Claude Desktop, Cursor, Cline, etc.) and gives them three powerful tools to enforce SecuFusion's engineering standards throughout the development lifecycle:
14
14
 
15
15
  | Tool | Phase | What it does |
16
16
  |---|---|---|
17
17
  | `manage_feature_spec` | Planning & Execution | Creates/updates a `.current-task-spec.md` blueprint for every feature |
18
- | `log_rejected_pattern` | Course Correction | Records bad patterns to `.rejected-patterns.json` so they are never repeated |
18
+ | `log_rejected_pattern` | Course Correction | Records bad patterns to `.rejected-patterns.json` so they're never repeated |
19
19
  | `run_pre_pr_checks` | PR Handoff | Scans the codebase and gates PRs with automated guardrail validation |
20
20
 
21
21
  ---
22
22
 
23
23
  ## Installation
24
24
 
25
- No installation needed for teammates just add to your MCP config and it runs via `npx`.
26
-
27
- If you want to run it from a local build (faster, fully offline):
25
+ ### Option 1`npx` (no install required)
28
26
 
29
27
  ```bash
30
- git clone https://github.com/your-org/secufusion-mcp
31
- cd secufusion-mcp
32
- npm install
33
- npm run build
28
+ npx secufusion-mcp
34
29
  ```
35
30
 
36
- ---
37
-
38
- ## Setup: Add to Your MCP Client
31
+ ### Option 2 — Global install
39
32
 
40
- ### Which config should I use?
33
+ ```bash
34
+ npm install -g secufusion-mcp
35
+ ```
41
36
 
42
- | Situation | Command to use |
43
- |---|---|
44
- | **You have the source on disk** (faster, offline) | `node C:\path\to\secufusion-mcp\index.js` |
45
- | **Anyone else / fresh machine** (auto-downloads, cached after first run) | `npx -y secufusion-mcp` |
37
+ ### Option 3 Local project install
46
38
 
47
- > `npx` downloads from npm on first run (~3s) then caches it locally. Every run after that is instant and requires no network.
39
+ ```bash
40
+ npm install --save-dev secufusion-mcp
41
+ ```
48
42
 
49
43
  ---
50
44
 
51
- ### Antigravity IDE
45
+ ## Setup: Add to Your MCP Client
46
+
47
+ ### Claude Desktop
52
48
 
53
- Open **Customizations → MCP Servers** → edit `mcp_config.json` directly:
49
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or
50
+ `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
54
51
 
55
- **If you have the source on disk:**
56
52
  ```json
57
53
  {
58
54
  "mcpServers": {
59
55
  "secufusion-mcp": {
60
- "command": "node",
61
- "args": ["C:\\Users\\YourName\\path\\to\\secufusion-mcp\\index.js"],
62
- "type": "stdio"
56
+ "command": "npx",
57
+ "args": ["-y", "secufusion-mcp"]
63
58
  }
64
59
  }
65
60
  }
66
61
  ```
67
62
 
68
- **If you are a teammate (no source):**
63
+ ### Cursor
64
+
65
+ Open **Settings → MCP** and add:
66
+
69
67
  ```json
70
68
  {
71
- "mcpServers": {
72
- "secufusion-mcp": {
73
- "command": "npx",
74
- "args": ["-y", "secufusion-mcp"],
75
- "type": "stdio"
76
- }
69
+ "secufusion-mcp": {
70
+ "command": "npx",
71
+ "args": ["-y", "secufusion-mcp"]
77
72
  }
78
73
  }
79
74
  ```
80
75
 
81
- ---
76
+ ### Cline (VS Code Extension)
82
77
 
83
- ### Claude Desktop
78
+ Open Cline settings → MCP Servers → Add:
84
79
 
85
- Edit `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
80
+ ```json
81
+ {
82
+ "secufusion-mcp": {
83
+ "command": "npx",
84
+ "args": ["-y", "secufusion-mcp"],
85
+ "disabled": false
86
+ }
87
+ }
88
+ ```
89
+
90
+ ### Using a local build (development)
86
91
 
87
92
  ```json
88
93
  {
89
- "mcpServers": {
90
- "secufusion-mcp": {
91
- "command": "npx",
92
- "args": ["-y", "secufusion-mcp"]
93
- }
94
+ "secufusion-mcp": {
95
+ "command": "node",
96
+ "args": ["C:/path/to/secufusion-mcp/index.js"]
94
97
  }
95
98
  }
96
99
  ```
97
100
 
98
101
  ---
99
102
 
100
- ### VS Code — Cline Extension
103
+ ## Tools Reference
104
+
105
+ ### 1. `manage_feature_spec`
101
106
 
102
- Install the **Cline** extension click ⚙️ Settings **MCP Servers** **Edit Config**:
107
+ Creates or updates the `.current-task-spec.md` file your single source of truth for every task. The AI reads this before writing any code.
103
108
 
109
+ **Parameters:**
110
+
111
+ | Parameter | Type | Required | Description |
112
+ |---|---|---|---|
113
+ | `action` | `"create"` \| `"update"` \| `"read"` | Yes | What to do with the spec |
114
+ | `task_description` | string | When `action=create` | Full description of the task/feature |
115
+ | `update_content` | string | When `action=update` | Markdown lines to merge (e.g. tick checkboxes) |
116
+ | `work_item_id` | string | No | Azure DevOps work item ID |
117
+ | `reference_file_path` | string | No | Path to an existing source file to extract coding patterns from |
118
+
119
+ **Example — Create a spec:**
120
+
121
+ ```
122
+ Ask your AI assistant:
123
+ "Start working on WI-1042: Add tenant-scoped audit log export to CSV.
124
+ Reference file: src/services/AuditService.java"
125
+ ```
126
+
127
+ The AI will call:
104
128
  ```json
105
129
  {
106
- "mcpServers": {
107
- "secufusion-mcp": {
108
- "command": "npx",
109
- "args": ["-y", "secufusion-mcp"],
110
- "disabled": false
111
- }
130
+ "action": "create",
131
+ "task_description": "Add tenant-scoped audit log export to CSV...",
132
+ "work_item_id": "1042",
133
+ "reference_file_path": "src/services/AuditService.java"
134
+ }
135
+ ```
136
+
137
+ This generates `.current-task-spec.md` with:
138
+ - Task description
139
+ - Pre-filled guardrails checklist
140
+ - Acceptance criteria placeholders
141
+ - Reference code snippet
142
+ - Session log
143
+
144
+ **Example — Tick off completed work:**
145
+
146
+ ```
147
+ Ask: "Mark the tenantId scoping and unit tests as done in the spec."
148
+ ```
149
+
150
+ The AI will call:
151
+ ```json
152
+ {
153
+ "action": "update",
154
+ "update_content": "- [x] All DB queries / event payloads are scoped with `tenantId`\n- [x] Unit tests written / updated for new business logic"
155
+ }
156
+ ```
157
+
158
+ **Example — Read current spec:**
159
+
160
+ ```
161
+ Ask: "Where did we leave off? Read the current spec."
162
+ ```
163
+
164
+ ```json
165
+ { "action": "read" }
166
+ ```
167
+
168
+ ---
169
+
170
+ ### 2. `log_rejected_pattern`
171
+
172
+ Appends a rejected code pattern to `.rejected-patterns.json`. The AI checks this file implicitly before every architectural suggestion to avoid repeating past mistakes.
173
+
174
+ **Parameters:**
175
+
176
+ | Parameter | Type | Required | Description |
177
+ |---|---|---|---|
178
+ | `pattern` | string | Yes | The bad pattern or approach |
179
+ | `reason` | string | Yes | Why it was rejected and what to do instead |
180
+ | `category` | enum | No | `architecture` \| `security` \| `database` \| `logging` \| `api-design` \| `testing` \| `other` |
181
+ | `file_context` | string | No | File or area where the pattern was observed |
182
+
183
+ **Example:**
184
+
185
+ ```
186
+ Tell your AI: "Never use a global @Repository bean without tenantId scoping again.
187
+ It was leaking cross-tenant data."
188
+ ```
189
+
190
+ The AI will call:
191
+ ```json
192
+ {
193
+ "pattern": "Injecting global @Repository bean and querying without tenantId filter",
194
+ "reason": "Causes cross-tenant data leakage. Always add .where(tenantId = :tenantId) or use TenantAwareRepository base class.",
195
+ "category": "security",
196
+ "file_context": "src/repositories/AuditLogRepository.java"
197
+ }
198
+ ```
199
+
200
+ This writes to `.rejected-patterns.json`:
201
+ ```json
202
+ [
203
+ {
204
+ "id": 1,
205
+ "timestamp": "2026-08-26T14:35:00.000Z",
206
+ "category": "security",
207
+ "pattern": "Injecting global @Repository bean...",
208
+ "reason": "Causes cross-tenant data leakage...",
209
+ "file_context": "src/repositories/AuditLogRepository.java"
112
210
  }
211
+ ]
212
+ ```
213
+
214
+ ---
215
+
216
+ ### 3. `run_pre_pr_checks`
217
+
218
+ Scans your entire codebase and produces a pass/fail report. **Must pass before raising a PR.**
219
+
220
+ **Parameters:**
221
+
222
+ | Parameter | Type | Required | Description |
223
+ |---|---|---|---|
224
+ | `work_item_id` | string | Yes | Azure DevOps work item ID for the PR summary |
225
+ | `root_dir` | string | No | Directory to scan (defaults to cwd) |
226
+ | `skip_checks` | array | No | Checks to bypass: `spec_boxes`, `console_logs`, `hardcoded_urls`, `flyway_migrations` |
227
+
228
+ **Checks performed:**
229
+
230
+ | Check | What fails it |
231
+ |---|---|
232
+ | **SPEC** | `.current-task-spec.md` is missing, or has any unchecked `- [ ]` boxes |
233
+ | **LOGGING** | Any `console.log()` in `.ts/.tsx/.js/.jsx` files, or `System.out.println()` in `.java` files |
234
+ | **SECURITY** | Hardcoded IP addresses or `uat.*` / `prod.*` / `staging.*` URLs in source or config files |
235
+ | **FLYWAY** | `@Entity`-annotated Java files exist but no `V*__.sql` Flyway migration files are found |
236
+
237
+ **Example — Run checks before PR:**
238
+
239
+ ```
240
+ Ask: "Prepare the PR for work item 1042."
241
+ ```
242
+
243
+ The AI will call:
244
+ ```json
245
+ {
246
+ "work_item_id": "1042"
113
247
  }
114
248
  ```
115
249
 
116
- ### VS Code — Workspace level (commit to repo)
250
+ **✅ Passing output:**
251
+ ```
252
+ # ✅ Pre-PR Checks PASSED — Work Item #1042
253
+
254
+ ✅ [SPEC] All spec checkboxes are checked.
255
+ ✅ [LOGGING] No console.log / System.out.println found.
256
+ ✅ [SECURITY] No hardcoded UAT/Prod IPs or environment URLs found.
257
+ ✅ [FLYWAY] Flyway migration coverage looks good.
258
+
259
+ ## PR Summary
260
+ - Work Item: #1042
261
+ - Spec: All acceptance criteria verified ✅
262
+ - Ready to raise PR 🚀
263
+ ```
264
+
265
+ **❌ Failing output (example):**
266
+ ```
267
+ # ❌ Pre-PR Checks FAILED — Work Item #1042
268
+
269
+ ❌ [SPEC] 3 unchecked item(s) in the spec:
270
+ • Flyway SQL migration created for every modified JPA @Entity
271
+ • Unit tests written / updated for new business logic
272
+ • API contract updated if endpoints changed
273
+
274
+ ❌ [LOGGING] Found 2 prohibited log statement(s):
275
+ • console.log() found at src/components/AuditTable.tsx:47
276
+ • System.out.println() found at src/main/java/AuditService.java:112
277
+ ```
278
+
279
+ ---
280
+
281
+ ## Guardrails Summary
282
+
283
+ These rules are enforced automatically — the AI will never violate them:
284
+
285
+ ```
286
+ ✅ All DB queries and event payloads scoped with tenantId
287
+ ✅ No console.log() or System.out.println() in any source file
288
+ ✅ No hardcoded UAT/Prod IPs or environment URLs
289
+ ✅ Every JPA @Entity change accompanied by a Flyway .sql migration
290
+ ✅ Spec must be fully checked before PR is raised
291
+ ```
292
+
293
+ ---
294
+
295
+ ## File Outputs
296
+
297
+ | File | Description |
298
+ |---|---|
299
+ | `.current-task-spec.md` | Living task blueprint — created per feature, updated as work progresses |
300
+ | `.rejected-patterns.json` | Cumulative log of all rejected patterns across sessions |
301
+
302
+ > **Tip:** Commit both files to your repo so the entire team benefits from the shared knowledge.
303
+
304
+ ---
305
+
306
+ ## Workflow Overview
307
+
308
+ ```
309
+ ┌─────────────────────────────────────────────────────┐
310
+ │ SecuFusion MCP Workflow │
311
+ ├──────────────┬──────────────────────────────────────┤
312
+ │ Phase 1 │ manage_feature_spec (action=create) │
313
+ │ Planning │ → Generates .current-task-spec.md │
314
+ ├──────────────┼──────────────────────────────────────┤
315
+ │ Phase 2 │ manage_feature_spec (action=update) │
316
+ │ Execution │ → Tick off ACs as you complete them │
317
+ ├──────────────┼──────────────────────────────────────┤
318
+ │ Phase 3 │ log_rejected_pattern │
319
+ │ Correction │ → Record mistakes to avoid repeat │
320
+ ├──────────────┼──────────────────────────────────────┤
321
+ │ Phase 4 │ run_pre_pr_checks │
322
+ │ PR Handoff │ → Must pass before raising PR │
323
+ └──────────────┴──────────────────────────────────────┘
324
+ ```
325
+
326
+ ---
327
+
328
+ ## Real-World Walkthrough
329
+
330
+ A complete end-to-end example of what you actually type and what happens at each phase.
331
+
332
+ ---
117
333
 
118
- Create `.vscode/mcp.json` in your project root:
334
+ ### Step 1 Integrate (one-time setup)
119
335
 
336
+ Add this to your MCP client config and restart. That's it.
337
+
338
+ **Antigravity / Claude Desktop / Cline — if you have the source on disk:**
120
339
  ```json
121
340
  {
122
- "servers": {
341
+ "mcpServers": {
123
342
  "secufusion-mcp": {
124
- "type": "stdio",
125
- "command": "npx",
126
- "args": ["-y", "secufusion-mcp"]
343
+ "command": "node",
344
+ "args": ["C:\\Users\\YourName\\Desktop\\mcp\\secufusion-mcp\\index.js"],
345
+ "type": "stdio"
127
346
  }
128
347
  }
129
348
  }
130
349
  ```
131
350
 
132
- ### Cursor
133
-
134
- Open Settings → MCP → Add:
135
-
351
+ **Teammates / fresh machines — pulls from npm, cached after first run:**
136
352
  ```json
137
353
  {
138
- "secufusion-mcp": {
139
- "command": "npx",
140
- "args": ["-y", "secufusion-mcp"]
354
+ "mcpServers": {
355
+ "secufusion-mcp": {
356
+ "command": "npx",
357
+ "args": ["-y", "secufusion-mcp"],
358
+ "type": "stdio"
359
+ }
141
360
  }
142
361
  }
143
362
  ```
144
363
 
145
- ---
364
+ > **Why two options?** If you have the compiled `index.js` on disk, `node` starts instantly and works fully offline. Teammates who don't have the source use `npx` — it downloads from npm once (~3s), then caches it locally so every subsequent run is instant with no network needed.
146
365
 
147
- ## How to Use It (Day-to-Day)
366
+ ---
148
367
 
149
- ### Start a task just paste your Azure work item
368
+ ### Step 2Start a new task (Planning phase)
150
369
 
151
- You do not need to learn any commands. Just tell your AI assistant:
370
+ Just paste your Azure DevOps work item ID and description directly into the chat. No special syntax needed.
152
371
 
372
+ **You type:**
153
373
  ```
154
374
  WI-2847: Add MFA enforcement for admin users on login.
155
375
  Admin users must be forced through TOTP verification before
156
376
  accessing any dashboard route. Exempt service accounts.
157
377
  ```
158
378
 
159
- The AI automatically calls `manage_feature_spec` and creates `.current-task-spec.md` with:
160
- - Your task description
161
- - A guardrails checklist
162
- - Acceptance criteria placeholders
163
- - A direct Azure DevOps link
164
- - A session log
379
+ **The AI automatically calls `manage_feature_spec` and creates `.current-task-spec.md`:**
380
+ ```markdown
381
+ # SecuFusion Feature Spec
382
+
383
+ **Generated:** 2026-08-26T14:35:00.000Z
384
+ **Azure DevOps Work Item:** 2847 → https://dev.azure.com/secufusion/_workitems/edit/2847
385
+
386
+ ## Task Description
387
+ Add MFA enforcement for admin users on login...
388
+
389
+ ## Guardrails Checklist
390
+ - [ ] All DB queries / event payloads are scoped with `tenantId`
391
+ - [ ] No `console.log` / `System.out.println` left in source files
392
+ - [ ] No hardcoded UAT/Prod IPs or environment URLs
393
+ - [ ] Flyway SQL migration created for every modified JPA `@Entity`
394
+ - [ ] Unit tests written / updated for new business logic
395
+ - [ ] API contract updated if endpoints changed
165
396
 
166
- You can be brief or paste the full ticket — both work:
397
+ ## Acceptance Criteria
398
+ - [ ] AC-1: (fill in from ticket)
399
+ - [ ] AC-2: (fill in from ticket)
167
400
 
401
+ ## Session Log
402
+ | 2026-08-26T14:35:00Z | Spec created |
168
403
  ```
169
- # Minimal
404
+
405
+ You can paste as little or as much as you want:
406
+
407
+ ```
408
+ # Minimal — one liner
170
409
  WI-2847: MFA for admin login with TOTP.
171
410
 
172
- # Full Azure paste
411
+ # Full ticket paste — straight from Azure
173
412
  WI-2847
174
413
  Title: Add MFA enforcement for admin users
175
414
  Description: Admin users must complete TOTP verification...
176
415
  Acceptance Criteria:
177
416
  - Given admin logs in, When MFA not done, Then redirect to /mfa
178
417
  - Service accounts in GROUP_SERVICE_ACCOUNTS are exempt
418
+ Priority: High
179
419
  ```
180
420
 
181
421
  ---
182
422
 
183
- ### Tick off completed work
423
+ ### Step 3 Write code normally
424
+
425
+ Just code as usual. With the MCP server active, the AI automatically:
426
+
427
+ - Adds `tenantId` scoping to every DB query it writes
428
+ - Uses a proper logger (e.g., `log.info()`) — never `console.log`
429
+ - Reads `.rejected-patterns.json` before making any architectural suggestion
430
+ - Reminds you to create a Flyway migration if it touches a `@Entity`
431
+ - References any `reference_file_path` you provided to match your coding style
432
+
433
+ ---
434
+
435
+ ### Step 4 — Tick off completed work (Execution phase)
436
+
437
+ As you finish pieces of the feature, tell the AI:
184
438
 
185
439
  ```
186
- I've finished the tenantId scoping and written the unit tests. Update the spec.
440
+ I've finished the tenantId scoping on all queries and written the unit tests.
441
+ Update the spec.
442
+ ```
443
+
444
+ The AI calls `manage_feature_spec` with `action=update` and the spec updates:
445
+
446
+ ```markdown
447
+ # Before
448
+ - [ ] All DB queries / event payloads are scoped with `tenantId`
449
+ - [ ] Unit tests written / updated for new business logic
450
+
451
+ # After
452
+ - [x] All DB queries / event payloads are scoped with `tenantId`
453
+ - [x] Unit tests written / updated for new business logic
187
454
  ```
188
455
 
189
- The AI checks off the matching boxes in `.current-task-spec.md`.
456
+ A new row is also appended to the Session Log automatically, so you always have an audit trail of progress across sessions.
190
457
 
191
458
  ---
192
459
 
193
- ### Record a mistake (so it never happens again)
460
+ ### Step 5 Course correction (if the AI does something wrong)
461
+
462
+ Say the AI used a hardcoded URL or proposed a pattern your team has banned:
463
+
464
+ ```
465
+ Stop using hardcoded staging URLs like https://staging.secufusion.io.
466
+ All env URLs must come from application.properties. Never hardcode them.
467
+ ```
194
468
 
469
+ The AI **immediately** calls `log_rejected_pattern`:
470
+
471
+ ```json
472
+ {
473
+ "pattern": "Hardcoded staging URL https://staging.secufusion.io in source files",
474
+ "reason": "Must use @Value('${app.base-url}') from application.properties. Hardcoded URLs break environment parity and expose internal topology.",
475
+ "category": "security",
476
+ "file_context": "src/services/NotificationService.java"
477
+ }
195
478
  ```
196
- Never use hardcoded staging URLs like https://staging.secufusion.io.
197
- All env URLs must come from application.properties.
479
+
480
+ This gets appended to `.rejected-patterns.json`:
481
+
482
+ ```json
483
+ [
484
+ {
485
+ "id": 1,
486
+ "timestamp": "2026-08-26T15:10:00.000Z",
487
+ "category": "security",
488
+ "pattern": "Hardcoded staging URL https://staging.secufusion.io in source files",
489
+ "reason": "Must use @Value from application.properties...",
490
+ "file_context": "src/services/NotificationService.java"
491
+ }
492
+ ]
198
493
  ```
199
494
 
200
- The AI logs it to `.rejected-patterns.json` and checks it before every future suggestion.
495
+ From this point on, the AI checks this file before every suggestion — the mistake will never be repeated, even in future sessions.
201
496
 
202
497
  ---
203
498
 
204
- ### Run pre-PR checks
499
+ ### Step 6 — Pre-PR checks (PR Handoff phase)
500
+
501
+ When you're done, say:
205
502
 
206
503
  ```
207
504
  Run pre-PR checks for work item 2847.
208
505
  ```
209
506
 
210
- **Pass:**
507
+ The AI scans your entire repo and produces a report.
508
+
509
+ **✅ Everything passes — ready to ship:**
211
510
  ```
511
+ # ✅ Pre-PR Checks PASSED — Work Item #2847
512
+
513
+ Scanned directory: C:\projects\secufusion-backend
514
+ Timestamp: 2026-08-26T16:00:00.000Z
515
+
212
516
  ✅ [SPEC] All spec checkboxes are checked.
213
517
  ✅ [LOGGING] No console.log / System.out.println found.
214
- ✅ [SECURITY] No hardcoded URLs found.
215
- ✅ [FLYWAY] Migration coverage looks good.
216
- Ready to raise PR 🚀
518
+ ✅ [SECURITY] No hardcoded UAT/Prod IPs or environment URLs found.
519
+ ✅ [FLYWAY] Flyway migration coverage looks good.
520
+
521
+ ## PR Summary
522
+ - Work Item: #2847
523
+ - Spec: All acceptance criteria verified ✅
524
+ - Guardrails: tenantId scoping, no debug logs, no hardcoded URLs, Flyway covered ✅
525
+ - Ready to raise PR 🚀
526
+
527
+ 🚫 Rejected Patterns Reminder (1 on record)
528
+ - [security] Hardcoded staging URL https://staging.secufusion.io in source files
217
529
  ```
218
530
 
219
- **Fail (fix and re-run):**
531
+ **❌ Checks fail — you must fix before PR:**
220
532
  ```
221
- [SPEC] 2 unchecked items:
533
+ # Pre-PR Checks FAILED — Work Item #2847
534
+
535
+ ## Errors (must fix before PR)
536
+
537
+ ❌ [SPEC] 2 unchecked item(s) in the spec:
222
538
  • Flyway SQL migration created for every modified JPA @Entity
223
- • API contract updated if endpoints changed
224
- ❌ [LOGGING] console.log() found at src/components/AuditExport.tsx:84
539
+ • API contract (OpenAPI / TS types) updated if endpoints changed
540
+
541
+ ❌ [LOGGING] Found 2 prohibited log statement(s):
542
+ • console.log() found at src/components/MfaSetup.tsx:47
543
+ • System.out.println() found at src/main/java/MfaService.java:112
544
+
545
+ ## Passed
546
+ ✅ [SECURITY] No hardcoded UAT/Prod IPs or environment URLs found.
547
+ ✅ [FLYWAY] Flyway migration coverage looks good.
225
548
  ```
226
549
 
550
+ Fix the issues, run checks again, and only raise the PR once it's fully green.
551
+
227
552
  ---
228
553
 
229
554
  ### Quick cheat sheet
230
555
 
231
- | What you want | What to say |
556
+ | What you want to do | What to say to the AI |
232
557
  |---|---|
233
- | Start a task | `WI-XXXX: [description]` |
558
+ | Start a new task | `WI-XXXX: [paste description from Azure]` |
234
559
  | Check where you left off | `Read the current spec` |
235
- | Mark work done | `Mark [X] as complete in the spec` |
560
+ | Mark work as done | `Mark the tenantId scoping as complete in the spec` |
236
561
  | Record a mistake | `Never do [X] again because [Y]` |
237
- | Pre-PR check | `Run pre-PR checks for WI-XXXX` |
238
- | Resume a session | `What's left on the current task?` |
562
+ | Gate the PR | `Run pre-PR checks for WI-XXXX` |
563
+ | Resume after a break | `What's left on the current task?` |
564
+ | Use a reference file | `WI-XXXX: [desc]. Reference: src/services/MyService.java` |
239
565
 
240
566
  ---
241
567
 
242
- ## Tools Reference
568
+ ## How It Actually Works — The Invoker
243
569
 
244
- ### 1. manage_feature_spec
570
+ There are two layers that need to be in place for the MCP server to work automatically.
245
571
 
246
- | Parameter | Type | Required | Description |
247
- |---|---|---|---|
248
- | `action` | `create` / `update` / `read` | Yes | Operation to perform |
249
- | `task_description` | string | When action=create | Full feature/task description |
250
- | `update_content` | string | When action=update | Markdown lines to merge (e.g. tick checkboxes) |
251
- | `work_item_id` | string | No | Azure DevOps work item ID |
252
- | `reference_file_path` | string | No | Existing source file to extract coding patterns from |
572
+ ### Layer 1 `mcp_config.json` (makes tools available)
253
573
 
254
- ---
574
+ This tells the IDE to start the MCP server process when it launches. The tools become registered and ready, but nothing calls them yet.
255
575
 
256
- ### 2. log_rejected_pattern
576
+ ```
577
+ IDE starts → reads mcp_config.json → spawns node index.js → tools registered
578
+ ```
257
579
 
258
- | Parameter | Type | Required | Description |
259
- |---|---|---|---|
260
- | `pattern` | string | Yes | The bad pattern or approach |
261
- | `reason` | string | Yes | Why rejected and what to do instead |
262
- | `category` | enum | No | `architecture`, `security`, `database`, `logging`, `api-design`, `testing`, `other` |
263
- | `file_context` | string | No | File where the pattern was observed |
580
+ ### Layer 2 `AGENTS.md` (the invoker tells AI when to call each tool)
264
581
 
265
- ---
582
+ Without this, the tools sit idle. The AI doesn't know when to invoke them.
583
+ Create `.agents/AGENTS.md` in your project root:
266
584
 
267
- ### 3. run_pre_pr_checks
585
+ ```markdown
586
+ # SecuFusion MCP Workflow Rules
268
587
 
269
- | Parameter | Type | Required | Description |
270
- |---|---|---|---|
271
- | `work_item_id` | string | Yes | Azure DevOps work item ID |
272
- | `root_dir` | string | No | Directory to scan (defaults to cwd) |
273
- | `skip_checks` | array | No | `spec_boxes`, `console_logs`, `hardcoded_urls`, `flyway_migrations` |
588
+ You are an elite Senior Developer working on the SecuFusion platform.
589
+ You have access to the `secufusion-mcp` MCP server. Follow these rules strictly.
274
590
 
275
- **Guardrail checks:**
591
+ ## Phase 1 — Planning (TRIGGER: user assigns a task or work item)
592
+ - Do NOT write code immediately.
593
+ - Call `manage_feature_spec` with `action=create`, passing the task description and `work_item_id`.
594
+ - Wait for the spec to be generated before writing any code.
276
595
 
277
- | Check | Fails when |
278
- |---|---|
279
- | **SPEC** | `.current-task-spec.md` is missing or has unchecked `- [ ]` boxes |
280
- | **LOGGING** | `console.log()` in `.ts/.tsx/.js/.jsx` or `System.out.println()` in `.java` files |
281
- | **SECURITY** | Hardcoded IPs or `uat.*` / `prod.*` / `staging.*` URLs in source or config files |
282
- | **FLYWAY** | `@Entity`-annotated Java files exist but no `V*__.sql` Flyway migrations found |
596
+ ## Phase 2 Execution (TRIGGER: as you complete work)
597
+ - Keep `.current-task-spec.md` updated as your source of truth.
598
+ - When you finish a logical chunk, call `manage_feature_spec` with `action=update`.
599
+ - If resuming a session, always call `manage_feature_spec` with `action=read` first.
283
600
 
284
- ---
601
+ ## Phase 3 — Course Correction (TRIGGER: user corrects you or rejects an approach)
602
+ - Immediately call `log_rejected_pattern`.
603
+ - Pass the bad `pattern` and the `reason` the user provided.
285
604
 
286
- ## Files Created in Your Repo
605
+ ## Phase 4 PR Handoff (TRIGGER: user says "prepare PR", "run checks", "ready to ship")
606
+ - Call `run_pre_pr_checks` with the `work_item_id`.
607
+ - Fix any errors and run again until all checks are green.
287
608
 
288
- | File | Purpose | Commit? |
289
- |---|---|---|
290
- | `.current-task-spec.md` | Living blueprint for the current task | Yes — team visibility |
291
- | `.rejected-patterns.json` | Cumulative log of banned patterns across sessions | Yes — shared team knowledge |
609
+ ## Guardrails (enforce always)
610
+ - Always scope DB queries and event payloads with `tenantId`.
611
+ - Never use `console.log` (JS/TS) or `System.out.println` (Java).
612
+ - Never hardcode UAT/Prod IPs or environment URLs.
613
+ - If you modify a JPA `@Entity`, create the corresponding Flyway `.sql` migration.
614
+ ```
292
615
 
293
- ---
616
+ ### How it all wires together
617
+
618
+ ```
619
+ mcp_config.json → starts the server (tools available)
620
+ +
621
+ .agents/AGENTS.md → tells AI when to invoke each tool (the invoker)
622
+
623
+ You say: "WI-1042: Add audit log export"
624
+
625
+ AI reads AGENTS.md → Phase 1 triggered → calls manage_feature_spec
626
+
627
+ .current-task-spec.md created in your project root
628
+ ```
294
629
 
295
- ## Workflow
630
+ ### Reusing across projects
631
+
632
+ Copy `.agents/AGENTS.md` into any project's root — the invoker follows you everywhere.
296
633
 
297
634
  ```
298
- Phase 1 — Planning → manage_feature_spec (create) → .current-task-spec.md generated
299
- Phase 2 — Execution → manage_feature_spec (update) → tick off ACs as you complete them
300
- Phase 3 — Correction → log_rejected_pattern → .rejected-patterns.json updated
301
- Phase 4 — PR Handoff → run_pre_pr_checks → must pass green before PR is raised
635
+ ProjectA/
636
+ .agents/AGENTS.md same file, copy it here
637
+
638
+ ProjectB/
639
+ .agents/AGENTS.md ← and here
640
+
641
+ mcp_config.json ← global, never changes
302
642
  ```
303
643
 
304
644
  ---
305
645
 
646
+ ## Talking to the AI — 5 Things You'll Ever Say
647
+
648
+ Once both layers are in place, you interact completely naturally:
649
+
650
+ | Situation | What you say |
651
+ |---|---|
652
+ | 🆕 New task | `WI-XXXX: [paste description from Azure]` |
653
+ | ✅ Done a chunk | `Done with the tenantId scoping, update the spec` |
654
+ | ❌ AI did something wrong | `Don't do X, do Y instead` |
655
+ | 🚀 Ready for PR | `Run checks for WI-XXXX` or `Prepare PR` |
656
+ | 🔄 Resuming after a break | `What's left?` or `Resume the current task` |
657
+
658
+ **Before `AGENTS.md`:** You had to remember which tool to invoke and when.
659
+
660
+ **After `AGENTS.md`:** You just describe work. The AI follows the 4-phase workflow automatically — no commands, no syntax, no manual tool calls.
661
+
662
+ ---
663
+
306
664
  ## Requirements
307
665
 
308
- - Node.js >= 18.0.0
666
+ - **Node.js** >= 18.0.0
309
667
  - An MCP-compatible AI client (Antigravity, Claude Desktop, Cursor, Cline, etc.)
310
668
 
311
669
  ---
312
670
 
313
671
  ## License
314
672
 
315
- ISC
673
+ ISC © SecuFusion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secufusion-mcp",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "SecuFusion MCP server - developer workflow tooling with guardrails",
6
6
  "main": "index.js",
@@ -17,7 +17,8 @@
17
17
  },
18
18
  "scripts": {
19
19
  "build": "tsc",
20
- "prepublishOnly": "npm run build",
20
+ "prepublishOnly": "copy ..\\README.md README.md && npm run build",
21
+ "postpublish": "del README.md",
21
22
  "start": "node index.js",
22
23
  "dev": "tsc && node index.js"
23
24
  },