Logo Design Patterns MCP Server

Design Patterns MCP Server

Cộng đồng
apolosan

MCP Server for suggestion of Design Patterns - Provides semantic search and recommendations for software design patterns

Nhà phát hànhapolosan
Kho mãdesign_patterns_mcp
Ngôn ngữTypeScript
Bản fork
9
Sao
29
Công cụ có sẵn
0
Phương thức truyền tảistdio, streamable-http
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Design Patterns MCP Server cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    29 sao và 9 bản fork từ kho mã được liên kết.

Design Patterns MCP Server

Version License: MIT Test Status Patterns Built for TypeScript

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

bash
# 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.js

Configure in your MCP client (Claude Desktop, Cursor, etc.) and start discovering patterns through natural language queries.

Tooling and build hygiene

  • Use Bun as the canonical package manager for this repository (bun install only). The lockfile is bun.lock.
  • Never copy a .git directory into dist/data (or ship it inside dist/). That path must remain a plain data directory to avoid multi‑gigabyte images and metadata leakage.

Features

FeatureDescription
Hybrid Search EngineBlended RAG combining semantic, keyword (BM25), and graph-augmented retrieval
710 PatternsComprehensive catalog across 90+ categories including Feature Flag / Feature Toggle for progressive delivery and experimentation
MCP IntegrationSeamless integration with Claude, Cursor, and other MCP clients
Multi-Level CachingL1 in-memory + L3 SQLite cache with 95%+ hit rate
Event Bus SystemDecoupled service communication via pub/sub
Telemetry & HealthReal-time performance metrics and system monitoring
SOLID ArchitectureClean, maintainable codebase following best practices
Production Ready654 test cases across 77 test files with 100% pass rate (0 failures, 0 skips)

Available Pattern Categories

CategoryCountExamples
Classic GoF Patterns34Factory, Builder, Observer, Strategy, Command
Architectural Patterns56MVC, Clean Architecture, Hexagonal, DDD, Feature Flag
Microservices & Cloud39Circuit Breaker, Saga, Service Mesh
Data Engineering54Repository, CQRS, Event Sourcing
AI/ML & MLOps46RAG, Fine-Tuning, Model Compression
React Patterns27Hooks, Server Components, Performance
Blockchain & Web3115DeFi, NFTs, Smart Contracts, MEV
Concurrency & Reactive45Producer-Consumer, Actor Model
Security21OAuth, RBAC, Zero Trust
Functional Programming26Monads, 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 embeddings

Usage

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 Trust

MCP Tools

ToolDescription
find_patternsHybrid search for patterns using problem descriptions
search_patternsKeyword or semantic search with filtering
get_pattern_detailsComprehensive pattern information with code examples
count_patternsStatistics about available patterns
get_health_statusSystem health and service status

Installation

Prerequisites

  • Node.js >= 18.0.0
  • Bun >= 1.0.0 (recommended) or npm >= 8.0.0

Setup with Bun

bash
bun install
bun run build
bun run db:setup

Setup 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:

bash
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.js

MCP Configuration

Add to your MCP client configuration (Claude Desktop, Cursor, etc.):

