The Design Patterns MCP Server provides intelligent design pattern recommendations through semantic search and natural language queries, accessing a comprehensive catalog of 555+ patterns across 20+ categories.
Core Capabilities:
Natural language pattern discovery: Find relevant patterns using problem descriptions with confidence-scored recommendations
Advanced search options: Perform keyword, semantic, or hybrid searches with filtering by categories (GoF, Architectural, Microservices, React, AI/ML, Security, etc.) and programming languages
Detailed pattern information: Access comprehensive details including multi-language code examples, relationships, and use cases for any specific pattern
Catalog statistics: Query total pattern counts with optional category breakdowns
High-performance operations: Fast vector search using sqlite-vec with LRU caching and object pooling, delivering 30-40% faster repeated queries
AI assistant integration: Compatible with MCP clients like Claude Code and Cursor for seamless workflow integration
Uses SQLite with vector extensions for efficient semantic search and storage of design pattern embeddings and metadata
Click on "Install 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 Patterns MCP ServerI need a pattern for handling user authentication with multiple providers"
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 Patterns MCP Server
An intelligent MCP (Model Context Protocol) server that provides design pattern recommendations using hybrid search (semantic + keyword + graph augmentation). Access 685+ design patterns across 90+ categories through a natural language interface with advanced blended RAG architecture.
Quick Start
# Clone and setup
git clone https://github.com/apolosan/design_patterns_mcp.git
cd design_patterns_mcp
# Install dependencies
bun install
# Build and setup database
bun run db:setup
# Start the server
bun run devConfigure in your MCP client (Claude Desktop, Cursor, etc.) and start discovering patterns through natural language queries.
Features
Feature | Description |
Hybrid Search Engine | Blended RAG combining semantic, keyword (TF-IDF), and graph-augmented retrieval |
685+ Patterns | Comprehensive catalog across 12 major categories |
MCP Integration | Seamless integration with Claude, Cursor, and other MCP clients |
Multi-Level Caching | L1 in-memory + L3 SQLite cache with 95%+ hit rate |
Event Bus System | Decoupled service communication via pub/sub |
Telemetry & Health | Real-time performance metrics and system monitoring |
SOLID Architecture | Clean, maintainable codebase following best practices |
Production Ready | 464 test cases with 100% pass rate |
Available Pattern Categories
Category | Count | Examples |
Classic GoF Patterns | 34 | Factory, Builder, Observer, Strategy, Command |
Architectural Patterns | 56 | MVC, Clean Architecture, Hexagonal, DDD |
Microservices & Cloud | 39 | Circuit Breaker, Saga, Service Mesh |
Data Engineering | 54 | Repository, CQRS, Event Sourcing |
AI/ML & MLOps | 46 | RAG, Fine-Tuning, Model Compression |
React Patterns | 27 | Hooks, Server Components, Performance |
Blockchain & Web3 | 115 | DeFi, NFTs, Smart Contracts, MEV |
Concurrency & Reactive | 45 | Producer-Consumer, Actor Model |
Security | 21 | OAuth, RBAC, Zero Trust |
Functional Programming | 26 | Monads, Functors, Higher-Order Functions |
Architecture
src/
├── adapters/ # External service adapters (LLM, embeddings)
├── cli/ # CLI commands (migrate, seed, embeddings, setup-relationships)
├── core/ # DI Container, configuration builder
├── db/ # Database migrations
├── events/ # Event bus system
├── handlers/ # MCP request handlers (hybrid search, recommendations)
├── health/ # Health check services
├── repositories/ # Data access layer
├── search/ # Hybrid search engine
├── services/ # Business services (cache, telemetry, pattern service)
├── strategies/ # Strategy pattern implementations
├── types/ # TypeScript type definitions
└── mcp-server.ts # MCP server entry point
data/
├── patterns/ # 750+ JSON pattern definitions
└── design-patterns.db # SQLite database with embeddingsUsage
Finding Patterns
Ask natural language questions through your MCP client:
"I need to create complex objects with many optional configurations"
→ Builder, Abstract Factory, Factory Method
"How to handle service failures gracefully in distributed systems?"
→ Circuit Breaker, Bulkhead, Retry, Fallback
"What pattern helps with state-dependent behavior in React?"
→ State Machine, Observer, useReducer
"How to implement secure authentication and authorization?"
→ OAuth 2.0, RBAC, JWT, Zero TrustMCP Tools
Tool | Description |
| Hybrid search for patterns using problem descriptions |
| Keyword or semantic search with filtering |
| Comprehensive pattern information with code examples |
| Statistics about available patterns |
| System health and service status |
Installation
Prerequisites
Node.js >= 18.0.0
Bun >= 1.0.0 (recommended) or npm >= 8.0.0
Setup
# Install dependencies
bun install
# Build project
bun run build
# Complete database setup (migrate + seed + embeddings + relationships)
bun run db:setup
# Or run steps individually
bun run migrate
bun run seed
bun run generate-embeddings
bun run setup-relationshipsMCP Configuration
Add to your .mcp.json or Claude Desktop configuration:
{
"mcpServers": {
"design-patterns": {
"command": "node",
"args": ["dist/src/mcp-server.js"],
"cwd": "/path/to/design-patterns-mcp",
"env": {
"LOG_LEVEL": "info",
"DATABASE_PATH": "./data/design-patterns.db",
"ENABLE_HYBRID_SEARCH": "true",
"ENABLE_GRAPH_AUGMENTATION": "true",
"EMBEDDING_COMPRESSION": "true",
"ENABLE_FUZZY_LOGIC": "true",
"ENABLE_TELEMETRY": "true",
"ENABLE_MULTI_LEVEL_CACHE": "true"
}
}
}
}Environment Variables
Variable | Default | Description |
|
| Logging level (debug, info, warn, error) |
|
| SQLite database path |
|
| Enable blended RAG search |
|
| Enable pattern relationship traversal |
|
| Dimensionality reduction |
|
| Fuzzy logic result refinement |
|
| Performance metrics |
|
| L1 + L3 caching |
|
| Request concurrency limit |
|
| Cache size limit |
|
| Cache TTL in milliseconds |
|
| Transport mode (stdio/http) |
|
| HTTP port (http mode) |
|
| MCP endpoint path |
|
| Health check path |
|
| Skip database setup |
Docker Deployment
Quick Start
# Build
docker build -t design-patterns-mcp .
# Run HTTP mode
docker run -p 3000:3000 -e TRANSPORT_MODE=http design-patterns-mcp
# Run stdio mode (default)
docker run design-patterns-mcpDocker Compose
docker compose up --build -dEnvironment Variables
Variable | Default | Description |
|
| Transport mode (stdio/http) |
|
| HTTP port (http mode) |
|
| MCP endpoint path |
|
| Health check path |
|
| SQLite database path |
|
| Logging level |
|
| Skip database setup |
Endpoints (HTTP mode)
GET /health- Health checkPOST /mcp- MCP JSON-RPC endpoint
Commands
# Development
bun run build # Compile TypeScript
bun run dev # Development with hot reload
bun run start # Build and start production server
# Database
bun run db:setup # Complete database setup
bun run migrate # Run migrations
bun run seed # Seed pattern data
bun run generate-embeddings # Generate semantic embeddings
bun run setup-relationships # Setup pattern relationships
# Quality
bun run test # Run all tests
bun run lint # Check code quality
bun run lint:fix # Auto-fix linting issues
bun run typecheck # TypeScript type checkingTesting
The project includes 464 test cases across 41 test files with 100% pass rate:
Contract Tests: MCP protocol compliance validation
Integration Tests: Component interaction tests
Performance Tests: Search and vectorization benchmarks
Unit Tests: Individual component tests
# Run all tests
bun run test
# Run specific test suites
bun run test:unit -- --grep "PatternService"
bun run test:integration -- --grep "database"
bun run test:performance -- --timeout 30000Architecture Patterns
This project implements the patterns it documents:
Pattern | Implementation |
Repository |
|
Service Layer |
|
Object Pool |
|
Dependency Injection |
|
Strategy |
|
Event Bus |
|
Multi-Level Cache |
|
Builder |
|
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
Fork the repository
Create a feature branch
Make changes following SOLID principles
Run tests and linting
Submit a pull request
License
MIT License - see LICENSE for details.
Resources
Version: 0.4.4
Last Updated: February 2026
Patterns: 685+ (750+ JSON files)
Tests: 464 test cases | 100% pass rate