API & MCP
Everything a person can do on Molar Mass & Composition Calculator, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://prooflinemolarmass.usefulweb.site/api/v1/calculate– run Molar Mass & Composition CalculatorGET https://prooflinemolarmass.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Molar Mass & Composition Calculator
Type a chemical formula — with nested brackets, hydrate water, charges or isotopes — and get its molar mass from the current IUPAC standard atomic weights with the combined uncertainty, the formula in Hill order and the mass and atom percentage of every element. Up to ten formulas at once. The second mode turns mass percentages from an elemental analysis into the empirical formula and, with a molar mass, the molecular formula. Part of the Proofline math notebook.
| Field | Type | Default | Description |
|---|---|---|---|
mode | select (formula, empirical) | "formula" | Calculation |
formulas | textarea | — | Formulas (one per line). Element symbols with counts (H2O), brackets ( ) and [ ] that may nest (K4[Fe(CN)6]), hydrates with · or * or a dot (CuSO4·5H2O), charges at the end (SO4^2-, Fe+3, NH4+), isotopes (^13C, D, T) and state symbols such as (aq), which are ignored. At most 10 lines. |
percentages | textarea | — | Mass percentages. Empirical formula: each element with its mass percentage, separated by commas or lines. |
molarMass | number | — | Molar mass of the compound (optional). Empirical formula: with a measured molar mass the molecular formula is the nearest whole multiple. |
Example request
Water
curl -X POST https://prooflinemolarmass.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"formulas":"H2O"}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://prooflinemolarmass.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
proofline_molar_mass - Local stdio connector:
node src/mcp-stdio.ts --tool=proofline-molar-mass
{
"mcpServers": {
"proofline-molar-mass": { "type": "http", "url": "https://prooflinemolarmass.usefulweb.site/mcp" }
}
}