# skydeckai/skydeckai-code architecture

> Architecture diagram of the GitHub repository skydeckai/skydeckai-code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skydeckai/skydeckai-code
- Repository: https://github.com/skydeckai/skydeckai-code

## Overview

##### Project type and purpose
- This is a Python-based MCP server packaged as a CLI tool (“skydeckai-code-cli”) that exposes ~26 “tools” for AI-driven software development workflows.
- Its purpose is to let an AI agent invoke file-system operations, code analysis (via tree-sitter), code execution, web fetching/searching, screenshot capture, system info, etc., through a common MCP protocol.

##### File structure
- Top-level:
- Dockerfile, pyproject.toml, smithery.yaml (packaging for MCP), README, LICENSE
- src/aidd/cli.py (entrypoint CLI)
- src/aidd/server.py (MCP server that registers tools)
- src/aidd/tools/… (each tool as a Python module)
- Pattern: a single process hosting a tool-registry and dispatching invocations to individual tool modules.
- Configuration: looks for ~/.skydeckai_code/config.json for workspace restrictions.

##### README for additional insights
- Lists the 26 tools in categories (File System, Code Tools, Web Tools, Screen Tools, System, Utility).
- Describes external dependencies: tree-sitter for parsing, ripgrep fallback, HTML-to-Markdown conversion, multiple search engines, screenshot libs, image handling.
- Shows CLI usage and security constraints (allowed directory sandboxing).

##### Elements
- Blue for internal components (CLI, Server, Tools)
- Green for external integrations (FS, Network, Parser, Screenshot)
- Orange for configuration and packaging artifacts (config file, Docker)

##### Final advice
- Sandbox boundary (allowed_directory).
- Technology callouts (tree-sitter, ripgrep, PIL, requests).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    User["User/Agent"]:::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        CLI["CLI Layer"]:::internal
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        MCP["MCP Server"]:::internal
        Registry["Tool Registry"]:::internal
        Base["Tool Base"]:::internal
    end

    %% Tools Layer
    subgraph "Tools"
        subgraph "File System & OS Tools"
            FT["File Operations"]:::internal
            DT["Directory Operations"]:::internal
            PT["Path Utilities"]:::internal
            ST["System Information"]:::internal
        end
        subgraph "Code Tools"
            CA["Code Analysis"]:::internal
            CE["Code Execution"]:::internal
            CT["Code Utilities"]:::internal
        end
        subgraph "Web Tools"
            WT["Web Tools"]:::internal
        end
        subgraph "Screenshot & Image Tools"
            SC["Screenshot Capture"]:::internal
            IP["Image Processing"]:::internal
            AA["Active Apps Listing"]:::internal
            AW["Available Windows Listing"]:::internal
        end
        subgraph "Utility & State Management"
            SS["Shared Tool State"]:::internal
            OT["Miscellaneous Helpers"]:::internal
        end
    end

    %% External Integrations
    subgraph "External Integrations"
        FS["File System & OS"]:::external
        NET["Network & Web"]:::external
        PARSER["Language Parsers"]:::external
        IMGAPI["Screenshot/Image APIs"]:::external
        SEARCH["Search Engines"]:::external
    end

    %% Configuration & Packaging
    Config["Config Store"]:::config
    Docker["Dockerfile"]:::config
    Packaging["Packaging Artifacts"]:::config

    %% Connections - Request Flow
    User -->|"CLI args"| CLI
    CLI -->|"invocation"| MCP
    MCP -->|"loads registry"| Registry
    Registry -->|"inherits"| Base
    Registry --> FT
    Registry --> DT
    Registry --> PT
    Registry --> ST
    Registry --> CA
    Registry --> CE
    Registry --> CT
    Registry --> WT
    Registry --> SC
    Registry --> IP
    Registry --> AA
    Registry --> AW
    Registry --> SS
    Registry --> OT

    FT -->|"file ops"| FS
    DT -->|"dir ops"| FS
    PT -->|"path utils"| FS
    ST -->|"sys info"| FS
    CA -->|"parse code"| PARSER
    CE -->|"execute code"| FS
    CT -->|"code utils"| PARSER
    WT -->|"http requests"| NET
    SC -->|"capture"| IMGAPI
    IP -->|"process images"| IMGAPI
    AA -->|"list apps"| IMGAPI
    AW -->|"list windows"| IMGAPI
    SS -->|"state management"| FS
    OT -->|"helpers"| FS

    MCP -->|"reads config"| Config
    CLI -->|"container support"| Docker
    MCP -->|"packaging metadata"| Packaging

    %% Response Flow
    MCP -->|"JSON RPC response"| CLI
    CLI -->|"output JSON"| User

    %% Click Events
    click CLI "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/cli.py"
    click MCP "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/server.py"
    click Base "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/base.py"
    click FT "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/file_tools.py"
    click DT "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/directory_tools.py"
    click PT "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/path_tools.py"
    click ST "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/system_tools.py"
    click CA "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/code_analysis.py"
    click CE "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/code_execution.py"
    click CT "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/code_tools.py"
    click WT "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/web_tools.py"
    click SC "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/screenshot_tool.py"
    click IP "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/image_tools.py"
    click AA "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/get_active_apps_tool.py"
    click AW "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/get_available_windows_tool.py"
    click SS "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/state.py"
    click OT "https://github.com/skydeckai/skydeckai-code/blob/main/src/aidd/tools/other_tools.py"
    click Docker "https://github.com/skydeckai/skydeckai-code/tree/main/Dockerfile"
    click Packaging "https://github.com/skydeckai/skydeckai-code/blob/main/pyproject.toml"

    %% Styles
    classDef internal fill:#D6EAFE,stroke:#0366d6,stroke-width:1px;
    classDef external fill:#E2F0CB,stroke:#6AA121,stroke-width:1px;
    classDef config fill:#FFE4B3,stroke:#D97704,stroke-width:1px;
```
