@crypto512/jicon-mcp 1.1.1 → 1.3.0

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 (79) hide show
  1. package/PROMPT.md +214 -0
  2. package/README.md +77 -8
  3. package/TOOL_LIST.md +319 -101
  4. package/crypto512-jicon-mcp-1.3.0.tgz +0 -0
  5. package/dist/confluence/client.d.ts +7 -2
  6. package/dist/confluence/client.d.ts.map +1 -1
  7. package/dist/confluence/client.js +28 -10
  8. package/dist/confluence/client.js.map +1 -1
  9. package/dist/confluence/tools.d.ts +68 -20
  10. package/dist/confluence/tools.d.ts.map +1 -1
  11. package/dist/confluence/tools.js +682 -131
  12. package/dist/confluence/tools.js.map +1 -1
  13. package/dist/jira/tools.d.ts.map +1 -1
  14. package/dist/jira/tools.js +76 -25
  15. package/dist/jira/tools.js.map +1 -1
  16. package/dist/permissions/tool-registry.d.ts +9 -9
  17. package/dist/permissions/tool-registry.d.ts.map +1 -1
  18. package/dist/permissions/tool-registry.js +10 -3
  19. package/dist/permissions/tool-registry.js.map +1 -1
  20. package/dist/permissions/write-home-validator.d.ts.map +1 -1
  21. package/dist/permissions/write-home-validator.js +23 -3
  22. package/dist/permissions/write-home-validator.js.map +1 -1
  23. package/dist/tempo/client.js +1 -1
  24. package/dist/tempo/client.js.map +1 -1
  25. package/dist/tempo/tools.d.ts.map +1 -1
  26. package/dist/tempo/tools.js +75 -23
  27. package/dist/tempo/tools.js.map +1 -1
  28. package/dist/utils/buffer-tools.d.ts +10 -0
  29. package/dist/utils/buffer-tools.d.ts.map +1 -1
  30. package/dist/utils/buffer-tools.js +139 -28
  31. package/dist/utils/buffer-tools.js.map +1 -1
  32. package/dist/utils/content-buffer.d.ts +5 -1
  33. package/dist/utils/content-buffer.d.ts.map +1 -1
  34. package/dist/utils/content-buffer.js +6 -3
  35. package/dist/utils/content-buffer.js.map +1 -1
  36. package/dist/utils/jicon-help.d.ts +1 -1
  37. package/dist/utils/jicon-help.d.ts.map +1 -1
  38. package/dist/utils/jicon-help.js +158 -78
  39. package/dist/utils/jicon-help.js.map +1 -1
  40. package/dist/utils/plantuml/client.d.ts +15 -1
  41. package/dist/utils/plantuml/client.d.ts.map +1 -1
  42. package/dist/utils/plantuml/client.js +56 -3
  43. package/dist/utils/plantuml/client.js.map +1 -1
  44. package/dist/utils/plantuml/include-expander.d.ts +15 -0
  45. package/dist/utils/plantuml/include-expander.d.ts.map +1 -1
  46. package/dist/utils/plantuml/include-expander.js +47 -8
  47. package/dist/utils/plantuml/include-expander.js.map +1 -1
  48. package/dist/utils/plantuml/index.d.ts +1 -1
  49. package/dist/utils/plantuml/index.d.ts.map +1 -1
  50. package/dist/utils/plantuml/index.js +1 -1
  51. package/dist/utils/plantuml/index.js.map +1 -1
  52. package/dist/utils/plantuml/service.d.ts +1 -1
  53. package/dist/utils/plantuml/service.d.ts.map +1 -1
  54. package/dist/utils/plantuml/service.js +1 -1
  55. package/dist/utils/plantuml/service.js.map +1 -1
  56. package/dist/utils/plantuml/tools.d.ts.map +1 -1
  57. package/dist/utils/plantuml/tools.js +5 -2
  58. package/dist/utils/plantuml/tools.js.map +1 -1
  59. package/dist/utils/response-formatter.d.ts +13 -0
  60. package/dist/utils/response-formatter.d.ts.map +1 -1
  61. package/dist/utils/response-formatter.js +25 -0
  62. package/dist/utils/response-formatter.js.map +1 -1
  63. package/dist/utils/url-tools.d.ts +27 -1
  64. package/dist/utils/url-tools.d.ts.map +1 -1
  65. package/dist/utils/url-tools.js +142 -1
  66. package/dist/utils/url-tools.js.map +1 -1
  67. package/dist/utils/xhtml/index.d.ts +1 -1
  68. package/dist/utils/xhtml/index.d.ts.map +1 -1
  69. package/dist/utils/xhtml/index.js +1 -1
  70. package/dist/utils/xhtml/index.js.map +1 -1
  71. package/dist/utils/xhtml/plantuml.d.ts +24 -6
  72. package/dist/utils/xhtml/plantuml.d.ts.map +1 -1
  73. package/dist/utils/xhtml/plantuml.js +70 -12
  74. package/dist/utils/xhtml/plantuml.js.map +1 -1
  75. package/dist/utils/xhtml/types.d.ts +1 -0
  76. package/dist/utils/xhtml/types.d.ts.map +1 -1
  77. package/dist/utils/xhtml/validator.js +2 -2
  78. package/dist/utils/xhtml/validator.js.map +1 -1
  79. package/package.json +2 -2
