mcp-gnu-units
mcp-gnu-units
mcp-gnu-units is an MCP server that gives AI agents precise, offline unit
conversion backed by the GNU units database. Convert between 3000+ units of
measurement — length, mass, time, temperature, area, volume, energy, power,
pressure, speed, data and more — evaluate compound unit expressions like kW*h
or acre*ft, reduce any quantity to its SI base units, search the unit database
by keyword, and look up the exact definition of any unit, prefix, or physical
constant. Deterministic, dimension-aware, and free of the hardcoded per-category
unit tables every other converter ships.
Status: feature-complete, pre-release. All five domain tools ship —
find_units,convert,convert_to_si,define_unit, andlist_prefixes— alongside theinfohealth check. Not yet published to PyPI; the remaining publish steps are tracked inTODO.
Distribution name: mcp-gnu-units · import package: mcp_gnu_units.
Built on GNU units
This project stands on the shoulders of GNU units, the units-conversion program written and maintained by Adrian Mariano for the Free Software Foundation. Its database is the product of decades of careful curation — thousands of units, physical constants drawn from CODATA and NIST, and the conversion semantics that make dimensional analysis trustworthy. This server would not exist without it.
mcp-gnu-units bundles that database verbatim (see
Bundled data & provenance below) and pairs it with
an independent, pure-Python conversion engine, so every number it returns traces
straight back to GNU units' own definitions. It is offered in the same spirit
and under the same license (GPL-3.0-or-later). If you find this useful, the
original earns the credit first: https://www.gnu.org/software/units/.
Related MCP server: Touchstone MCP Server
Bundled data & provenance
This server stands on GNU units, Adrian
Mariano's units-conversion program, by bundling its unit database verbatim at
src/mcp_gnu_units/data/definitions.units. The conversion engine here is an
independent implementation; GNU units supplies the data.
Source: GNU units 2.27 (tarball),
definitions.unitsdata version 3.26 (2026-02-25).License: GPL-3.0-or-later © Free Software Foundation — the same license as this project, so the two are wholly compatible.
Integrity: the upstream tarball was GPG-verified (good signature from Adrian Mariano) before the file was vendored.
Full attribution, version pins, and checksums are recorded in
NOTICE.
Sponsoring
mcp-gnu-units is free, open-source software developed in my spare time. Sponsoring keeps this project alive and actively maintained — it funds new units-engine features, bug fixes, and ongoing support, and it's a direct signal that the work is worth continuing.
If the project is useful to you, please consider sponsoring it through GitHub Sponsors. Click the Sponsor button at the top of the repository, or visit the link directly, and pick a one-time or recurring tier. Every contribution, large or small, is hugely appreciated and goes straight back into keeping mcp-gnu-units healthy.
License
GPL-3.0-or-later. See LICENSE. The bundled GNU units database is
also GPL-3.0-or-later © Free Software Foundation; see NOTICE.
Available Tools
6 toolsconvertA
Convert a value or unit expression from one unit to another (GNU units engine, TODO §16).
The universal conversion core: one tool covers every category (length, mass,
time, temperature, area, volume, energy, power, speed, data, …) plus compound
expressions like kW*h or acre*ft. Linear conversions return the ratio of
coefficients; a nonlinear target (e.g. tempF) applies that unit's inverse.
Returns: from and to (echoed), result (the converted magnitude WITH the
target unit, e.g. "1.609344 km" — the primary human-readable answer), value
(the same magnitude as a bare float for programmatic use), and exact (true
when the result is exact, false when it was rounded).
Errors cleanly (isError) when a unit is unknown, an expression is malformed,
or the two sides are not conformable.
Example: convert("1 mile", "km") ->
{"from":"1 mile","to":"km","result":"1.609344 km","value":1.609344,"exact":true}
Inputs: to_expr (required), from_expr (required).
convert_to_siA
Reduce a value or unit expression to its SI base units (GNU units engine, TODO §17).
Rewrites any expression in terms of the database's primitive/base units — kg, m,
s, A, K, mol, cd, and the like — collapsing all derived and prefixed units. This
is how you see what a quantity really is dimensionally: kW*hour becomes
3600000 kg m^2 / s^2 (3.6 MJ), newton becomes 1 kg m / s^2. Use it to
compare or sanity-check units, or to get a magnitude in coherent SI.
Returns: expr (echoed), result (the reduced quantity WITH its base-unit
signature, e.g. "3600000 kg m^2 / s^2" — the primary human-readable answer),
value (the same magnitude as a bare float for programmatic use), dimension
(just the base-unit signature, e.g. "kg m^2 / s^2", or "1" when dimensionless),
and exact (true when the result is exact, false when it was rounded).
Errors cleanly (isError) when a unit is unknown, an expression is malformed, or
it is a nonlinear unit with no linear base form (e.g. tempF).
Example: convert_to_si("kWhour") ->
{"expr":"kWhour","result":"3600000 kg m^2 / s^2","value":3600000.0,
"dimension":"kg m^2 / s^2","exact":true}
Inputs: expr (required).
define_unitA
Show a single unit/prefix/constant's definition, kind, dimension, and base value (TODO §13).
Looks up one name in the GNU units database and reports exactly what it is and
what it reduces to — the inspect/"define" counterpart to convert. Works for
ordinary units, SI/binary prefixes, physical constants, nonlinear function
units (tempF), and piecewise tables (brwiregauge).
Returns an object with:
name: echoed.kind: "unit" | "primitive" | "prefix" | "function" | "table".definition: the database definition text (source line, leading name token removed). "!" marks a primitive/base unit.dimension: base-unit signature, e.g. "kg m^2 / s^3" for power; "1" when dimensionless. Omitted for hits that do not reduce.base_value: the unit reduced to base units with its coefficient, e.g. "745.699871582 kg m^2 / s^3". Omitted alongsidedimension.function: for nonlinear units only — {signature, input_dimensions, output_dimension} describing the conversion function.
Errors cleanly (isError) when the name is not defined in the database. Example: define_unit("newton") -> {"name":"newton","kind":"unit","definition":"kg m / s^2", "base_value":"1 kg m / s^2","dimension":"kg m / s^2"}
Inputs: name (required).
find_unitsA
Search the GNU units database for units whose name or definition contains a keyword.
Basic substring search over the 3000+ unit GNU units database (TODO §14.1). A
hit is any unit whose name OR definition text contains query (case-insensitive);
prefixes are excluded. Results are returned in the database's native order and
capped at limit. Use this to discover the exact spelling of a unit before
calling a conversion tool.
Returns: query (echoed), count (number of results returned), and results,
a list of objects each carrying:
name: the unit's name.definition: its definition text (the source line with the leading name token removed, so the name is not repeated).kind: "unit" | "primitive" | "function" | "table".dimension: the unit reduced to base-unit signature, e.g. "kg m^2 / s^3" for power — use it to check whether two units are conformable without a second call. Omitted for hits that do not reduce (functions, tables).base_value: the unit reduced to base/primitive units, coefficient included, e.g. "745.699 kg m^2 / s^3". Omitted alongsidedimensionwhen the hit does not reduce.
Enriching each hit lets you search AND triage in a single call instead of a follow-up lookup per unit. Example: find_units("horsepower") -> {"query":"horsepower","count":9,"results":[{"name":"horsepower", "definition":"550 foot pound force / sec","kind":"unit", "dimension":"kg m^2 / s^3","base_value":"745.7 kg m^2 / s^3"}, ...]}
Inputs: query (required), limit.
infoA
Discovery / health-check entrypoint: report availability and version info.
Returns seven keys: status ("available"), name, version (package version),
python (runtime version), mcp_sdk (MCP SDK version, or "unknown"),
toolsets (empty until the GNU units engine lands), and units_db — the
bundled GNU units database's source, data_version, and data_updated
(§2.4.6 / §5.4), read from the shipped file's own header so it can't drift.
Example: {"status":"available","name":"mcp-gnu-units","version":"0.0.1",
"python":"3.12.3","mcp_sdk":"2.3.0","toolsets":[],
"units_db":{"source":"GNU units","data_version":"3.26","data_updated":"2026-02-25"}}
Inputs: no named parameters.
list_prefixesA
List every SI and binary prefix in the GNU units database with its multiplier (TODO §13).
Enumerates all defined prefixes — the SI decimal ladder (quetta…quecto and
their symbols Q…q) plus the binary/IEC prefixes (kibi/Ki, mebi/Mi,
…) — sorted by descending magnitude. Useful for discovering the exact prefix
spelling to use in a convert or convert_to_si expression, or for seeing a
prefix's exact numeric value.
Returns: count (number of prefixes) and prefixes, a list of objects each
with name (the prefix, without its trailing hyphen) and multiplier (its
value as a string, exact where the value is an exact integer, e.g. kibi ->
"1024", mega -> "1000000").
Example: list_prefixes() ->
{"count":125,"prefixes":[{"name":"quetta","multiplier":"1000000000000000000000000000000"},
...,{"name":"kibi","multiplier":"1024"}, ...]}
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: info for metadata, convert for arbitrary unit conversion, convert_to_si for SI base reduction, define_unit for single-unit inspection, find_units for database search, and list_prefixes for prefix enumeration. The only potential overlap is convert vs convert_to_si, but their outputs and use cases are explicitly differentiated.
Three tools follow a clear verb_noun pattern (define_unit, find_units, list_prefixes) and two more are related verb phrases (convert, convert_to_si), but info is a noun outlier and convert is a bare verb. The set is still mostly consistent and readable.
Six tools is well within the ideal 3–15 range for a unit conversion and database inspection server. Each tool covers a distinct core capability and none feels redundant or missing.
The surface covers conversion, SI reduction, single-unit definition, keyword search, prefix listing, and service metadata. Minor gaps exist, such as no direct way to list all units or browse by dimension, but agents can approximate these via find_units with broad queries.
Maintenance
Related MCP Connectors
60+ units, live FX, timezones, and date arithmetic for AI agents.
Exact fraction math for AI agents. No floating-point drift. CODATA 2022 constants and units.
Verified physics and chemistry calculators for AI agents: search in plain English, run with units.
Everyday calculators and converters for AI assistants: units, dates, percentages, text, JSON.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceVerified unit conversion and dimensional analysis for AI agents. 190+ units, 31 domain formulas (clinical, physics, aerospace, SRE), physical constants with uncertainty propagation. Refuses invalid conversions structurally: the tool that won't convert mg to mL and knows the difference between torque and energy.AGPL 3.0
- AlicenseNot gradedqualityDmaintenanceProvides deterministic, verifiable text/code/measurement utilities for AI agents, enabling tasks like unit conversion, citation formatting, diffing, proofreading, readability scoring, and syntax checking with re-executable proof.14 PyPIMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to convert between measurement units across length, weight, temperature, volume, speed, and data storage, with formulas included. Supports pay-per-call access via x402 micropayments without API keys or signup.MIT
- AlicenseBqualityBmaintenanceEnables AI agents to perform accurate local computations including arbitrary-precision math, date handling, unit conversion, subnet calculations, encoding, hashing, and text analysis, all without network calls or API keys.27MIT