Skip to content

Commit fbf3cc6

Browse files
tosin2013claude
andcommitted
feat(docs): add validated patterns and deployment info to server context
Enhanced server-context-generator.ts with 3 new sections for deployment awareness: 1. **Validated Deployment Patterns Section**: - Lists all 7 validated patterns (OpenShift, Kubernetes, Docker, Node.js, Python, MCP, A2A) - Shows version, required dependencies, deployment phases, critical validation checks - Includes base code repository URLs - Provides MCP resource URIs for accessing pattern details - Lists related deployment tools 2. **MCP Resources Section**: - Featured resources for validated patterns (4 new resources) - Architectural knowledge graph - Deployment status and project metrics - Shows 7 featured + 16 additional resources (23 total) 3. **Recent Deployment Activity Section**: - Tracks deployment-related intents from knowledge graph - Shows DAG executions via bootstrap_validation_loop - Lists recent deployment attempts with status and tools used - Documents hybrid DAG architecture capabilities - Platform support and cleanup options Impact: - LLMs using @.mcp-server-context.md now have full awareness of deployment capabilities - Instant discovery of validated patterns without querying resources - Visibility into recent deployment activity and DAG execution history - Comprehensive deployment workflow guidance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 143c425 commit fbf3cc6

File tree

1 file changed

+170
-0
lines changed

1 file changed

+170
-0
lines changed

src/utils/server-context-generator.ts

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { MemoryEntityManager } from './memory-entity-manager.js';
1616
import { ConversationMemoryManager } from './conversation-memory-manager.js';
1717
import { loadConfig } from './config.js';
1818
import { EnhancedLogger } from './enhanced-logging.js';
19+
import { listAllPatterns } from './validated-pattern-definitions.js';
1920

