Design Patterns MCP Server
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 "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 Patterns MCP Server I 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 710 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 and build (using bun)
bun install
bun run db:setup
# Or using npm (if bun is not installed)
npm install --ignore-scripts
npx tsc
node dist/cli/migrate.js
node dist/cli/seed.js
node dist/cli/generate-embeddings.js
node dist/cli/setup-relationships.jsConfigure in your MCP client (Claude Desktop, Cursor, etc.) and start discovering patterns through natural language queries.
Related MCP server: Acemcp
Tooling and build hygiene
Use Bun as the canonical package manager for this repository (
bun installonly). The lockfile isbun.lock.Never copy a
.gitdirectory intodist/data(or ship it insidedist/). That path must remain a plain data directory to avoid multi‑gigabyte images and metadata leakage.
Features
Feature | Description |
Hybrid Search Engine | Blended RAG combining semantic, keyword (BM25), and graph-augmented retrieval |
710 Patterns | Comprehensive catalog across 90+ categories including Feature Flag / Feature Toggle for progressive delivery and experimentation |
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 | 654 test cases across 77 test files with 100% pass rate (0 failures, 0 skips) |
Available Pattern Categories
Category | Count | Examples |
Classic GoF Patterns | 34 | Factory, Builder, Observer, Strategy, Command |
Architectural Patterns | 56 | MVC, Clean Architecture, Hexagonal, DDD, Feature Flag |
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/ # 710 JSON pattern definitions (see `feature-flag.json`)
└── design-patterns.db # SQLite database with 710 patterns and 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 with Bun
bun install
bun run build
bun run db:setupSetup with npm
The prepare script in package.json requires bun. If you don't have bun installed, use --ignore-scripts to skip it and build manually:
npm install --ignore-scripts
npx tsc
# Setup database
node dist/cli/migrate.js
node dist/cli/seed.js
node dist/cli/generate-embeddings.js
node dist/cli/setup-relationships.jsMCP Configuration
Add to your MCP client configuration (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"design-patterns": {
"command": "node",
"args": ["/absolute/path/to/design-patterns-mcp/dist/mcp-server.js"],
"env": {
"LOG_LEVEL": "info",
"DATABASE_PATH": "/absolute/path/to/design-patterns-mcp/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"
}
}
}
}Important: Use absolute paths for both
argsandDATABASE_PATH. MCP clients like Cursor do not reliably support thecwdfield, so relative paths resolve against the user's home directory rather than the project directory. See the project quickstart for client-specific configuration examples.
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 654 test cases across 77 test files with 100% pass rate (0 failures, 0 skips):
Contract Tests: MCP protocol compliance validation
Integration Tests: Component interaction tests against live SQLite DB and embeddings
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 |
|
Vector search (runtime honesty)
The server uses sql.js (SQLite WASM) with in-memory cosine similarity over stored embeddings. Native sqlite-vec (vec0 virtual tables) is not available in this runtime. Semantic search works for the current catalog size (~710 patterns) but does not use indexed native vector tables.
Enable LLM enrichment only when you have a real provider integration — built-in LLM bridge providers return placeholders unless extended.
Contributing
Contributions are welcome! See the contributing guide.
Fork the repository
Create a feature branch
Make changes following SOLID principles
Run tests and linting
Submit a pull request
Release Notes
v0.7.2 — Version Bump (2026-08-16)
Canonical version bumped from
0.7.1→0.7.2across active source and documentation files.Files updated:
package.json,src/mcp-server.ts(Server registration + runtime info),AGENTS.md,CLAUDE.md(canonical-identity header),README.md(badge, release-notes section, version footer),CHANGELOG.md(new entry).docs/IMPROVEMENTS_03.mdandQUICKSTART.mdaudit-evidence references preserved untouched per state #45.Stale version references corrected:
AGENTS.mdandCLAUDE.mdheader(version 0.6.0)→(version 0.7.2)(was 7 minor versions behind the actualpackage.json).Runtime self-report now advertises
0.7.2to MCP clients viaServerconstructor and/infoendpoint.No code-level behavioural change: pure release/version-canonicalisation patch.
Tests: full suite preserved (no test files modified), typecheck clean.
v0.7.1 — Lint + Test Stabilization (2026-08-16)
Test suite fully validated: 654/654 GREEN, 0 skips, 0 todos (was 651/654 with 3 pre-existing flakes).
Resolved
data/.gitleak introduced bydb:setuppipeline (data-hygiene test).Aligned two outdated tests with the BUG-007 contract: snake_case
search_typeis silently ignored byvalidateSearchPatternsArgsand the canonical defaulthybridstrategy is applied.tests/unit/input-validation.test.tstests/unit/mcp-server-search.test.ts
README.md version drift corrected: trailing block now reflects canonical 0.7.0 → 0.7.1 baseline, badge + Production Ready + Testing section aligned with current 654-test suite.
Lint baseline restored: 0 problems, exit 0 (was 2 errors + 6 warnings).
Removed unused
HealthStatusimport insrc/mcp/http-transport.ts.Added targeted
eslint-disableforrequire-awaiton the synchronouscheck()insrc/health/embedding-coverage-health-check.ts(interface conformance preserved).Refactored
ensureBM25()insrc/handlers/keyword-search-handler.tsto returnBM25Scorer, eliminating 4 non-null assertions at the call sites.Replaced 2 non-null assertions on
results.find()intests/unit/bm25-scorer.test.tswith explicittoBeDefinedguards.
bun run typecheckclean.
v0.7.0 — Catalog Expansion (2026-08-16)
24 new design patterns added from
docs/01_Agentic_Design_Patterns.mdanddocs/02_Data_Engineering_Design_Patterns.md:3 Agentic AI: Multi-Agent Collaboration, Goal Setting and Monitoring, Exception Handling and Recovery.
21 Data Engineering: Aligned Fan-In, Unaligned Fan-In, Bin Pack Orderer, Exclusive Choice, FIFO Orderer, Fine-Grained Accessor for Resources, Fine-Grained Accessor for Tables, Fine-Grained Tracker, In-Place Overwriter, Isolated Sequencer, Metadata Decorator, Metadata Enhancer, Offline Observer, Schema Compatibility Enforcer, Schema Migrator, Secretless Connector, Secrets Pointer, Single Runner, Skew Detector, SLA Misses Detector, Vertical Partitioner.
Catalog grew from 686 → 710 patterns (Agentic AI: 3→6, Data Engineering: 4→25).
Integrity check PASS: 710 patterns, 151 valid relationships.
654/654 tests pass (100% green, 0 skips, 0 todos).
License
MIT License - see LICENSE for details.
Resources
Vector search notes (sql.js vs sqlite-vec) — see contributing guide
MCP tools surface reference
Documentation index
Version: 0.7.2 Last Updated: August 2026 Patterns: 710 JSON definitions (highlight: Feature Flag / Feature Toggle) Tests: 654 test cases | 100% pass rate (0 failures, 0 skips)
See also: the latest adversarial quality assurance report (16 findings: 1 critical, 9 high-priority, 6 minor). Findings cover search pipeline correctness, configuration drift, transport security, and documentation sync.
Available Tools
4 toolscount_patternsB
Get the total number of design patterns in the database
Inputs: includeDetails.
find_patternsC
Find design patterns matching a problem description using semantic search
Inputs: query (required), categories, maxResults, programmingLanguage.
get_pattern_detailsC
Get detailed information about a specific pattern
Inputs: patternId (required).
search_patternsC
Search patterns by keyword or semantic similarity
Inputs: query (required), searchType, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Multiple tools have overlapping purposes that could cause confusion. 'find_patterns' and 'search_patterns' both appear to search for patterns, with descriptions that are nearly identical ('semantic search' vs 'keyword or semantic similarity'), making them difficult to distinguish. 'count_patterns' and 'get_pattern_details' are clearer, but the overlap between the two search tools significantly reduces disambiguation.
All tool names follow a consistent verb_noun pattern with snake_case, such as 'count_patterns', 'find_patterns', 'get_pattern_details', and 'search_patterns'. This uniformity makes the tool set predictable and easy to understand, with no deviations in naming conventions.
With only 4 tools, the set feels thin for a server focused on design patterns, which typically involve operations like creating, updating, or categorizing patterns. While basic retrieval functions are covered, the low count may limit functionality for more complex agent tasks, placing it in the borderline range for appropriateness.
The tool set is severely incomplete for a design patterns domain, as it only supports read operations (counting, searching, and getting details) with no ability to create, update, delete, or manage patterns. This lack of CRUD coverage creates significant gaps that will likely cause agent failures when trying to perform full lifecycle tasks.
Maintenance
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
295k+ bug-fix patterns with MCP Hub proxy, PII filtering, and code search
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables semantic code search across projects using AI embeddings to find code by meaning rather than just text matching. Provides fast intelligent search, symbol analysis, and code similarity detection with multi-language support.MIT
- AlicenseAqualityDmaintenanceProvides code repository indexing and semantic search capabilities, allowing natural language queries to find relevant code snippets with automatic incremental indexing and multi-language support.116 npm359ISC
- AlicenseAqualityDmaintenanceProvides design pattern templates and anti-pattern guidance to AI coding agents for correct pattern implementation.21MIT
- 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