sad-mcp 0.1.25 → 0.1.27

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/dist/index.js CHANGED
@@ -1,13 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { readFileSync } from "fs";
5
+ import { join, dirname } from "path";
6
+ import { fileURLToPath } from "url";
4
7
  import { registerToolHandlers } from "./tools.js";
5
8
  import { registerPromptHandlers } from "./prompts.js";
6
9
  import { trackServerStart } from "./tracking.js";
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
+ const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
7
13
  async function main() {
8
14
  // Connect to Claude Desktop IMMEDIATELY — no blocking auth here
9
15
  // Auth happens lazily on first Drive API call
10
- const server = new Server({ name: "sad-mcp", version: "0.1.7" }, {
16
+ const server = new Server({ name: "sad-mcp", version: pkg.version }, {
11
17
  capabilities: {
12
18
  tools: {},
13
19
  prompts: {},
@@ -18,7 +24,7 @@ async function main() {
18
24
  trackServerStart();
19
25
  const transport = new StdioServerTransport();
20
26
  await server.connect(transport);
21
- console.error("SAD MCP server started.");
27
+ console.error(`SAD MCP server v${pkg.version} started.`);
22
28
  }
23
29
  main().catch((err) => {
24
30
  console.error("SAD MCP failed to start:", err);
package/dist/prompts.js CHANGED
@@ -22,8 +22,8 @@ const SKILLS = [
22
22
  },
23
23
  {
24
24
  id: "bpmn-diagram",
25
- name: "BPMN Diagram",
26
- description: "Create BPMN business process diagrams as interactive HTML/SVG files",
25
+ name: "BPMN Process Analysis",
26
+ description: "Analyze a business process and produce a structured BPMN 1.1 model for review",
27
27
  },
28
28
  ];
29
29
  // Internal skills: loadable via GetPrompt but not shown in ListPrompts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sad-mcp",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "MCP server for Software Analysis and Design course materials at BGU",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,125 +1,215 @@
1
1
  ---
2
2
  name: bpmn-diagram
3
- description: Create BPMN (Business Process Model and Notation) diagrams as interactive HTML/SVG files. Use this skill when the user asks to create, model, or visualize a business process, workflow diagram, BPMN diagram, or process map. This is Phase 1 structural modeling. It outputs a text model for user review before rendering.
3
+ description: Analyze a business process and produce a structured BPMN 1.1 model for review. Outputs an HTML page with visual summary and embedded JSON model. Use when the user describes a process and wants it modeled.
4
4
  ---
5
5
 
6
- # BPMN Diagram Creation — Phase 1: Structural Model
6
+ # BPMN Process Analysis
7
7
 
8
- This skill creates professional BPMN 1.1 diagrams in two steps. **This is Step 1 you will build a structural text model only. No HTML, no SVG, no code.**
8
+ Analyze a business process description and produce a structured BPMN 1.1 model. The output is an HTML page that presents the model for user review, with the machine-readable JSON model embedded for later use.
9
9
 
10
- After the user approves the model, you will use the `bpmn-render` prompt to generate the visual diagram.
10
+ **You are producing an analysis, not a diagram. Do not generate any visual diagram, SVG, or drawing.**
11
11
 
12
- ## CRITICAL RULES
12
+ ## Critical Modeling Rules
13
13
 
14
- 1. **GATEWAYS have types**: Every gateway must be classified as XOR (exclusive), AND (parallel), or OR (inclusive). This determines the marker (X / + / O) drawn inside the diamond later.
14
+ 1. **CUSTOMERS / EXTERNAL PARTIES get their own POOL**: If a customer, patient, citizen, or external company (e.g., חברת אשראי, ספק) acts independently — they are a SEPARATE POOL with message flows. They are NOT a lane. The only exception: if the organization fully controls the participant's actions within its system (e.g., customer using a bank app).
15
15
 
16
- 2. **CUSTOMERS / EXTERNAL PARTIES get their own POOL**: If a customer, patient, citizen, or external company (e.g., חברת אשראי, ספק) acts independently they are a SEPARATE POOL with message flows. They are NOT a lane. The only exception: if the organization fully controls the participant's actions within its system (e.g., customer using a bank app).
16
+ 2. **DATA STORES are mandatory**: If any task involves "block account", "generate invoice", "credit account", "update record", "register", "look up", or any read/write to persistent state a Data Store is required.
17
17
 
18
- 3. **DATA STORES are mandatory**: If any task involves "block account", "generate invoice", "credit account", "update record", "register", "look up", or any read/write to persistent state a Data Store is required with data associations to the relevant tasks.
18
+ 3. **EVERY PARTICIPANT MUST APPEAR**: If the process description mentions a customer/patient/companythey MUST appear in the model. Never omit a participant.
19
19
 
20
- 4. **EVERY PARTICIPANT MUST APPEAR**: If the process description mentions a customer/patient/companythey MUST appear in the model. Never omit a participant.
20
+ 4. **GATEWAYS have types**: Every gateway must be classified as XOR (exclusive one path), AND (parallel all paths), or OR (inclusive — one or more paths).
21
21
 
22
- ## Step 1 — Identify Participants
22
+ ## Analysis Steps
23
23
 
24
- List every actor/role mentioned. For each, classify as POOL or LANE:
24
+ ### Step 1 Identify Participants
25
25
 
26
- - **POOL** (separate): The participant acts independently and communicates with the organization from outside. Examples: customer calling to cancel, patient arriving at a clinic, citizen filing a complaint, external company (credit card company, supplier, contractor).
27
- - **LANE** (within org pool): Internal role within the organization, OR the organization fully dictates how the participant performs activities within its system.
26
+ List every actor/role. Classify each as POOL or LANE:
27
+
28
+ - **POOL**: Acts independently, communicates from outside. Examples: customer calling to cancel, patient arriving at clinic, citizen filing complaint, external company (credit card, supplier, contractor).
29
+ - **LANE**: Internal role, OR the organization controls how they perform activities within its system.
28
30
  - **The test**: "Does the organization orchestrate this participant's actions, or do they act independently?" Independent → POOL.
29
31
 
30
- ## Step 2 — Identify Tasks
32
+ ### Step 2 — Identify Tasks
31
33
 
32
- List every action/task. For each task, specify which lane or pool it belongs to.
34
+ List every action/task. Assign each to a specific lane or pool.
33
35
 
34
36
  Look for implied activities — phrases like "is expected to be in phone contact" or "will coordinate directly" describe real tasks, not annotations.
35
37
 
36
- ## Step 3 — Identify Gateways (with type!)
38
+ ### Step 3 — Identify Gateways
37
39
 
38
- List every decision point. For each gateway specify:
39
- - **Type**: XOR (only one path taken), AND (all paths taken in parallel), or OR (one or more paths)
40
+ List every decision point. For each:
41
+ - **Type**: XOR, AND, or OR
40
42
  - **Question/condition**: What is being decided
41
- - **Branches**: The possible outcomes and where each leads
42
- - **Merge**: Where branches reconverge merge gateways must also be listed with their type
43
-
44
- ## Step 4 — Identify Data Stores
43
+ - **Branches**: Possible outcomes and where each leads
44
+ - **Merge**: Where branches reconverge (merge gateways must also specify type)
45
45
 
46
- Scan all tasks for persistent storage operations.
46
+ ### Step 4 Identify Data Stores
47
47
 
48
- **Trigger words**: "system", "database", "account", "record", "registry".
49
- **Action verbs**: "block account", "update record", "generate invoice", "credit account", "register", "log", "store", "look up", "check status".
48
+ Scan tasks for persistent storage. **Trigger words**: "system", "database", "account", "record", "registry". **Action verbs**: "block account", "update record", "generate invoice", "credit account", "register", "log", "store", "look up", "check status".
50
49
 
51
- If ANY task reads/writes shared persistent state → Data Store required. A system = a data store. An account = a data store.
50
+ Any task that reads/writes shared persistent state → Data Store required. A system = a data store. An account = a data store.
52
51
 
53
- List each data store with its name and which tasks connect to it (read/write).
52
+ ### Step 5 Identify Data Objects
54
53
 
55
- ## Step 5 Identify Data Objects
54
+ List transient data flowing between tasks (e.g., "בקשת ביטול", "חשבונית זיכוי"). These are documents, not persistent systems.
56
55
 
57
- List specific pieces of data flowing between tasks (e.g., "בקשת ביטול", "חשבונית זיכוי"). These are transient documents, not persistent systems.
56
+ ### Step 6 Identify Flows
58
57
 
59
- ## Step 6 Identify Flows
60
-
61
- - **Sequence flows** (within a pool): The order of tasks within each pool
58
+ - **Sequence flows** (within a pool): Task ordering within each pool
62
59
  - **Message flows** (between pools): Every communication between separate pools. Check bidirectional — every message expecting a response needs a return flow.
63
60
  - **Data associations**: Connections between tasks and data stores / data objects.
64
61
 
65
- ## Step 7 — Identify Events
62
+ ### Step 7 — Identify Events
66
63
 
67
64
  - **Start events**: One per pool
68
65
  - **End events**: One or more per pool (different outcomes)
69
- - **Intermediate events**: For passive waiting (not tasks) — when a participant waits for a signal/message from another participant
66
+ - **Intermediate events**: For passive waiting — when a participant waits for a signal/message
70
67
 
71
- ## Step 8 — Verify Completeness
68
+ ### Step 8 — Verify Completeness & Note Assumptions
72
69
 
73
70
  - Every pool has a complete flow: start → tasks/gateways → end
74
71
  - External parties have their full process modeled, not just a single task
75
- - Every message that expects a response has a return message flow
76
-
77
- ## Required Output Format
78
-
79
- Output the model in this exact format:
80
-
72
+ - List any assumptions you made about the process
73
+ - List any open questions where the description was ambiguous
74
+
75
+ ## Output Format
76
+
77
+ Generate a **single self-contained HTML file** with two parts:
78
+
79
+ ### Part 1: Visual Presentation (what the user sees)
80
+
81
+ A clean, RTL Hebrew page with these sections:
82
+
83
+ 1. **Header**: Process title in Hebrew, "ניתוח תהליך BPMN 1.1" subtitle
84
+ 2. **Structure Overview card**: Shows number of pools and lanes as a simple hierarchy:
85
+ ```
86
+ 🏊 מאגרים (Pools):
87
+ ├── לקוח (מאגר חיצוני — פועל באופן עצמאי)
88
+ └── חברת אישימוטו (מאגר ארגוני)
89
+ ├── שירות לקוחות
90
+ ├── שימור לקוחות
91
+ └── הנהלת חשבונות
92
+ ```
93
+ 3. **Workflow per pool/lane card**: For each pool and lane, show the task flow as a numbered list with gateway branches indented:
94
+ ```
95
+ שירות לקוחות:
96
+ 1. קבלת פנייה ובדיקת תאריך
97
+ 2. ⬦ XOR: כמה ימים מאז הרכישה?
98
+ ├── ≤ 7 ימים → 3. ביטול מנוי → 4. חסימת חשבון
99
+ ├── 7-14 ימים → העברה לשימור לקוחות
100
+ └── > 14 ימים → 5. הודעה על דחיית הבקשה
101
+ ```
102
+ 4. **Gateways card**: Table of all gateways with type, question, and branches
103
+ 5. **Data Stores card**: Each store with its connected tasks (reads/writes)
104
+ 6. **Data Objects card**: Each object with source and target
105
+ 7. **Message Flows card**: Between which pools, what's communicated, direction
106
+ 8. **Assumptions & Open Questions card**: Yellow/orange highlight for attention
107
+ 9. **Footer**: "כשהמודל מאושר, ניתן לבקש: 'צייר את דיאגרמת ה-BPMN'"
108
+
109
+ **Styling guidelines:**
110
+ - Use `Noto Sans Hebrew` from Google Fonts
111
+ - `lang="he"` and `dir="rtl"` on the HTML element
112
+ - Dark theme: `#1a1a2e` background, `#16213e` cards, white/light text
113
+ - Color-coded cards: pools in blue, gateways in amber, data stores in green, messages in purple, assumptions in orange
114
+ - Clean, modern look with rounded corners and subtle shadows
115
+
116
+ ### Part 2: JSON Model (embedded, machine-readable)
117
+
118
+ Embed the structured model in a `<script type="application/json" id="bpmn-model">` tag. This is not visible to the user but available for later processing.
119
+
120
+ **JSON Schema:**
121
+
122
+ ```json
123
+ {
124
+ "title": { "he": "שם התהליך", "en": "Process Name" },
125
+ "pools": [
126
+ {
127
+ "id": "pool-id",
128
+ "name": "שם המאגר",
129
+ "type": "external",
130
+ "reason": "why this is a separate pool",
131
+ "lanes": []
132
+ },
133
+ {
134
+ "id": "org-id",
135
+ "name": "שם הארגון",
136
+ "type": "organization",
137
+ "reason": "main organization",
138
+ "lanes": [
139
+ { "id": "lane-id", "name": "שם המסלול" }
140
+ ]
141
+ }
142
+ ],
143
+ "tasks": [
144
+ {
145
+ "id": "task-id",
146
+ "name": "שם המשימה",
147
+ "pool": "pool-id",
148
+ "lane": "lane-id-or-null",
149
+ "description": "optional details"
150
+ }
151
+ ],
152
+ "gateways": [
153
+ {
154
+ "id": "gw-id",
155
+ "type": "XOR",
156
+ "role": "split",
157
+ "question": "מה השאלה?",
158
+ "pool": "pool-id",
159
+ "lane": "lane-id-or-null",
160
+ "branches": [
161
+ { "label": "תיאור הענף", "target": "task-or-gw-id" }
162
+ ]
163
+ }
164
+ ],
165
+ "dataStores": [
166
+ {
167
+ "id": "ds-id",
168
+ "name": "שם מאגר הנתונים",
169
+ "reads": ["task-id-1"],
170
+ "writes": ["task-id-2"]
171
+ }
172
+ ],
173
+ "dataObjects": [
174
+ {
175
+ "id": "do-id",
176
+ "name": "שם מסמך/נתון",
177
+ "from": "task-id",
178
+ "to": "task-id"
179
+ }
180
+ ],
181
+ "events": [
182
+ {
183
+ "id": "event-id",
184
+ "type": "start",
185
+ "pool": "pool-id",
186
+ "lane": "lane-id-or-null",
187
+ "name": "תיאור האירוע"
188
+ }
189
+ ],
190
+ "sequenceFlows": [
191
+ { "from": "element-id", "to": "element-id", "label": "optional" }
192
+ ],
193
+ "messageFlows": [
194
+ { "from": "pool-id", "to": "pool-id", "description": "מה מועבר" }
195
+ ],
196
+ "assumptions": [
197
+ "הנחה שנעשתה..."
198
+ ],
199
+ "openQuestions": [
200
+ "שאלה שדורשת הבהרה..."
201
+ ]
202
+ }
81
203
  ```
82
- STRUCTURAL MODEL:
83
-
84
- POOLS:
85
- - [Pool name] — [reason: acts independently / external company]
86
- Tasks: [task1] → [task2] → ...
87
- Start: [description]
88
- End(s): [description(s)]
89
-
90
- ORGANIZATION POOL: [org name]
91
- LANE: [lane name]
92
- Tasks: [task1] → [task2] → ...
93
- LANE: [lane name]
94
- Tasks: ...
95
- Start: [description]
96
- End(s): [description(s)]
97
-
98
- GATEWAYS:
99
- - [G1] Type: XOR | Question: [question] | In: [lane/pool] | Branches: [branch1 → ..., branch2 → ...]
100
- - [G2] Type: XOR (merge) | In: [lane/pool] | Merges: [branches from G1]
101
-
102
- DATA STORES:
103
- - [Store name] — reads: [task X, task Y] | writes: [task Z]
104
-
105
- DATA OBJECTS:
106
- - [Object name] — from: [task X] → to: [task Y]
107
-
108
- MESSAGE FLOWS:
109
- - [Pool A] → [Pool B]: [what is communicated]
110
- - [Pool B] → [Pool A]: [response]
111
- ```
112
-
113
- ## After Outputting the Model
114
204
 
115
- Present the model and ask the user:
205
+ ## After Generating the Output
116
206
 
117
- **"הנה המודל המבני של התהליך. האם לעבור לשלב הבא ולייצר את הדיאגרמה, או שיש שינויים?"**
207
+ Tell the user in the conversation (not in the HTML):
118
208
 
119
- When the user confirms, use the **`bpmn-render`** prompt to generate the visual diagram. Pass it the approved structural model.
209
+ **"יצרתי ניתוח מבני של התהליך. אפשר לעיין בקובץ ה-HTML ולבדוק שהמודל נכון. כשהמודל מאושר, אפשר לבקש ממני לצייר את דיאגרמת ה-BPMN."**
120
210
 
121
211
  ## Hebrew Language Guidelines
122
212
 
123
- Use the **male grammatical form** (זכר) for all roles and participants:
213
+ Use the **male grammatical form** (זכר) for all roles:
124
214
  - ✅ רופא, אח, מטופל, לקוח, מנהל, עובד, משתמש, סטודנט
125
215
  - ❌ אחות, מטופלת, לקוחה, מנהלת, מזכירה