Skip to main content
Glama

Citadel-Math (citadel_math_core / kmath-mcp)

License Rust MCP Server

Deterministic Mathematical Proof Kernel, Dimensional Analysis Shield, and Physics/Engineering MCP Server.
Deterministik Matematiksel İspat Çekirdeği, $\mathbb{Z}^7$ Boyut Analizi Kalkanı ve Fizik/Mühendislik MCP Sunucusu.


Why Citadel-Math? / Neden Citadel-Math?

Large Language Models hallucinate units, drop denominator domain guards, confuse classical/relativistic regimes, and leak IEEE-754 rounding errors into engineering safety factors.
Citadel-Math (kmath-mcp) gives AI coding agents (Claude, Cursor, Windsurf, Antigravity) and human engineers a pure-Rust (#![forbid(unsafe_code)]) + Python deterministic verification oracle backed by curated NIST CODATA constants, SI dimensional lattice proofs, and an executable physics engine.

Büyük Dil Modelleri (LLM) formül türetirken sıklıkla birim hatası yapar, payda sıfır koşullarını atlar ve kayan nokta yuvarlama hatalarını güvenlik katsayılarına sızdırır. Citadel-Math, yapay zekâ ajanlarına olasılıksal tahmin yerine mikrosaniye hızında deterministik ispat ve simülasyon araçları sunar.


Related MCP server: SciMath MCP

Core Architecture / Temel Mimari

.
├── AGENTS.md                       # 7 Constitutional Invariants (Boyutsal Mutlaklık, Termodinamik & SSOT kuralları)
├── kmath.py                        # Zero-tolerance Engineering Audit Cockpit (10 Python + Rust CLI)
├── kmath_mcp.py                    # 15-Tool Model Context Protocol (MCP) Server for LLM Agents
├── icat_motoru.py                  # Symbolic Physics Synthesis & CLI Runner
├── mcp_config.example.json         # Portable MCP client configuration example
├── citadel_math_core/              # Pure-Rust (#![forbid(unsafe_code)]) Engine & Native Binary
│   └── src/
│       ├── proof_kernel.rs         # Z[x] & MultiPolyZ (grevlex) algebraic equivalence + GuardedPoly domain guards
│       ├── interval.rs             # IEEE 1788-2015 outward-rounded Interval64 + Dual64 automatic differentiation
│       ├── dimensions.rs           # Z^7 SI Dimensional Shield & ScaledUnit converter
│       ├── buckingham.rs           # Exact rational/integer Z^7 nullspace Buckingham-Pi discovery
│       ├── pareto.rs               # Exact Skyline & NSGA-II multi-objective Pareto optimizer
│       ├── graph.rs                # SSOT canonical hypergraph (214 laws, 544 inverse laws, 18 physical regimes)
│       ├── simulator.rs            # RK4 & adaptive Dormand-Prince RK4(5) trajectory integrator + USSA-1976 atmosphere
│       ├── astrodynamics.rs        # WGS84 J2 orbital precession & universal-variable Lambert solver
│       ├── materials.rs            # 30 aerospace/UHTC/TPS materials, NASA SP-8007 buckling & PICA-X ablation
│       ├── cad.rs                  # 2D parametric CAD, Steiner/moment of inertia, Euler buckling & R12 DXF/SVG
│       ├── designer.rs             # Closed-loop inverse vehicle design engine
│       ├── codegen.rs              # Verified zero-panic Result<f64, &'static str> Rust function generator
│       └── physical_bounds.rs      # Thermodynamics 1st/2nd law (Carnot), v < c causality & momentum pruning
├── engine/                         # Python symbolic AST, SymPy parity, harvester, RK4 & knowledge graph modules
├── database/
│   ├── canonical_laws.json         # 214 verified physics/system equations across 18 regimes
│   ├── ONTOLOGY.json               # 353 unique SI symbol-dimension definitions (SSOT)
│   └── materials.json              # 30 certified structural & thermal protection materials
└── data/
    └── nist_constants.json         # Official NIST CODATA 2022 fundamental constants

Quick Start / Hızlı Kurulum

1. Build the Pure-Rust Core / Rust Çekirdeğini Derleyin

cargo build --release --manifest-path citadel_math_core/Cargo.toml

2. Install Python Dependencies / Python Bağımlılıklarını Yükleyin

pip install -r requirements.txt

3. Verify All 26 Audit Gates / Tüm Denetim Kapılarını Doğrulayın

python kmath.py audit

And run the standalone native Rust audit (16 mathematical & physical gates, ~14 ms):

./citadel_math_core/target/release/citadel_math_core audit

4. Connect as an MCP Server / MCP Sunucusu Olarak Bağlayın

Copy mcp_config.example.json into your MCP client configuration (updating the path to kmath_mcp.py if needed):

{
  "mcpServers": {
    "kmath": {
      "command": "python",
      "args": ["./kmath_mcp.py"],
      "env": {
        "OPENBLAS_NUM_THREADS": "1",
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

15 Deterministic MCP Tools (kmath_mcp.py)

Tool

Function

kmath_audit

Runs the Python (10-gate) & Rust (16-gate) constitutional integrity audits.

kmath_dimension_check

Verifies $\mathbb{Z}^7$ SI dimensional homogeneity (dim(LHS) == dim(RHS)) for arbitrary expressions.

kmath_prove_identity

Proves polynomial/rational algebraic equivalence (GuardedPoly) with domain guards & overflow rejection.

kmath_interval_eval

Evaluates expressions using IEEE 1788-2015 outward-rounded Interval64 + Dual64 sensitivity.

kmath_constant

Fetches certified NIST CODATA 2022 fundamental constants and exact SI definitions.

kmath_materials

Queries and ranks 30 structural, cryogenic, UHTC, and ablative TPS materials.

kmath_stress_check

Checks cylindrical shell Von Mises stress, NASA SP-8007 buckling, and aerothermal TPS survival.

kmath_simulate_trajectory

Runs 4th-order Runge-Kutta (RK4) trajectory integration with USSA-1976 7-layer atmosphere.

kmath_solve_for

Symbolically solves canonical equations with automated SymPy/AST validation.

kmath_synthesize

Synthesizes new valid formulas across the canonical AND-OR hypergraph with regime pruning.

kmath_inverse_design

Runs closed-loop parametric sweeps returning verified Pareto-optimal aerospace designs.

kmath_physical_bounds_check

Prunes violations of 1st/2nd Thermodynamics Laws (Carnot), $v < c$, and momentum conservation.

kmath_regime_check

Validates variable compatibility across 18 physical validity regimes (Mach, relativistic, etc.).

kmath_buckingham_pi

Computes exact integer $\mathbb{Z}^7$ nullspace dimensionless $\Pi$-groups.

kmath_pareto_front

Computes exact Pareto Skyline (Rank 0), NSGA-II crowding distances, and Utopia knee points.


CLI Usage / Komut Satırı Kullanımı

python kmath.py audit                 # Run 10-gate Python + SSOT engineering audit
python kmath.py rust audit            # Run 16-gate pure-Rust proof & simulation audit
python kmath.py simulate compare      # Compare Chemical vs. Beamed Laser vs. Kinetic launch trajectories
python kmath.py materials             # Rank certified aerospace/TPS materials by breaking length & strength
python kmath.py stress                # Check cylindrical shell stress & heat flux limits
python kmath.py stats                 # Show ontology, canonical law, and staging harvest metrics

Verification Summary / Doğrulama Özeti

  • Python Audit (python kmath.py audit): 10/10 PASS (214 canonical laws, 353 ontology symbols, 18 physical regimes, 30 materials).

  • Rust Audit (citadel_math_core audit): 16/16 PASS (#![forbid(unsafe_code)], 214 SSOT AST laws + 544 inverse laws, IEEE 1788-2015 outward-rounded intervals, Buckingham-$\Pi$, NSGA-II Skyline, 2D CAD R12 DXF/SVG).


License / Lisans

Citadel-Math Source-Available License (Read & Run Permitted — All Modification & Derivative Rights Reserved).
İnceleme, derleme ve olduğu gibi çalıştırma serbesttir; kaynak kodunu değiştirme, türev eser üretme ve değiştirilmiş sürüm dağıtma haklarının tamamı saklıdır (Tüm Değiştirme Hakları Saklıdır). — see LICENSE for details.
Copyright © 2026 Mekserina Karaosmanoğlu. All Modification Rights Reserved.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      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.
      AGPL 3.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables reliable engineering and scientific computation through tools for exact arithmetic, unit-aware formulas, calculus, linear algebra, statistics, uncertainty propagation, and physical constants, all executed safely in reproducible subprocesses.
      8
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides deterministic tools for symbolic math, equation solving, relation verification, reasoning structure audits, and validated CAD primitives, returning evidence artifacts for every result.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides exact, deterministic tools for math, dates, units, validation, and more to AI agents, returning precise answers with explicit assumptions and warnings instead of model guesses.
      MIT