# outboundani/five9-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/outboundani/five9-mcp
- Repository: https://github.com/outboundani/five9-mcp

## Overview

five9-mcp is a Cloudflare Worker that exposes Five9 contact-center operations as MCP tools. AI clients authenticate at the Worker, invoke tool dispatch, and receive JSON results backed by Five9 SOAP or New Platform REST APIs. The product also includes browser setup/console pages, stateless OAuth, campaign and agent administration, reporting, and an IVR authoring path with optional speech synthesis. Relationships below follow the excerpts and README; unsampled tool handlers and routes are represented only where documented, so their internal links are omitted.

Main entry points: [`src/tools.js`](https://github.com/outboundani/five9-mcp/blob/main/src/tools.js) (Tool catalog and dispatch), [`src/index.js`](https://github.com/outboundani/five9-mcp/blob/main/src/index.js) (HTTP and MCP router), [`src/five9rest.js`](https://github.com/outboundani/five9-mcp/blob/main/src/five9rest.js) (REST client), [`src/tts.js`](https://github.com/outboundani/five9-mcp/blob/main/src/tts.js) (Prompt audio synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Worker entry"]
  node_worker["HTTP and MCP router<br/>[index.js]"]
end

subgraph group_access["Access and setup"]
  node_oauth["OAuth authorization<br/>[oauth.js]"]
  node_settings["Configuration<br/>[config.js]"]
  node_kv[("Worker KV config")]
  node_webui["Landing and console UI<br/>[ui.js]"]
end

subgraph group_operations["Contact center tools"]
  node_catalog["Tool catalog and dispatch<br/>[tools.js]"]
  node_context["Operator instructions<br/>[about.js]"]
end

subgraph group_integrations["Five9 integrations"]
  node_soap["SOAP services<br/>[five9.js]"]
  node_rest["REST client<br/>[five9rest.js]"]
  node_rest_rules["REST safety rules<br/>[rest-rules.js]"]
end

subgraph group_authoring["IVR authoring"]
  node_ivr["IVR flow composer<br/>[ivr.js]"]
  node_tts["Prompt audio synthesis<br/>[tts.js]"]
end

node_client(("MCP client"))
node_five9[("Five9 contact center")]
node_worker_ai["Workers AI"]
node_optional_tts["Optional TTS providers"]

node_client -->|"sends HTTP"| node_worker
node_worker -->|"handles OAuth"| node_oauth
node_worker -->|"loads config"| node_settings
node_settings -->|"reads and writes"| node_kv
node_worker -->|"serves pages"| node_webui
node_worker -->|"dispatches tools"| node_catalog
node_worker -->|"supplies instructions"| node_context
node_catalog -->|"calls SOAP"| node_soap
node_catalog -->|"calls REST"| node_rest
node_catalog -->|"checks requests"| node_rest_rules
node_rest -->|"resolves API base"| node_rest_rules
node_soap -->|"sends SOAP requests"| node_five9
node_rest -->|"calls New Platform API"| node_five9
node_catalog -->|"validates and composes"| node_ivr
node_ivr -->|"parses Five9 XML"| node_soap
node_catalog -->|"generates prompt audio"| node_tts
node_tts -->|"synthesizes speech"| node_worker_ai
node_tts -.->|"supports providers"| node_optional_tts
node_webui -->|"uses tool metadata"| node_catalog

click node_worker "https://github.com/outboundani/five9-mcp/blob/main/src/index.js"
click node_catalog "https://github.com/outboundani/five9-mcp/blob/main/src/tools.js"
click node_context "https://github.com/outboundani/five9-mcp/blob/main/src/about.js"
click node_soap "https://github.com/outboundani/five9-mcp/blob/main/src/five9.js"
click node_rest "https://github.com/outboundani/five9-mcp/blob/main/src/five9rest.js"
click node_rest_rules "https://github.com/outboundani/five9-mcp/blob/main/src/rest-rules.js"
click node_oauth "https://github.com/outboundani/five9-mcp/blob/main/src/oauth.js"
click node_settings "https://github.com/outboundani/five9-mcp/blob/main/src/config.js"
click node_webui "https://github.com/outboundani/five9-mcp/blob/main/src/ui.js"
click node_ivr "https://github.com/outboundani/five9-mcp/blob/main/src/ivr.js"
click node_tts "https://github.com/outboundani/five9-mcp/blob/main/src/tts.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_worker,node_client toneBlue
class node_oauth,node_settings,node_kv,node_webui,node_five9 toneAmber
class node_catalog,node_context toneMint
class node_soap,node_rest,node_rest_rules,node_worker_ai toneRose
class node_ivr,node_tts,node_optional_tts toneIndigo
```

## Components

### Worker entry

- [HTTP and MCP router](https://github.com/outboundani/five9-mcp/blob/main/src/index.js): `src/index.js`

### Access and setup

- [OAuth authorization](https://github.com/outboundani/five9-mcp/blob/main/src/oauth.js): `src/oauth.js`
- [Configuration](https://github.com/outboundani/five9-mcp/blob/main/src/config.js): `src/config.js`
- **Worker KV config**
- [Landing and console UI](https://github.com/outboundani/five9-mcp/blob/main/src/ui.js): `src/ui.js`

### Contact center tools

- [Tool catalog and dispatch](https://github.com/outboundani/five9-mcp/blob/main/src/tools.js): `src/tools.js`
- [Operator instructions](https://github.com/outboundani/five9-mcp/blob/main/src/about.js): `src/about.js`

### Five9 integrations

- [SOAP services](https://github.com/outboundani/five9-mcp/blob/main/src/five9.js): `src/five9.js`
- [REST client](https://github.com/outboundani/five9-mcp/blob/main/src/five9rest.js): `src/five9rest.js`
- [REST safety rules](https://github.com/outboundani/five9-mcp/blob/main/src/rest-rules.js): `src/rest-rules.js`

### IVR authoring

- [IVR flow composer](https://github.com/outboundani/five9-mcp/blob/main/src/ivr.js): `src/ivr.js`
- [Prompt audio synthesis](https://github.com/outboundani/five9-mcp/blob/main/src/tts.js): `src/tts.js`

### Other components

- **MCP client**
- **Five9 contact center**
- **Workers AI**
- **Optional TTS providers**

## Connections

- MCP client → HTTP and MCP router: sends HTTP (evidence: `README.md`)
- HTTP and MCP router → OAuth authorization: handles OAuth (evidence: `src/index.js`)
- HTTP and MCP router → Configuration: loads config (evidence: `src/index.js`)
- Configuration → Worker KV config: reads and writes (evidence: `src/config.js`)
- HTTP and MCP router → Landing and console UI: serves pages (evidence: `src/index.js`)
- HTTP and MCP router → Tool catalog and dispatch: dispatches tools (evidence: `src/index.js`)
- HTTP and MCP router → Operator instructions: supplies instructions (evidence: `src/about.js`)
- Tool catalog and dispatch → SOAP services: calls SOAP (evidence: `src/tools.js`)
- Tool catalog and dispatch → REST client: calls REST (evidence: `src/tools.js`)
- Tool catalog and dispatch → REST safety rules: checks requests (evidence: `src/tools.js`)
- REST client → REST safety rules: resolves API base (evidence: `src/five9rest.js`)
- SOAP services → Five9 contact center: sends SOAP requests (evidence: `README.md`)
- REST client → Five9 contact center: calls New Platform API (evidence: `README.md`)
- Tool catalog and dispatch → IVR flow composer: validates and composes (evidence: `src/tools.js`)
- IVR flow composer → SOAP services: parses Five9 XML (evidence: `src/ivr.js`)
- Tool catalog and dispatch → Prompt audio synthesis: generates prompt audio (evidence: `src/tools.js`)
- Prompt audio synthesis → Workers AI: synthesizes speech (evidence: `src/tts.js`)
- Prompt audio synthesis → Optional TTS providers: supports providers (evidence: `src/tts.js`)
- Landing and console UI → Tool catalog and dispatch: uses tool metadata (evidence: `src/ui.js`)