2021
export interface ServerContextOptions {
2122
outputPath?: string;
@@ -51,6 +52,12 @@ export class ServerContextGenerator {
5152
// Server Quick Reference
5253
sections.push(this.generateServerInfo());
5354

55+
// Validated Deployment Patterns
56+
sections.push(this.generateValidatedPatternsSection());
57+
58+
// MCP Resources
59+
sections.push(this.generateMcpResourcesSection());
60+
5461
// Memory & Knowledge Graph Status
5562
sections.push(
5663
await this.generateMemoryStatus(kgManager, memoryManager, conversationManager, maxRecentItems)
@@ -59,6 +66,9 @@ export class ServerContextGenerator {
5966
// Analytics
6067
sections.push(await this.generateAnalytics(kgManager));
6168

69+
// Recent Deployment Activity
70+
sections.push(await this.generateDeploymentActivitySection(kgManager));
71+
6272
// Patterns
6373
sections.push(await this.generatePatterns(memoryManager));
6474

@@ -580,6 +590,166 @@ ${knowledgeGaps || '- No knowledge gaps identified'}
580590
${opportunities || '- No optimization opportunities identified'}`;
581591
}
582592

593+
private generateValidatedPatternsSection(): string {
594+
const patterns = listAllPatterns();
595+
596+
const patternList = patterns
597+
.map(
598+
p => `- **${p.name}** (${p.platformType})
599+
- Version: ${p.version}
600+
- Dependencies: ${p.billOfMaterials.dependencies.filter(d => d.required).length} required
601+
- Deployment Phases: ${p.deploymentPhases.length}
602+
- Validation Checks: ${p.validationChecks.filter(v => v.severity === 'critical').length} critical
603+
- Base Code: ${p.baseCodeRepository.url}`
604+
)
605+
.join('\n\n');
606+
607+
return `## 🚀 Validated Deployment Patterns
608+
609+
The server provides ${patterns.length} pre-validated deployment patterns for different platforms.
610+
Each pattern includes bill of materials, deployment phases, validation checks, and authoritative sources.
611+
612+
### Available Patterns
613+
614+
${patternList}
615+
616+
### How to Access
617+
618+
Use MCP resources to get pattern details:
619+
- \`adr://validated_patterns\` - Complete catalog
620+
- \`adr://validated_pattern/{platform}\` - Specific pattern (openshift, kubernetes, docker, nodejs, python, mcp, a2a)
621+
- \`adr://pattern_sources/{platform}\` - Authoritative documentation sources
622+
- \`adr://pattern_base_code/{platform}\` - Base code repository integration
623+
624+
### Related Tools
625+
626+
- \`bootstrap_validation_loop\` - Deploy with DAG-based infrastructure automation
627+
- \`deployment_readiness\` - Validate deployment readiness
628+
- \`generate_deployment_guidance\` - Get platform-specific deployment recommendations`;
629+
}
630+
631+
private generateMcpResourcesSection(): string {
632+
const resources = [
633+
{
634+
uri: 'adr://validated_patterns',
635+
name: 'Validated Patterns Catalog',
636+
description: 'Complete catalog of all deployment patterns',
637+
},
638+
{
639+
uri: 'adr://validated_pattern/{platform}',
640+
name: 'Pattern by Platform',
641+
description: 'Individual pattern with BOM, phases, validations',
642+
},
643+
{
644+
uri: 'adr://pattern_sources/{platform}',
645+
name: 'Authoritative Sources',
646+
description: 'Prioritized documentation sources for LLM research',
647+
},
648+
{
649+
uri: 'adr://pattern_base_code/{platform}',
650+
name: 'Base Code Repository',
651+
description: 'Framework code integration instructions',
652+
},
653+
{
654+
uri: 'adr://architectural_knowledge_graph',
655+
name: 'Knowledge Graph',
656+
description: 'Complete architectural relationships and decisions',
657+
},
658+
{
659+
uri: 'adr://deployment_status',
660+
name: 'Deployment Status',
661+
description: 'Current deployment state and health checks',
662+
},
663+
{
664+
uri: 'adr://project_metrics',
665+
name: 'Project Metrics',
666+
description: 'Code metrics and quality scores',
667+
},
668+
];
669+
670+
const resourceList = resources
671+
.map(r => `- **${r.uri}**\n ${r.name}: ${r.description}`)
672+
.join('\n\n');
673+
674+
return `## 📦 MCP Resources
675+
676+
The server exposes ${resources.length} key resources (+ 16 more) for read-only access.
677+
678+
### Featured Resources
679+
680+
${resourceList}
681+
682+
**Total**: 23 resources available via MCP protocol
683+
See full list with \`ListResources\` MCP request`;
684+
}
685+
686+
private async generateDeploymentActivitySection(
687+
kgManager: KnowledgeGraphManager
688+
): Promise<string> {
689+
try {
690+
const kg = await kgManager.loadKnowledgeGraph();
691+
692+
// Find deployment-related intents
693+
const deploymentIntents = kg.intents.filter(intent => {
694+
const toolNames = intent.toolChain.map(tc => tc.toolName);
695+
return (
696+
intent.humanRequest.toLowerCase().includes('deploy') ||
697+
intent.humanRequest.toLowerCase().includes('bootstrap') ||
698+
intent.humanRequest.toLowerCase().includes('infrastructure') ||
699+
toolNames.some(name =>
700+
[
701+
'bootstrap_validation_loop',
702+
'deployment_readiness',
703+
'generate_deployment_guidance',
704+
].includes(name)
705+
)
706+
);
707+
});
708+
709+
const recentDeployments = deploymentIntents
710+
.slice(-3)
711+
.reverse()
712+
.map(intent => {
713+
const toolNames = intent.toolChain.map(tc => tc.toolName).join(', ');
714+
return `- **${intent.humanRequest.substring(0, 60)}...**
715+
- Status: ${intent.currentStatus}
716+
- Tools: ${toolNames || 'None'}
717+
- Time: ${new Date(intent.timestamp).toLocaleString()}`;
718+
})
719+
.join('\n\n');
720+
721+
// Check for bootstrap loop executions
722+
const bootstrapExecutions = deploymentIntents.filter(intent =>
723+
intent.toolChain.some(tc => tc.toolName === 'bootstrap_validation_loop')
724+
);
725+
const dagExecutions = bootstrapExecutions.length;
726+
const successfulDeployments = deploymentIntents.filter(
727+
intent => intent.currentStatus === 'completed'
728+
).length;
729+
730+
return `## 🏗️ Recent Deployment Activity
731+
732+
**Deployment Intents**: ${deploymentIntents.length}
733+
**DAG Executions**: ${dagExecutions}
734+
**Successful Deployments**: ${successfulDeployments}
735+
736+
### Recent Activity (Last 3)
737+
738+
${recentDeployments || '- No recent deployment activity'}
739+
740+
### Deployment Capabilities
741+
742+
- **Hybrid DAG Architecture**: Infrastructure deployment runs once, application iterates with auto-fix
743+
- **Platform Support**: OpenShift, Kubernetes, Docker, Node.js, Python, MCP, A2A
744+
- **Validation**: Zero-tolerance validation with automatic remediation
745+
- **Cleanup**: Full teardown support via \`deploymentCleanupRequested\` parameter`;
746+
} catch {
747+
return `## 🏗️ Recent Deployment Activity
748+
749+
_Deployment activity tracking unavailable_`;
750+
}
751+
}
752+
583753
private generateUsageGuide(): string {
584754
return `## 📝 How to Use This Context
585755

0 commit comments

Comments
 (0)