schemeog-mcp 2.7.0 → 2.8.2

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 (3) hide show
  1. package/README.md +89 -93
  2. package/index.js +50 -21
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,14 @@
1
- # SchemeOG MCP Server v2.7
1
+ # SchemeOG MCP Server v2.8
2
2
 
3
3
  MCP server for [SchemeOG Cloud](https://scheme.smartlaunchhub.com) — create diagrams and flowcharts with AI.
4
4
 
5
+ ## Features
6
+
7
+ - **15 commands** for schemas, projects, and tags
8
+ - **Auto-refresh**: Browser automatically reloads when MCP updates schema
9
+ - **Smart positioning**: Existing elements keep their positions, new elements get auto-layout
10
+ - **No coordinate conflicts**: MCP ignores x/y to prevent overlapping cards
11
+
5
12
  ## 15 Commands
6
13
 
7
14
  ### Schemas (6 commands)
@@ -71,88 +78,6 @@ In `~/.claude.json` (or Cline settings):
71
78
 
72
79
  ## Schema Data Format
73
80
 
74
- ### Full schema example (inline connections)
75
-
76
- Connections are defined **inside each element** in the `connections` array:
77
-
78
- ```json
79
- {
80
- "name": "User Registration Flow",
81
- "description": "User registration process",
82
- "elements": [
83
- {
84
- "id": "start",
85
- "type": "card",
86
- "title": "Registration Form",
87
- "color": "light_green",
88
- "x": 100,
89
- "y": 100,
90
- "tags": ["user"],
91
- "description": "User fills in email and password",
92
- "connections": [
93
- {"to": "validate", "label": "submit"}
94
- ]
95
- },
96
- {
97
- "id": "validate",
98
- "type": "condition",
99
- "title": "Validate Data",
100
- "color": "light_yellow",
101
- "x": 300,
102
- "y": 100,
103
- "tags": ["system", "check"],
104
- "description": "Check email format and password strength",
105
- "connections": [
106
- {"to": "save", "label": "valid"},
107
- {"to": "error", "label": "invalid", "style": "dashed"}
108
- ]
109
- },
110
- {
111
- "id": "save",
112
- "type": "card",
113
- "title": "Save to Database",
114
- "color": "light_blue",
115
- "x": 500,
116
- "y": 50,
117
- "tags": ["system"],
118
- "description": "Create user record in database",
119
- "connections": [
120
- {"to": "success"}
121
- ]
122
- },
123
- {
124
- "id": "error",
125
- "type": "card",
126
- "title": "Validation Error",
127
- "color": "light_red",
128
- "x": 500,
129
- "y": 150,
130
- "tags": ["system", "error"],
131
- "description": "Show validation errors to user",
132
- "connections": [
133
- {"to": "start", "label": "retry"}
134
- ]
135
- },
136
- {
137
- "id": "success",
138
- "type": "card",
139
- "title": "Registration Complete",
140
- "color": "light_green",
141
- "x": 700,
142
- "y": 100,
143
- "tags": ["user"],
144
- "description": "User successfully registered"
145
- }
146
- ],
147
- "tagsDictionary": [
148
- {"id": "tag-user", "name": "user", "color": "#4CAF50"},
149
- {"id": "tag-system", "name": "system", "color": "#2196F3"},
150
- {"id": "tag-check", "name": "check", "color": "#FF9800"},
151
- {"id": "tag-error", "name": "error", "color": "#F44336"}
152
- ]
153
- }
154
- ```
155
-
156
81
  ### Element (card or condition)
157
82
 
158
83
  ```json
@@ -161,8 +86,6 @@ Connections are defined **inside each element** in the `connections` array:
161
86
  "type": "card",
162
87
  "title": "Card Title",
163
88
  "color": "light_blue",
164
- "x": 100,
165
- "y": 200,
166
89
  "tags": ["tag1", "tag2"],
167
90
  "description": "Detailed description",
168
91
  "borderColor": "blue",
@@ -174,14 +97,16 @@ Connections are defined **inside each element** in the `connections` array:
174
97
  }
175
98
  ```
176
99
 
100
+ **IMPORTANT: Do NOT specify `x` and `y` coordinates!**
101
+ - MCP automatically ignores coordinates to prevent cards from overlapping
102
+ - Existing elements keep their positions
103
+ - New elements are automatically positioned by auto-layout
104
+ - This prevents the common problem of Claude copying coordinates from existing cards
105
+
177
106
  **Element types:**
178
107
  - `card` — regular process/action card
179
108
  - `condition` — decision point (diamond shape)
180
109
 
181
- **Coordinates (`x`, `y`):**
182
- - Optional but recommended for precise positioning
183
- - If omitted, auto-layout will arrange elements
184
-
185
110
  **Completion status (`completed`):**
186
111
  - `true` — card is marked as completed (done)
187
112
  - `false` or omitted — card is not completed
@@ -224,14 +149,73 @@ Connections are defined inside each element's `connections` array:
224
149
 
225
150
  **Line styles (`style`):** `solid` (default), `dashed`, `dotted`
226
151
 
152
+ ### Full schema example
153
+
154
+ ```json
155
+ {
156
+ "name": "User Registration Flow",
157
+ "description": "User registration process",
158
+ "elements": [
159
+ {
160
+ "id": "start",
161
+ "type": "card",
162
+ "title": "Registration Form",
163
+ "color": "light_green",
164
+ "tags": ["user"],
165
+ "description": "User fills in email and password",
166
+ "connections": [
167
+ {"to": "validate", "label": "submit"}
168
+ ]
169
+ },
170
+ {
171
+ "id": "validate",
172
+ "type": "condition",
173
+ "title": "Validate Data",
174
+ "color": "light_yellow",
175
+ "tags": ["system"],
176
+ "connections": [
177
+ {"to": "save", "label": "valid"},
178
+ {"to": "error", "label": "invalid"}
179
+ ]
180
+ },
181
+ {
182
+ "id": "save",
183
+ "type": "card",
184
+ "title": "Save to Database",
185
+ "color": "light_blue",
186
+ "tags": ["system"],
187
+ "connections": [{"to": "success"}]
188
+ },
189
+ {
190
+ "id": "error",
191
+ "type": "card",
192
+ "title": "Validation Error",
193
+ "color": "light_red",
194
+ "tags": ["system"],
195
+ "connections": [{"to": "start", "label": "retry"}]
196
+ },
197
+ {
198
+ "id": "success",
199
+ "type": "card",
200
+ "title": "Registration Complete",
201
+ "color": "light_green",
202
+ "tags": ["user"]
203
+ }
204
+ ],
205
+ "tagsDictionary": [
206
+ {"id": "tag-user", "name": "user", "color": "#4CAF50"},
207
+ {"id": "tag-system", "name": "system", "color": "#2196F3"}
208
+ ]
209
+ }
210
+ ```
211
+
227
212
  ### Tags Dictionary (tagsDictionary)
228
213
 
229
214
  ```json
230
215
  {
231
216
  "tagsDictionary": [
232
217
  {"id": "tag-1", "name": "system", "color": "#2196F3"},
233
- {"id": "tag-2", "name": "user", "color": "#4CAF50"},
234
- {"id": "tag-3", "name": "check", "color": "#FF9800"}
218
+ {"id": "tag-2", "name": "user", "color": "#4CAF50"}
235
219
  ]
236
220
  }
237
221
  ```
@@ -240,13 +224,25 @@ Connections are defined inside each element's `connections` array:
240
224
  - `system`, `user`, `admin`
241
225
  - `client`, `manager`, `bot`
242
226
 
227
+ ## Auto-Refresh Feature
228
+
229
+ When you edit a schema via MCP while viewing it in the browser:
230
+ - Browser automatically detects changes every 3 seconds
231
+ - Page reloads ONLY when changes are made by MCP (not by your own edits)
232
+ - No manual refresh needed — just edit via MCP and watch the browser update!
233
+
234
+ **How it works:**
235
+ - MCP marks all updates with `updatedBy: 'mcp'`
236
+ - Browser ignores its own updates (`updatedBy: 'web'`)
237
+ - This prevents infinite reload loops when you edit in browser
238
+
243
239
  ## Opening Schema by URL
244
240
 
245
241
  You can open any schema by URL using `get_schema_by_url`:
246
242
 
247
243
  ```
248
- # Canvas URL
249
- https://scheme.smartlaunchhub.com/canvas?id=abc123
244
+ # Canvas URL (основной формат)
245
+ https://scheme.smartlaunchhub.com/canvas?schema=abc123
250
246
 
251
247
  # Shared link
252
248
  https://scheme.smartlaunchhub.com/shared/xyz789
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * SchemeOG MCP Server v2.6
4
+ * SchemeOG MCP Server v2.8
5
5
  *
6
6
  * MCP сервер для работы со схемами, проектами и тегами в SchemeOG Cloud.
7
7
  *
@@ -399,13 +399,13 @@ function normalizeElements(elements) {
399
399
  fixed.tags = el.tags;
400
400
  }
401
401
 
402
- // Координаты x, y — СОХРАНЯЕМ! (нужны для правильного отображения)
403
- if (typeof el.x === "number") {
404
- fixed.x = el.x;
405
- }
406
- if (typeof el.y === "number") {
407
- fixed.y = el.y;
408
- }
402
+ // Координаты x, y — НЕ сохраняем от MCP!
403
+ // Причина: Claude часто копирует координаты существующих карточек,
404
+ // что приводит к наложению карточек друг на друга.
405
+ // Клиент сам расположит новые карточки через auto-layout.
406
+ //
407
+ // Если нужно ОБНОВИТЬ существующий элемент с сохранением позиции,
408
+ // координаты будут взяты из текущих данных схемы на сервере.
409
409
 
410
410
  // Completed — отметка о завершении карточки
411
411
  if (typeof el.completed === "boolean") {
@@ -551,9 +551,9 @@ const TOOLS = [
551
551
  description: `Получить схему по URL ссылке.
552
552
 
553
553
  Поддерживаемые форматы URL:
554
- - https://scheme.smartlaunchhub.com/canvas?schema=ID
555
- - https://scheme.smartlaunchhub.com/canvas?id=ID
554
+ - https://scheme.smartlaunchhub.com/canvas?schema=ID (основной формат)
556
555
  - scheme.smartlaunchhub.com/canvas?schema=ID
556
+ - https://scheme.smartlaunchhub.com/canvas?id=ID (устаревший)
557
557
 
558
558
  Автоматически извлекает ID схемы из URL и проверяет доступ.
559
559
  Если у пользователя есть доступ к схеме — возвращает полные данные.
@@ -577,6 +577,10 @@ const TOOLS = [
577
577
 
578
578
  ВАЖНО: Генерируй схему с elements и tagsDictionary. Связи указывай ВНУТРИ элементов!
579
579
 
580
+ ⚠️ КРИТИЧНО: НЕ указывай x и y координаты для НОВЫХ элементов!
581
+ Карточки без координат автоматически расположатся через auto-layout.
582
+ Если указать x/y — карточки наложатся друг на друга!
583
+
580
584
  Параметры:
581
585
  - name: название схемы (обязательно)
582
586
  - description: описание
@@ -594,6 +598,7 @@ const TOOLS = [
594
598
  "tags": ["тег1"], // массив названий тегов (опционально)
595
599
  "description": "Описание", // подробное описание (опционально)
596
600
  "connections": [{"to": "target_id", "label": "подпись"}] // ИСХОДЯЩИЕ СВЯЗИ (опционально)
601
+ // НЕ указывай x, y — они рассчитаются автоматически!
597
602
  }
598
603
 
599
604
  СВЯЗИ (inline формат — внутри элемента):
@@ -609,7 +614,7 @@ const TOOLS = [
609
614
  "color": "#2196F3" // цвет в HEX
610
615
  }
611
616
 
612
- Пример: создать схему регистрации:
617
+ Пример: создать схему регистрации (БЕЗ координат x/y!):
613
618
  {
614
619
  "name": "User Registration",
615
620
  "elements": [
@@ -974,9 +979,9 @@ const TOOLS = [
974
979
  /**
975
980
  * Извлечь ID схемы из URL
976
981
  * Поддерживает форматы:
977
- * - https://scheme.smartlaunchhub.com/canvas?schema=ID
978
- * - https://scheme.smartlaunchhub.com/canvas?id=ID
982
+ * - https://scheme.smartlaunchhub.com/canvas?schema=ID (основной)
979
983
  * - scheme.smartlaunchhub.com/canvas?schema=ID
984
+ * - https://scheme.smartlaunchhub.com/canvas?id=ID (устаревший)
980
985
  */
981
986
  function extractSchemaIdFromUrl(url) {
982
987
  if (!url || typeof url !== "string") return null;
@@ -1139,7 +1144,7 @@ ID: ${schema.id}
1139
1144
  Проект: ${schema.project?.name || "Общие"}
1140
1145
  Элементов: ${schema.data?.elements?.length || 0}
1141
1146
  Связей: ${schema.data?.connections?.length || 0}
1142
- URL: ${API_BASE_URL}/canvas?id=${schema.id}
1147
+ URL: ${API_BASE_URL}/canvas?schema=${schema.id}
1143
1148
 
1144
1149
  Элементы:
1145
1150
  ${JSON.stringify(schema.data?.elements || [], null, 2)}
@@ -1246,7 +1251,7 @@ ${projectInfo}
1246
1251
  Элементов: ${data.elements.length}
1247
1252
  Связей: ${data.connections.length}
1248
1253
 
1249
- URL: ${API_BASE_URL}/canvas?id=${result.schema.id}
1254
+ URL: ${API_BASE_URL}/canvas?schema=${result.schema.id}
1250
1255
 
1251
1256
  Открой ссылку в браузере чтобы увидеть схему.${warningsText}`,
1252
1257
  }],
@@ -1284,6 +1289,24 @@ URL: ${API_BASE_URL}/canvas?id=${result.schema.id}
1284
1289
  };
1285
1290
  }
1286
1291
 
1292
+ // ВАЖНО: Сохраняем координаты существующих элементов!
1293
+ // MCP не передаёт x/y, поэтому берём их из текущих данных.
1294
+ const existingPositions = {};
1295
+ (currentData.elements || []).forEach(el => {
1296
+ if (el.id && (typeof el.x === 'number' || typeof el.y === 'number')) {
1297
+ existingPositions[el.id] = { x: el.x, y: el.y };
1298
+ }
1299
+ });
1300
+
1301
+ // Применяем сохранённые координаты к элементам
1302
+ normalized.elements.forEach(el => {
1303
+ if (existingPositions[el.id]) {
1304
+ el.x = existingPositions[el.id].x;
1305
+ el.y = existingPositions[el.id].y;
1306
+ }
1307
+ // Новые элементы (без координат) будут расположены через auto-layout на клиенте
1308
+ });
1309
+
1287
1310
  newData.elements = normalized.elements;
1288
1311
  // Связи извлекаются из элементов (inline формат)
1289
1312
  newData.connections = normalized.extractedConnections;
@@ -1291,6 +1314,9 @@ URL: ${API_BASE_URL}/canvas?id=${result.schema.id}
1291
1314
  }
1292
1315
  updateBody.data = newData;
1293
1316
 
1317
+ // ВАЖНО: Отправляем updatedBy: 'mcp' чтобы браузер знал что обновление от MCP
1318
+ updateBody.updatedBy = 'mcp';
1319
+
1294
1320
  const result = await apiRequest(`/schemas/${schema_id}`, {
1295
1321
  method: "PUT",
1296
1322
  body: JSON.stringify(updateBody),
@@ -1314,7 +1340,7 @@ URL: ${API_BASE_URL}/canvas?id=${result.schema.id}
1314
1340
  Элементов: ${result.schema.data?.elements?.length || 0}
1315
1341
  Связей: ${result.schema.data?.connections?.length || 0}
1316
1342
 
1317
- URL: ${API_BASE_URL}/canvas?id=${schema_id}${warningsText}`,
1343
+ URL: ${API_BASE_URL}/canvas?schema=${schema_id}${warningsText}`,
1318
1344
  }],
1319
1345
  };
1320
1346
  }
@@ -1464,11 +1490,12 @@ URL: ${API_BASE_URL}/canvas?id=${schema_id}${warningsText}`,
1464
1490
  const tagsDictionary = currentData.tagsDictionary || [];
1465
1491
  tagsDictionary.push(newTag);
1466
1492
 
1467
- // Обновляем схему
1493
+ // Обновляем схему (с пометкой от MCP)
1468
1494
  await apiRequest(`/schemas/${schema_id}`, {
1469
1495
  method: "PUT",
1470
1496
  body: JSON.stringify({
1471
1497
  data: { ...currentData, tagsDictionary },
1498
+ updatedBy: 'mcp',
1472
1499
  }),
1473
1500
  });
1474
1501
 
@@ -1498,11 +1525,12 @@ URL: ${API_BASE_URL}/canvas?id=${schema_id}${warningsText}`,
1498
1525
  return el;
1499
1526
  });
1500
1527
 
1501
- // Обновляем схему
1528
+ // Обновляем схему (с пометкой от MCP)
1502
1529
  await apiRequest(`/schemas/${schema_id}`, {
1503
1530
  method: "PUT",
1504
1531
  body: JSON.stringify({
1505
1532
  data: { ...currentData, tagsDictionary, elements },
1533
+ updatedBy: 'mcp',
1506
1534
  }),
1507
1535
  });
1508
1536
 
@@ -1540,11 +1568,12 @@ URL: ${API_BASE_URL}/canvas?id=${schema_id}${warningsText}`,
1540
1568
  return el;
1541
1569
  });
1542
1570
 
1543
- // Обновляем схему
1571
+ // Обновляем схему (с пометкой от MCP)
1544
1572
  await apiRequest(`/schemas/${schema_id}`, {
1545
1573
  method: "PUT",
1546
1574
  body: JSON.stringify({
1547
1575
  data: { ...currentData, elements },
1576
+ updatedBy: 'mcp',
1548
1577
  }),
1549
1578
  });
1550
1579
 
@@ -1619,7 +1648,7 @@ async function main() {
1619
1648
  const server = new Server(
1620
1649
  {
1621
1650
  name: "schemeog-mcp",
1622
- version: "2.6.0",
1651
+ version: "2.8.1",
1623
1652
  },
1624
1653
  {
1625
1654
  capabilities: {
@@ -1649,7 +1678,7 @@ async function main() {
1649
1678
  const transport = new StdioServerTransport();
1650
1679
  await server.connect(transport);
1651
1680
 
1652
- console.error("SchemeOG MCP Server v2.6 запущен");
1681
+ console.error("SchemeOG MCP Server v2.8.1 запущен");
1653
1682
  }
1654
1683
 
1655
1684
  main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schemeog-mcp",
3
- "version": "2.7.0",
3
+ "version": "2.8.2",
4
4
  "description": "MCP Server for SchemeOG Cloud - Create and manage visual diagrams and flowcharts with AI assistance",
5
5
  "type": "module",
6
6
  "main": "index.js",