weights-and-measures-mcp-server

nothans/weights-and-measures-mcp-server

3.2

If you are the rightful owner of weights-and-measures-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Weights and Measures MCP Server provides tools and resources for accurate unit conversions and access to comprehensive reference tables for various measurement systems.

Tools
3
Resources
0
Prompts
0

Weights and Measures MCP Server

A Model Context Protocol (MCP) server that provides tools and resources for weights and measures conversions. This server enables AI assistants to perform accurate unit conversions and access comprehensive reference tables for different measurement systems.

Features

Tools

  1. convert_unit - Convert values between different units of measurement

    • Supports weight conversions (Avoirdupois, Troy, Apothecaries', Metric)
    • Supports length conversions (Imperial/US, Metric)
    • Supports volume conversions (US Fluid, Imperial Fluid, Metric)
    • Example: Convert 10 pounds to kilograms, or 5 miles to kilometers
  2. get_conversion_factor - Get the conversion multiplier between two units

    • Returns the exact factor needed to convert from one unit to another
    • Useful for understanding conversion relationships
    • Example: Get the factor to convert troy ounces to grams
  3. list_units - List all available units, optionally filtered by category

    • View all supported units
    • Filter by category: weight, length, or volume
    • Helps discover available conversion options

Resources

Access comprehensive reference tables for different measurement systems:

Weight Tables:

  • weights://tables/avoirdupois - Commercial weight (pounds, ounces, grains)
  • weights://tables/troy - Precious metals weight (troy ounces, pennyweights)
  • weights://tables/apothecaries - Pharmacy weight (drams, scruples)
  • weights://tables/metric-weight - Metric weight (kilograms, grams)
  • weights://tables/cross-system-weight - Cross-system conversions

Length Tables:

  • length://tables/imperial-us - Imperial/US measurements (miles, yards, feet, inches)
  • length://tables/metric - Metric measurements (kilometers, meters, centimeters)
  • length://tables/cross-system - Imperial/Metric conversions

Volume Tables:

  • volume://tables/us-fluid - US fluid measurements (gallons, quarts, pints, cups)
  • volume://tables/imperial-fluid - Imperial fluid measurements
  • volume://tables/metric-volume - Metric volume (liters, milliliters)
  • volume://tables/cross-system-volume - Cross-system conversions

Additional:

  • units://all - Complete list of all supported units

Installation

Prerequisites

  • Python 3.10 or higher
  • uv package manager

Install Dependencies

# Clone the repository
git clone https://github.com/yourusername/weights-and-measures-mcp-server.git
cd weights-and-measures-mcp-server

# Install dependencies with uv
uv sync

Usage

With Claude Desktop

Add this configuration to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "weights-and-measures": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/weights-and-measures-mcp-server",
        "run",
        "weights-and-measures-server"
      ]
    }
  }
}

Replace /ABSOLUTE/PATH/TO/ with the actual path to your cloned repository.

Standalone

Run the server directly:

uv run weights-and-measures-server

Or with Python:

python -m weights_and_measures_server.server

Example Usage

Once connected to an MCP client (like Claude Desktop), you can:

Convert units:

  • "Convert 10 pounds to kilograms"
  • "How many liters are in 5 gallons?"
  • "Convert 100 miles to kilometers"

Get conversion factors:

  • "What's the conversion factor from troy ounces to grams?"
  • "How do I convert feet to meters?"

Access reference tables:

  • "Show me the avoirdupois weight table"
  • "What are the metric length measurements?"
  • "List all available units for volume"

Supported Units

Weight:

  • Avoirdupois: gross_ton, net_ton, pound, ounce, grain
  • Troy: troy_pound, troy_ounce, pennyweight, troy_grain
  • Apothecaries: apothecaries_pound, apothecaries_ounce, dram, scruple, apothecaries_grain
  • Metric: metric_ton, kilogram, gram, decigram, centigram, milligram

Length:

  • Imperial/US: mile, yard, foot, inch
  • Metric: kilometer, meter, decimeter, centimeter, millimeter

Volume:

  • US Fluid: us_gallon, gallon, quart, pint, fluid_ounce, cup, tablespoon, teaspoon
  • Imperial: imperial_gallon, imperial_quart, imperial_pint, imperial_fluid_ounce
  • Metric: cubic_meter, liter, deciliter, centiliter, milliliter
  • Cubic: cubic_inch, cubic_foot

Development

Project Structure

weights-and-measures-mcp-server/
├── weights_and_measures_server/
│   ├── __init__.py
│   ├── server.py          # MCP server implementation
│   └── data.py            # Conversion factors and reference tables
├── pyproject.toml         # Project configuration
├── test_server.py         # Test suite
└── README.md