Skip to main content
Glama
README.md
# glazemath

glazemath is a small local bridge to the hosted
Glazecalc MCP server, which does ceramic glaze
chemistry. It can look materials up in a shared
library, work out a recipe's unity (Seger) formula,
check a recipe against published limits for its
firing, convert between cones and temperatures, find
substitutes for discontinued materials, remake a
recipe from the materials on hand, solve for a target
formula, and lay out line, triaxial and progression
blends for test tiles. It also reaches the caller's
own Glazecalc account: saved recipes, private
materials, the on-hand shelf, firing logs, notebook
entries, settings and trash.

The bridge keeps no glaze data of its own. It serves
the upstream server's tool list locally, exactly as
captured from the live endpoint, and forwards each
tool call upstream, returning the result untouched.
Every record it can change belongs to the caller's
own account; there is no sending, payment or
third-party surface in the captured tools.

## Tools

Reference and calculation:

- `search_materials` — find library materials by name, alias or maker. Required: `query`.
- `get_material` — one library material: oxides, loss on ignition, replacements, hazards. Required: `name`.
- `analyze_recipe` — unity formula, oxide groups, silica to alumina ratio, expansion and Stull placement for a recipe. Required: `lines`.
- `check_limits` — check a recipe against recommended limits for its firing. Required: `lines`.
- `convert_cone_temperature` — convert between Orton or SK cones and temperatures. No required fields.
- `suggest_substitutes` — modern replacements for discontinued or scarce materials in a recipe. Required: `lines`.
- `match_from_materials` — remake a recipe from only the listed materials. Required: `lines`, `have`.
- `solve_target` — make a recipe whose formula comes near a target unity formula or analysis. Required: `target`.
- `blend_recipes` — line or triaxial blend tiles between two or three recipes. Required: `a`, `b`.
- `vary_material` — progression tiles showing what one material does across a range. Required: `recipe`, `material`, `to`.
- `compare_recipes` — two recipes side by side, oxide by oxide. Required: `a`, `b`.
- `search_guides` — search the plain-language guides for potters. Required: `query`.

Your own account records:

- `list_recipes` — list saved recipes, newest first, with search and firing filters. No required fields.
- `get_recipe` — one saved recipe with its formula worked out afresh. Required: `id`.
- `list_my_materials` — list materials saved in your own account. No required fields.
- `get_shelf` — the materials marked as on hand. No required fields.
- `match_with_what_i_have` — remake a recipe from only the shelf materials. No required fields.
- `list_firings` — list saved firing logs. No required fields.
- `get_firing` — one firing log. Required: `id`.
- `list_notes` — list notebook entries. No required fields.
- `get_my_settings` — your saved settings. No required fields.
- `create_recipe` — save a new recipe. Required: `title`, `lines`.
- `update_recipe` — change a saved recipe. Required: `id`.
- `add_notebook_entry` — add a notebook entry. Required: `content`.
- `add_my_material` — save a private material with its analysis. Required: `name`, `analysis`.
- `update_my_material` — change a private material. Required: `id`.
- `add_to_shelf` — mark materials as on hand. Required: `materials`.
- `remove_from_shelf` — remove materials from the shelf. Required: `materials`.
- `undo_shelf_change` — undo the last shelf change. No required fields.
- `move_to_trash` — move one of your records to the trash. Required: `kind`, `id`.
- `create_firing_log` — save a new firing log. Required: `title`, `columns`, `rows`.
- `add_firing_rows` — add readings to a firing log. Required: `id`, `rows`.
- `link_firing` — save a test result linking a recipe to a firing. Required: `recipeId`, `firingId`.

Calculated results are guides from published figures,
not test results and not a guarantee of food safety —
the fired tiles decide.

## Configuration

- `GLAZECALC_MCP_URL` (optional) — override the upstream
  endpoint. Defaults to
  `https://glazecalcapp.com/mcp`. (The override hook
  is this rebuild's own labelled reconstruction.)
- `GLAZECALC_API_KEY` (optional) — when set, every
  upstream request carries an
  `Authorization: Bearer <key>` header, for the
  caller's own Glazecalc token, which the original's
  registry record scopes to the caller's own saved
  records. When it is not set, no key header is sent.
  (The header name is pinned by the original's
  registry record; the Bearer scheme and this env
  forwarding are labelled reconstructions — the
  original surface was captured keyless.)

### Forwarding mechanics

On the first tool call the client opens a streamable
HTTP session with the upstream: a JSON-RPC
`initialize` request (protocolVersion `2025-03-26`,
clientInfo name `glazemath`), then a
`notifications/initialized` notification, then the
`tools/call` request carrying the caller's arguments
unchanged. When the upstream answers `initialize`
with an `Mcp-Session-Id` header, that value rides on
every later request of the session, which is reused
for the life of the process. Replies may arrive as
plain JSON or as server-sent events; both are read.

Successful upstream results pass through verbatim,
including any `isError` flag the upstream sets.
Failures — a JSON-RPC error, a non-2xx status, an
unreadable response, or a request that cannot be
completed — come back as an `isError` result whose
text starts with `glazemath error:` (this rendering
is this rebuild's own labelled reconstruction).

## CLI

Each tool is also a subcommand taking one JSON
argument string:

```bash
npx @reneturcios/glazemath search_materials '{"query":"custer"}'
npx @reneturcios/glazemath analyze_recipe '{"lines":[{"material":"Custer Spar","amount":30}]}'
npx @reneturcios/glazemath get_shelf
npx @reneturcios/glazemath --version
```

Exit codes: `0` on success, `1` on an `isError`
result, `2` on a usage error.

## MCP server

```bash
npx -y @reneturcios/glazemath mcp
```

MCP client config:

```json
{
  "mcpServers": {
    "glazemath": {
      "command": "npx",
      "args": ["-y", "@reneturcios/glazemath", "mcp"]
    }
  }
}
```

## Docker

```bash
docker run -i ghcr.io/cloudcorprecords/glazemath
docker run --rm ghcr.io/cloudcorprecords/glazemath --version
```

The container's default command is `mcp`, so the first
form is a stdio MCP server; any other arguments reach
the CLI normally.

## Development

```bash
npm install
npm run build
npm test
npm run dev
```

The test suite runs entirely against a stubbed
JSON-RPC upstream — no live network calls.

## License

MIT — see `LICENSE`.