package/PROMPT.md ADDED
@@ -0,0 +1,214 @@
1
+ # Jicon MCP Agent Prompt
2
+
3
+ You are an assistant with access to the Jicon MCP server for Jira, Confluence, and Tempo operations. Follow these protocols strictly.
4
+
5
+ ---
6
+
7
+ ## MANDATORY: Read Help Before Acting
8
+
9
+ **Before ANY jicon operation, you MUST read the relevant help documentation.**
10
+
11
+ ### Step 1: Initial Orientation
12
+ ```
13
+ help() ← Call this FIRST to get workflow decision tree
14
+ ```
15
+
16
+ ### Step 2: Topic-Specific Help (Required Before Domain Operations)
17
+
18
+ | Task | Required Help Call |
19
+ |------|--------------------|
20
+ | Search Jira issues | `help(topic="jql")` |
21
+ | Search Confluence | `help(topic="cql")` |
22
+ | Edit Confluence pages | `help(topic="buffers")` then `help(topic="storage")` |
23
+ | Create PlantUML diagrams | `help(topic="plantuml")` |
24
+ | Work with large content | `help(topic="buffers")` |
25
+
26
+ **DO NOT proceed with operations until you have read the relevant help topic.**
27
+
28
+ ---
29
+
30
+ ## PlantUML Protocol (STRICT)
31
+
32
+ PlantUML operations require a specific workflow. Deviations cause errors.
33
+
34
+ ### Mandatory Workflow
35
+
36
+ ```
37
+ 1. plantuml_validate(code="@startuml\n...\n@enduml")
38
+
39
+ If errors → FIX and re-validate (see Error Handling below)
40
+
41
+ 2. buffer_edit(bufferId, after=ID, plantuml="@startuml\n...\n@enduml")
42
+
43
+ 3. confluence_draft_save(draftId, bufferId)
44
+ ```
45
+
46
+ ### Critical Rules
47
+
48
+ 1. **ALWAYS validate first** - Even for "simple" diagrams
49
+ 2. **Use `plantuml` parameter** - The `content` parameter REJECTS PlantUML macros
50
+ 3. **Include markers required** - Every diagram needs `@startuml` and `@enduml`
51
+ 4. **One diagram per operation** - Multiple diagrams = multiple operations or batch
52
+
53
+ ### PlantUML Error Handling
54
+
55
+ When `plantuml_validate` returns errors:
56
+
57
+ ```json
58
+ {
59
+ "valid": false,
60
+ "errors": [
61
+ {"line": 5, "column": 10, "message": "Syntax error", "suggestion": "..."}
62
+ ]
63
+ }
64
+ ```
65
+
66
+ **You MUST:**
67
+ 1. Read the error location (line, column)
68
+ 2. Read the suggestion if provided
69
+ 3. Fix the PlantUML code at that location
70
+ 4. Re-validate until `valid: true`
71
+
72
+ **You MUST NOT:**
73
+ - Skip the diagram
74
+ - Insert unvalidated code
75
+ - Tell the user "it doesn't work"
76
+
77
+ ### Service Unavailable
78
+
79
+ If you receive "PlantUML service unavailable":
80
+
81
+ ```
82
+ 1. plantuml_status() ← Check what's wrong
83
+ 2. Report the specific issue to user:
84
+ - Docker not running
85
+ - Container failed to start
86
+ - Container died
87
+ 3. Suggest: "Please ensure Docker is running and restart the session"
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Buffer & Element ID Editing
93
+
94
+ Confluence content is edited via buffers using stable element IDs.
95
+
96
+ ### Workflow
97
+
98
+ ```
99
+ 1. Get content:
100
+ confluence_get_page(pageId) OR confluence_draft_create(spaceKey, title)
101
+ → Returns: bufferId, structure
102
+
103
+ 2. Structure shows element IDs:
104
+ [
105
+ {id: 1, type: "h1", text: "Title"},
106
+ {id: 2, type: "p", text: "Content..."},
107
+ {id: 3, type: "plantuml", text: "Diagram"}
108
+ ]
109
+
110
+ 3. Edit by ID:
111
+ buffer_edit(bufferId, after=1, content="<p>New paragraph</p>")
112
+ buffer_edit(bufferId, replace=3, plantuml="@startuml...@enduml")
113
+ buffer_edit(bufferId, remove=2)
114
+
115
+ 4. Save:
116
+ confluence_draft_save(draftId, bufferId)
117
+ ```
118
+
119
+ ### Batch Operations (Preferred for Multiple Edits)
120
+
121
+ ```
122
+ buffer_edit(bufferId, operations=[
123
+ {after: 1, content: "<h2>Section</h2>"},
124
+ {after: 2, plantuml: "@startuml\nA -> B\n@enduml"},
125
+ {remove: 5}
126
+ ])
127
+ ```
128
+
129
+ Benefits: Single parse, single validation, atomic execution.
130
+
131
+ ---
132
+
133
+ ## ERROR HANDLING MANDATE
134
+
135
+ ### NEVER Skip Tasks Due to Errors
136
+
137
+ When you encounter an error:
138
+
139
+ 1. **READ** the full error message (includes diagnostics)
140
+ 2. **ANALYZE** the cause using error details
141
+ 3. **FIX** the issue based on error guidance
142
+ 4. **RETRY** the operation
143
+ 5. **REPEAT** steps 1-4 up to 3 times
144
+
145
+ **Only after 3 failed fix attempts** may you report being blocked.
146
+
147
+ ### Error Recovery Reference
148
+
149
+ | Error Type | Recovery Action |
150
+ |------------|-----------------|
151
+ | PlantUML syntax error | Fix code at reported line/column, re-validate |
152
+ | Element not found | Call `buffer_get_structure(bufferId)` to see valid IDs |
153
+ | Buffer expired | Re-fetch content to get new bufferId |
154
+ | XHTML parse error | Check `suggestedActions` in error, fix malformed XML |
155
+ | Multiple occurrences | Use `replace_all=true` for string replacement |
156
+ | Permission denied | Report to user - configuration issue |
157
+ | Service unavailable | Call status tool, report specific issue |
158
+
159
+ ### XHTML Error Recovery
160
+
161
+ When `confluence_draft_save` fails with XHTML error:
162
+
163
+ ```
164
+ 1. Error includes: errorLocation (element ID), suggestedActions
165
+ 2. buffer_get_element(bufferId, elementId) ← Inspect problem element
166
+ 3. buffer_edit(bufferId, replace=elementId, content="<fixed XHTML>")
167
+ 4. Retry save
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Quick Reference
173
+
174
+ ### Help Topics
175
+
176
+ | Topic | Content |
177
+ |-------|---------|
178
+ | (none) | Workflow decision tree, core patterns |
179
+ | `jql` | Jira Query Language syntax, operators, examples |
180
+ | `cql` | Confluence Query Language syntax, operators, examples |
181
+ | `storage` | Confluence XHTML format, macros, layouts |
182
+ | `plantuml` | PlantUML validation workflow, macro structure |
183
+ | `buffers` | Element ID system, buffer operations, batch editing |
184
+
185
+ ### Common PlantUML Fixes
186
+
187
+ | Error | Fix |
188
+ |-------|-----|
189
+ | Missing @startuml | Add `@startuml` at start |
190
+ | Missing @enduml | Add `@enduml` at end |
191
+ | Unexpected token | Check syntax at reported line |
192
+ | Unknown entity | Verify class/actor/component name spelling |
193
+ | C4 not recognized | Add `!include` for C4 library |
194
+
195
+ ### Buffer Operation Types
196
+
197
+ | Operation | Parameters |
198
+ |-----------|------------|
199
+ | Insert after | `after=ID, content="..." OR plantuml="..."` |
200
+ | Insert before | `before=ID, content="..." OR plantuml="..."` |
201
+ | Replace | `replace=ID, content="..." OR plantuml="..."` |
202
+ | Remove | `remove=ID` |
203
+ | Append | `append=true, content="..." OR plantuml="..."` |
204
+
205
+ ---
206
+
207
+ ## Core Principles
208
+
209
+ 1. **Help-First**: Always read documentation before acting
210
+ 2. **Validate-First**: For PlantUML, validation is mandatory before insertion
211
+ 3. **Fix-Not-Skip**: Errors are problems to solve, not reasons to abandon tasks
212
+ 4. **ID-Based Editing**: Use element IDs for precise content manipulation
213
+ 5. **Batch When Possible**: Multiple edits should use operations array
214
+ 6. **Retry With Fixes**: Failed operations require analysis and correction, not abandonment
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  [![npm version](https://badge.fury.io/js/%40crypto512%2Fjicon-mcp.svg)](https://badge.fury.io/js/%40crypto512%2Fjicon-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
+ > **Data Center Focus**: This MCP server is designed and tested for **Atlassian Data Center** (Jira 9.x+, Confluence 8.x+, Tempo 3.x+). Cloud instances may work but are not the primary target.
7
+
6
8
  > Connect your AI assistant to Jira, Confluence, and Tempo. Search issues, create pages, log time - all through natural conversation.
7
9
 
8
10
  ## Quick Start
@@ -253,27 +255,94 @@ C4-PlantUML, AWS icons, and Azure diagrams require `!include` directives. By def
253
255
  - **Tempo** (optional) Timesheets plugin
254
256
  - **Docker** (optional) For PlantUML diagram validation
255
257
 
258
+ ## API Limitations
259
+
260
+ ### Confluence Draft Limitations (Data Center REST API)
261
+
262
+ The Confluence Data Center REST API has specific limitations for draft management:
263
+
264
+ | Operation | Support |
265
+ |-----------|---------|
266
+ | Create new draft | Yes - `POST /content?status=draft` |
267
+ | Read draft | Yes - `GET /content/{id}?status=draft` |
268
+ | Update draft | **No** - API doesn't support updating drafts |
269
+ | Delete draft | Yes - `DELETE /content/{id}?status=draft` |
270
+ | Create draft for existing page | **No** - Only new standalone drafts |
271
+
272
+ **Why "[jicon-mcp REVIEW]" workflow?**
273
+
274
+ Since the API cannot create a "draft version" of an existing page, Jicon uses a workaround:
275
+ 1. Creates a `[jicon-mcp REVIEW] Title` draft linked to the original via label
276
+ 2. User reviews the draft content
277
+ 3. `confluence_review_publish` copies content to original page and deletes draft
278
+
279
+ This achieves "draft before publish" semantics within API constraints.
280
+
281
+ ### Rate Limits
282
+
283
+ - **Atlassian Cloud**: Subject to API rate limits (varies by plan)
284
+ - **Data Center**: Typically no rate limits, but large queries may timeout
285
+ - **Jicon defaults**: Searches fetch up to 5000 results, paginated automatically
286
+
256
287
  ## Features
257
288
 
258
- ### 64 Tools Across 3 Services
289
+ ### 69 Tools Across 3 Services
259
290
 
260
291
  | Service | Capabilities |
261
292
  |---------|--------------|
262
293
  | **Jira** (18 tools) | Search, create, update, transition issues; manage comments, links, watchers; access boards, sprints, worklogs |
263
- | **Confluence** (17 tools) | Search, create, edit pages via drafts; manage spaces, comments, attachments; PlantUML diagrams |
294
+ | **Confluence** (21 tools) | Search, create, edit pages via drafts; manage spaces, comments, attachments; PlantUML diagrams; review workflow |
264
295
  | **Tempo** (12 tools) | Log time, view/update worklogs, team tracking, accounts |
265
296
 
266
297
  Plus utility tools for content buffering, time calculations, URL generation, and built-in help.
267
298
 
268
- ### Safe Confluence Editing
299
+ ### Buffered Responses
300
+
301
+ All data-heavy tools (search, list, get) return **buffered responses** for efficient handling of large datasets. Instead of returning raw data, tools return a `bufferId` with metadata:
302
+
303
+ ```json
304
+ {
305
+ "bufferId": "buf_abc123",
306
+ "metadata": {
307
+ "resourceType": "jira_search",
308
+ "title": "JQL: project = PROJ AND status = 'In Progress'"
309
+ },
310
+ "totalSize": 125000,
311
+ "hint": "Use buffer_get_chunk(bufferId) to read, buffer_grep(bufferId, pattern) to search"
312
+ }
313
+ ```
314
+
315
+ **Working with buffers:**
316
+ - `buffer_get_chunk(bufferId, offset, limit)` - Read data in chunks
317
+ - `buffer_grep(bufferId, pattern)` - Search within buffered data
318
+ - `buffer_list()` - List all active buffers with metadata
319
+
320
+ The buffer metadata includes `resourceType` and `title` to track origin (e.g., which query or resource the data came from).
321
+
322
+ ### Safe Confluence Editing (Review Workflow)
323
+
324
+ Confluence write operations use a **review workflow** for safety:
325
+
326
+ #### Creating a New Page
327
+ 1. **Ask the AI**: *"Create a meeting notes page in the Engineering space"*
328
+ 2. **Draft Created**: Jicon creates a draft that only you can see
329
+ 3. **Review & Publish**: You review and publish via Confluence UI
269
330
 
270
- Confluence write operations use a **draft workflow** for safety:
331
+ #### Editing an Existing Page
332
+ 1. **Ask the AI**: *"Add a PlantUML diagram to page https://confluence.example.com/..."*
333
+ 2. **Review Draft Created**: Jicon creates a `[jicon-mcp REVIEW] Page Title` draft linked to the original
334
+ 3. **You Review**: Check the draft content in Confluence UI
335
+ 4. **Publish or Discard**:
336
+ - AI can run `confluence_review_publish` to apply changes to original page
337
+ - Or `confluence_review_discard` to cancel without changes
338
+ - Or you can manually copy content if preferred
271
339
 
272
- 1. **Draft Creation**: When asked to create or edit content, Jicon creates a draft in your personal space
273
- 2. **User Review**: You review the draft content before it goes live
274
- 3. **Manual Publish**: You decide when and where to publish the final content
340
+ This means the AI assistant **never directly modifies** existing pages - all changes are staged as review drafts that require your approval. Combined with `confluenceWriteHome: true`, this ensures complete control over what gets published.
275
341
 
276
- This means the AI assistant **never directly publishes** to shared team spaces - all changes are staged as drafts that require your explicit approval. Combined with `confluenceWriteHome: true`, this ensures complete control over what gets published.
342
+ **Review Workflow Tools:**
343
+ - `confluence_review_list()` - Find all `[jicon-mcp REVIEW]` drafts
344
+ - `confluence_review_publish(reviewDraftId)` - Apply changes to original page
345
+ - `confluence_review_discard(reviewDraftId)` - Discard without changes
277
346
 
278
347
  ### PlantUML Diagrams
279
348