# quantgeekdev/mcp-framework architecture

> Architecture diagram of the GitHub repository quantgeekdev/mcp-framework, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quantgeekdev/mcp-framework
- Repository: https://github.com/quantgeekdev/mcp-framework

## Overview

##### Main Components

a) Core Framework Components:
- MCPServer (central component)
- Feature Loaders (PromptLoader, ResourceLoader, ToolLoader)
- Base Classes (BaseTool, BasePrompt, BaseResource)
- CLI Interface

b) External Integration Points:
- Claude Desktop Integration
- LLM (Language Model) Interface
- Client Applications

##### Component Relationships

- Inheritance relationships (Base classes → Implementations)
- Data flow (Client requests → Server → Tools/Prompts/Resources)
- Loading/Discovery paths (Loaders → Implementation directories)

##### Specific Elements

a) Framework Core:
**┌─ MCPServer**
- Feature Loaders
- PromptLoader
- ResourceLoader
- ToolLoader
- Logger

b) Base Classes:
**┌─ Abstract Components**
- BaseTool
- BasePrompt
- BaseResource

c) CLI Structure:
**┌─ CLI**
- Project Creation
- Tool Addition
- Prompt Addition
- Resource Addition

##### Implementation Details

How the framework handles:
- Type safety with Zod integration
- Directory-based discovery system
- Runtime validation flow
- Tool/Prompt/Resource registration process

##### Notes for Implementation

- Use double lines for data flow paths

##### Additional Details

- How the CLI interfaces with the project structure
- Where user customization points exist
- Relationship with Claude Desktop
- Build pipeline flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Integration Layer"]
        CD[Claude Desktop]
        OC[Other Clients]
    end

    subgraph Core["Core Framework Layer"]
        MCP["MCP Server"]:::core
        click MCP "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/core/MCPServer.ts"
        
        Log["Logger"]:::core
        click Log "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/core/Logger.ts"
        
        subgraph Loaders["Feature Loaders"]
            PL["Prompt Loader"]:::loader
            click PL "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/loaders/promptLoader.ts"
            RL["Resource Loader"]:::loader
            click RL "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/loaders/resourceLoader.ts"
            TL["Tool Loader"]:::loader
            click TL "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/loaders/toolLoader.ts"
        end

        subgraph Base["Base Classes"]
            BT["Base Tool"]:::base
            click BT "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/tools/BaseTool.ts"
            BP["Base Prompt"]:::base
            click BP "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/prompts/BasePrompt.ts"
            BR["Base Resource"]:::base
            click BR "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/resources/BaseResource.ts"
        end
    end

    subgraph CLI["CLI Layer"]
        CLIE["CLI Entry Point"]:::cli
        click CLIE "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/cli/index.ts"
        
        subgraph CLITools["CLI Tools"]
            PC["Project Creation"]:::cli
            click PC "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/cli/project/create.ts"
            TA["Tool Addition"]:::cli
            click TA "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/cli/project/add-tool.ts"
            PA["Prompt Addition"]:::cli
            click PA "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/cli/project/add-prompt.ts"
            RA["Resource Addition"]:::cli
            click RA "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/cli/project/add-resource.ts"
        end

        Build["Build System"]:::cli
        click Build "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/cli/framework/build.ts"
        
        PV["Project Validation"]:::cli
        click PV "https://github.com/QuantGeekDev/mcp-framework/blob/main/src/cli/utils/validate-project.ts"
    end

    subgraph Implementation["Implementation Layer"]
        CT["Custom Tools"]:::impl
        CP["Custom Prompts"]:::impl
        CR["Custom Resources"]:::impl
    end

    %% Relationships
    CD --> MCP
    OC --> MCP
    MCP --> Log
    
    MCP --> PL
    MCP --> RL
    MCP --> TL
    
    PL --> BP
    RL --> BR
    TL --> BT
    
    BP --> CP
    BR --> CR
    BT --> CT
    
    CLIE --> PC
    CLIE --> TA
    CLIE --> PA
    CLIE --> RA
    CLIE --> Build
    CLIE --> PV

    %% Styles
    classDef core fill:#2374ab,stroke:#2374ab,color:#fff
    classDef loader fill:#48a9a6,stroke:#48a9a6,color:#fff
    classDef base fill:#4b4e6d,stroke:#4b4e6d,color:#fff
    classDef impl fill:#95a5a6,stroke:#95a5a6,color:#fff
    classDef cli fill:#e67e22,stroke:#e67e22,color:#fff

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Loaders"]:::loader
        L3["Base Classes"]:::base
        L4["Implementation"]:::impl
        L5["CLI Components"]:::cli
    end
```