json
{
  "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 args and DATABASE_PATH. MCP clients like Cursor do not reliably support the cwd field, 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

VariableDefaultDescription
LOG_LEVELinfoLogging level (debug, info, warn, error)
DATABASE_PATH./data/design-patterns.dbSQLite database path
ENABLE_HYBRID_SEARCHtrueEnable blended RAG search
ENABLE_GRAPH_AUGMENTATIONtrueEnable pattern relationship traversal
EMBEDDING_COMPRESSIONtrueDimensionality reduction
ENABLE_FUZZY_LOGICtrueFuzzy logic result refinement
ENABLE_TELEMETRYtruePerformance metrics
ENABLE_MULTI_LEVEL_CACHEtrueL1 + L3 caching
MAX_CONCURRENT_REQUESTS10Request concurrency limit
CACHE_MAX_SIZE1000Cache size limit
CACHE_TTL3600000Cache TTL in milliseconds
TRANSPORT_MODEstdioTransport mode (stdio/http)
HTTP_PORT3000HTTP port (http mode)
MCP_ENDPOINT/mcpMCP endpoint path
HEALTH_CHECK_PATH/healthHealth check path
SKIP_DB_SETUPfalseSkip database setup

Docker Deployment

Quick Start

bash
# 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-mcp

Docker Compose

bash
docker compose up --build -d

Environment Variables

VariableDefaultDescription
TRANSPORT_MODEstdioTransport mode (stdio/http)
HTTP_PORT3000HTTP port (http mode)
MCP_ENDPOINT/mcpMCP endpoint path
HEALTH_CHECK_PATH/healthHealth check path
DATABASE_PATH/app/data/design-patterns.dbSQLite database path
LOG_LEVELinfoLogging level
SKIP_DB_SETUPfalseSkip database setup

Endpoints (HTTP mode)

  • GET /health - Health check
  • POST /mcp - MCP JSON-RPC endpoint

Commands

bash
# 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 checking

Testing

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
bash
# 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 30000

Architecture Patterns

This project implements the patterns it documents:

PatternImplementation
Repositoryrepositories/pattern-repository.ts
Service Layerservices/pattern-service.ts
Object Poolservices/statement-pool.ts
Dependency Injectioncore/container.ts
Strategystrategies/search-strategy.ts
Event Busevents/event-bus.ts
Multi-Level Cacheservices/multi-level-cache.ts
Buildercore/config-builder.ts

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.

  1. Fork the repository
  2. Create a feature branch
  3. Make changes following SOLID principles
  4. Run tests and linting
  5. Submit a pull request

Release Notes

v0.7.2 — Version Bump (2026-08-16)

  • Canonical version bumped from 0.7.1 → 0.7.2 across 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.md and QUICKSTART.md audit-evidence references preserved untouched per state #45.
  • Stale version references corrected: AGENTS.md and CLAUDE.md header (version 0.6.0) → (version 0.7.2) (was 7 minor versions behind the actual package.json).
  • Runtime self-report now advertises 0.7.2 to MCP clients via Server constructor and /info endpoint.
  • 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/.git leak introduced by db:setup pipeline (data-hygiene test).
  • Aligned two outdated tests with the BUG-007 contract: snake_case search_type is silently ignored by validateSearchPatternsArgs and the canonical default hybrid strategy is applied.
    • tests/unit/input-validation.test.ts
    • tests/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 HealthStatus import in src/mcp/http-transport.ts.
    • Added targeted eslint-disable for require-await on the synchronous check() in src/health/embedding-coverage-health-check.ts (interface conformance preserved).
    • Refactored ensureBM25() in src/handlers/keyword-search-handler.ts to return BM25Scorer, eliminating 4 non-null assertions at the call sites.
    • Replaced 2 non-null assertions on results.find() in tests/unit/bm25-scorer.test.ts with explicit toBeDefined guards.
  • bun run typecheck clean.

v0.7.0 — Catalog Expansion (2026-08-16)

  • 24 new design patterns added from docs/01_Agentic_Design_Patterns.md and docs/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


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.

Cài đặt

TypingMind
Yêu cầu:

Node.js 18+

{
  "mcpServers": {
    "apolosan-design_patterns_mcp": {
      "command": "",
      "args": []
    }
  }
}

Dùng MCP Design Patterns MCP Server với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Design Patterns MCP Server, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. Bạn có thể chạy MCP ngay trên thiết bị của mình hoặc kết nối qua URL của máy chủ MCP từ xa.

Cách 1: Dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Design Patterns MCP Server làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Design Patterns MCP Server.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "apolosan-design_patterns_mcp": {
      "command": "npx",
      "args": [
        "-y",
        "design-patterns-mcp"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Design Patterns MCP Server, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Design Patterns MCP Server.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Design Patterns MCP Server giúp tôi làm việc này không?
Design Patterns MCP Server
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Design Patterns MCP Server.

Cách 2: Thêm URL máy chủ MCP

Dùng cách này khi Design Patterns MCP Server đã được lưu trữ từ xa hoặc nhóm của bạn muốn có một trình kết nối dùng chung cho nhiều người dùng.

1

Mở mục Trình kết nối MCP

Trong TypingMind, vào Plugin, mở mục Trình kết nối MCP, rồi chọn Thêm URL.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Vào mục Plugin.
  3. Mở mục Trình kết nối MCP.
  4. Nhấp vào Thêm URL.
Biểu mẫu Thêm URL máy chủ MCP tùy chỉnh của TypingMind
2

Dán URL máy chủ

Nhập URL máy chủ của bạn vào trường URL máy chủ. Thêm tên kết nối, mô tả, biểu tượng, header HTTP tùy chỉnh hoặc cài đặt ứng dụng khách OAuth nếu máy chủ yêu cầu.

  1. Dán URL máy chủ của bạn vào trường URL máy chủ.
  2. Nhập tên kết nối cho Design Patterns MCP Server.
  3. Thêm mô tả và biểu tượng nếu bạn muốn dễ nhận biết kết nối hơn.
  4. Thêm header HTTP tùy chỉnh hoặc thông tin ứng dụng khách OAuth nếu máy chủ yêu cầu xác thực.
3

Tạo kết nối

Nhấp vào Tạo kết nối, sau đó quay lại danh sách Plugin và xác nhận kết nối MCP mới đang hoạt động.

  1. Nhấp vào Tạo kết nối.
  2. Quay lại danh sách trình kết nối MCP.
  3. Xác nhận kết nối Design Patterns MCP Server hiển thị trạng thái đang hoạt động.
  4. Làm mới danh sách plugin nếu kết nối chưa xuất hiện ngay.
4

Đổi mô hình mà không cần kết nối lại

Bắt đầu cuộc trò chuyện với mô hình bạn thích, bật các công cụ của Design Patterns MCP Server trong mục Plugin và chuyển sang mô hình khác khi cần. Kết nối MCP vẫn sẵn dùng trong không gian làm việc TypingMind.

  1. Bắt đầu cuộc trò chuyện mới trong TypingMind.
  2. Chọn mô hình AI bạn muốn dùng.
  3. Bật các công cụ của Design Patterns MCP Server trong mục Plugin.
  4. Yêu cầu mô hình dùng công cụ khi cần.
  5. Chuyển sang mô hình AI khác và dùng lại cùng kết nối MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Design Patterns MCP Server giúp tôi làm việc này không?
Design Patterns MCP Server
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Design Patterns MCP Server.

Câu hỏi thường gặp

Máy chủ MCP Design Patterns MCP Server dùng để làm gì?

Design Patterns MCP Server là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Design Patterns MCP Server với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Design Patterns MCP Server với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Design Patterns MCP Server với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Design Patterns MCP Server, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Design Patterns MCP Server với TypingMind?

Bạn có thể kết nối Design Patterns MCP Server trong TypingMind bằng trình kết nối MCP cục bộ hoặc bằng cách thêm URL máy chủ MCP từ xa. Dùng trình kết nối cục bộ khi máy chủ cần truy cập tệp, ứng dụng hoặc tài nguyên riêng trên thiết bị của bạn; dùng URL máy chủ khi máy chủ MCP được lưu trữ từ xa.

MCP Design Patterns MCP Server cung cấp những công cụ nào trong TypingMind?

Design Patterns MCP Server cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Design Patterns MCP Server không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Design Patterns MCP Server yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