Skip to main content
Glama
mcp-indesign-agent

mcp-indesign-agent

by anananaTERRA

MCP InDesign Agent

MCP server para editar Adobe InDesign via linguagem natural no Cursor.

Cursor Agent → MCP (stdio) → Bridge local (AppleScript + dispatcher.jsx) → InDesign

v0.1.0 — Document Model em cache, UUIDs persistentes (mcp:<uuid>), ~22 tools semânticas e operações em lote. Plano: PLAN.md.

Prerequisites

  • macOS (bridge v1 = AppleScript + ExtendScript)

  • Node.js 20+

  • Adobe InDesign instalado e aberto, com um .indd ativo para scan/batch

  • Permissão de Automação (veja abaixo)

Related MCP server: Illustrator MCP

macOS Automation

Na primeira chamada (npm run doctor ou o MCP no Cursor), o macOS pode pedir permissão para controlar o InDesign.

  1. System Settings → Privacy & Security → Automation

  2. Garanta que o app que lança o MCP (Cursor, Terminal, etc.) pode controlar Adobe InDesign

  3. Se o bridge falhar com timeout / Apple Event errors: reabra o InDesign, confirme o nome do app com npm run doctor, e aceite o diálogo de Automação de novo

O script não usa UI scripting frágil: envia JSON ao extendscript/dispatcher.jsx via do script.

Install & build

npm install
npm run build
npm run doctor

doctor imprime apps detectados, versão, doc ativo e smoke de UUID / batch / styles / analyze.

Defina o nome do app se a detecção automática não bater:

INDESIGN_APP_NAME="Adobe InDesign 2026" npm run doctor

Nomes típicos: Adobe InDesign 2026, Adobe InDesign 2025 (veja /Applications).

Connect to Cursor

  1. npm run build

  2. Adicione em ~/.cursor/mcp.json (ou .cursor/mcp.json do projeto):

{
  "mcpServers": {
    "mcp-indesign-agent": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/mcp-indesign-agent/dist/index.js"],
      "env": {
        "INDESIGN_APP_NAME": "Adobe InDesign 2026",
        "INDESIGN_BRIDGE": "applescript"
      }
    }
  }
}
  1. Substitua o path absoluto e o INDESIGN_APP_NAME pelo resultado do doctor

  2. Recarregue os MCP servers no Cursor

  3. Teste: “Ping InDesign e faça scan do documento ativo”

Fluxo do agent (obrigatório na prática)

ping_indesign
  → scan_document                 # cache + snapshot before
  → analyze_page                  # roles (Header, Body…)
  → preview_batch | layout_assistant (opcional)
  → checkpoint                    # cópia .indd em disco (automática, ver abaixo)
  → execute_batch | layout_assistant fix
  → summarize_changes

Meta: pedido editorial típico em ≤ 3 round-trips MCP (scan → batch → summarize).

Checkpoint: a rede que o snapshot não é

Em 11/08/2026, 18 scripts de patch ad-hoc em ~20 minutos destruíram a p.8 de um livro em produção. Não havia como voltar: snapshot guarda só bounds, paragraphStyle e um textPreview truncado, e não tem restore; nenhum script usava transação, então cada um virava várias entradas de undo.

O servidor agora recusa mutação sem rede:

  • op: "checkpoint" — doc.saveACopy() para <pasta do .indd>/_checkpoints/ com nome <base>-<tag>-<YYYYMMDD-HHMMSS>.indd, mantendo os keep mais recentes (default 12). Disponível em execute_operation e como comando de execute_batch. Roda antes e fora da transação — a cópia precisa sobreviver ao rollback que ela existe para permitir.

  • Gate no execute_batch — todo batch mutante exige um checkpoint da geração atual do documento (meta.generation). Por default o servidor tira a cópia sozinho (INDESIGN_CHECKPOINT_MODE=auto) e recusa o batch se o saveACopy falhar. skipCheckpoint: true é a saída deliberada.

  • Uma transação por pedido — todo batch mutante roda dentro de app.doScript(…, UndoModes.ENTIRE_SCRIPT, "<nome>"). Um Cmd+Z desfaz o pedido inteiro e uma exceção no meio reverte tudo. O nome do undo é forçado a ASCII.

Criar/apagar frames muda a geração e invalida o checkpoint anterior; editar texto não muda, então uma cópia cobre uma sequência de edições de texto.

Exemplos:

Pedido

Sequência

“Aumenta o espaço entre os títulos”

