# frederoover/ah-be-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/frederoover/ah-be-mcp
- Repository: https://github.com/frederoover/ah-be-mcp

## Overview

ah-be-mcp is a local stdio MCP server that exposes Albert Heijn Belgium tools to AI clients. The principal workflow is an assistant request, MCP tool dispatch, and a domain operation through appie-go to AH, followed by a result returned to the assistant. Its capabilities cover product search and details, bonus offers, cart/list management, account actions, orders and receipts, and update checks. The sampled implementation is concentrated in main.go; unsampled tool handlers are included only at the documented capability level, so their internal calls are not expanded.

Main entry points: [`main.go`](https://github.com/frederoover/ah-be-mcp/blob/main/main.go) (Tool dispatch and access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_protocol["MCP interface"]
  node_mcp["stdio MCP server<br/>[main.go]"]
  node_tool_dispatch["Tool dispatch and access<br/>[main.go]"]
end

subgraph group_shopping["Shopping tools"]
  node_product_tools["Product search and details<br/>[main.go]"]
  node_bonus_tools["Bonus offers and periods<br/>[main.go]"]
  node_cart_tools["Winkelmandje tools<br/>[main.go]"]
end

subgraph group_account["Account tools"]
  node_account_tools["Login and member profile<br/>[main.go]"]
  node_order_tools["Orders and receipts<br/>[main.go]"]
end

subgraph group_operations["Local operations"]
  node_update_check["Update check<br/>[main.go]"]
end

node_assistant(("AI assistant"))
node_appie["appie-go client"]
node_ah_api["AH private API"]
node_token_file["Local token file"]
node_browser["Web browser"]
node_github["GitHub releases API"]

node_assistant -->|"sends tool requests"| node_mcp
node_mcp -->|"dispatches tools"| node_tool_dispatch
node_tool_dispatch -->|"routes requests"| node_product_tools
node_tool_dispatch -->|"routes requests"| node_bonus_tools
node_tool_dispatch -->|"routes requests"| node_cart_tools
node_tool_dispatch -->|"routes requests"| node_account_tools
node_tool_dispatch -->|"routes requests"| node_order_tools
node_tool_dispatch -->|"routes requests"| node_update_check
node_account_tools -->|"opens login"| node_browser
node_account_tools -->|"logs in and reads member"| node_appie
node_account_tools -->|"saves credentials"| node_token_file
node_product_tools -->|"searches and reads products"| node_appie
node_bonus_tools -->|"reads bonus data"| node_appie
node_cart_tools -->|"reads and patches list"| node_appie
node_order_tools -->|"reads orders and receipts"| node_appie
node_appie -->|"calls AH"| node_ah_api
node_update_check -->|"checks latest release"| node_github

click node_mcp "https://github.com/frederoover/ah-be-mcp/blob/main/main.go"
click node_tool_dispatch "https://github.com/frederoover/ah-be-mcp/blob/main/main.go"
click node_product_tools "https://github.com/frederoover/ah-be-mcp/blob/main/main.go"
click node_bonus_tools "https://github.com/frederoover/ah-be-mcp/blob/main/main.go"
click node_cart_tools "https://github.com/frederoover/ah-be-mcp/blob/main/main.go"
click node_account_tools "https://github.com/frederoover/ah-be-mcp/blob/main/main.go"
click node_order_tools "https://github.com/frederoover/ah-be-mcp/blob/main/main.go"
click node_update_check "https://github.com/frederoover/ah-be-mcp/blob/main/main.go"

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_mcp,node_tool_dispatch,node_appie,node_browser toneBlue
class node_product_tools,node_bonus_tools,node_cart_tools toneAmber
class node_account_tools,node_order_tools,node_ah_api,node_github toneMint
class node_update_check toneRose
class node_assistant,node_token_file toneIndigo
```

## Components

### MCP interface

- [stdio MCP server](https://github.com/frederoover/ah-be-mcp/blob/main/main.go): `main.go`
- [Tool dispatch and access](https://github.com/frederoover/ah-be-mcp/blob/main/main.go): `main.go`

### Shopping tools

- [Product search and details](https://github.com/frederoover/ah-be-mcp/blob/main/main.go): `main.go`
- [Bonus offers and periods](https://github.com/frederoover/ah-be-mcp/blob/main/main.go): `main.go`
- [Winkelmandje tools](https://github.com/frederoover/ah-be-mcp/blob/main/main.go): `main.go`

### Account tools

- [Login and member profile](https://github.com/frederoover/ah-be-mcp/blob/main/main.go): `main.go`
- [Orders and receipts](https://github.com/frederoover/ah-be-mcp/blob/main/main.go): `main.go`

### Local operations

- [Update check](https://github.com/frederoover/ah-be-mcp/blob/main/main.go): `main.go`

### Other components

- **AI assistant**
- **appie-go client**
- **AH private API**
- **Local token file**
- **Web browser**
- **GitHub releases API**

## Connections

- AI assistant → stdio MCP server: sends tool requests (evidence: `README.md`)
- stdio MCP server → Tool dispatch and access: dispatches tools (evidence: `main.go`)
- Tool dispatch and access → Product search and details: routes requests (evidence: `main.go`)
- Tool dispatch and access → Bonus offers and periods: routes requests (evidence: `main.go`)
- Tool dispatch and access → Winkelmandje tools: routes requests (evidence: `main.go`)
- Tool dispatch and access → Login and member profile: routes requests (evidence: `main.go`)
- Tool dispatch and access → Orders and receipts: routes requests (evidence: `README.md`)
- Tool dispatch and access → Update check: routes requests (evidence: `main.go`)
- Login and member profile → Web browser: opens login (evidence: `main.go`)
- Login and member profile → appie-go client: logs in and reads member (evidence: `main.go`)
- Login and member profile → Local token file: saves credentials (evidence: `README.md`)
- Product search and details → appie-go client: searches and reads products (evidence: `main.go`)
- Bonus offers and periods → appie-go client: reads bonus data (evidence: `main.go`)
- Winkelmandje tools → appie-go client: reads and patches list (evidence: `main.go`)
- Orders and receipts → appie-go client: reads orders and receipts (evidence: `README.md`)
- appie-go client → AH private API: calls AH (evidence: `README.md`)
- Update check → GitHub releases API: checks latest release (evidence: `main.go`)
