TypeScale MCP

v0.1.1
io.github.ahmedsaeed1-eng/typescale-mcp Checked 2 days ago Published 6 days ago

Fluid typography and spacing tokens for accessible interfaces.

Type should carry the structure of a page. TypeScale calculates fluid font sizes, spacing, corner radii and target sizes, with support for English and Arabic typography. The output is intended for design systems, web CSS, and Flutter interfaces. Values shown in CSS pixels using the default viewport range and 16px rem baseline. These are computed values, not measurements of drawn text in the specimen illustration. Once this version is published to npm by the repository maintainer, register the pinned local stdio server directly with Codex:

Summary extracted from the README.

TypeScale MCP

A reference system for type and space that adapts to the interface.

TypeScale editorial specimen showing a modular hierarchy from caption to H1

SPECIMEN 01 — The responsive scale

Token checks GitHub stars MIT license Node.js 20+ Model Context Protocol stdio

Type should carry the structure of a page. TypeScale calculates fluid font sizes, spacing, corner radii and target sizes, with support for English and Arabic typography. The output is intended for design systems, web CSS, and Flutter interfaces.

The default specimen

Role At 360px At 1440px
Caption 12.098 12.098
Small 13.913 14.4
Body 16 18
H6 18.4 22.5
H5 21.16 28.125
H4 24.334 35.156
H3 27.984 43.945
H2 32.182 54.932
H1 37.009 68.665

Values shown in CSS pixels using the default viewport range and 16px rem baseline. These are computed values, not measurements of drawn text in the specimen illustration.

System Text Space
English & Arabic, LTR/RTL Nine type roles; fluid CSS Spacing, radii, control padding, touch targets
Node.js 20+; MCP stdio Font and line-height guidance CSS, JSON, Flutter-friendly tokens

Local by design. The two read-only tools perform deterministic numerical computation. They do not read project files, make network calls or execute commands. Setup requires installing dependencies.


Package installation

Once this version is published to npm by the repository maintainer, register the pinned local stdio server directly with Codex:

codex mcp add typescale -- npx --yes typescale-mcp@0.1.1

Or install the exact release and use the installed command:

npm install -g typescale-mcp@0.1.1
codex mcp add typescale -- typescale-mcp

The package metadata declares the MCP Registry identity io.github.ahmedsaeed1-eng/typescale-mcp. The official registry entry is a separate publication step after npm release; local stdio use does not require it.

01 / Installation

Runtime requires Node.js 20 or newer; development checks require Node 20.19+, 22.13+ or 24+ for ESLint 10.

git clone https://github.com/ahmedsaeed1-eng/typescale-mcp.git
cd typescale-mcp
npm ci
npm run lint
npm run format_check
npm test

The npm install step obtains dependencies from the package registry; server requests themselves never use a network interface.

02 / Connect to Codex

From the repository directory run:

codex mcp add typescale -- node /absolute/path/to/typescale-mcp/src/server.js

Use the actual absolute path to your checkout. On Windows use the absolute Windows path in quotes if it contains spaces. Run codex mcp list to confirm registration.

Equivalent configuration in Codex's MCP settings:

[mcp_servers.typescale]
command = "node"
args = ["/absolute/path/to/typescale-mcp/src/server.js"]

The command starts an MCP service communicating on stdin/stdout. It is not an interactive terminal prompt.

03 / Tool reference

Name Purpose
generate_design_tokens Generate fluid typography, spacing, radii, target sizes and layout tokens
typography_recommendations Return typography and direction guidance for an English or Arabic interface

Example prompt for Codex:

Use TypeScale to generate Arabic RTL design tokens at 360–1440px viewport widths. Keep body text readable and controls comfortable. Show CSS variables and the Flutter mapping.

Example arguments for generate_design_tokens:

{"locale":"ar","baseMin":16,"baseMax":18,"ratioMin":1.15,"ratioMax":1.25,"viewportMin":360,"viewportMax":1440,"spacingUnit":4,"density":"comfortable","format":"all"}
Parameter Accepted range or value Default
baseMin / baseMax 14–24 px; max >= min 16 / 18
ratioMin / ratioMax 1.01–1.333; max >= min 1.15 / 1.25
viewportMin 280–1440 px, integer 360
viewportMax 320–2560 px, integer, > min 1440
spacingUnit 2–8 px, integer 4
density compact, comfortable comfortable
locale en, ar en
format json, css, flutter, all all

All inputs are optional. The recommendation tool accepts locale only.

04 / Apply the scale

Use the returned CSS custom property definitions, then reference them in project styles:

body {
  font-family: var(--font-family);
  font-size: var(--type-body);
  line-height: var(--line-height-body);
}
h1 {
  font-size: var(--type-h1);
  line-height: var(--line-height-heading);
}
button {
  min-block-size: var(--touch-recommended);
  padding-block: var(--control-padding-block);
  padding-inline: var(--control-padding-inline);
}

Set lang="ar" and dir="rtl" on the relevant Arabic document or subtree. The tool provides tokens only; this CSS does not apply itself.

05 / Design notes and limitations

Font sizes scale geometrically at both viewport bounds, then interpolate using CSS clamp(). The smallest caption is bounded at a 12px design size; scale roles may intentionally coincide in low-ratio designs. A user-configurable browser root font size changes the interpretation of rem units; do not override it to force the example baseline.

The Flutter mapping is JSON with min/max logical-pixel font sizes and line-height multipliers. Applications must apply responsive interpolation themselves and respect platform text scaling. No actual Flutter source is generated.

Targets of 44px and 48px are recommended design defaults, not guarantees of accessibility. Test the rendered interface for contrast, text zoom, hit areas, wrapping and multilingual glyphs. Font stacks are suggestions, not distributed font files. No browser, font or rendered layout measurement is performed.

06 / Development

npm run lint
npm run format_check
npm test

The suite tests deterministic calculations, range validation, Arabic guidance, format outputs, target sizes, and both tools via the official MCP client and a real stdio connection. Version 0.1.1 additionally rejects invalid direct numeric inputs and verifies 48 combinations of role ordering, finite values and bounded settings. Local Node 24: 9/9 tests, ESLint and Prettier passed. CI is configured for Node 20 and 22 across Linux, macOS and Windows.

Colophon

MIT. See LICENSE and THIRD_PARTY.md.