Repository avatar
Other Tools
v0.1.1
active

typescale-mcp

io.github.ahmedsaeed1-eng/typescale-mcp

Fluid typography and spacing tokens for accessible interfaces.

Documentation

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

RoleAt 360pxAt 1440px
Caption12.09812.098
Small13.91314.4
Body1618
H618.422.5
H521.1628.125
H424.33435.156
H327.98443.945
H232.18254.932
H137.00968.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.

SystemTextSpace
English & Arabic, LTR/RTLNine type roles; fluid CSSSpacing, radii, control padding, touch targets
Node.js 20+; MCP stdioFont and line-height guidanceCSS, 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

NamePurpose
generate_design_tokensGenerate fluid typography, spacing, radii, target sizes and layout tokens
typography_recommendationsReturn 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"}
ParameterAccepted range or valueDefault
baseMin / baseMax14–24 px; max >= min16 / 18
ratioMin / ratioMax1.01–1.333; max >= min1.15 / 1.25
viewportMin280–1440 px, integer360
viewportMax320–2560 px, integer, > min1440
spacingUnit2–8 px, integer4
densitycompact, comfortablecomfortable
localeen, aren
formatjson, css, flutter, allall

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.