# theloniuser/indesign-uxp-server architecture

> Architecture diagram of the GitHub repository theloniuser/indesign-uxp-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/theloniuser/indesign-uxp-server
- Repository: https://github.com/theloniuser/indesign-uxp-server

## Overview

This is an MCP server that lets AI clients operate Adobe InDesign through a UXP plugin rather than desktop automation. The principal workflow is client tool request → MCP registration/dispatch → domain handler generates InDesign JavaScript → HTTP/WebSocket bridge → plugin executes against the InDesign DOM → structured result returns. Domain branches cover document/page/content, graphics and layout, books, and export. The excerpts show handler execution and session/formatting utilities; the README documents the bridge and plugin path, while unsampled handler internals are not inferred beyond indexed references.

Main entry points: [`src/core/InDesignMCPServer.js`](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/core/InDesignMCPServer.js) (MCP server), [`src/core/scriptExecutor.js`](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/core/scriptExecutor.js) (Script executor), [`src/handlers/textHandlers.js`](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/textHandlers.js) (Text handlers), [`src/handlers/graphicsHandlers.js`](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/graphicsHandlers.js) (Graphics handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mcp["MCP interface"]
  node_entry["Server entry<br/>[index.js]"]
  node_mcpserver["MCP server"]
  node_schemas["Tool schemas"]
end

subgraph group_domains["InDesign operations"]
  node_documents["Document handlers"]
  node_pages["Page / spread handlers<br/>[pageHandlers.js]"]
  node_text["Text handlers<br/>[textHandlers.js]"]
  node_styles["Style handlers<br/>[styleHandlers.js]"]
  node_graphics["Graphics handlers"]
  node_pageitems["Page item handlers"]
  node_groups["Group handlers<br/>[groupHandlers.js]"]
  node_masters["Master spread handlers"]
  node_books["Book handlers<br/>[bookHandlers.js]"]
  node_export["Export handlers<br/>[exportHandlers.js]"]
  node_utilities["Utility / help handlers<br/>[utilityHandlers.js]"]
end

subgraph group_runtime["Execution runtime"]
  node_executor["Script executor<br/>[scriptExecutor.js]"]
  node_session["Session manager<br/>[sessionManager.js]"]
  node_format["String formatting<br/>[stringUtils.js]"]
  node_color["Color resolution<br/>[colorUtils.js]"]
  node_geometry["Geometry conversion<br/>[geometryUtils.js]"]
  node_bridge["HTTP / WS bridge<br/>[server.js]"]
end

subgraph group_host["InDesign host"]
  node_plugin["UXP plugin<br/>[index.js]"]
  node_indesign["InDesign DOM"]
end

node_client(("AI / MCP client"))

node_client -->|"starts server"| node_entry
node_entry -->|"creates"| node_mcpserver
node_entry -->|"starts if absent"| node_bridge
node_client -->|"sends MCP requests"| node_mcpserver
node_mcpserver -->|"registers tools"| node_schemas
node_mcpserver -->|"dispatches"| node_documents
node_mcpserver -->|"dispatches"| node_pages
node_mcpserver -->|"dispatches"| node_text
node_mcpserver -->|"dispatches"| node_styles
node_mcpserver -->|"dispatches"| node_graphics
node_mcpserver -->|"dispatches"| node_pageitems
node_mcpserver -->|"dispatches"| node_groups
node_mcpserver -->|"dispatches"| node_masters
node_mcpserver -->|"dispatches"| node_books
node_mcpserver -->|"dispatches"| node_export
node_mcpserver -->|"dispatches"| node_utilities
node_documents -->|"executes scripts"| node_executor
node_pages -->|"executes scripts"| node_executor
node_text -->|"executes scripts"| node_executor
node_graphics -->|"executes scripts"| node_executor
node_books -->|"executes scripts"| node_executor
node_executor -->|"POSTs code"| node_bridge
node_bridge -->|"forwards via WebSocket"| node_plugin
node_plugin -->|"executes in DOM"| node_indesign
node_documents -->|"updates session"| node_session
node_graphics -->|"uses positioning state"| node_session
node_text -->|"uses positioning state"| node_session
node_graphics -->|"embeds resolver"| node_color
node_graphics -->|"converts units"| node_geometry
node_text -->|"embeds resolver"| node_color
node_text -->|"converts units"| node_geometry
node_documents -->|"formats results"| node_format
node_books -->|"formats results"| node_format

click node_entry "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/index.js"
click node_mcpserver "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/core/InDesignMCPServer.js"
click node_schemas "https://github.com/theloniuser/indesign-uxp-server/tree/main/src/types"
click node_documents "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/documentHandlers.js"
click node_pages "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/pageHandlers.js"
click node_text "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/textHandlers.js"
click node_styles "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/styleHandlers.js"
click node_graphics "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/graphicsHandlers.js"
click node_pageitems "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/pageItemHandlers.js"
click node_groups "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/groupHandlers.js"
click node_masters "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/masterSpreadHandlers.js"
click node_books "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/bookHandlers.js"
click node_export "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/exportHandlers.js"
click node_utilities "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/utilityHandlers.js"
click node_executor "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/core/scriptExecutor.js"
click node_session "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/core/sessionManager.js"
click node_format "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/utils/stringUtils.js"
click node_color "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/utils/colorUtils.js"
click node_geometry "https://github.com/theloniuser/indesign-uxp-server/blob/main/src/utils/geometryUtils.js"
click node_bridge "https://github.com/theloniuser/indesign-uxp-server/blob/main/bridge/server.js"
click node_plugin "https://github.com/theloniuser/indesign-uxp-server/blob/main/plugin/index.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_entry,node_mcpserver,node_schemas,node_client toneBlue
class node_documents,node_pages,node_text,node_styles,node_graphics,node_pageitems,node_groups,node_masters,node_books,node_export,node_utilities toneAmber
class node_executor,node_session,node_format,node_color,node_geometry,node_bridge toneMint
class node_plugin,node_indesign toneRose
```

## Components

### MCP interface

- [Server entry](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/index.js): `src/index.js`
- [MCP server](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/core/InDesignMCPServer.js): `src/core/InDesignMCPServer.js`
- [Tool schemas](https://github.com/theloniuser/indesign-uxp-server/tree/main/src/types): `src/types`

### InDesign operations

- [Document handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/documentHandlers.js): `src/handlers/documentHandlers.js`
- [Page / spread handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/pageHandlers.js): `src/handlers/pageHandlers.js`
- [Text handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/textHandlers.js): `src/handlers/textHandlers.js`
- [Style handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/styleHandlers.js): `src/handlers/styleHandlers.js`
- [Graphics handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/graphicsHandlers.js): `src/handlers/graphicsHandlers.js`
- [Page item handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/pageItemHandlers.js): `src/handlers/pageItemHandlers.js`
- [Group handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/groupHandlers.js): `src/handlers/groupHandlers.js`
- [Master spread handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/masterSpreadHandlers.js): `src/handlers/masterSpreadHandlers.js`
- [Book handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/bookHandlers.js): `src/handlers/bookHandlers.js`
- [Export handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/exportHandlers.js): `src/handlers/exportHandlers.js`
- [Utility / help handlers](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/handlers/utilityHandlers.js): `src/handlers/utilityHandlers.js`

### Execution runtime

- [Script executor](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/core/scriptExecutor.js): `src/core/scriptExecutor.js`
- [Session manager](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/core/sessionManager.js): `src/core/sessionManager.js`
- [String formatting](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/utils/stringUtils.js): `src/utils/stringUtils.js`
- [Color resolution](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/utils/colorUtils.js): `src/utils/colorUtils.js`
- [Geometry conversion](https://github.com/theloniuser/indesign-uxp-server/blob/main/src/utils/geometryUtils.js): `src/utils/geometryUtils.js`
- [HTTP / WS bridge](https://github.com/theloniuser/indesign-uxp-server/blob/main/bridge/server.js): `bridge/server.js`

### InDesign host

- [UXP plugin](https://github.com/theloniuser/indesign-uxp-server/blob/main/plugin/index.js): `plugin/index.js`
- **InDesign DOM**

### Other components

- **AI / MCP client**

## Connections

- AI / MCP client → Server entry: starts server (evidence: `README.md`)
- Server entry → MCP server: creates (evidence: `src/index.js`)
- Server entry → HTTP / WS bridge: starts if absent (evidence: `src/index.js`)
- AI / MCP client → MCP server: sends MCP requests (evidence: `README.md`)
- MCP server → Tool schemas: registers tools (evidence: `src/core/InDesignMCPServer.js`)
- MCP server → Document handlers: dispatches
- MCP server → Page / spread handlers: dispatches
- MCP server → Text handlers: dispatches
- MCP server → Style handlers: dispatches
- MCP server → Graphics handlers: dispatches
- MCP server → Page item handlers: dispatches
- MCP server → Group handlers: dispatches
- MCP server → Master spread handlers: dispatches
- MCP server → Book handlers: dispatches
- MCP server → Export handlers: dispatches
- MCP server → Utility / help handlers: dispatches
- Document handlers → Script executor: executes scripts (evidence: `src/handlers/documentHandlers.js`)
- Page / spread handlers → Script executor: executes scripts (evidence: `src/handlers/pageHandlers.js`)
- Text handlers → Script executor: executes scripts (evidence: `src/handlers/textHandlers.js`)
- Graphics handlers → Script executor: executes scripts (evidence: `src/handlers/graphicsHandlers.js`)
- Book handlers → Script executor: executes scripts (evidence: `src/handlers/bookHandlers.js`)
- Script executor → HTTP / WS bridge: POSTs code (evidence: `src/core/scriptExecutor.js`)
- HTTP / WS bridge → UXP plugin: forwards via WebSocket (evidence: `README.md`)
- UXP plugin → InDesign DOM: executes in DOM (evidence: `README.md`)
- Document handlers → Session manager: updates session (evidence: `src/handlers/documentHandlers.js`)
- Graphics handlers → Session manager: uses positioning state (evidence: `src/handlers/graphicsHandlers.js`)
- Text handlers → Session manager: uses positioning state (evidence: `src/handlers/textHandlers.js`)
- Graphics handlers → Color resolution: embeds resolver (evidence: `src/handlers/graphicsHandlers.js`)
- Graphics handlers → Geometry conversion: converts units (evidence: `src/handlers/graphicsHandlers.js`)
- Text handlers → Color resolution: embeds resolver (evidence: `src/handlers/textHandlers.js`)
- Text handlers → Geometry conversion: converts units (evidence: `src/handlers/textHandlers.js`)
- Document handlers → String formatting: formats results (evidence: `src/handlers/documentHandlers.js`)
- Book handlers → String formatting: formats results (evidence: `src/handlers/bookHandlers.js`)
