@redpanda-data/docs-extensions-and-macros 4.13.0 → 4.13.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 (49) hide show
  1. package/bin/doc-tools-mcp.js +15 -3
  2. package/bin/doc-tools.js +767 -2088
  3. package/bin/mcp-tools/property-docs.js +18 -0
  4. package/bin/mcp-tools/rpcn-docs.js +28 -3
  5. package/cli-utils/antora-utils.js +53 -2
  6. package/cli-utils/dependencies.js +313 -0
  7. package/cli-utils/diff-utils.js +273 -0
  8. package/cli-utils/doc-tools-utils.js +54 -0
  9. package/extensions/algolia-indexer/generate-index.js +134 -102
  10. package/extensions/algolia-indexer/index.js +70 -38
  11. package/extensions/collect-bloblang-samples.js +2 -1
  12. package/extensions/generate-rp-connect-categories.js +126 -67
  13. package/extensions/generate-rp-connect-info.js +291 -137
  14. package/macros/rp-connect-components.js +34 -5
  15. package/mcp/CLI_INTERFACE.adoc +384 -0
  16. package/mcp/COSTS.adoc +167 -0
  17. package/mcp/DEVELOPMENT.adoc +726 -0
  18. package/mcp/README.adoc +172 -0
  19. package/mcp/USER_GUIDE.adoc +1392 -0
  20. package/mcp/WRITER_EXTENSION_GUIDE.adoc +814 -0
  21. package/mcp/prompts/README.adoc +183 -0
  22. package/mcp/prompts/property-docs-guide.md +283 -0
  23. package/mcp/prompts/review-for-style.md +128 -0
  24. package/mcp/prompts/rpcn-connector-docs-guide.md +126 -0
  25. package/mcp/prompts/write-new-guide.md +222 -0
  26. package/mcp/team-standards/style-guide.md +321 -0
  27. package/mcp/templates/README.adoc +212 -0
  28. package/mcp/templates/prompt-review-template.md +80 -0
  29. package/mcp/templates/prompt-write-template.md +110 -0
  30. package/mcp/templates/resource-template.md +76 -0
  31. package/package.json +8 -5
  32. package/tools/add-commercial-names.js +207 -0
  33. package/tools/generate-cli-docs.js +6 -2
  34. package/tools/get-console-version.js +5 -0
  35. package/tools/get-redpanda-version.js +5 -0
  36. package/tools/property-extractor/compare-properties.js +3 -3
  37. package/tools/property-extractor/generate-handlebars-docs.js +14 -14
  38. package/tools/property-extractor/generate-pr-summary.js +46 -0
  39. package/tools/property-extractor/pr-summary-formatter.js +375 -0
  40. package/tools/redpanda-connect/README.adoc +403 -38
  41. package/tools/redpanda-connect/connector-binary-analyzer.js +588 -0
  42. package/tools/redpanda-connect/generate-rpcn-connector-docs.js +97 -34
  43. package/tools/redpanda-connect/parse-csv-connectors.js +1 -1
  44. package/tools/redpanda-connect/pr-summary-formatter.js +601 -0
  45. package/tools/redpanda-connect/report-delta.js +69 -2
  46. package/tools/redpanda-connect/rpcn-connector-docs-handler.js +1180 -0
  47. package/tools/redpanda-connect/templates/connector.hbs +38 -0
  48. package/tools/redpanda-connect/templates/intro.hbs +0 -20
  49. package/tools/redpanda-connect/update-nav.js +205 -0
