# prmalakoti/mcp-hub architecture

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

- Interactive diagram: https://gitdiagram.com/prmalakoti/mcp-hub
- Repository: https://github.com/prmalakoti/mcp-hub

## Overview

MCP Hub combines a NestJS control plane for registering and managing MCP server processes with a standalone STDIO MCP server that exposes health, time, calculator, and echo tools. The README describes a React frontend, but the sampled App.tsx is still the Vite starter, so no frontend-to-API behavior is inferred. The backend MCP client is also documented but not evidenced as an implemented runtime workflow in the sampled files; the graph focuses on verified management and tool-serving paths.

Main entry points: [`server/src/modules/mcp/mcp.service.ts`](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/mcp.service.ts) (MCP Service), [`server/mcp-server/register-tools.ts`](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/register-tools.ts) (Tool Registration), [`server/src/modules/mcp/mcp.controller.ts`](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/mcp.controller.ts) (MCP REST API), [`server/mcp-server/tools/calculator/calculator.tool.ts`](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/calculator/calculator.tool.ts) (Calculator Tool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Frontend"]
  node_frontend["React App<br/>[App.tsx]"]
end

subgraph group_control["Backend Control Plane"]
  node_api["MCP REST API<br/>[mcp.controller.ts]"]
  node_manager["MCP Service<br/>[mcp.service.ts]"]
  node_processes["Process Manager"]
  node_records["Server Records"]
  node_create_dto["Create DTO"]
  node_update_dto["Update DTO"]
  node_status["Server Status"]
  node_database[("Database Config<br/>[database.config.ts]")]
end

subgraph group_runtime["Standalone MCP Server"]
  node_mcp_runtime["MCP Runtime<br/>[main.ts]"]
  node_registration["Tool Registration<br/>[register-tools.ts]"]
end

subgraph group_tools["MCP Tools"]
  node_health["Health Tool<br/>[health.tool.ts]"]
  node_health_service["Health Logic<br/>[health.service.ts]"]
  node_time["Time Tool<br/>[time.tool.ts]"]
  node_time_service["Time Logic<br/>[time.service.ts]"]
  node_calculator["Calculator Tool<br/>[calculator.tool.ts]"]
  node_calculator_schema["Calculator Schema"]
  node_calculator_service["Calculator Logic"]
  node_echo["Echo Tool<br/>[echo.tool.ts]"]
  node_echo_schema["Echo Schema<br/>[echo.schema.ts]"]
  node_echo_service["Echo Logic<br/>[echo.service.ts]"]
end

node_user(("User"))
node_mcp_client(("MCP Client"))

node_user -->|"uses"| node_frontend
node_user -->|"manages servers"| node_api
node_frontend -.->|"calls API"| node_api
node_api -->|"delegates to"| node_manager
node_api -->|"accepts"| node_create_dto
node_api -->|"accepts"| node_update_dto
node_manager -->|"starts and stops"| node_processes
node_manager -->|"reads and writes"| node_records
node_manager -->|"sets status"| node_status
node_manager -.->|"persists via ORM"| node_database
node_mcp_runtime -->|"registers tools"| node_registration
node_registration -->|"registers"| node_health
node_registration -->|"registers"| node_time
node_registration -->|"registers"| node_calculator
node_registration -->|"registers"| node_echo
node_health -->|"delegates to"| node_health_service
node_time -->|"delegates to"| node_time_service
node_calculator -->|"delegates to"| node_calculator_service
node_calculator -->|"validates with"| node_calculator_schema
node_echo -->|"delegates to"| node_echo_service
node_echo -->|"validates with"| node_echo_schema
node_mcp_client -->|"connects via STDIO"| node_mcp_runtime

click node_frontend "https://github.com/prmalakoti/mcp-hub/blob/main/client/src/App.tsx"
click node_api "https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/mcp.controller.ts"
click node_manager "https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/mcp.service.ts"
click node_processes "https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/process/process-manager.service.ts"
click node_records "https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/entities/mcp-server.entity.ts"
click node_create_dto "https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/dto/create-mcp-server.dto.ts"
click node_update_dto "https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/dto/update-mcp-server.dto.ts"
click node_status "https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/enums/server-status.enum.ts"
click node_database "https://github.com/prmalakoti/mcp-hub/blob/main/server/src/config/database.config.ts"
click node_mcp_runtime "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/main.ts"
click node_registration "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/register-tools.ts"
click node_health "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/health/health.tool.ts"
click node_health_service "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/health/health.service.ts"
click node_time "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/time/time.tool.ts"
click node_time_service "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/time/time.service.ts"
click node_calculator "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/calculator/calculator.tool.ts"
click node_calculator_schema "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/calculator/calculator.schema.ts"
click node_calculator_service "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/calculator/calculator.service.ts"
click node_echo "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/echo/echo.tool.ts"
click node_echo_schema "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/echo/echo.schema.ts"
click node_echo_service "https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/echo/echo.service.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_user,node_mcp_client toneBlue
class node_api,node_manager,node_processes,node_records,node_create_dto,node_update_dto,node_status,node_database toneAmber
class node_mcp_runtime,node_registration toneMint
class node_health,node_health_service,node_time,node_time_service,node_calculator,node_calculator_schema,node_calculator_service,node_echo,node_echo_schema,node_echo_service toneRose
```

## Components

### Frontend

- [React App](https://github.com/prmalakoti/mcp-hub/blob/main/client/src/App.tsx): `client/src/App.tsx`

### Backend Control Plane

- [MCP REST API](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/mcp.controller.ts): `server/src/modules/mcp/mcp.controller.ts`
- [MCP Service](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/mcp.service.ts): `server/src/modules/mcp/mcp.service.ts`
- [Process Manager](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/process/process-manager.service.ts): `server/src/modules/mcp/process/process-manager.service.ts`
- [Server Records](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/entities/mcp-server.entity.ts): `server/src/modules/mcp/entities/mcp-server.entity.ts`
- [Create DTO](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/dto/create-mcp-server.dto.ts): `server/src/modules/mcp/dto/create-mcp-server.dto.ts`
- [Update DTO](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/dto/update-mcp-server.dto.ts): `server/src/modules/mcp/dto/update-mcp-server.dto.ts`
- [Server Status](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/modules/mcp/enums/server-status.enum.ts): `server/src/modules/mcp/enums/server-status.enum.ts`
- [Database Config](https://github.com/prmalakoti/mcp-hub/blob/main/server/src/config/database.config.ts): `server/src/config/database.config.ts`

### Standalone MCP Server

- [MCP Runtime](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/main.ts): `server/mcp-server/main.ts`
- [Tool Registration](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/register-tools.ts): `server/mcp-server/register-tools.ts`

### MCP Tools

- [Health Tool](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/health/health.tool.ts): `server/mcp-server/tools/health/health.tool.ts`
- [Health Logic](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/health/health.service.ts): `server/mcp-server/tools/health/health.service.ts`
- [Time Tool](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/time/time.tool.ts): `server/mcp-server/tools/time/time.tool.ts`
- [Time Logic](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/time/time.service.ts): `server/mcp-server/tools/time/time.service.ts`
- [Calculator Tool](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/calculator/calculator.tool.ts): `server/mcp-server/tools/calculator/calculator.tool.ts`
- [Calculator Schema](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/calculator/calculator.schema.ts): `server/mcp-server/tools/calculator/calculator.schema.ts`
- [Calculator Logic](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/calculator/calculator.service.ts): `server/mcp-server/tools/calculator/calculator.service.ts`
- [Echo Tool](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/echo/echo.tool.ts): `server/mcp-server/tools/echo/echo.tool.ts`
- [Echo Schema](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/echo/echo.schema.ts): `server/mcp-server/tools/echo/echo.schema.ts`
- [Echo Logic](https://github.com/prmalakoti/mcp-hub/blob/main/server/mcp-server/tools/echo/echo.service.ts): `server/mcp-server/tools/echo/echo.service.ts`

### Other components

- **User**
- **MCP Client**

## Connections

- User → React App: uses
- User → MCP REST API: manages servers (evidence: `server/src/modules/mcp/mcp.controller.ts`)
- React App → MCP REST API: calls API
- MCP REST API → MCP Service: delegates to (evidence: `server/src/modules/mcp/mcp.controller.ts`)
- MCP REST API → Create DTO: accepts (evidence: `server/src/modules/mcp/mcp.controller.ts`)
- MCP REST API → Update DTO: accepts (evidence: `server/src/modules/mcp/mcp.controller.ts`)
- MCP Service → Process Manager: starts and stops (evidence: `server/src/modules/mcp/mcp.service.ts`)
- MCP Service → Server Records: reads and writes (evidence: `server/src/modules/mcp/mcp.service.ts`)
- MCP Service → Server Status: sets status (evidence: `server/src/modules/mcp/mcp.service.ts`)
- MCP Service → Database Config: persists via ORM
- MCP Runtime → Tool Registration: registers tools (evidence: `server/mcp-server/main.ts`)
- Tool Registration → Health Tool: registers (evidence: `server/mcp-server/register-tools.ts`)
- Tool Registration → Time Tool: registers (evidence: `server/mcp-server/register-tools.ts`)
- Tool Registration → Calculator Tool: registers (evidence: `server/mcp-server/register-tools.ts`)
- Tool Registration → Echo Tool: registers (evidence: `server/mcp-server/register-tools.ts`)
- Health Tool → Health Logic: delegates to (evidence: `server/mcp-server/tools/health/health.tool.ts`)
- Time Tool → Time Logic: delegates to (evidence: `server/mcp-server/tools/time/time.tool.ts`)
- Calculator Tool → Calculator Logic: delegates to (evidence: `server/mcp-server/tools/calculator/calculator.tool.ts`)
- Calculator Tool → Calculator Schema: validates with (evidence: `server/mcp-server/tools/calculator/calculator.tool.ts`)
- Echo Tool → Echo Logic: delegates to (evidence: `server/mcp-server/tools/echo/echo.tool.ts`)
- Echo Tool → Echo Schema: validates with (evidence: `server/mcp-server/tools/echo/echo.tool.ts`)
- MCP Client → MCP Runtime: connects via STDIO (evidence: `README.md`)
