Skip to main content
Glama
PetriLahdelma

glyphs-mini-mcp

README.md
# glyphs-mini-mcp

A Model Context Protocol (MCP) server that lets an agent **build and edit fonts for
Glyphs Mini**, which has no Python API or plugin system of its own.

Unlike [`thierryc/Glyphs-mcp`](https://github.com/thierryc/Glyphs-mcp) — which runs
*inside* full Glyphs 3/4 via `from GlyphsApp import …` and cannot load into Glyphs
Mini — this server runs **standalone** and edits the `.glyphs` file on disk with
[`glyphsLib`](https://github.com/googlefonts/glyphsLib). `.glyphs` is the exact
format Glyphs Mini opens and saves, so the workflow is:

```
agent → MCP tools edit the .glyphs file → glyphs_open_in_mini → view/edit in Glyphs Mini
```

It also gives the agent its **own rendered-specimen feedback loop** (fontmake +
Pillow), so it can *see* the letterforms without needing the app.

## Tools (17)

| Tool | What it does |
|------|--------------|
| `glyphs_new_font` | Create a single-master `.glyphs` (with `.notdef` + `space`) and set it active |
| `glyphs_open_font` | Load an existing `.glyphs` as the active document |
| `glyphs_save_font` | Write the active font back to disk |
| `glyphs_font_summary` | Family, UPM, master metrics, glyph names |
| `glyphs_set_metrics` | UPM / ascender / descender / x-height / cap-height |
| `glyphs_add_glyph` | Add a glyph (Unicode from hex, char, or AGL name) + width |
| `glyphs_set_width` | Set advance width (spacing) |
| `glyphs_add_contour` | Add a Bézier contour from an explicit node list |
| `glyphs_add_rectangle` | Add a rectangle — the right primitive for a **stem/bar** |
| `glyphs_add_ellipse` | Add a real modulated **bowl/ring** (N/S/E/W extrema, optional counter) |
| `glyphs_add_component` | Reference another glyph (reuse: `n`→`m`, `o`→`b d p q`, accents) |
| `glyphs_get_glyph` | Inspect a glyph (unicode, width, contour/component counts) |
| `glyphs_delete_glyph` / `glyphs_clear_glyph` | Remove a glyph / clear its outlines |
| `glyphs_set_kerning` | Set a kerning pair |
| `glyphs_render_specimen` | Compile to TTF (fontmake) + render `text` to PNG to inspect shapes |
| `glyphs_open_in_mini` | Save and open the `.glyphs` in Glyphs Mini |

Design note: `add_rectangle` is for stems/bars only; round letters must use
`add_ellipse` (a real Bézier bowl) or `add_contour`. This mirrors the `type-design`
skill's rule against building letterforms from rectangle primitives.

## Requirements

- macOS, Python 3.11–3.14
- Glyphs Mini (to *view* the result; not required for the server to run)
- Python deps in `requirements.txt` (`mcp`, `glyphsLib`, `fonttools`, `fontmake`,
  `skia-pathops`, `pillow`, …)

## Install

```bash
cd glyphs-mini-mcp
uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -r requirements.txt
```

Register with Claude Code (already done on this machine, user scope):

```bash
claude mcp add -s user glyphs-mini -- /ABSOLUTE/PATH/glyphs-mini-mcp/run-mcp.sh
```

Then **restart Claude Code** — MCP servers attach at session start, so the
`mcp__glyphs-mini__*` tools only appear in a new session.

## Usage sketch

```
glyphs_new_font(path="~/Test.glyphs", family_name="Test", upm=1000, cap_height=700, x_height=500)
glyphs_add_glyph(name="o", width=560)
glyphs_add_ellipse(name="o", cx=280, cy=250, rx=240, ry=260, counter_rx=148, counter_ry=186)   # a real bowl
glyphs_add_glyph(name="n", width=600)
glyphs_add_rectangle(name="n", x0=0, y0=0, x1=88, y1=500)                                        # a stem
glyphs_add_contour(name="n", nodes=[...])                                                        # the arch
glyphs_render_specimen(text="nono", size=140)     # look at it
glyphs_open_in_mini()                             # view/edit in Glyphs Mini
```

## Caveat: reloading in Glyphs Mini

Glyphs Mini has no scripting, so the server can't force an already-open document to
reload. After the agent edits and saves, use **File → Revert** in Glyphs Mini (or
close and let `glyphs_open_in_mini` reopen it) to see the latest changes.

## Files

- `server.py` — the FastMCP stdio server (`glyphs_mini_mcp`)
- `run-mcp.sh` — launcher used by `claude mcp add`
- `requirements.txt`, `test_smoke.py`, `test_stdio.py`

## Trademarks & affiliation

"Glyphs" and "Glyphs Mini" are trademarks of Glyphs GmbH. This project is an
independent, unofficial tool and is **not affiliated with or endorsed by
Glyphs GmbH**. The name is used only to describe file-format compatibility
(nominative use). It uses **no Glyphs proprietary code or SDK** — it reads and
writes the open `.glyphs` format via the third-party, Apache-2.0
[glyphsLib](https://github.com/googlefonts/glyphsLib), and it launches an
already-installed Glyphs Mini via macOS `open`.

## Licenses

This project is MIT (see [LICENSE](LICENSE)). It depends on, but does not vendor,
these third-party packages (installed from PyPI):

| Package | License |
|---|---|
| glyphsLib, fontmake | Apache-2.0 |
| fontTools, mcp, pydantic | MIT |
| skia-pathops | BSD-3-Clause |
| Pillow | HPND |

All permissive and compatible; there is no copyleft dependency.