# antfu/nuxt-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/antfu/nuxt-mcp
- Repository: https://github.com/antfu/nuxt-mcp

## Overview

##### Main Components
- Monorepo Root: Represent the overall repository containing shared configuration files (e.g., package.json at the root, pnpm-lock.yaml, and pnpm-workspace.yaml) and directories like .github, .vscode, and configuration scripts (build.config.ts, eslint.config.js, tsconfig.json).
- Package A – nuxt-mcp:
- Module: The core functionality defined in packages/nuxt-mcp/src (e.g., module.ts, tools, types).
- Playground: A demonstration area (packages/nuxt-mcp/playground) with an example Nuxt app including nuxt.config.ts and sample components.
- Package B – vite-plugin-mcp:
- Plugin functionality defined in packages/vite-plugin-mcp/src (e.g., connect.ts, server.ts, index.ts, types.ts).
- Playground: An example Vite project (packages/vite-plugin-mcp/playground) including configuration (vite.config.ts), main application code (main.ts) with counter.ts, and an HTML file.
- Tests: A test directory that includes test cases and exported YAML files (e.g., test/exports/nuxt-mcp.yaml, test/exports/vite-plugin-mcp.yaml) to verify the packages’ functionality.
- CI/CD & Workflow: GitHub workflows (.github/workflows) for continuous integration and release processes.

##### Relationships and Interactions
- Both packages share common tooling and build configurations at the monorepo level. They likely have interdependencies or at least a similar design pattern to support the MCP functionality.
- The playground examples for both packages demonstrate how to integrate each into their respective frameworks (Nuxt and Vite) and serve as a live sandbox, indicating a clear separation between development and production-ready components.
- Testing and CI workflows interact with both packages to ensure consistency and stability across the project.

##### Architectural Patterns & Design Principles
- Modular Architecture – With each package being independently maintained but developed within the same repository. Emphasize their isolation (via src, playground, and package.json files) and separation of concerns.
- Integration via Plugins/Modules – The project adapts different ecosystems (Nuxt and Vite) through respective modules/plugins.
- Extensibility – The presence of playground examples and separate tool scripts (e.g., scaffold.ts, runtime.ts) suggests that the project is built with further extensibility in mind.

##### Relevant Technologies and Tools
- Nuxt (for nuxt-mcp) and Vite (for vite-plugin-mcp) as the primary frameworks.
- TypeScript is used across the project (multiple tsconfig.json files and .ts file extensions).
- Additional build and configuration tools: pnpm for managing the monorepo, ESLint for linting, and GitHub Actions for CI/CD.
- Testing frameworks (Vitest based on vitest.config.ts and files in the test directory).

##### Instructing the Principal Software Engineer on Diagramming
- Create clearly labeled components, such as “Monorepo Root,” “nuxt-mcp Module,” “vite-plugin-mcp Plugin,” “Playground Examples,” “CI/CD Workflows,” and “Test Suites.”
– Data flow from the application (playground) to the modules/plugins.
– Dependencies between the core source (src) and tooling scripts.
– Interactions with external systems like the Nuxt or Vite runtime.
– Rectangles for core components.
- Detail each component as much as necessary, ensuring modular boundaries are well represented and all significant architectural elements (tools, configs, CI workflows) are included.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Monorepo Root"
        CONFIG["Shared Config & CI/CD"]
        CI["CI/CD Workflows"]
        PM["Project Modules"]
        TESTS["Test Suites"]
        CONFIG -->|"includes"| CI
        CONFIG -->|"defines"| PM
    end

    subgraph "nuxt-mcp Package"
        N_SRC["Core Module (src)"]
        N_PLAYGROUND["Playground Example"]
        N_SRC -->|"demonstrates"| N_PLAYGROUND
    end

    subgraph "vite-plugin-mcp Package"
        V_SRC["Plugin Functionality (src)"]
        V_PLAYGROUND["Playground Example"]
        V_SRC -->|"supports"| V_PLAYGROUND
    end

    %% Connect Project Modules to Packages
    PM -->|"contains"| N_SRC
    PM -->|"contains"| V_SRC

    %% External Ecosystems
    NUXT["Nuxt Ecosystem"]:::external
    VITE["Vite Ecosystem"]:::external

    %% Playground examples rely on external frameworks
    N_PLAYGROUND -->|"runs on"| NUXT
    V_PLAYGROUND -->|"runs on"| VITE

    %% Tests validate core components
    TESTS -->|"verify"| N_SRC
    TESTS -->|"verify"| V_SRC

    %% CI/CD triggers tests
    CI -->|"executes"| TESTS

    %% Click Events
    click CONFIG "https://github.com/antfu/nuxt-mcp/blob/main/package.json"
    click CI "https://github.com/antfu/nuxt-mcp/tree/main/.github/workflows"
    click N_SRC "https://github.com/antfu/nuxt-mcp/tree/main/packages/nuxt-mcp/src"
    click N_PLAYGROUND "https://github.com/antfu/nuxt-mcp/tree/main/packages/nuxt-mcp/playground"
    click V_SRC "https://github.com/antfu/nuxt-mcp/tree/main/packages/vite-plugin-mcp/src"
    click V_PLAYGROUND "https://github.com/antfu/nuxt-mcp/tree/main/packages/vite-plugin-mcp/playground"
    click TESTS "https://github.com/antfu/nuxt-mcp/tree/main/test"

    %% Styles
    classDef root fill:#ffa,stroke:#333,stroke-width:2px;
    classDef package fill:#aaf,stroke:#333,stroke-width:2px;
    classDef src fill:#afa,stroke:#333,stroke-width:2px;
    classDef playground fill:#faa,stroke:#333,stroke-width:2px;
    classDef test fill:#ffa07a,stroke:#333,stroke-width:2px;
    classDef ci fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef external fill:#f0e68c,stroke:#333,stroke-width:2px;

    class CONFIG,PM root;
    class N_SRC,V_SRC src;
    class N_PLAYGROUND,V_PLAYGROUND playground;
    class CI ci;
    class TESTS test;
    class NUXT,VITE external;
```