scan → analyze_page → execute_batch com stack em {role:"Header"} → summarize_changes

“Textos sobrepostos”

scan → layout_assistant diagnose → preview → fix

“Aplica Heading 1 no título”

scan → analyze_page → apply_style / batch applyStyle

“Relinka a imagem missing”

scan → check_missing_links → relink_asset

Targets: uuid | { uuid } | { role, pageIndex? } | { selection: true }.
Nunca use pageIndex:itemIndex como identidade. Geometria em points.

Tools (teto ~25)

Novas capacidades entram como op no dispatcher + comando de batch, não como tool MCP nova — salvo superfície semântica clara (analyze_page, layout_assistant).

Grupo

Tools

Sessão

ping_indesign, scan_document, refresh_document, get_document_model, get_selection

Semântica

analyze_page

Batch / snapshots

snapshot, preview_batch, execute_batch, summarize_changes

Conveniência (thin)

execute_operation, layout_operation

Layout assist

layout_assistant (diagnose | preview | fix)

Styles

list_styles, apply_style, create_style, update_style

Assets

list_assets, check_missing_links, relink_asset, replace_asset, embed_asset

Preferir sempre execute_batch para mutações multi-passo. Thin tools existem para 1 op.

Ops de execute_batch

checkpoint, move, resize, delete, duplicate, createTextFrame, setText, replaceText, setFont, setFill, align, distribute, center, stack, applyMargins, applyStyle, createStyle, updateStyle, relinkAsset, replaceAsset, embedAsset.

checkpoint é a única que não muta o documento.

Env

Var

Default

INDESIGN_APP_NAME

auto (maior ano em /Applications)

INDESIGN_SCRIPT_TIMEOUT_SEC

300

INDESIGN_TEMP_DIR

tmpdir/mcp-indesign-agent

INDESIGN_BRIDGE

applescript

INDESIGN_CHECKPOINT_MODE

auto (require = só recusa, nunca salva sozinho; off = sem gate)

INDESIGN_CHECKPOINT_KEEP

12

INDESIGN_CHECKPOINT_MAX_AGE_MIN

120 (0 desliga a expiração)

Scripts

Script

Uso

npm run build

Compila dist/

npm start

Sobe o MCP (node dist/index.js)

npm run dev

MCP via tsx (dev)

npm run doctor

Probe bridge + smoke

npm run typecheck

tsc --noEmit

npm test

Gate de checkpoint + transação (node --test, sem InDesign)

Layout do repo

extendscript/dispatcher.jsx   # Único script de runtime no InDesign
src/
  index.ts                    # Entry MCP + agent instructions
  agent-instructions.ts       # Orientação scan→batch para o client
  bridge/                     # BridgeAdapter (AppleScript v1)
  session/                    # Document Model, cache, snapshots, checkpoints, semantic
  commands/                   # Zod schema, planner, batch, checkpoint gate, mutations
  tools/                      # Tools MCP registradas
  lib/                        # geometry + text-layout (pts) + layout-assistant + ascii
tests/                        # Gate + transação (fake bridge, não abre o InDesign)

License

MIT

Available Tools

22 tools
analyze_pageA

Classify page items into semantic roles (Header, Subtitle, Body, Caption, Image, Background, Logo, Decorative, Unknown) and store them on the Document Model. Call after scan_document so batch targets like {role:"Header"} work. Typical flow: scan → analyze_page → execute_batch → summarize_changes.

Inputs: pageIndex (required), persist.

apply_styleA

Apply a paragraph, character, or object style to target item(s). Prefer execute_batch when combining with other ops.

Inputs: style (required), target (required), styleKind, timeoutSec.

create_styleB

Create a paragraph/character/object style (from selection item, basedOn, and/or font size spec).

Inputs: name (required), spec, basedOn, styleKind, +2 more.

embed_assetB

Embed a linked asset into the document (unlink from disk).

Inputs: name, linkId, timeoutSec.

execute_batchA

Preferred mutation path: resolve targets → checkpoint gate → one dispatcher round-trip inside a single ENTIRE_SCRIPT undo transaction → modelPatch on cache. ALWAYS prefer this over execute_operation / layout_operation when combining ops. Mutating batches need an on-disk checkpoint for the current generation; the server takes one automatically and refuses the batch if saving it fails. Typical flow: scan_document → (analyze_page) → execute_batch → summarize_changes.

Inputs: commands (required), timeoutSec, checkpointTag, skipCheckpoint, +2 more.

execute_operationA

