Skip to main content
Glama

phm-lite-check

PHM Physics Check MCP server

Deterministic physics plausibility checking for LLM outputs and robotics / embodied-AI datasets. Zero dependencies, pure standard library, Python >= 3.8.

This package is an independent, community-provided library: it is the offline subset of the PHM physical-judgment engine (proprietary core methods are intentionally excluded). A companion plugin (phm-physics-check) is listed on the Dify Marketplace.

Not affiliated with, endorsed by, or sponsored by LangChain, AutoGen, or Dify. Integration adapters are community-provided.

Approved by the PyRIT creator — microsoft/PyRIT

A scorer wrapper of this package lives in microsoft/PyRIT PR #3507 (physics_consistency_scorer). Status as of 2026-11-10:

  • Six first-round correctness issues (maintainer + automated reviewer) were fixed same-day (2026-11-08).

  • The PyRIT creator (richlundeen) approved the PR ("no blocking concerns remain"), verified 356 scoped tests, Ruff and the scoped type check.

  • He then pushed follow-up integration commits on this PR's branch: an upstream-main merge to clear conflicts (eb8948e) and a hook adaptation to the new ScoringExpectation scorer API with documented numeric checks (8a163d9).

  • The PR remains open pending the maintainer's merge; nothing is left open on this side.

Related MCP server: mcp-toolkit

Claimed on MCPush

Ownership-verified listing approved on MCPush: security grade A, 3 tools, no sign-in required, local & free (v1.0.1).

What it checks

Text / quantities (check_text, full_check)

  • Dimensional / unit consistency (SI + common units)

  • Universal speed limit (c)

  • Absolute temperature floor (0 K)

  • Non-negativity of mass / length / energy

  • Probability range [0, 1]

  • Kinematic relations (free-fall family, tolerance-checked)

  • Conservation checks (energy / momentum, tolerance-checked)

Robotics records (check_robotics_record)

  • Quaternion normalization (|q| within tolerance of 1.0)

  • Timestamp sanity: monotonicity, duplicates, NaN/Inf, outlier gaps (possible frame loss)

  • NaN / Inf scan over numeric arrays

  • Unit annotation presence for common motion fields

Design guarantees

  • Deterministic: same input -> same output, always reproducible.

  • Zero dependencies: pure standard library; framework adapters import their host lazily.

  • Verdicts: PASS / WARN / FAIL with structured violation records.

  • No network calls: everything runs offline in-process.

NOTE: this package contains only the deterministic offline subset of the PHM physical-judgment engine. Proprietary core methods are intentionally excluded. (Deployment-specific deep checks are available separately via a configurable remote engine endpoint, not included in this package.)

Install

Option A — from the GitHub repo (no package index needed):

pip install git+https://github.com/PHM-Audit/phm-lite-check

Option B — from a Release wheel (faster, no git clone):

pip install https://github.com/PHM-Audit/phm-lite-check/releases/download/v1.0.0/phm_lite_check-1.0.0-py3-none-any.whl

Optional extras (once installed):

pip install "phm-lite-check[langchain]"   # + langchain-core (adapter tests)
pip install "phm-lite-check[autogen]"     # + autogen-agentchat

PyPI listing is planned; both options above work today.

Quickstart — library

from phm_lite_check import check_text, check_robotics_record

check_text("The drone descends at 450 km/h and confidence is 1.8.")
# {"verdict": "FAIL", "violations": [...], ...}

check_robotics_record({
    "quaternion": [1.395, 0.0, 0.0, 0.0],   # |q| >> 1 -> FAIL
    "timestamps": [0.0, 0.1, 0.05],          # not monotonic -> FAIL
    "position": [1.0, 2.0],                  # no unit annotated -> WARN
})

Quickstart — LangChain

from phm_lite_check.integrations import langchain_tool

tools = langchain_tool.get_langchain_tools()   # 3 @tool callables
agent = create_react_agent(llm, tools)         # your usual wiring

Quickstart — AutoGen (v0.4+)

from autogen_agentchat.agents import AssistantAgent
from phm_lite_check.integrations import autogen_tool

assistant = AssistantAgent(
    name="checked_assistant",
    model_client=...,                    # your model client
    tools=autogen_tool.get_autogen_tools(),
)

Quickstart — MCP server (stdio)

The package ships a Model Context Protocol server entry point (phm_lite_check/mcp_server.py, FastMCP, stdio transport). Works with Claude Desktop, Cursor, Cline or any MCP host.

Install with the MCP extra (requires mcp>=1.0,<2 — the 2.x SDK renamed the FastMCP API):

