Glyphs mcp scripting

From thierryc/Glyphs-mcp · View interactive version

Glyphs mcp scripting is an AI agent skill from the GitHub repository thierryc/Glyphs-mcp. Write and run focused Glyphs Python scripts, using direct native execution and current-state recovery.

How to use this skill

Skill file

Glyphs Font Scripts

Create a workspace script for the requested one-off native operation. Reusable

plugins and ongoing coding sessions use $glyphs-mcp-development.

Writing and statically validating a script need no running Glyphs, MCP,

document discovery or Save. Unrelated Python needs no Glyphs skill.

Before authoring a Glyphs script for metrics, geometry, components,

foreground/background, glyph information, reinterpolation or automatic feature

updates, check the retained get_status.nativeActions. Prefer the matching

closed native action for an ordinary

single-command edit when advertised. For a custom or large composed operation,

offer direct native scripting under the [shared route and recovery

guide](../glyphs/references/python-scripts.md#choose-the-route). Original task

authorization permits execution without a separate code review or Run question.

If the required action is missing, report the capability gap; do not silently

use a script as a substitute for that missing capability. A deliberately chosen

bulk script is a separate supported route, not a repair for an installation gap.

Before scripting compilation or export, also check jobKinds and

jobCapabilities. Prefer feature_compile for native compiler diagnostics and

font_export for typed static/variable/web generation plus table or bounded

shaping verification. A missing advertised capability is an installation gap,

not permission to emulate it with arbitrary Python.

Use the development skill's offline documentation

for unfamiliar APIs and its existing scaffold.py create script and

validate --target 4 commands. Separate pure logic from native access. State

targets, effects and verification; preserve fractional values, native flags,

metadata and object identity.

For coordinate edits, use the native precision recipe.

For feature work, use OpenType guidance.

Execution follows the user's authorised task. Use disposable copies for

experiments and the native iteration reference

for logs, proofs and cleanup. Static validation is not runtime success. Never

promise recovery of arbitrary Python's external effects. Pre-run memory recovery

restores the whole font, including pre-existing unsaved edits; external effects remain outside recovery.

For needed MCP context, reuse the verified $glyphs connection

and intended document ID already in context. Resolve missing bindings through the

document targeting reference.

Do not reload the entry, repeat discovery or refetch known API excerpts merely

to switch to scripting. Rediscover after document_not_found, a target change or

bridge/Glyphs restart; never silently substitute another open font. Reads are fresh.

Dirty documents can be inspected without saving.

For advertised python_script jobs, follow the shared [execution and recovery

contract](../glyphs/references/python-scripts.md). Choose the smallest useful form:

manifest and loop over paths/nodes locally.

targets, params and Glyphs. Use exact identifiers and expected values in

params; targets:[] is valid when no layer target is meaningful.

Choose automated edit targets from glyph data, not Font View sidebar filters.

Capture intentional UI selection once into exact names/layers/surfaces before

preparation. Whole scripts must preflight every supplied owner before writing;

see explicit target guidance

and the executable explicit width example.

Automatic sidebar counting may still run after edits; neither explicit targeting

nor interface batching guarantees prevention of native sidebar alerts.

Direct native scripting requires script.native.v1. Use source, params,

entrypoint, targets and optional summary; no execution/recovery mode or

count threshold. Scripts have no fixed surface-count ceiling; the complete

request must fit the existing 4 MiB budget. Keep one bulk job and report all

eligible targets or a clear preparation failure, never a truncated edit.

Dirty, clean and pathless fonts run without Save. Require script.recovery.snapshot.v1

and preparation version 3; the bridge captures a detached full-font copy before execution.

Intent controls the workflow. Perform a requested task by generating, validating

and testing code as appropriate, running it, then verifying the result. Do not

require code review or a separate Run question for result-focused tasks. Writing

a script includes code review but does not authorize live execution. Reviewing

means review only. Write-and-run includes review and authorized execution.

Use mode="apply" under task authorization when script.apply-authorized.v1

is advertised: preparation and Run are dispatched internally. Explicit previews

use mode="preview" and wait. Source remains available through optional Script details.

With Automatic Keep enabled, a visible, connected and freshly reconciled

successful card can Keep without saving after 30 seconds, ending recovery.

Disable it before waiting on a native question; silence, Skip and dismissal

apply no choice. Failed, partial, blocked and uncertain outcomes remain manual.

Honor “wait for my answer” with auto_keep=false on new workflows or the

existing Wait for my answer action; retain that directive for later requests.

See the shared contract for countdown, visibility and text-only behavior.

Restore before run restores the pre-run copy including existing unsaved edits,

clears Undo history and replaces later edits. Recovery lasts only in this Glyphs session. It never saves or replays code. Keep

or Save ends the restoration offer. Failure/cancellation leaves possible partial

edits for inspection; never auto-reload. Keep generated scripts free of save/close

calls and reconcile uncertain outcomes without replay. Use

vertical_flip.py for explicit vertical pivots.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.