Thin single-op wrapper around execute_batch (checkpoint/move/resize/delete/duplicate/setText/replaceText/setFont/setFill/applyStyle). op=checkpoint saves an .indd copy to _checkpoints/ next to the document and needs no target — run it before a risky sequence of edits. Prefer execute_batch when issuing two or more ops.

Inputs: op (required), x, y, dx, +18 more.

get_document_modelA

Return a summary of the cached Document Model without rescanning InDesign (unless forceRefresh or cache empty).

Inputs: maxAgeMs, timeoutSec, forceRefresh, includeItems.

get_selectionB

Read the current InDesign selection as stable UUIDs and sync them into the session cache.

Inputs: timeoutSec, writeUuids.

layout_assistantA

Diagnose or fix page layout (overlapping/tight text, items outside margins). Modes: diagnose | preview | fix. Prefer after scan_document (+ analyze_page for title roles). Units are points. fix applies via execute_batch.

Inputs: mode (required), pageIndex (required), uuids, marginPt, +4 more.

layout_operationA

Layout helpers: align | distribute | center | stack | applyMargins. Thin wrapper — prefer execute_batch when combining with other ops. Requires scan_document; role targets need analyze_page.

Inputs: op (required), target (required), axis, align, +4 more.

list_assetsA

List placed links/assets (path, status, page) from cache or refresh from InDesign.

Inputs: status, refresh, timeoutSec.

list_stylesA

List paragraph / character / object styles from the Document Model cache (or refresh from InDesign). Prefer after scan_document; use apply_style / execute_batch applyStyle to apply.

Inputs: refresh, styleKind, timeoutSec.

ping_indesignA

Check if Adobe InDesign is reachable (app open, version, active document). Call first in a session before scan_document.

Inputs: timeoutSec.

preview_batchA

Dry-run a batch against the cached Document Model (no InDesign writes). Call after scan_document. Prefer preview_batch before a large execute_batch.

Inputs: commands (required).

refresh_documentA

Invalidate and reload the Document Model from InDesign. Use only after manual edits in InDesign or when the cache may be stale — not before every mutation.

Inputs: depth, pages, timeoutSec, writeUuids.

replace_assetB

Replace a placed asset with another file (same as relink_asset).

Inputs: filePath (required), name, linkId, timeoutSec.

scan_documentA

Scan the active InDesign document into the session Document Model cache and write stable mcp: labels. Call ONCE per session before planning edits; then use execute_batch (not repeated scans).

Inputs: depth, timeoutSec, writeUuids, captureSnapshot.

snapshotA

Capture or inspect Document Model snapshots. Modes: before | after | list | diff. Capture uses the current session cache (run scan_document first).

Inputs: mode (required), label, afterId, beforeId.

summarize_changesA

Diff snapshot before vs after into agent-readable summary. Call after execute_batch (or layout_assistant fix). Defaults to the last before/after pair from scan_document + batch.

Inputs: afterId, beforeId.

update_styleB

Update an existing style definition (spec, basedOn, rename, or copy from an item).

Inputs: style (required), spec, basedOn, newName, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 22 tools

    Disambiguation2/5

    Several tools have unclear boundaries: execute_operation, layout_operation, and execute_batch overlap significantly with execute_batch being the preferred path; relink_asset and replace_asset are explicitly described as the same. This creates risk of selecting the wrong tool for a task.

    Naming Consistency3/5

    Most tools follow a verb_noun pattern (ping_indesign, scan_document, execute_batch), but there are outliers like snapshot (verb/noun), layout_assistant (noun_noun), and check_missing_links (verb_adjective_noun). The mix of styles at least remains readable and skake_case is consistent.

    Tool Count4/5

    At 22 tools, the server is on the heavier side but still within a reasonable range for a feature-rich InDesign automation server. The count is slightly inflated by redundant wrappers and aliases, but each tool has some justification.

    Completeness4/5

    The tool surface covers a broad workflow: session setup (ping, scan, get model), analysis (analyze_page), mutations (execute_batch, style/layout operations), and asset management (list, check, relink, embed). Missing features like document creation/export are notable but likely outside the intended scope.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      C
      maintenance
      A Model Context Protocol (MCP) server that gives AI assistants direct, native control over Adobe InDesign via a UXP plugin bridge, with ~130 tools covering documents, pages, text, graphics, styles, master spreads, books, and export.
      100
      50 npm
      110
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An MCP server that lets AI assistants like Claude control Adobe Illustrator through natural language by executing ExtendScript code and providing document state inspection.
      12
      7
      MIT