Design-Pattern-MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Design-Pattern-MCP I need the Strategy pattern template for TypeScript."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Design-Pattern-MCP
An MCP (Model Context Protocol) server that provides design pattern structural constraints and anti-patterns to AI coding agents. Agents call this server during code generation to ensure they implement patterns correctly.
This server is not for human use. It is called by AI coding agents (Claude Code, Cursor, Copilot, etc.).
Tools
suggest_pattern
Map a problem description to pattern name(s).
Input: { description: string, category?: "creational"|"structural"|"behavioral"|"modern"|"architectural" }
Output: Up to 3 PatternSuggestion[] — { name, category, rationale, confidence }
Token cost: ~50–100 tokens
get_template
Get structural constraints and anti-patterns for a specific pattern in a specific language.
Input: { pattern: string, language: "go"|"java"|"python"|"rust"|"typescript"|"generic" }
Output: Compact plain text with COMPONENTS, CONSTRAINTS, ANTI-PATTERNS, language-specific notes, example structure
Token cost: ~300–500 tokens
Related MCP server: python-patterns-mcp
Installation
git clone git@github.com:sirius-zuo/design-pattern-mcp.git
cd design-pattern-mcp
npm install
npm run buildRegister with Claude Code
Add to ~/.claude/settings.json:
{
"mcpServers": {
"design-pattern-templates": {
"command": "node",
"args": ["/absolute/path/to/design-pattern-mcp/dist/index.js"]
}
}
}Register with Cursor
Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
{
"mcpServers": {
"design-pattern-templates": {
"command": "node",
"args": ["/absolute/path/to/design-pattern-mcp/dist/index.js"]
}
}
}Register with Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"design-pattern-templates": {
"command": "node",
"args": ["/absolute/path/to/design-pattern-mcp/dist/index.js"]
}
}
}Register with GitHub Copilot (VS Code)
Add to .vscode/mcp.json (project) or user settings:
{
"servers": {
"design-pattern-templates": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/design-pattern-mcp/dist/index.js"]
}
}
}Usage in Claude Desktop
Once registered, you can ask Claude to use the tools directly in conversation. The typical workflow is: suggest a pattern first, then fetch the full template for the one you want to implement.
Example 1 — Find the right pattern
You ask Claude:
I need to support multiple payment methods like credit card, PayPal, and crypto that can be swapped at runtime. What pattern should I use?
Claude calls suggest_pattern and returns:
[
{
"name": "Strategy",
"category": "behavioral",
"rationale": "multiple interchangeable algorithms",
"confidence": 0.67
},
{
"name": "Decorator",
"category": "structural",
"rationale": "add responsibilities dynamically without subclassing",
"confidence": 0.50
},
{
"name": "Saga",
"category": "modern",
"rationale": "long-running distributed transaction",
"confidence": 0.33
}
]Strategy is the strongest match. You then ask for the full template.
Example 2 — Get the full template for your language
You ask Claude:
Give me the Strategy pattern template for TypeScript.
Claude calls get_template with { pattern: "strategy", language: "typescript" } and returns:
Pattern: Strategy
Language: typescript
COMPONENTS:
- **Context**: Holds a reference to a Strategy. Delegates algorithm execution to it. Contains NO algorithm logic itself.
CONSTRAINTS:
- Context must NOT contain algorithm logic; all logic lives in ConcreteStrategy.
ANTI-PATTERNS:
- Embedding the if/else or switch selection logic inside Context (defeats the purpose).
TYPESCRIPT-SPECIFIC NOTES:
- Define single-method stateless strategies as function types: `type SortStrategy = (data: number[]) => number[]` — no interface or class needed.
- Multi-method or stateful strategies: use an `interface` with structural typing — no `implements` declaration required.
- Inject via constructor (`constructor(private strategy: SortStrategy)`) for immutability; use a setter only when runtime switching is required.
- `Context` holds a field typed to the function type or interface; calling it is `this.strategy(params)` or `this.strategy.execute(params)`.
EXAMPLE STRUCTURE:
```typescript
type Sorter = (data: number[]) => number[];
class SortContext {
constructor(private strategy: Sorter) {}
setStrategy(s: Sorter): void { this.strategy = s; }
run(data: number[]): number[] { return this.strategy(data); }
}
// Usage — any function with the right signature is a valid strategy
const ctx = new SortContext(data => [...data].sort((a, b) => a - b));
ctx.run([3, 1, 2]); // [1, 2, 3]
// Interface-based for stateful strategies
interface PricingStrategy { calculate(basePrice: number): number; }
class DiscountStrategy implements PricingStrategy {
constructor(private pct: number) {}
calculate(base: number): number { return base * (1 - this.pct); }
}Claude then uses this output as grounding constraints when writing your actual payment service code — ensuring the context doesn't embed algorithm logic, strategies are injected via constructor, and the TypeScript-idiomatic function-type approach is used.
Pattern Coverage
38 patterns across 5 categories:
Creational (5): Abstract Factory, Builder, Factory Method, Prototype, Singleton
Structural (7): Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy
Behavioral (11): Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor
Modern (8): Circuit Breaker, CQRS, Dependency Injection, Event Sourcing, Pub/Sub, Repository, Retry with Backoff, Saga
Architectural (7): Clean Architecture, Event-Driven Architecture, Hexagonal Architecture, Layered Architecture, Microservices, MVC/MVP/MVVM, Pipe and Filter
Development
npm test # run tests
npm run build # compile TypeScript to dist/
npm start # run the MCP serverAvailable Tools
2 toolsget_templateA
Get structural constraints and anti-patterns for a specific design pattern in a specific language. Returns compact plain text (~300-500 tokens) optimized for LLM consumption. Call this when you know which pattern to implement.
Inputs: pattern (required), language (required).
suggest_patternA
Map a problem description to design pattern name(s). Returns up to 3 ranked suggestions with confidence scores. Call this when you know the problem but not which pattern to apply.
Inputs: description (required), category.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have completely distinct purposes: one maps a problem to pattern names, the other retrieves implementation details for a known pattern. No overlap or ambiguity exists.
Both tool names follow the verb_noun convention (suggest_pattern, get_template), creating a predictable pattern.
With only 2 tools, the server feels minimal. However, the narrow scope (pattern suggestion and template retrieval) justifies the small count, though it borders on too few.
The core workflow is covered: identify a pattern, then retrieve its template. Missing a list_patterns or comparison tool, but these are not essential for the primary purpose.
Maintenance
Related MCP Connectors
Read-only Pattern-Assist corpus for aspiring software engineers: grounded dev patterns with sources.
AI Design Blueprint is a doctrine and runtime standard for agentic AI: 10 principles, 16 laws, and Pro/Teams validators your coding agent calls over MCP.
Design intelligence for coding agents: audits, design systems, and a taste profile agents consult.
Patterns for designing and reviewing AI skills, agents, and multi-agent workflows. Find guidance on context economy, delegation, verification, and tool design; inspect claims, worked examples, maturity labels, and source references. Five read-only tools let agents discover relevant patterns, compare concise cards, read specific sections, and explore relationships. Hosted Streamable HTTP at https://agentic-atlas.dev/mcp/ — no installation, account, or API key required. Browse the atlas at https://agentic-atlas.dev/.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides intelligent design pattern recommendations using semantic search through a comprehensive catalog of 200+ patterns across 20 categories. Users can describe programming problems in natural language to discover appropriate design patterns with contextual recommendations.435MIT
- AlicenseNot gradedqualityDmaintenanceExposes the 23 Gang of Four design patterns to AI coding agents for generation, canonical examples, AST-based detection, validation, and anti-pattern refactoring in Python codebases.1MIT
- AlicenseNot gradedqualityBmaintenanceProvides architecture design expertise to AI coding agents, analyzing requirements, selecting architecture patterns, generating concrete designs, and evaluating quality attributes.1MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to make evidence-aware design-pattern decisions by analyzing cases, comparing options, detecting misuse, stress-testing assumptions, planning adoption, writing ADRs, and generating evidence plans with transparent scoring.812 npm3MIT