MCP Hub
Back to servers

ucon-mcp

Verified 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.

glama
Updated
Apr 16, 2026

ucon-tools

tests codecov publish

Hostable interfaces for the ucon dimensional analysis engine.

Documentation · MCP Server Guide · Tool Reference


What is ucon-tools?

ucon is a unit-aware computation library for Python. ucon-tools packages it into interfaces that other systems can consume — MCP servers for AI agents, REST APIs for web services, CLIs for humans at a terminal.

Each interface lives under ucon.tools.<interface> and is installable as an optional extra:

InterfacePackageExtraStatus
MCP serverucon.tools.mcpucon-tools[mcp]Available
REST APIucon.tools.restucon-tools[rest]Planned
CLIucon.tools.cliucon-tools[cli]Planned

MCP Server

The MCP server gives AI agents (Claude, Cursor, and other MCP clients) dimensionally-verified unit conversion and computation.

Agent: "Convert 5 mcg/kg/min for an 80 kg patient to mL/h. Drug is 400 mg in 250 mL."

  decompose → constraint solver places quantities, auto-bridges mcg→mg and min→h
  compute   → 5 × 80 kg × (60 min/h) × (1 mg/1000 mcg) × (250 mL/400 mg) = 15 mL/h
  validate  → result dimension matches expected unit ✓

Installation

pip install ucon-tools[mcp]

Requires Python 3.10+.

Configuration

Claude Desktop / Claude Code — add to your MCP configuration:

{
  "mcpServers": {
    "ucon": {
      "command": "uvx",
      "args": ["--from", "ucon-tools[mcp]", "ucon-mcp"]
    }
  }
}

Standalone:

ucon-mcp                    # stdio transport (default)
ucon-mcp --transport sse    # SSE transport for remote clients

Tools

Core — conversion and computation:

ToolDescription
convertConvert a value between compatible units
computeMulti-step factor-label calculation with dimensional tracking
decomposeBuild a factor chain from natural-language or structured input
check_dimensionsCheck if two units share the same dimension

Discovery — explore the unit system:

ToolDescription
list_unitsList available units, optionally filtered by dimension
list_scalesList SI decimal and binary prefixes
list_dimensionsList available physical dimensions
list_constantsList physical constants (CODATA 2022)
list_formulasList registered domain formulas

Runtime extension — add units and conversions per session:

ToolDescription
define_unitRegister a custom unit for the session
define_conversionAdd a conversion edge (linear or affine)
define_constantDefine a custom physical constant
call_formulaCall a registered dimensionally-typed formula
reset_sessionClear all session-defined units, conversions, and constants

Kind-of-Quantity (KOQ) — semantic disambiguation:

ToolDescription
define_quantity_kindRegister a quantity kind for disambiguation
declare_computationDeclare expected quantity kind before computing
validate_resultValidate that a result matches the declared kind
list_quantity_kindsList registered quantity kinds
extend_basisCreate an extended dimensional basis
list_extended_basesList session-defined extended bases

Architecture

ucon-tools is an interface layer. It does not reimplement dimensional analysis — it delegates to ucon for all unit resolution, conversion, and dimensional algebra. What it adds is interface-specific logic: session state, protocol handling, error suggestions, and agent-oriented features like the decompose constraint solver and KOQ disambiguation.

┌───────────────────────────────────────────────────────┐
│                     Clients                           │
│   MCP (Claude, Cursor)  ·  HTTP  ·  Terminal          │
└──────────┬──────────────────┬──────────────┬──────────┘
           │                  │              │
┌──────────▼───┐   ┌──────────▼───┐  ┌───────▼──────┐
│ ucon.tools   │   │ ucon.tools   │  │ ucon.tools   │
│     .mcp     │   │     .rest    │  │     .cli     │
│              │   │              │  │              │
│  sessions    │   │  (planned)   │  │  (planned)   │
│  decompose   │   │              │  │              │
│  KOQ         │   │              │  │              │
│  suggestions │   │              │  │              │
└──────┬───────┘   └──────┬───────┘  └──────┬───────┘
       │                  │                 │
       └──────────────────┼─────────────────┘
                          │ Python imports
               ┌──────────▼──────────┐
               │        ucon         │
               │                     │
               │  Units, Dimensions  │
               │  ConversionGraph    │
               │  Scales, Constants  │
               └─────────────────────┘

Development

make venv                               # Create virtual environment
source .ucon-tools-3.12/bin/activate    # Activate
make test                               # Run tests
make test-all                           # Run across all supported Python versions

Running the MCP server locally

make mcp-server                         # Foreground (stdio)
make mcp-server-bg                      # Background
make mcp-server-stop                    # Stop background server

License

AGPL-3.0. See LICENSE.

Reviews

No reviews yet

Sign in to write a review