Skip to main content
Glama
apolosan

Design Patterns MCP Server

by apolosan
composite.json1.19 kB
{ "id": "composite", "name": "Composite", "category": "Structural", "description": "Composes objects into tree structures to represent part-whole hierarchies", "when_to_use": "Tree structures\nUniform treatment\nRecursive structures", "benefits": "Simplified client code\nEasy to add new components\nRecursive composition", "drawbacks": "Can make design overly general\nType safety issues", "use_cases": "File systems\nUI component trees\nOrganization charts", "complexity": "Medium", "tags": [ "structural", "tree", "hierarchy" ], "examples": { "typescript": { "language": "typescript", "code": "interface Component {\n execute(): void;\n}\n\nclass Leaf implements Component {\n constructor(private name: string) {}\n execute() { console.log(this.name); }\n}\n\nclass Composite implements Component {\n private children: Component[] = [];\n \n add(c: Component) { this.children.push(c); }\n execute() { this.children.forEach(c => c.execute()); }\n}\n\n// Usage: treat individual and composite uniformly\nconst tree = new Composite();\ntree.add(new Leaf('Leaf 1'));\ntree.add(new Leaf('Leaf 2'));\ntree.execute();" } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/apolosan/design_patterns_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server