@@ -0,0 +1,726 @@
1
+ = MCP Server Development Guide
2
+ :toc:
3
+ :toclevels: 3
4
+
5
+ Developer guide for working on the Redpanda Doc Tools MCP server.
6
+
7
+ The MCP (Model Context Protocol) server exposes `doc-tools` functionality to Claude Code through a writer-friendly natural language interface. This guide covers the architecture, development workflow, and how to extend the server.
8
+
9
+ == Architecture
10
+
11
+ === Components
12
+
13
+ The MCP server consists of several key components:
14
+
15
+ *Server implementation* (`bin/doc-tools-mcp.js`):: Main MCP server that handles the protocol communication with Claude Code
16
+
17
+ *Tool modules* (`bin/mcp-tools/`):: Individual tool implementations that wrap CLI commands
18
+ +
19
+ * `antora.js` - Antora structure analysis
20
+ * `version.js` - Version information from GitHub
21
+ * `generate.js` - Documentation generation commands
22
+ * `cli.js` - Raw CLI command execution
23
+
24
+ *Prompt system* (`prompts/`):: Pre-defined instructions for specific documentation workflows
25
+ +
26
+ See link:prompts/README.adoc[Prompts documentation]
27
+
28
+ *Setup automation* (`cli-utils/setup-mcp.js`):: Automated MCP server configuration for Claude Code/Desktop
29
+
30
+ === How it works
31
+
32
+ . Claude Code starts the MCP server when you launch Claude Code in any directory
33
+ . The server detects the repository context (git root, Antora structure, doc-tools availability)
34
+ . When you ask Claude to perform a task, Claude decides which tools to use
35
+ . The server receives tool requests via the MCP protocol
36
+ . Tool modules execute CLI commands in the detected repository context
37
+ . Results are returned to Claude, which presents them to you
38
+
39
+ === Protocol flow
40
+
41
+ [,mermaid]
42
+ ----
43
+ sequenceDiagram
44
+ participant User
45
+ participant Claude
46
+ participant MCP Server
47
+ participant CLI
48
+
49
+ User->>Claude: "Generate property docs for v25.3.1"
50
+ Claude->>MCP Server: generate_property_docs(version: "v25.3.1")
51
+ MCP Server->>CLI: npx doc-tools generate property-docs --tag v25.3.1
52
+ CLI-->>MCP Server: Output + exit code
53
+ MCP Server-->>Claude: JSON response
54
+ Claude-->>User: "✓ Generated 342 properties"
55
+ ----
56
+
57
+ == Development setup
58
+
59
+ === Prerequisites
60
+
61
+ * Node.js 18 or later
62
+ * Claude Code installed
63
+ * Git
64
+
65
+ === Initial setup
66
+
67
+ . Clone the repository:
68
+ +
69
+ [,bash]
70
+ ----
71
+ git clone https://github.com/redpanda-data/docs-extensions-and-macros.git
72
+ cd docs-extensions-and-macros
73
+ ----
74
+
75
+ . Install dependencies:
76
+ +
77
+ [,bash]
78
+ ----
79
+ npm install
80
+ ----
81
+
82
+ . Configure MCP server for local development:
83
+ +
84
+ [,bash]
85
+ ----
86
+ npx doc-tools setup-mcp
87
+ ----
88
+ +
89
+ This configures Claude Code to use your local development version.
90
+
91
+ . Restart Claude Code to load the server
92
+
93
+ === Project structure
94
+
95
+ [,bash]
96
+ ----
97
+ docs-extensions-and-macros/
98
+ ├── bin/
99
+ │ ├── doc-tools-mcp.js # Main MCP server
100
+ │ └── mcp-tools/ # Tool implementations
101
+ │ ├── antora.js # Antora structure analysis
102
+ │ ├── cloud-regions.js # Cloud regions table generation
103
+ │ ├── crd-docs.js # Kubernetes CRD docs generation
104
+ │ ├── helm-docs.js # Helm chart docs generation
105
+ │ ├── index.js # Main tool orchestrator
106
+ │ ├── job-queue.js # Background job management
107
+ │ ├── metrics-docs.js # Metrics docs generation
108
+ │ ├── openapi.js # OpenAPI bundle generation
109
+ │ ├── property-docs.js # Property docs generation
110
+ │ ├── review.js # Documentation quality review
111
+ │ ├── rpcn-docs.js # Redpanda Connect docs generation
112
+ │ ├── rpk-docs.js # RPK CLI docs generation
113
+ │ ├── utils.js # Shared utilities
114
+ │ └── versions.js # Version information
115
+ ├── __tests__/mcp/ # MCP tests
116
+ │ ├── cli-contract.test.js
117
+ │ ├── doc-tools-mcp.test.js
118
+ │ ├── integration.test.js
119
+ │ └── README.adoc
120
+ └── cli-utils/
121
+ └── setup-mcp.js # Setup automation
122
+ ----
123
+
124
+ == Adding a new tool
125
+
126
+ === Step 1: Define the tool schema
127
+
128
+ Edit `bin/doc-tools-mcp.js` and add your tool to the tools array:
129
+
130
+ [,javascript]
131
+ ----
132
+ {
133
+ name: 'my_new_tool',
134
+ description: 'Description of what this tool does for writers',
135
+ inputSchema: {
136
+ type: 'object',
137
+ properties: {
138
+ my_parameter: {
139
+ type: 'string',
140
+ description: 'Description of this parameter'
141
+ }
142
+ },
143
+ required: ['my_parameter']
144
+ }
145
+ }
146
+ ----
147
+
148
+ *Design principles for tool schemas:*
149
+
150
+ * Use writer-friendly descriptions (no technical jargon)
151
+ * Parameter names should be clear and intuitive
152
+ * Use natural language in descriptions
153
+ * Mark parameters as required only if absolutely necessary
154
+
155
+ === Step 2: Create the tool module
156
+
157
+ Create a new file in `bin/mcp-tools/my-tool.js`:
158
+
159
+ [,javascript]
160
+ ----
161
+ const { execSync } = require('child_process');
162
+
163
+ /**
164
+ * Execute my new tool
165
+ * @param {Object} params - Tool parameters
166
+ * @param {string} params.my_parameter - Description
167
+ * @param {Object} context - Execution context
168
+ * @param {string} context.repoRoot - Repository root path
169
+ * @returns {Object} Result object with success and data
170
+ */
171
+ function executeMyTool(params, context) {
172
+ try {
173
+ // Validate parameters
174
+ if (!params.my_parameter) {
175
+ return {
176
+ success: false,
177
+ error: 'Parameter my_parameter is required',
178
+ suggestion: 'Provide a value like "example"'
179
+ };
180
+ }
181
+
182
+ // Execute CLI command
183
+ const output = execSync(
184
+ `npx doc-tools my-command --param ${params.my_parameter}`,
185
+ {
186
+ cwd: context.repoRoot,
187
+ encoding: 'utf8',
188
+ maxBuffer: 50 * 1024 * 1024,
189
+ timeout: 5 * 60 * 1000
190
+ }
191
+ );
192
+
193
+ // Parse output and return structured result
194
+ return {
195
+ success: true,
196
+ output,
197
+ summary: 'Successfully executed my tool'
198
+ };
199
+ } catch (err) {
200
+ return {
201
+ success: false,
202
+ error: `Command failed: ${err.message}`,
203
+ stdout: err.stdout || '',
204
+ stderr: err.stderr || '',
205
+ exitCode: err.status
206
+ };
207
+ }
208
+ }
209
+
210
+ module.exports = { executeMyTool };
211
+ ----
212
+
213
+ *Best practices for tool modules:*
214
+
215
+ * Always return structured JSON objects
216
+ * Include helpful error messages and suggestions
217
+ * Use appropriate timeouts (default: 5 minutes)
218
+ * Parse CLI output to extract useful information
219
+ * Handle all error cases gracefully
220
+
221
+ === Step 3: Wire up the tool
222
+
223
+ In `bin/doc-tools-mcp.js`, import your tool module and add a case to the tool handler:
224
+
225
+ [,javascript]
226
+ ----
227
+ const { executeMyTool } = require('./mcp-tools/my-tool');
228
+
229
+ // In the tool handler switch statement:
230
+ case 'my_new_tool':
231
+ result = executeMyTool(params, context);
232
+ break;
233
+ ----
234
+
235
+ === Step 4: Add tests
236
+
237
+ See <<Testing>> section below.
238
+
239
+ === Step 5: Document the tool
240
+
241
+ Update link:USER_GUIDE.adoc[USER_GUIDE.adoc] to document:
242
+
243
+ * The tool in the "Available tools" section
244
+ * JSON response structure
245
+ * Usage examples
246
+
247
+ Update link:CLI_INTERFACE.adoc[CLI_INTERFACE.adoc] if you added a new CLI command.
248
+
249
+ == Adding a new prompt
250
+
251
+ Prompts provide contextual guidance to Claude when working on specific documentation tasks.
252
+
253
+ NOTE: This section is for *developers* adding prompts programmatically. *Technical writers* should use link:WRITER_EXTENSION_GUIDE.adoc[Writer Extension Guide] which provides step-by-step instructions with no code required.
254
+
255
+ === How the prompt system works
256
+
257
+ The MCP server uses *automatic discovery* of prompts:
258
+
259
+ . Prompts are Markdown files in `mcp/prompts/` directory
260
+ . Each prompt has YAML frontmatter defining metadata (description, version, arguments)
261
+ . At startup, the server scans the directory and loads all `.md` files
262
+ . Prompts are cached in memory for performance
263
+ . Changes are automatically reloaded in development mode (`MCP_DEV_MODE=true`)
264
+
265
+ *No code changes needed!* Just drop a `.md` file with valid frontmatter and restart.
266
+
267
+ === Step 1: Create the prompt file with frontmatter
268
+
269
+ Create a new Markdown file in `mcp/prompts/` with YAML frontmatter:
270
+
271
+ [,bash]
272
+ ----
273
+ mcp/prompts/my-docs-guide.md
274
+ ----
275
+
276
+ [,markdown]
277
+ ----
278
+ ---
279
+ description: Guide for working with specific documentation type
280
+ version: 1.0.0
281
+ arguments:
282
+ - name: content
283
+ description: The documentation content to process
284
+ required: true
285
+ argumentFormat: content-append
286
+ ---
287
+
288
+ # My Documentation Guide
289
+
290
+ This guide explains how to work with [specific documentation type].
291
+
292
+ ## Overview
293
+
294
+ [Explanation of the documentation system]
295
+
296
+ ## Workflow
297
+
298
+ 1. First step
299
+ 2. Second step
300
+ 3. Third step
301
+
302
+ ## Important rules
303
+
304
+ - Rule 1
305
+ - Rule 2
306
+ - Rule 3
307
+
308
+ ## Common tasks
309
+
310
+ ### Task 1: Do something
311
+
312
+ [Detailed instructions]
313
+
314
+ ### Task 2: Do something else
315
+
316
+ [Detailed instructions]
317
+
318
+ ## Validation
319
+
320
+ Before committing, check:
321
+
322
+ - [ ] Checklist item 1
323
+ - [ ] Checklist item 2
324
+ ----
325
+
326
+ *Required frontmatter fields:*
327
+
328
+ description:: Clear explanation of what the prompt does (min 10 characters)
329
+ version:: Semantic version (for example, "1.0.0")
330
+ arguments:: (Optional) Array of argument definitions
331
+ * `name`: Argument name (lowercase, underscores only)
332
+ * `description`: What this argument is for
333
+ * `required`: Boolean indicating if required
334
+ argumentFormat:: (Optional) How to append arguments:
335
+ * `content-append`: Append content with separator (default)
336
+ * `structured`: Insert arguments as structured sections
337
+
338
+ *Best practices for prompts:*
339
+
340
+ * Write for technical writers, not developers
341
+ * Include concrete examples
342
+ * Explain the "why" behind rules
343
+ * Provide validation checklists
344
+ * Use clear, scannable structure
345
+ * Keep version updated when making significant changes
346
+
347
+ === Step 2: Validate the prompt
348
+
349
+ Run validation to check frontmatter and metadata:
350
+
351
+ [,bash]
352
+ ----
353
+ npx doc-tools validate-mcp
354
+ ----
355
+
356
+ This checks:
357
+
358
+ * YAML frontmatter is valid
359
+ * Required fields are present (description, version)
360
+ * Argument names use only lowercase and underscores
361
+ * Version follows semantic versioning
362
+ * No naming conflicts with existing prompts
363
+
364
+ === Step 3: Preview the prompt
365
+
366
+ Test the prompt before deploying:
367
+
368
+ [,bash]
369
+ ----
370
+ # Preview with content argument
371
+ npx doc-tools preview-prompt my-docs-guide --content "Test content"
372
+
373
+ # See how it appears to Claude
374
+ ----
375
+
376
+ === Step 4: Deploy and test
377
+
378
+ . Restart Claude Code to load the new prompt
379
+ . Test with Claude:
380
+ +
381
+ ----
382
+ You: "List available prompts"
383
+ Claude: *shows your new prompt in the list*
384
+
385
+ You: "Use the my-docs-guide prompt with this content: [...]"
386
+ Claude: *retrieves and applies your prompt*
387
+ ----
388
+
389
+ === Auto-discovery details
390
+
391
+ The prompt discovery system (`bin/mcp-tools/prompt-discovery.js`):
392
+
393
+ . Scans `mcp/prompts/*.md` files
394
+ . Parses YAML frontmatter using `js-yaml`
395
+ . Validates against JSON schema using `ajv`
396
+ . Extracts prompt name from filename (for example, `my-docs-guide.md` → `my-docs-guide`)
397
+ . Caches content and metadata in memory
398
+ . Provides generic handler that works for all prompts
399
+
400
+ *Development mode:*
401
+
402
+ Enable file watching to automatically reload changes:
403
+
404
+ [,bash]
405
+ ----
406
+ export MCP_DEV_MODE=true
407
+ # Restart Claude Code
408
+ # Now changes to prompts are automatically reloaded
409
+ ----
410
+
411
+ === For more information
412
+
413
+ * link:WRITER_EXTENSION_GUIDE.adoc[Writer Extension Guide] - Complete guide for writers adding prompts (no code)
414
+ * link:TEAM_ROLLOUT_GUIDE.adoc#operational-playbook[Operational Playbook] - Managing prompts in production
415
+ * `bin/mcp-tools/prompt-discovery.js` - Auto-discovery implementation
416
+ * `bin/mcp-tools/frontmatter.js` - Frontmatter parsing and validation
417
+
418
+ == Testing
419
+
420
+ The MCP server has three types of tests:
421
+
422
+ === Integration tests
423
+
424
+ Test MCP tools end-to-end through the tool execution layer.
425
+
426
+ *Location:* `__tests__/mcp/integration.test.js`
427
+
428
+ *Add tests for new tools:*
429
+
430
+ [,javascript]
431
+ ----
432
+ test('my_new_tool returns expected result', () => {
433
+ const result = mcpTools.executeTool('my_new_tool', {
434
+ my_parameter: 'test-value'
435
+ });
436
+
437
+ expect(result).toBeDefined();
438
+ expect(result.success).toBe(true);
439
+ expect(result.summary).toContain('Successfully');
440
+ });
441
+
442
+ test('my_new_tool validates parameters', () => {
443
+ const result = mcpTools.executeTool('my_new_tool', {});
444
+
445
+ expect(result.success).toBe(false);
446
+ expect(result.error.toLowerCase()).toContain('required');
447
+ });
448
+ ----
449
+
450
+ === CLI contract tests
451
+
452
+ Verify that the doc-tools CLI maintains the expected interface.
453
+
454
+ *Location:* `__tests__/mcp/cli-contract.test.js`
455
+
456
+ *Add tests for new CLI commands:*
457
+
458
+ [,javascript]
459
+ ----
460
+ test('my-command exists', () => {
461
+ const result = executeCLI('my-command --help');
462
+ expect(result.success).toBe(true);
463
+ });
464
+
465
+ test('my-command supports required flag --param', () => {
466
+ const result = executeCLI('my-command --help');
467
+ expect(result.output).toContain('--param');
468
+ });
469
+ ----
470
+
471
+ See link:CLI_INTERFACE.adoc[CLI Interface Contract] for details on the contract.
472
+
473
+ === Unit tests
474
+
475
+ Test individual MCP server components in isolation.
476
+
477
+ *Location:* `__tests__/mcp/doc-tools-mcp.test.js`
478
+
479
+ *Add tests for tool modules:*
480
+
481
+ [,javascript]
482
+ ----
483
+ describe('executeMyTool', () => {
484
+ test('executes successfully with valid params', () => {
485
+ const result = executeMyTool(
486
+ { my_parameter: 'test' },
487
+ { repoRoot: '/test' }
488
+ );
489
+
490
+ expect(result.success).toBeDefined();
491
+ });
492
+
493
+ test('returns error for missing parameters', () => {
494
+ const result = executeMyTool({}, { repoRoot: '/test' });
495
+
496
+ expect(result.success).toBe(false);
497
+ expect(result.error).toContain('required');
498
+ });
499
+ });
500
+ ----
501
+
502
+ === Running tests
503
+
504
+ Run all MCP tests:
505
+
506
+ [,bash]
507
+ ----
508
+ npm run test:mcp
509
+ ----
510
+
511
+ Run specific test suites:
512
+
513
+ [,bash]
514
+ ----
515
+ npm run test:mcp:integration # Integration tests only
516
+ npm run test:mcp:contract # Contract tests only
517
+ ----
518
+
519
+ Run with coverage:
520
+
521
+ [,bash]
522
+ ----
523
+ npm test -- --coverage __tests__/mcp/
524
+ ----
525
+
526
+ Run in watch mode during development:
527
+
528
+ [,bash]
529
+ ----
530
+ npm test -- --watch __tests__/mcp/
531
+ ----
532
+
533
+ See link:../__tests__/mcp/README.adoc[Test documentation] for more details.
534
+
535
+ == Debugging
536
+
537
+ === Enable debug logging
538
+
539
+ Set the `NODE_ENV` environment variable to see detailed logs:
540
+
541
+ [,bash]
542
+ ----
543
+ NODE_ENV=development claude
544
+ ----
545
+
546
+ This enables:
547
+
548
+ * Stack traces in error responses
549
+ * Additional console logging
550
+ * Verbose MCP protocol messages
551
+
552
+ === View MCP server logs
553
+
554
+ The server logs to stderr (not stdout) to avoid interfering with the MCP protocol.
555
+
556
+ Claude Code captures these logs. Check:
557
+
558
+ * macOS: `~/Library/Logs/Claude/`
559
+ * Linux: `~/.local/share/Claude/logs/`
560
+ * Windows: `%APPDATA%\Claude\logs\`
561
+
562
+ === Test the server directly
563
+
564
+ You can test tool execution without Claude Code:
565
+
566
+ [,javascript]
567
+ ----
568
+ // test-tool.js
569
+ const mcpTools = require('./bin/mcp-tools');
570
+
571
+ const result = mcpTools.executeTool('get_redpanda_version', {});
572
+ console.log(JSON.stringify(result, null, 2));
573
+ ----
574
+
575
+ [,bash]
576
+ ----
577
+ node test-tool.js
578
+ ----
579
+
580
+ === Common issues
581
+
582
+ *Tool not showing up in Claude Code*
583
+
584
+ * Run `npx doc-tools setup-mcp --status` to verify configuration
585
+ * Check `~/.claude.json` for the `mcpServers` section
586
+ * Restart Claude Code completely
587
+ * Check logs for server startup errors
588
+
589
+ *"doc-tools not found" errors*
590
+
591
+ * Ensure you're in a repository that has doc-tools installed
592
+ * Check that `npx doc-tools --version` works
593
+ * Verify `repoRoot` is correctly detected
594
+
595
+ *Timeout errors*
596
+
597
+ * Increase timeout in tool module (default: 5 minutes)
598
+ * Check network connectivity for version tools
599
+ * Look for infinite loops in CLI commands
600
+
601
+ == Security
602
+
603
+ === Command injection prevention
604
+
605
+ All CLI commands go through validation in `cli.js`:
606
+
607
+ * Shell metacharacters blocked: `;`, `|`, `&`, `$`, ``` ` ```, `<`, `>`, `(`, `)`
608
+ * Path traversal sequences blocked: `..`, `~`
609
+ * Commands must be non-empty strings
610
+
611
+ *Always use the CLI validation when executing shell commands.*
612
+
613
+ === Sensitive data
614
+
615
+ * Never log sensitive data (tokens, passwords, API keys)
616
+ * Don't expose internal paths in error messages
617
+ * Sanitize file paths before returning to Claude
618
+
619
+ === Resource limits
620
+
621
+ All CLI commands have:
622
+
623
+ * 5-minute timeout
624
+ * 50MB output buffer limit
625
+ * Execution in detected repository context only
626
+
627
+ == Best practices
628
+
629
+ === Tool design
630
+
631
+ * *Writer-focused*: Design tools for technical writers, not developers
632
+ * *Natural language*: Use conversational descriptions and parameter names
633
+ * *Helpful errors*: Always include suggestions for fixing errors
634
+ * *Structured output*: Return consistent JSON structures
635
+ * *Fail gracefully*: Handle all error cases with clear messages
636
+
637
+ === Code organization
638
+
639
+ * One tool module per file in `bin/mcp-tools/`
640
+ * Keep modules focused and single-purpose
641
+ * Export only necessary functions
642
+ * Document function parameters and return values
643
+
644
+ === Error handling
645
+
646
+ * Always catch exceptions
647
+ * Return structured error objects with `success: false`
648
+ * Include helpful suggestions in error responses
649
+ * Preserve stdout/stderr for debugging
650
+
651
+ === Performance
652
+
653
+ * Use appropriate timeouts for different operations
654
+ * Parse CLI output efficiently
655
+ * Cache repository detection when possible
656
+ * Avoid unnecessary file system operations
657
+
658
+ == Release process
659
+
660
+ === Before releasing
661
+
662
+ . Run all tests: `npm run test:mcp`
663
+ . Update version in `package.json`
664
+ . Update link:USER_GUIDE.adoc[USER_GUIDE.adoc] with any changes
665
+ . Test manually with Claude Code
666
+ . Check that setup command works: `npx doc-tools setup-mcp`
667
+
668
+ === Publishing
669
+
670
+ . Commit all changes
671
+ . Tag the release: `git tag -a v1.2.3 -m "Release 1.2.3"`
672
+ . Push with tags: `git push --tags`
673
+ . Publish to npm: `npm publish`
674
+
675
+ === After releasing
676
+
677
+ . Update documentation if needed
678
+ . Notify writers of any breaking changes
679
+ . Monitor for issues
680
+
681
+ == Related documentation
682
+
683
+ *User documentation*
684
+
685
+ * link:USER_GUIDE.adoc[User guide] - Guide for writers using the MCP server with Claude Code
686
+
687
+ *Developer documentation*
688
+
689
+ * link:../__tests__/mcp/README.adoc[Test documentation] - How to run and write tests
690
+ * link:CLI_INTERFACE.adoc[CLI interface contract] - CLI interface that the MCP server depends on
691
+ * link:prompts/README.adoc[Prompts documentation] - How the prompt system works
692
+
693
+ *External documentation*
694
+
695
+ * https://modelcontextprotocol.io/[MCP Protocol Specification]
696
+ * https://docs.anthropic.com/claude[Claude Code Documentation]
697
+ * https://nodejs.org/docs/latest/api/child_process.html[Node.js child_process]
698
+
699
+ == Contributing
700
+
701
+ When contributing to the MCP server:
702
+
703
+ . Read this guide thoroughly
704
+ . Review existing tool implementations for patterns
705
+ . Write tests for all new functionality
706
+ . Update documentation
707
+ . Follow the existing code style
708
+ . Test manually with Claude Code before submitting PR
709
+
710
+ == Getting help
711
+
712
+ * Check Claude Code logs for errors
713
+ * Review the link:../__tests__/mcp/README.adoc[test documentation]
714
+ * Look at existing tool implementations for examples
715
+ * Open an issue in the repository
716
+
717
+ == Roadmap
718
+
719
+ Potential future improvements:
720
+
721
+ * Additional documentation generation tools
722
+ * More sophisticated prompt selection
723
+ * Caching layer for expensive operations
724
+ * Better error recovery
725
+ * Streaming output for long-running operations
726
+ * Tool result validation