@redpanda-data/docs-extensions-and-macros 4.13.6 → 4.14.1
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/bin/doc-tools-mcp.js +84 -131
- package/bin/doc-tools.js +105 -192
- package/bin/mcp-tools/generated-docs-review.js +11 -158
- package/bin/mcp-tools/index.js +0 -4
- package/bin/mcp-tools/mcp-validation.js +44 -149
- package/extensions/generate-rp-connect-info.js +9 -1
- package/mcp/COSTS.adoc +7 -17
- package/mcp/DEVELOPMENT.adoc +2 -175
- package/mcp/README.adoc +27 -61
- package/mcp/WRITER_EXTENSION_GUIDE.adoc +128 -738
- package/package.json +2 -2
- package/tools/redpanda-connect/helpers/renderConnectFields.js +1 -1
- package/tools/redpanda-connect/helpers/renderLeafField.js +1 -1
- package/tools/redpanda-connect/helpers/toYaml.js +1 -1
- package/bin/mcp-tools/content-review.js +0 -196
- package/bin/mcp-tools/frontmatter.js +0 -138
- package/bin/mcp-tools/prompt-discovery.js +0 -283
- package/mcp/prompts/README.adoc +0 -183
- package/mcp/prompts/property-docs-guide.md +0 -283
- package/mcp/prompts/review-for-style.md +0 -128
- package/mcp/prompts/rpcn-connector-docs-guide.md +0 -126
- package/mcp/prompts/write-new-guide.md +0 -222
- package/mcp/team-standards/style-guide.md +0 -321
- package/mcp/templates/README.adoc +0 -212
- package/mcp/templates/prompt-review-template.md +0 -80
- package/mcp/templates/prompt-write-template.md +0 -110
- package/mcp/templates/resource-template.md +0 -76
package/bin/doc-tools-mcp.js
CHANGED
|
@@ -25,26 +25,14 @@ const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio
|
|
|
25
25
|
const {
|
|
26
26
|
CallToolRequestSchema,
|
|
27
27
|
ListToolsRequestSchema,
|
|
28
|
-
ListPromptsRequestSchema,
|
|
29
|
-
GetPromptRequestSchema,
|
|
30
28
|
ListResourcesRequestSchema,
|
|
31
29
|
ReadResourceRequestSchema,
|
|
32
30
|
} = require('@modelcontextprotocol/sdk/types.js');
|
|
33
31
|
const { findRepoRoot, executeTool } = require('./mcp-tools');
|
|
34
32
|
const { initializeJobQueue, getJob, listJobs } = require('./mcp-tools/job-queue');
|
|
35
33
|
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
PromptCache,
|
|
39
|
-
loadAllPrompts,
|
|
40
|
-
watchPrompts,
|
|
41
|
-
buildPromptWithArguments,
|
|
42
|
-
promptsToMcpFormat
|
|
43
|
-
} = require('./mcp-tools/prompt-discovery');
|
|
44
|
-
const {
|
|
45
|
-
validatePromptArguments,
|
|
46
|
-
validateMcpConfiguration
|
|
47
|
-
} = require('./mcp-tools/mcp-validation');
|
|
34
|
+
// Prompts and most resources migrated to docs-team-standards plugin
|
|
35
|
+
// This MCP server now focuses on execution tools only
|
|
48
36
|
const {
|
|
49
37
|
UsageStats,
|
|
50
38
|
createPeriodicReporter,
|
|
@@ -57,8 +45,7 @@ const packageJson = require('../package.json');
|
|
|
57
45
|
// Base directory
|
|
58
46
|
const baseDir = path.join(__dirname, '..');
|
|
59
47
|
|
|
60
|
-
// Initialize prompt cache
|
|
61
|
-
const promptCache = new PromptCache();
|
|
48
|
+
// Initialize usage stats (prompt cache removed - prompts migrated to docs-team-standards)
|
|
62
49
|
const usageStats = new UsageStats();
|
|
63
50
|
|
|
64
51
|
// Create the MCP server
|
|
@@ -70,8 +57,8 @@ const server = new Server(
|
|
|
70
57
|
{
|
|
71
58
|
capabilities: {
|
|
72
59
|
tools: {},
|
|
73
|
-
prompts: {},
|
|
74
60
|
resources: {},
|
|
61
|
+
// prompts: {} - Removed, prompts migrated to docs-team-standards plugin
|
|
75
62
|
},
|
|
76
63
|
}
|
|
77
64
|
);
|
|
@@ -394,7 +381,7 @@ const tools = [
|
|
|
394
381
|
},
|
|
395
382
|
{
|
|
396
383
|
name: 'review_generated_docs',
|
|
397
|
-
description: '
|
|
384
|
+
description: 'Validate auto-generated documentation for structural issues. Checks for missing descriptions, invalid $refs, DRY violations, invalid xrefs, and calculates quality scores. For style and tone review, use the content-reviewer agent from docs-team-standards.',
|
|
398
385
|
inputSchema: {
|
|
399
386
|
type: 'object',
|
|
400
387
|
properties: {
|
|
@@ -415,25 +402,6 @@ const tools = [
|
|
|
415
402
|
required: ['doc_type']
|
|
416
403
|
}
|
|
417
404
|
},
|
|
418
|
-
{
|
|
419
|
-
name: 'review_content',
|
|
420
|
-
description: 'Review documentation content with automatic style guide context. This tool bundles the style guide and review instructions in a single call, ensuring the LLM has all necessary context. Use this instead of manually fetching resources when you need a quick, comprehensive review.',
|
|
421
|
-
inputSchema: {
|
|
422
|
-
type: 'object',
|
|
423
|
-
properties: {
|
|
424
|
-
content: {
|
|
425
|
-
type: 'string',
|
|
426
|
-
description: 'The documentation content to review (can be a file path or raw content)'
|
|
427
|
-
},
|
|
428
|
-
focus: {
|
|
429
|
-
type: 'string',
|
|
430
|
-
description: 'What aspect to focus on (optional, defaults to comprehensive)',
|
|
431
|
-
enum: ['comprehensive', 'style', 'terminology', 'clarity']
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
required: ['content']
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
405
|
{
|
|
438
406
|
name: 'run_doc_tools_command',
|
|
439
407
|
description: 'Advanced: Run a raw doc-tools command. Only use this if none of the specific tools above fit your needs. Requires knowledge of doc-tools CLI syntax.',
|
|
@@ -483,21 +451,21 @@ const tools = [
|
|
|
483
451
|
}
|
|
484
452
|
];
|
|
485
453
|
|
|
486
|
-
// Resource definitions -
|
|
454
|
+
// Resource definitions - Only personas remains (other standards migrated to docs-team-standards plugin)
|
|
487
455
|
const resources = [
|
|
488
456
|
{
|
|
489
|
-
uri: 'redpanda://
|
|
490
|
-
name: '
|
|
491
|
-
description: '
|
|
492
|
-
mimeType: 'text/
|
|
457
|
+
uri: 'redpanda://personas',
|
|
458
|
+
name: 'Repository Personas',
|
|
459
|
+
description: 'Target audience personas for this repository. Loaded from docs-data/personas.yaml in the current working directory. Defines reader types, goals, pain points, and content preferences.',
|
|
460
|
+
mimeType: 'text/yaml',
|
|
493
461
|
version: '1.0.0',
|
|
494
|
-
lastUpdated: '2025-
|
|
462
|
+
lastUpdated: '2025-01-07'
|
|
495
463
|
}
|
|
496
464
|
];
|
|
497
465
|
|
|
498
|
-
// Resource file mappings
|
|
466
|
+
// Resource file mappings (most resources migrated to docs-team-standards plugin)
|
|
499
467
|
const resourceMap = {
|
|
500
|
-
|
|
468
|
+
// Only personas remains - it's loaded dynamically from cwd, not from team-standards/
|
|
501
469
|
};
|
|
502
470
|
|
|
503
471
|
/**
|
|
@@ -506,12 +474,17 @@ const resourceMap = {
|
|
|
506
474
|
* @returns {Object} Resource content
|
|
507
475
|
*/
|
|
508
476
|
function getResourceContent(uri) {
|
|
477
|
+
// Special handling for personas - load from current working directory
|
|
478
|
+
if (uri === 'redpanda://personas') {
|
|
479
|
+
return getPersonasResource();
|
|
480
|
+
}
|
|
481
|
+
|
|
509
482
|
const resource = resourceMap[uri];
|
|
510
483
|
if (!resource) {
|
|
511
484
|
throw new Error(`Unknown resource: ${uri}`);
|
|
512
485
|
}
|
|
513
486
|
|
|
514
|
-
const resourcePath = path.join(baseDir, '
|
|
487
|
+
const resourcePath = path.join(baseDir, 'team-standards', resource.file);
|
|
515
488
|
try {
|
|
516
489
|
const content = fs.readFileSync(resourcePath, 'utf8');
|
|
517
490
|
return {
|
|
@@ -527,16 +500,71 @@ function getResourceContent(uri) {
|
|
|
527
500
|
}
|
|
528
501
|
}
|
|
529
502
|
|
|
503
|
+
/**
|
|
504
|
+
* Load personas from current repository's docs-data/personas.yaml
|
|
505
|
+
* Falls back to a helpful message if not found
|
|
506
|
+
* @returns {Object} Resource content
|
|
507
|
+
*/
|
|
508
|
+
function getPersonasResource() {
|
|
509
|
+
const cwd = process.cwd();
|
|
510
|
+
const personasPath = path.join(cwd, 'docs-data', 'personas.yaml');
|
|
511
|
+
|
|
512
|
+
try {
|
|
513
|
+
if (fs.existsSync(personasPath)) {
|
|
514
|
+
const content = fs.readFileSync(personasPath, 'utf8');
|
|
515
|
+
return {
|
|
516
|
+
contents: [{
|
|
517
|
+
uri: 'redpanda://personas',
|
|
518
|
+
mimeType: 'text/yaml',
|
|
519
|
+
text: content
|
|
520
|
+
}]
|
|
521
|
+
};
|
|
522
|
+
} else {
|
|
523
|
+
// Return helpful message when no personas file exists
|
|
524
|
+
const fallbackContent = `# No personas defined for this repository
|
|
525
|
+
#
|
|
526
|
+
# To define personas, create: docs-data/personas.yaml
|
|
527
|
+
#
|
|
528
|
+
# Example:
|
|
529
|
+
# personas:
|
|
530
|
+
# - id: developer
|
|
531
|
+
# name: Application Developer
|
|
532
|
+
# description: Builds applications using this product
|
|
533
|
+
# goals:
|
|
534
|
+
# - Integrate quickly
|
|
535
|
+
# - Find working examples
|
|
536
|
+
# pain_points:
|
|
537
|
+
# - Complex configuration
|
|
538
|
+
# - Missing examples
|
|
539
|
+
# content_preferences:
|
|
540
|
+
# - Code-first explanations
|
|
541
|
+
# - Copy-paste examples
|
|
542
|
+
#
|
|
543
|
+
# For the full template, see:
|
|
544
|
+
# https://github.com/redpanda-data/docs-extensions-and-macros/blob/main/team-standards/personas-template.yaml
|
|
545
|
+
#
|
|
546
|
+
# Current working directory: ${cwd}
|
|
547
|
+
`;
|
|
548
|
+
return {
|
|
549
|
+
contents: [{
|
|
550
|
+
uri: 'redpanda://personas',
|
|
551
|
+
mimeType: 'text/yaml',
|
|
552
|
+
text: fallbackContent
|
|
553
|
+
}]
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
} catch (err) {
|
|
557
|
+
console.error(`Error loading personas: ${err.message}`);
|
|
558
|
+
throw new Error(`Failed to load personas: ${err.message}`);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
530
562
|
// Handle list tools request
|
|
531
563
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
532
564
|
return { tools };
|
|
533
565
|
});
|
|
534
566
|
|
|
535
|
-
//
|
|
536
|
-
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
537
|
-
const allPrompts = promptCache.getAll();
|
|
538
|
-
return { prompts: promptsToMcpFormat(allPrompts) };
|
|
539
|
-
});
|
|
567
|
+
// Prompts handler removed - prompts migrated to docs-team-standards plugin
|
|
540
568
|
|
|
541
569
|
// Handle list resources request
|
|
542
570
|
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
@@ -553,49 +581,7 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
|
553
581
|
return getResourceContent(uri);
|
|
554
582
|
});
|
|
555
583
|
|
|
556
|
-
//
|
|
557
|
-
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
558
|
-
const { name, arguments: args } = request.params;
|
|
559
|
-
|
|
560
|
-
// Record usage
|
|
561
|
-
usageStats.recordPrompt(name);
|
|
562
|
-
|
|
563
|
-
// Get prompt from cache
|
|
564
|
-
const prompt = promptCache.get(name);
|
|
565
|
-
if (!prompt) {
|
|
566
|
-
throw new Error(`Unknown prompt: ${name}`);
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// Validate arguments if schema exists
|
|
570
|
-
if (prompt.arguments && prompt.arguments.length > 0) {
|
|
571
|
-
try {
|
|
572
|
-
validatePromptArguments(name, args, prompt.arguments);
|
|
573
|
-
} catch (err) {
|
|
574
|
-
return {
|
|
575
|
-
messages: [{
|
|
576
|
-
role: 'user',
|
|
577
|
-
content: {
|
|
578
|
-
type: 'text',
|
|
579
|
-
text: `Error: ${err.message}`
|
|
580
|
-
}
|
|
581
|
-
}]
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// Build prompt with arguments
|
|
587
|
-
const promptText = buildPromptWithArguments(prompt, args);
|
|
588
|
-
|
|
589
|
-
return {
|
|
590
|
-
messages: [{
|
|
591
|
-
role: 'user',
|
|
592
|
-
content: {
|
|
593
|
-
type: 'text',
|
|
594
|
-
text: promptText
|
|
595
|
-
}
|
|
596
|
-
}]
|
|
597
|
-
};
|
|
598
|
-
});
|
|
584
|
+
// Get prompt handler removed - prompts migrated to docs-team-standards plugin
|
|
599
585
|
|
|
600
586
|
// Handle tool execution
|
|
601
587
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -666,40 +652,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
666
652
|
|
|
667
653
|
// Start the server
|
|
668
654
|
async function main() {
|
|
669
|
-
//
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
console.error(`Loaded ${prompts.length} prompts`);
|
|
673
|
-
|
|
674
|
-
// Validate configuration at startup
|
|
675
|
-
console.error('Validating MCP configuration...');
|
|
676
|
-
const validation = validateMcpConfiguration({
|
|
677
|
-
resources,
|
|
678
|
-
resourceMap,
|
|
679
|
-
prompts,
|
|
680
|
-
baseDir
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
if (!validation.valid) {
|
|
684
|
-
console.error('\nMCP Configuration validation FAILED:');
|
|
685
|
-
validation.errors.forEach(err => console.error(` ${err}`));
|
|
686
|
-
console.error('\nServer cannot start with invalid configuration.');
|
|
687
|
-
process.exit(1);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
if (validation.warnings.length > 0) {
|
|
691
|
-
console.error('\nWarnings:');
|
|
692
|
-
validation.warnings.forEach(warn => console.error(` ⚠ ${warn}`));
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
console.error('Configuration valid');
|
|
696
|
-
|
|
697
|
-
// Enable file watching in dev mode
|
|
698
|
-
if (process.env.MCP_DEV_MODE === 'true') {
|
|
699
|
-
watchPrompts(baseDir, promptCache, (reloadedPrompts) => {
|
|
700
|
-
console.error(`Prompts reloaded: ${reloadedPrompts.length} available`);
|
|
701
|
-
});
|
|
702
|
-
}
|
|
655
|
+
// Prompts have been migrated to docs-team-standards plugin (skills/agents)
|
|
656
|
+
// No prompts to load from this MCP server
|
|
657
|
+
console.error('Prompts: migrated to docs-team-standards plugin');
|
|
703
658
|
|
|
704
659
|
// Initialize usage tracking
|
|
705
660
|
createShutdownHandler(usageStats, baseDir);
|
|
@@ -722,11 +677,9 @@ async function main() {
|
|
|
722
677
|
console.error(`Server version: ${packageJson.version}`);
|
|
723
678
|
console.error(`Working directory: ${process.cwd()}`);
|
|
724
679
|
console.error(`Repository root: ${repoInfo.root} (${repoInfo.detected ? repoInfo.type : 'not detected'})`);
|
|
680
|
+
console.error('Mode: execution tools only (prompts/resources migrated to docs-team-standards)');
|
|
725
681
|
console.error('Background job queue: enabled');
|
|
726
682
|
console.error('Command timeout: 10 minutes');
|
|
727
|
-
console.error('Auto-discovery: enabled');
|
|
728
|
-
console.error('Startup validation: enabled');
|
|
729
|
-
console.error('Usage telemetry: enabled');
|
|
730
683
|
}
|
|
731
684
|
|
|
732
685
|
main().catch((error) => {
|
package/bin/doc-tools.js
CHANGED
|
@@ -400,10 +400,8 @@ programCli
|
|
|
400
400
|
})
|
|
401
401
|
|
|
402
402
|
/**
|
|
403
|
-
* @description Validate the MCP server configuration including
|
|
404
|
-
*
|
|
405
|
-
* @why Use this command to verify that all MCP prompts and resources are properly
|
|
406
|
-
* configured before deploying or after making changes to prompt files.
|
|
403
|
+
* @description Validate the MCP server configuration including tools and resources.
|
|
404
|
+
* @why Use this command to verify the MCP server is properly configured.
|
|
407
405
|
* @example
|
|
408
406
|
* # Validate MCP configuration
|
|
409
407
|
* npx doc-tools validate-mcp
|
|
@@ -411,49 +409,44 @@ programCli
|
|
|
411
409
|
*/
|
|
412
410
|
programCli
|
|
413
411
|
.command('validate-mcp')
|
|
414
|
-
.description('Validate MCP server configuration (
|
|
412
|
+
.description('Validate MCP server configuration (tools, resources)')
|
|
415
413
|
.action(() => {
|
|
416
|
-
const {
|
|
417
|
-
PromptCache,
|
|
418
|
-
loadAllPrompts
|
|
419
|
-
} = require('./mcp-tools/prompt-discovery')
|
|
420
414
|
const {
|
|
421
415
|
validateMcpConfiguration,
|
|
422
416
|
formatValidationResults
|
|
423
417
|
} = require('./mcp-tools/mcp-validation')
|
|
424
418
|
|
|
425
|
-
|
|
426
|
-
const
|
|
419
|
+
// Tools are defined in doc-tools-mcp.js - we validate the structure
|
|
420
|
+
const tools = [
|
|
421
|
+
{ name: 'get_antora_structure', description: 'Get Antora documentation structure' },
|
|
422
|
+
{ name: 'get_redpanda_version', description: 'Get latest Redpanda version' },
|
|
423
|
+
{ name: 'get_console_version', description: 'Get latest Console version' },
|
|
424
|
+
{ name: 'generate_property_docs', description: 'Generate property documentation' },
|
|
425
|
+
{ name: 'generate_metrics_docs', description: 'Generate metrics documentation' },
|
|
426
|
+
{ name: 'generate_rpk_docs', description: 'Generate rpk CLI documentation' },
|
|
427
|
+
{ name: 'generate_rpcn_connector_docs', description: 'Generate connector documentation' },
|
|
428
|
+
{ name: 'generate_helm_docs', description: 'Generate Helm chart documentation' },
|
|
429
|
+
{ name: 'generate_crd_docs', description: 'Generate CRD documentation' },
|
|
430
|
+
{ name: 'generate_cloud_regions', description: 'Generate cloud regions documentation' },
|
|
431
|
+
{ name: 'generate_bundle_openapi', description: 'Bundle OpenAPI specifications' },
|
|
432
|
+
{ name: 'review_generated_docs', description: 'Review generated documentation' },
|
|
433
|
+
{ name: 'run_doc_tools_command', description: 'Run raw doc-tools command' },
|
|
434
|
+
{ name: 'get_job_status', description: 'Get background job status' },
|
|
435
|
+
{ name: 'list_jobs', description: 'List background jobs' }
|
|
436
|
+
]
|
|
427
437
|
|
|
428
438
|
const resources = [
|
|
429
439
|
{
|
|
430
|
-
uri: 'redpanda://
|
|
431
|
-
name: '
|
|
432
|
-
description: '
|
|
433
|
-
mimeType: 'text/markdown',
|
|
434
|
-
version: '1.0.0',
|
|
435
|
-
lastUpdated: '2025-12-11'
|
|
440
|
+
uri: 'redpanda://personas',
|
|
441
|
+
name: 'Repository Personas',
|
|
442
|
+
description: 'Target audience personas loaded from docs-data/personas.yaml'
|
|
436
443
|
}
|
|
437
444
|
]
|
|
438
445
|
|
|
439
|
-
const resourceMap = {
|
|
440
|
-
'redpanda://style-guide': { file: 'style-guide.md', mimeType: 'text/markdown' }
|
|
441
|
-
}
|
|
442
|
-
|
|
443
446
|
try {
|
|
444
|
-
console.log('
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
console.log('\nValidating configuration...')
|
|
449
|
-
const validation = validateMcpConfiguration({
|
|
450
|
-
resources,
|
|
451
|
-
resourceMap,
|
|
452
|
-
prompts,
|
|
453
|
-
baseDir
|
|
454
|
-
})
|
|
455
|
-
|
|
456
|
-
const output = formatValidationResults(validation, { resources, prompts })
|
|
447
|
+
console.log('Validating MCP configuration...')
|
|
448
|
+
const validation = validateMcpConfiguration({ tools, resources })
|
|
449
|
+
const output = formatValidationResults(validation, { tools, resources })
|
|
457
450
|
console.log('\n' + output)
|
|
458
451
|
|
|
459
452
|
if (!validation.valid) {
|
|
@@ -466,74 +459,9 @@ programCli
|
|
|
466
459
|
})
|
|
467
460
|
|
|
468
461
|
/**
|
|
469
|
-
* @description
|
|
470
|
-
*
|
|
471
|
-
* @why Use this command
|
|
472
|
-
* output format and argument substitution works correctly.
|
|
473
|
-
* @example
|
|
474
|
-
* # Preview a prompt with content argument
|
|
475
|
-
* npx doc-tools preview-prompt review-content --content "Sample text"
|
|
476
|
-
*
|
|
477
|
-
* # Preview a prompt with topic and audience
|
|
478
|
-
* npx doc-tools preview-prompt write-docs --topic "Kafka" --audience "developers"
|
|
479
|
-
* @requirements None.
|
|
480
|
-
*/
|
|
481
|
-
programCli
|
|
482
|
-
.command('preview-prompt')
|
|
483
|
-
.description('Preview a prompt with arguments to see the final output')
|
|
484
|
-
.argument('<prompt-name>', 'Name of the prompt to preview')
|
|
485
|
-
.option('--content <text>', 'Content argument (for review/check prompts)')
|
|
486
|
-
.option('--topic <text>', 'Topic argument (for write prompts)')
|
|
487
|
-
.option('--audience <text>', 'Audience argument (for write prompts)')
|
|
488
|
-
.action((promptName, options) => {
|
|
489
|
-
const {
|
|
490
|
-
PromptCache,
|
|
491
|
-
loadAllPrompts,
|
|
492
|
-
buildPromptWithArguments
|
|
493
|
-
} = require('./mcp-tools/prompt-discovery')
|
|
494
|
-
|
|
495
|
-
const baseDir = findRepoRoot()
|
|
496
|
-
const promptCache = new PromptCache()
|
|
497
|
-
|
|
498
|
-
try {
|
|
499
|
-
loadAllPrompts(baseDir, promptCache)
|
|
500
|
-
|
|
501
|
-
const prompt = promptCache.get(promptName)
|
|
502
|
-
if (!prompt) {
|
|
503
|
-
console.error(`Error: Prompt not found: ${promptName}`)
|
|
504
|
-
console.error(`\nAvailable prompts: ${promptCache.getNames().join(', ')}`)
|
|
505
|
-
process.exit(1)
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
const args = {}
|
|
509
|
-
if (options.content) args.content = options.content
|
|
510
|
-
if (options.topic) args.topic = options.topic
|
|
511
|
-
if (options.audience) args.audience = options.audience
|
|
512
|
-
|
|
513
|
-
const promptText = buildPromptWithArguments(prompt, args)
|
|
514
|
-
|
|
515
|
-
console.log('='.repeat(70))
|
|
516
|
-
console.log(`PROMPT PREVIEW: ${promptName}`)
|
|
517
|
-
console.log('='.repeat(70))
|
|
518
|
-
console.log(`Description: ${prompt.description}`)
|
|
519
|
-
console.log(`Version: ${prompt.version}`)
|
|
520
|
-
if (prompt.arguments.length > 0) {
|
|
521
|
-
console.log(`Arguments: ${prompt.arguments.map(a => a.name).join(', ')}`)
|
|
522
|
-
}
|
|
523
|
-
console.log('='.repeat(70))
|
|
524
|
-
console.log('\n' + promptText)
|
|
525
|
-
console.log('\n' + '='.repeat(70))
|
|
526
|
-
} catch (err) {
|
|
527
|
-
console.error(`Error: Preview failed: ${err.message}`)
|
|
528
|
-
process.exit(1)
|
|
529
|
-
}
|
|
530
|
-
})
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* @description Show MCP server version information including available prompts,
|
|
534
|
-
* resources, and optionally usage statistics from previous sessions.
|
|
535
|
-
* @why Use this command to see what MCP capabilities are available and to review
|
|
536
|
-
* usage patterns for optimization.
|
|
462
|
+
* @description Show MCP server version information including available tools
|
|
463
|
+
* and optionally usage statistics from previous sessions.
|
|
464
|
+
* @why Use this command to see what MCP capabilities are available.
|
|
537
465
|
* @example
|
|
538
466
|
* # Show version and capabilities
|
|
539
467
|
* npx doc-tools mcp-version
|
|
@@ -548,105 +476,90 @@ programCli
|
|
|
548
476
|
.option('--stats', 'Show usage statistics if available', false)
|
|
549
477
|
.action((options) => {
|
|
550
478
|
const packageJson = require('../package.json')
|
|
551
|
-
const {
|
|
552
|
-
PromptCache,
|
|
553
|
-
loadAllPrompts
|
|
554
|
-
} = require('./mcp-tools/prompt-discovery')
|
|
555
|
-
|
|
556
|
-
const baseDir = findRepoRoot()
|
|
557
|
-
const promptCache = new PromptCache()
|
|
558
479
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
480
|
+
const tools = [
|
|
481
|
+
{ name: 'get_antora_structure', description: 'Get Antora documentation structure' },
|
|
482
|
+
{ name: 'get_redpanda_version', description: 'Get latest Redpanda version' },
|
|
483
|
+
{ name: 'get_console_version', description: 'Get latest Console version' },
|
|
484
|
+
{ name: 'generate_property_docs', description: 'Generate property documentation' },
|
|
485
|
+
{ name: 'generate_metrics_docs', description: 'Generate metrics documentation' },
|
|
486
|
+
{ name: 'generate_rpk_docs', description: 'Generate rpk CLI documentation' },
|
|
487
|
+
{ name: 'generate_rpcn_connector_docs', description: 'Generate connector documentation' },
|
|
488
|
+
{ name: 'generate_helm_docs', description: 'Generate Helm chart documentation' },
|
|
489
|
+
{ name: 'generate_crd_docs', description: 'Generate CRD documentation' },
|
|
490
|
+
{ name: 'generate_cloud_regions', description: 'Generate cloud regions documentation' },
|
|
491
|
+
{ name: 'generate_bundle_openapi', description: 'Bundle OpenAPI specifications' },
|
|
492
|
+
{ name: 'review_generated_docs', description: 'Structural validation of generated docs' },
|
|
493
|
+
{ name: 'run_doc_tools_command', description: 'Run raw doc-tools command' },
|
|
494
|
+
{ name: 'get_job_status', description: 'Get background job status' },
|
|
495
|
+
{ name: 'list_jobs', description: 'List background jobs' }
|
|
496
|
+
]
|
|
570
497
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
498
|
+
const resources = [
|
|
499
|
+
{
|
|
500
|
+
uri: 'redpanda://personas',
|
|
501
|
+
name: 'Repository Personas',
|
|
502
|
+
description: 'Loaded from docs-data/personas.yaml'
|
|
503
|
+
}
|
|
504
|
+
]
|
|
576
505
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
: ''
|
|
582
|
-
console.log(` - ${prompt.name} (v${prompt.version})${args}`)
|
|
583
|
-
console.log(` ${prompt.description}`)
|
|
584
|
-
})
|
|
585
|
-
console.log('')
|
|
506
|
+
console.log('Redpanda Doc Tools MCP Server')
|
|
507
|
+
console.log('='.repeat(60))
|
|
508
|
+
console.log(`Server version: ${packageJson.version}`)
|
|
509
|
+
console.log('')
|
|
586
510
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
console.log('')
|
|
511
|
+
console.log(`Tools (${tools.length} available):`)
|
|
512
|
+
tools.forEach(tool => {
|
|
513
|
+
console.log(` - ${tool.name}`)
|
|
514
|
+
console.log(` ${tool.description}`)
|
|
515
|
+
})
|
|
516
|
+
console.log('')
|
|
594
517
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
.
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
console.log('\nResource Access:')
|
|
627
|
-
Object.entries(stats.resources)
|
|
628
|
-
.sort(([, a], [, b]) => b - a)
|
|
629
|
-
.forEach(([uri, count]) => {
|
|
630
|
-
console.log(` ${uri}: ${count} reads`)
|
|
631
|
-
})
|
|
632
|
-
}
|
|
633
|
-
} catch (err) {
|
|
634
|
-
console.error('Failed to parse usage statistics:', err.message)
|
|
518
|
+
console.log(`Resources (${resources.length} available):`)
|
|
519
|
+
resources.forEach(resource => {
|
|
520
|
+
console.log(` - ${resource.name}`)
|
|
521
|
+
console.log(` URI: ${resource.uri}`)
|
|
522
|
+
console.log(` ${resource.description}`)
|
|
523
|
+
})
|
|
524
|
+
console.log('')
|
|
525
|
+
|
|
526
|
+
console.log('Note: Prompts and most resources have been migrated to')
|
|
527
|
+
console.log('the docs-team-standards Claude Code plugin.')
|
|
528
|
+
console.log('')
|
|
529
|
+
|
|
530
|
+
if (options.stats) {
|
|
531
|
+
const statsPath = path.join(os.tmpdir(), 'mcp-usage-stats.json')
|
|
532
|
+
if (fs.existsSync(statsPath)) {
|
|
533
|
+
try {
|
|
534
|
+
const stats = JSON.parse(fs.readFileSync(statsPath, 'utf8'))
|
|
535
|
+
console.log('Usage Statistics:')
|
|
536
|
+
console.log('='.repeat(60))
|
|
537
|
+
|
|
538
|
+
if (stats.tools && Object.keys(stats.tools).length > 0) {
|
|
539
|
+
console.log('\nTool Usage:')
|
|
540
|
+
Object.entries(stats.tools)
|
|
541
|
+
.sort(([, a], [, b]) => b.count - a.count)
|
|
542
|
+
.forEach(([name, data]) => {
|
|
543
|
+
console.log(` ${name}:`)
|
|
544
|
+
console.log(` Invocations: ${data.count}`)
|
|
545
|
+
if (data.errors > 0) {
|
|
546
|
+
console.log(` Errors: ${data.errors}`)
|
|
547
|
+
}
|
|
548
|
+
})
|
|
635
549
|
}
|
|
636
|
-
}
|
|
637
|
-
console.
|
|
638
|
-
console.log('Statistics are exported when the MCP server shuts down.')
|
|
550
|
+
} catch (err) {
|
|
551
|
+
console.error('Failed to parse usage statistics:', err.message)
|
|
639
552
|
}
|
|
553
|
+
} else {
|
|
554
|
+
console.log('No usage statistics available yet.')
|
|
555
|
+
console.log('Statistics are exported when the MCP server shuts down.')
|
|
640
556
|
}
|
|
641
|
-
|
|
642
|
-
console.log('')
|
|
643
|
-
console.log('For more information, see:')
|
|
644
|
-
console.log(' mcp/WRITER_EXTENSION_GUIDE.adoc')
|
|
645
|
-
console.log(' mcp/AI_CONSISTENCY_ARCHITECTURE.adoc')
|
|
646
|
-
} catch (err) {
|
|
647
|
-
console.error(`Error: Failed to retrieve version information: ${err.message}`)
|
|
648
|
-
process.exit(1)
|
|
649
557
|
}
|
|
558
|
+
|
|
559
|
+
console.log('')
|
|
560
|
+
console.log('For more information, see:')
|
|
561
|
+
console.log(' mcp/WRITER_EXTENSION_GUIDE.adoc')
|
|
562
|
+
console.log(' mcp/README.adoc')
|
|
650
563
|
})
|
|
651
564
|
|
|
652
565
|
// ====================================================================
|