secufusion-mcp 1.0.2 → 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.
- package/README.md +553 -47
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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,36 +10,44 @@
|
|
|
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, etc.) and gives them three powerful tools to enforce SecuFusion's engineering standards:
|
|
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
|
-
| `manage_feature_spec` | Planning & Execution | Creates/updates a `.current-task-spec.md` blueprint |
|
|
18
|
-
| `log_rejected_pattern` | Course Correction | Records bad patterns to `.rejected-patterns.json` |
|
|
19
|
-
| `run_pre_pr_checks` | PR Handoff | Scans the codebase and gates PRs with guardrail validation |
|
|
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're never repeated |
|
|
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
|
-
### Option 1 — npx (no install required)
|
|
25
|
+
### Option 1 — `npx` (no install required)
|
|
26
|
+
|
|
26
27
|
```bash
|
|
27
28
|
npx secufusion-mcp
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
### Option 2 — Global install
|
|
32
|
+
|
|
31
33
|
```bash
|
|
32
34
|
npm install -g secufusion-mcp
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
### Option 3 — Local project install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install --save-dev secufusion-mcp
|
|
41
|
+
```
|
|
42
|
+
|
|
35
43
|
---
|
|
36
44
|
|
|
37
45
|
## Setup: Add to Your MCP Client
|
|
38
46
|
|
|
39
47
|
### Claude Desktop
|
|
40
48
|
|
|
41
|
-
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
42
|
-
|
|
49
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or
|
|
50
|
+
`%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
43
51
|
|
|
44
52
|
```json
|
|
45
53
|
{
|
|
@@ -52,7 +60,9 @@ or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
|
52
60
|
}
|
|
53
61
|
```
|
|
54
62
|
|
|
55
|
-
### Cursor
|
|
63
|
+
### Cursor
|
|
64
|
+
|
|
65
|
+
Open **Settings → MCP** and add:
|
|
56
66
|
|
|
57
67
|
```json
|
|
58
68
|
{
|
|
@@ -63,105 +73,601 @@ or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
|
63
73
|
}
|
|
64
74
|
```
|
|
65
75
|
|
|
76
|
+
### Cline (VS Code Extension)
|
|
77
|
+
|
|
78
|
+
Open Cline settings → MCP Servers → Add:
|
|
79
|
+
|
|
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)
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"secufusion-mcp": {
|
|
95
|
+
"command": "node",
|
|
96
|
+
"args": ["C:/path/to/secufusion-mcp/index.js"]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
66
101
|
---
|
|
67
102
|
|
|
68
103
|
## Tools Reference
|
|
69
104
|
|
|
70
|
-
### 1. manage_feature_spec
|
|
105
|
+
### 1. `manage_feature_spec`
|
|
71
106
|
|
|
72
|
-
Creates or updates `.current-task-spec.md` — your single source of truth for every task.
|
|
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.
|
|
73
108
|
|
|
74
109
|
**Parameters:**
|
|
75
110
|
|
|
76
111
|
| Parameter | Type | Required | Description |
|
|
77
112
|
|---|---|---|---|
|
|
78
|
-
| `action` | `create`
|
|
79
|
-
| `task_description` | string | When action=create | Full feature
|
|
80
|
-
| `update_content` | string | When action=update | Markdown to merge (tick checkboxes) |
|
|
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) |
|
|
81
116
|
| `work_item_id` | string | No | Azure DevOps work item ID |
|
|
82
|
-
| `reference_file_path` | string | No |
|
|
117
|
+
| `reference_file_path` | string | No | Path to an existing source file to extract coding patterns from |
|
|
118
|
+
|
|
119
|
+
**Example — Create a spec:**
|
|
83
120
|
|
|
84
|
-
**Example:**
|
|
85
121
|
```
|
|
86
|
-
|
|
87
|
-
|
|
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:
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
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" }
|
|
88
166
|
```
|
|
89
167
|
|
|
90
168
|
---
|
|
91
169
|
|
|
92
|
-
### 2. log_rejected_pattern
|
|
170
|
+
### 2. `log_rejected_pattern`
|
|
93
171
|
|
|
94
|
-
Appends
|
|
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.
|
|
95
173
|
|
|
96
174
|
**Parameters:**
|
|
97
175
|
|
|
98
176
|
| Parameter | Type | Required | Description |
|
|
99
177
|
|---|---|---|---|
|
|
100
178
|
| `pattern` | string | Yes | The bad pattern or approach |
|
|
101
|
-
| `reason` | string | Yes | Why rejected and what to do instead |
|
|
102
|
-
| `category` | enum | No | architecture
|
|
103
|
-
| `file_context` | string | No | File where the pattern was observed |
|
|
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 |
|
|
104
182
|
|
|
105
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
|
+
}
|
|
106
198
|
```
|
|
107
|
-
|
|
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"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
108
212
|
```
|
|
109
213
|
|
|
110
214
|
---
|
|
111
215
|
|
|
112
|
-
### 3. run_pre_pr_checks
|
|
216
|
+
### 3. `run_pre_pr_checks`
|
|
113
217
|
|
|
114
|
-
Scans
|
|
218
|
+
Scans your entire codebase and produces a pass/fail report. **Must pass before raising a PR.**
|
|
115
219
|
|
|
116
220
|
**Parameters:**
|
|
117
221
|
|
|
118
222
|
| Parameter | Type | Required | Description |
|
|
119
223
|
|---|---|---|---|
|
|
120
|
-
| `work_item_id` | string | Yes | Azure DevOps work item ID |
|
|
224
|
+
| `work_item_id` | string | Yes | Azure DevOps work item ID for the PR summary |
|
|
121
225
|
| `root_dir` | string | No | Directory to scan (defaults to cwd) |
|
|
122
|
-
| `skip_checks` | array | No | `spec_boxes`, `console_logs`, `hardcoded_urls`, `flyway_migrations` |
|
|
226
|
+
| `skip_checks` | array | No | Checks to bypass: `spec_boxes`, `console_logs`, `hardcoded_urls`, `flyway_migrations` |
|
|
123
227
|
|
|
124
228
|
**Checks performed:**
|
|
125
229
|
|
|
126
|
-
| Check |
|
|
230
|
+
| Check | What fails it |
|
|
127
231
|
|---|---|
|
|
128
|
-
| SPEC |
|
|
129
|
-
| LOGGING | console.log() or System.out.println()
|
|
130
|
-
| SECURITY | Hardcoded
|
|
131
|
-
| FLYWAY |
|
|
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"
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
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.
|
|
132
303
|
|
|
133
304
|
---
|
|
134
305
|
|
|
135
|
-
##
|
|
306
|
+
## Workflow Overview
|
|
136
307
|
|
|
137
308
|
```
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
+
└──────────────┴──────────────────────────────────────┘
|
|
143
324
|
```
|
|
144
325
|
|
|
145
326
|
---
|
|
146
327
|
|
|
147
|
-
##
|
|
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
|
+
---
|
|
333
|
+
|
|
334
|
+
### Step 1 — Integrate (one-time setup)
|
|
335
|
+
|
|
336
|
+
Add this to your MCP client config and restart. That's it.
|
|
148
337
|
|
|
338
|
+
**Antigravity / Claude Desktop / Cline — if you have the source on disk:**
|
|
339
|
+
```json
|
|
340
|
+
{
|
|
341
|
+
"mcpServers": {
|
|
342
|
+
"secufusion-mcp": {
|
|
343
|
+
"command": "node",
|
|
344
|
+
"args": ["C:\\Users\\YourName\\Desktop\\mcp\\secufusion-mcp\\index.js"],
|
|
345
|
+
"type": "stdio"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
149
349
|
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
350
|
+
|
|
351
|
+
**Teammates / fresh machines — pulls from npm, cached after first run:**
|
|
352
|
+
```json
|
|
353
|
+
{
|
|
354
|
+
"mcpServers": {
|
|
355
|
+
"secufusion-mcp": {
|
|
356
|
+
"command": "npx",
|
|
357
|
+
"args": ["-y", "secufusion-mcp"],
|
|
358
|
+
"type": "stdio"
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
154
362
|
```
|
|
155
363
|
|
|
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.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
### Step 2 — Start a new task (Planning phase)
|
|
369
|
+
|
|
370
|
+
Just paste your Azure DevOps work item ID and description directly into the chat. No special syntax needed.
|
|
371
|
+
|
|
372
|
+
**You type:**
|
|
373
|
+
```
|
|
374
|
+
WI-2847: Add MFA enforcement for admin users on login.
|
|
375
|
+
Admin users must be forced through TOTP verification before
|
|
376
|
+
accessing any dashboard route. Exempt service accounts.
|
|
377
|
+
```
|
|
378
|
+
|
|
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
|
|
396
|
+
|
|
397
|
+
## Acceptance Criteria
|
|
398
|
+
- [ ] AC-1: (fill in from ticket)
|
|
399
|
+
- [ ] AC-2: (fill in from ticket)
|
|
400
|
+
|
|
401
|
+
## Session Log
|
|
402
|
+
| 2026-08-26T14:35:00Z | Spec created |
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
You can paste as little or as much as you want:
|
|
406
|
+
|
|
407
|
+
```
|
|
408
|
+
# Minimal — one liner
|
|
409
|
+
WI-2847: MFA for admin login with TOTP.
|
|
410
|
+
|
|
411
|
+
# Full ticket paste — straight from Azure
|
|
412
|
+
WI-2847
|
|
413
|
+
Title: Add MFA enforcement for admin users
|
|
414
|
+
Description: Admin users must complete TOTP verification...
|
|
415
|
+
Acceptance Criteria:
|
|
416
|
+
- Given admin logs in, When MFA not done, Then redirect to /mfa
|
|
417
|
+
- Service accounts in GROUP_SERVICE_ACCOUNTS are exempt
|
|
418
|
+
Priority: High
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
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:
|
|
438
|
+
|
|
439
|
+
```
|
|
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
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
A new row is also appended to the Session Log automatically, so you always have an audit trail of progress across sessions.
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
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
|
+
```
|
|
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
|
+
}
|
|
478
|
+
```
|
|
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
|
+
]
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
From this point on, the AI checks this file before every suggestion — the mistake will never be repeated, even in future sessions.
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
### Step 6 — Pre-PR checks (PR Handoff phase)
|
|
500
|
+
|
|
501
|
+
When you're done, say:
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
Run pre-PR checks for work item 2847.
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
The AI scans your entire repo and produces a report.
|
|
508
|
+
|
|
509
|
+
**✅ Everything passes — ready to ship:**
|
|
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
|
+
|
|
516
|
+
✅ [SPEC] All spec checkboxes are checked.
|
|
517
|
+
✅ [LOGGING] No console.log / System.out.println found.
|
|
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
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
**❌ Checks fail — you must fix before PR:**
|
|
532
|
+
```
|
|
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:
|
|
538
|
+
• Flyway SQL migration created for every modified JPA @Entity
|
|
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.
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
Fix the issues, run checks again, and only raise the PR once it's fully green.
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
### Quick cheat sheet
|
|
555
|
+
|
|
556
|
+
| What you want to do | What to say to the AI |
|
|
557
|
+
|---|---|
|
|
558
|
+
| Start a new task | `WI-XXXX: [paste description from Azure]` |
|
|
559
|
+
| Check where you left off | `Read the current spec` |
|
|
560
|
+
| Mark work as done | `Mark the tenantId scoping as complete in the spec` |
|
|
561
|
+
| Record a mistake | `Never do [X] again because [Y]` |
|
|
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` |
|
|
565
|
+
|
|
566
|
+
---
|
|
567
|
+
|
|
568
|
+
## How It Actually Works — The Invoker
|
|
569
|
+
|
|
570
|
+
There are two layers that need to be in place for the MCP server to work automatically.
|
|
571
|
+
|
|
572
|
+
### Layer 1 — `mcp_config.json` (makes tools available)
|
|
573
|
+
|
|
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.
|
|
575
|
+
|
|
576
|
+
```
|
|
577
|
+
IDE starts → reads mcp_config.json → spawns node index.js → tools registered
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Layer 2 — `AGENTS.md` (the invoker — tells AI when to call each tool)
|
|
581
|
+
|
|
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:
|
|
584
|
+
|
|
585
|
+
```markdown
|
|
586
|
+
# SecuFusion MCP Workflow Rules
|
|
587
|
+
|
|
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.
|
|
590
|
+
|
|
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.
|
|
595
|
+
|
|
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.
|
|
600
|
+
|
|
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.
|
|
604
|
+
|
|
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.
|
|
608
|
+
|
|
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
|
+
```
|
|
615
|
+
|
|
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
|
+
```
|
|
629
|
+
|
|
630
|
+
### Reusing across projects
|
|
631
|
+
|
|
632
|
+
Copy `.agents/AGENTS.md` into any project's root — the invoker follows you everywhere.
|
|
633
|
+
|
|
634
|
+
```
|
|
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
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
---
|
|
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
|
+
|
|
156
662
|
---
|
|
157
663
|
|
|
158
664
|
## Requirements
|
|
159
665
|
|
|
160
|
-
- Node.js >= 18.0.0
|
|
161
|
-
- An MCP-compatible AI client (Claude Desktop, Cursor, Cline, etc.)
|
|
666
|
+
- **Node.js** >= 18.0.0
|
|
667
|
+
- An MCP-compatible AI client (Antigravity, Claude Desktop, Cursor, Cline, etc.)
|
|
162
668
|
|
|
163
669
|
---
|
|
164
670
|
|
|
165
671
|
## License
|
|
166
672
|
|
|
167
|
-
ISC
|
|
673
|
+
ISC © SecuFusion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "secufusion-mcp",
|
|
3
|
-
"version": "1.0.
|
|
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
|
},
|