# nighttrek/software-planning-mcp architecture

> Architecture diagram of the GitHub repository nighttrek/software-planning-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nighttrek/software-planning-mcp
- Repository: https://github.com/nighttrek/software-planning-mcp

## Overview

##### Project type and purpose
- This is not a web frontend. It’s a backend “Model Context Protocol” (MCP) server written in Node.js/TypeScript.
- It exposes a set of “tools” (start_planning, add_todo, etc.) to any MCP‑compliant client (e.g., Claude Desktop).
- Its purpose is to orchestrate interactive planning sessions: receiving commands, managing todo items, scoring complexity, and persisting plans.

##### File structure
- Top level:
- Dockerfile, smithery.yaml – deployment/config files for containerization and MCP registration
- package.json, pnpm-lock.yaml, tsconfig.json – build and dependency configs
- src/ – TypeScript source code
- src/index.ts – the entrypoint that registers all tools and handles the MCP lifecycle
- src/prompts.ts – defines question templates and prompt logic
- src/storage.ts – encapsulates persistence (in memory, file system, or database)
- src/types.ts – shared type definitions for request and data models

##### README for additional insights
- Lists all “tools” the server offers, their inputs and outputs
- Shows how the client invokes these tools via `client.callTool(…)`
- Describes build, install, and configuration steps (how MCP picks up this server)

##### Main components
a. MCP Client (e.g., Claude Desktop)
b. MCP Server – Node.js process
- Controller Layer (index.ts)
- Prompt Service (prompts.ts)
- Storage Service (storage.ts)
- Types / DTO layer (types.ts)
c. Persistence Layer (in-memory cache or file-based JSON, or external database if added later)
d. Configuration (smithery.yaml, Dockerfile)
e. (Optional) External AI / NLP engine if prompts are forwarded

##### Relationships and interactions
- Client → MCP Server: sends tool invocation requests
- MCP Server (Controller) → Prompt Service: to generate or format messages/templates
- MCP Server (Controller) → Storage Service: to create, update, retrieve, or delete todos and plans
- Storage Service → (Persistent store)
- MCP Server → Client: returns tool results (todos list, confirmation, plan text)

##### Architectural patterns and design principles
- Command pattern: each tool maps to a function in index.ts
- Service separation: prompts and storage logic are factored into separate modules
- Type safety: DTOs and request parameters defined in types.ts
- Config-driven deployment: smithery.yaml registers commands, Dockerfile enables containerization

##### Relevant technologies/frameworks
- Node.js + TypeScript
- pnpm for package management
- MCP runtime (Smithery CLI integration)
- Potential file‑based or in‑memory persistence (no external DB in current scope)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Entities
    Client["MCP Client"]:::external

    %% Server Components
    subgraph "MCP Server"
        Controller["Controller (index.ts)"]:::code
        Prompt["Prompt Service (prompts.ts)"]:::code
        Storage["Storage Service (storage.ts)"]:::code
        Types["Types / DTOs (types.ts)"]:::code
    end

    %% Persistence
    Persistence["Persistence Store"]:::external

    %% Configuration Artifacts
    subgraph "Configuration"
        Dockerfile["Dockerfile"]:::config
        Smithery["smithery.yaml"]:::config
        Package["package.json"]:::config
        TsConfig["tsconfig.json"]:::config
    end

    %% Relationships
    Client -->|"Tool call"| Controller
    Controller -->|"Generate prompt"| Prompt
    Controller -->|"Uses DTOs"| Types
    Controller -->|"CRUD operations"| Storage
    Storage -->|"Persist/Retrieve"| Persistence
    Controller -->|"Return result"| Client

    %% Click Events
    click Controller "https://github.com/nighttrek/software-planning-mcp/blob/main/src/index.ts"
    click Prompt "https://github.com/nighttrek/software-planning-mcp/blob/main/src/prompts.ts"
    click Storage "https://github.com/nighttrek/software-planning-mcp/blob/main/src/storage.ts"
    click Types "https://github.com/nighttrek/software-planning-mcp/blob/main/src/types.ts"
    click Dockerfile "https://github.com/nighttrek/software-planning-mcp/tree/main/Dockerfile"
    click Smithery "https://github.com/nighttrek/software-planning-mcp/blob/main/smithery.yaml"
    click Package "https://github.com/nighttrek/software-planning-mcp/blob/main/package.json"
    click TsConfig "https://github.com/nighttrek/software-planning-mcp/blob/main/tsconfig.json"

    %% Styles
    classDef code fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef external fill:#DFFFE0,stroke:#228B22,color:#228B22;
    classDef config fill:#FFE4B5,stroke:#FF8C00,color:#FF8C00;
```