pip install "phm-lite-check[mcp]"

Run the server:

python3 -m phm_lite_check.mcp_server

Claude Desktop / generic MCP host configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "phm-lite-check": {
      "command": "python3",
      "args": ["-m", "phm_lite_check.mcp_server"]
    }
  }
}

Tools exposed over MCP (all declared readOnlyHint):

Tool

Input

Checks

physics_text_check

{"text": "..."}

unit inconsistency, lightspeed violations, probabilities outside [0,1], kinematic impossibilities

physics_quantity_check

{"value": 5.5, "unit": "km/s"}

per-quantity physical bounds

robotics_data_check

{"record_json": "{...}"}

quaternion normalization, timestamp sanity, NaN/Inf scan, unit annotation

Verified end-to-end on mcp 1.30.0: JSON-RPC initialize handshake, tools/list returns the three tools above, and a tools/call round-trip on physics_quantity_check executes against the local rule table. The server makes zero network calls.

Also packaged as an MCPB bundle and listed in the official MCP Registry (io.github.PHM-Audit/phm-lite-check@1.0.1, stdio).

Tools exposed by both adapters

Tool

Input

Checks

physics_text_check

free text with quantities

unit consistency, limits, probabilities

physics_quantity_check

value + unit

one quantity against physical law

robotics_data_check

JSON record

quaternions, timestamps, NaN/Inf, units

Tests

pip install -e ".[dev]"
pytest tests/ -q

License

MIT

Benchmark

The judgment rules shipped here are exercised in public by DPC-Bench v0.2 — a paired clean/corrupted physical-consistency detection benchmark (7 task families incl. a real NGSIM I-80 family, three-caliber L1/L2/L3 labels).

Available Tools

3 tools
physics_quantity_checkPhysics quantity checkA
Read-only

Validate one quantity against physical law (speed-of-light limit, temperature floor, probability range, kinematic relations).

Args:
    value: numeric value
    unit: unit string, e.g. "km/s", "K", "kg"

Inputs: unit (required), value (required). Returns: result

physics_text_checkPhysics text checkA
Read-only

Scan free text for implausible numeric claims: unit inconsistency, speed-of-light violations, probabilities outside [0, 1], kinematic impossibilities. Deterministic, offline.

Args:
    text: any text containing numbers with units

Inputs: text (required). Returns: result

robotics_data_checkRobotics data checkA
Read-only

Check a robotics / embodied-AI dataset record for physical plausibility: quaternion normalization, timestamp sanity, NaN/Inf scan, unit annotation.

Args:
    record_json: JSON object with optional keys 'quaternion'/'quaternions',
                 'timestamps', 'units', plus numeric arrays

Inputs: record_json (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 3 tools

    Disambiguation4/5

    The three tools have clearly different input targets: free text, a single value/unit pair, and a robotics JSON record. There is some conceptual overlap in the physical-law checks they perform, but the descriptions make the intended use distinguishable.

    Naming Consistency5/5

    All tool names follow the same predictable snake_case pattern of domain_object_check: physics_text_check, physics_quantity_check, robotics_data_check. No inconsistent verb styles or casing are present.

    Tool Count5/5

    Three tools is appropriately compact for a lightweight plausibility-checking server, and each tool covers a distinct input type without obvious redundancy. The surface is well-scoped rather than thin or bloated.

    Completeness4/5

    The set covers text claims, individual quantities, and robotics dataset records, which addresses the core plausibility-checking workflow. Minor gaps exist, such as no explicit batch/table quantity checker or broader dataset-format support, but agents can work around this by repeated use of physics_quantity_check.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables any Model Context Protocol-compatible host (Claude Desktop, Cherry Studio, Cline, MCP Inspector) to call 8 plug-and-play tools over stdio: hotspot ranking, TC3 signing, text chunking, date calculation, read-only SQLite queries, webpage text extraction, JWT decode/verify, and health checks.
      8
      MIT
    • F
      license
      B
      quality
      B
      maintenance
      MCP server (stdio, official Python SDK) exposing a single tool: quantity_execute. Performs dimensional calculation and unit conversion with evidence. Solves silent unit errors in LLM agent chains: 20 m/s × 3 h returns 216 km.
      1
      -
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI agents and MCP clients to decompose text into atomic claims and cross-verify them against reference knowledge to flag ungrounded claims, numerical contradictions, and hallucinated entities. Runs deterministically with zero dependencies over JSON-RPC stdio, avoiding LLM round-trips for routine verification tasks.
      -