# hareeshwar-n-k/lexaflow-alexa-plus-mcp architecture

> Architecture diagram of the GitHub repository hareeshwar-n-k/lexaflow-alexa-plus-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp
- Repository: https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp

## Overview

LexaFlow is a stateful household assistant: a browser-based Alexa+ simulator sends requests to an HTTP server, which uses an agent runtime and MCP tools to coordinate memory, commerce, smart-home, and media capabilities. Tool services persist household state and produce structured results for the simulator. The README documents the fallback and optional Bedrock paths; sampled excerpts do not expose every server route or UI request, so those links use README evidence.

Main entry points: [`src/tools.js`](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/tools.js) (MCP tool dispatch), [`src/store.js`](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/store.js) (Persistent household state), [`src/server.js`](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/server.js) (HTTP API server), [`src/bedrock-agent.js`](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/bedrock-agent.js) (Agent runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Alexa+ experience"]
  node_simulator["Echo Show simulator<br/>[app.js]"]
end

subgraph group_runtime["Agent and MCP runtime"]
  node_http_server["HTTP API server<br/>[server.js]"]
  node_agent["Agent runtime<br/>[bedrock-agent.js]"]
  node_mcp["MCP endpoint<br/>[mcp-server.js]"]
  node_tool_dispatch["MCP tool dispatch<br/>[tools.js]"]
end

subgraph group_domains["Household services"]
  node_memory_service["Household memory<br/>[memory-service.js]"]
  node_commerce_service["Cart and checkout"]
  node_catalog["Product and recipe catalog<br/>[catalog.js]"]
  node_smarthome["Smart-home scenes"]
  node_media["Multimodal cards<br/>[media-service.js]"]
end

subgraph group_state["State and telemetry"]
  node_store[("Persistent household state<br/>[store.js]")]
  node_seed["Initial household data<br/>[seed.js]"]
  node_telemetry["Event and telemetry stream<br/>[store.js]"]
end

node_household_user(("Household user"))
node_bedrock{{"Amazon Bedrock"}}
node_mcp_client(("External MCP client"))

node_household_user -->|"interacts with"| node_simulator
node_simulator -->|"sends requests"| node_http_server
node_http_server -->|"invokes agent"| node_agent
node_agent -->|"calls tools"| node_tool_dispatch
node_http_server -->|"mounts endpoint"| node_mcp
node_mcp_client -->|"sends JSON-RPC"| node_mcp
node_mcp -->|"dispatches tools"| node_tool_dispatch
node_tool_dispatch -->|"calls memory"| node_memory_service
node_tool_dispatch -->|"calls commerce"| node_commerce_service
node_tool_dispatch -->|"calls scenes"| node_smarthome
node_tool_dispatch -->|"renders cards"| node_media
node_commerce_service -->|"reads products"| node_catalog
node_commerce_service -->|"reads and updates"| node_store
node_memory_service -->|"reads and updates"| node_store
node_smarthome -->|"reads and updates"| node_store
node_media -->|"reads state"| node_store
node_store -->|"initializes from"| node_seed
node_seed -->|"builds seed cart"| node_catalog
node_agent -.->|"plans with"| node_bedrock
node_http_server -->|"broadcasts events"| node_telemetry

click node_simulator "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/public/app.js"
click node_http_server "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/server.js"
click node_agent "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/bedrock-agent.js"
click node_mcp "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/mcp-server.js"
click node_tool_dispatch "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/tools.js"
click node_memory_service "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/memory-service.js"
click node_commerce_service "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/commerce-service.js"
click node_catalog "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/catalog.js"
click node_smarthome "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/smarthome-service.js"
click node_media "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/media-service.js"
click node_store "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/store.js"
click node_seed "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/seed.js"
click node_telemetry "https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/store.js"

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_simulator,node_household_user,node_mcp_client toneBlue
class node_http_server,node_agent,node_mcp,node_tool_dispatch toneAmber
class node_memory_service,node_commerce_service,node_catalog,node_smarthome,node_media toneMint
class node_store,node_seed,node_telemetry toneRose
class node_bedrock toneIndigo
```

## Components

### Alexa+ experience

- [Echo Show simulator](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/public/app.js): `public/app.js`

### Agent and MCP runtime

- [HTTP API server](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/server.js): `src/server.js`
- [Agent runtime](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/bedrock-agent.js): `src/bedrock-agent.js`
- [MCP endpoint](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/mcp-server.js): `src/mcp-server.js`
- [MCP tool dispatch](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/tools.js): `src/tools.js`

### Household services

- [Household memory](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/memory-service.js): `src/memory-service.js`
- [Cart and checkout](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/commerce-service.js): `src/commerce-service.js`
- [Product and recipe catalog](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/catalog.js): `src/catalog.js`
- [Smart-home scenes](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/smarthome-service.js): `src/smarthome-service.js`
- [Multimodal cards](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/media-service.js): `src/media-service.js`

### State and telemetry

- [Persistent household state](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/store.js): `src/store.js`
- [Initial household data](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/seed.js): `src/seed.js`
- [Event and telemetry stream](https://github.com/hareeshwar-n-k/lexaflow-alexa-plus-mcp/blob/main/src/store.js): `src/store.js`

### Other components

- **Household user**
- **Amazon Bedrock**
- **External MCP client**

## Connections

- Household user → Echo Show simulator: interacts with (evidence: `README.md`)
- Echo Show simulator → HTTP API server: sends requests (evidence: `README.md`)
- HTTP API server → Agent runtime: invokes agent (evidence: `README.md`)
- Agent runtime → MCP tool dispatch: calls tools (evidence: `src/bedrock-agent.js`)
- HTTP API server → MCP endpoint: mounts endpoint (evidence: `src/server.js`)
- External MCP client → MCP endpoint: sends JSON-RPC (evidence: `README.md`)
- MCP endpoint → MCP tool dispatch: dispatches tools (evidence: `src/mcp-server.js`)
- MCP tool dispatch → Household memory: calls memory (evidence: `src/tools.js`)
- MCP tool dispatch → Cart and checkout: calls commerce (evidence: `src/tools.js`)
- MCP tool dispatch → Smart-home scenes: calls scenes (evidence: `src/tools.js`)
- MCP tool dispatch → Multimodal cards: renders cards (evidence: `src/tools.js`)
- Cart and checkout → Product and recipe catalog: reads products (evidence: `src/commerce-service.js`)
- Cart and checkout → Persistent household state: reads and updates (evidence: `src/commerce-service.js`)
- Household memory → Persistent household state: reads and updates (evidence: `src/memory-service.js`)
- Smart-home scenes → Persistent household state: reads and updates (evidence: `src/smarthome-service.js`)
- Multimodal cards → Persistent household state: reads state (evidence: `src/media-service.js`)
- Persistent household state → Initial household data: initializes from (evidence: `src/store.js`)
- Initial household data → Product and recipe catalog: builds seed cart (evidence: `src/seed.js`)
- Agent runtime → Amazon Bedrock: plans with (evidence: `README.md`)
- HTTP API server → Event and telemetry stream: broadcasts events (evidence: `src/server.js`)
