battery-erp
Battery-ERP – Material-, Zell-, Pack- und Lieferkettenmanagement mit Echtzeit-Rohstoffpreisen und Fabric-Lakehouse-Analysen.
Deckt die gesamte Batterie-Wertschöpfungskette ab: von Lithium, Kobalt, Nickel, Mangan, Graphit über Zellchemien (NMC-811, NCA, LFP, LMO) bis hin zu Batteriepacks mit BOM-Kalkulation, Lieferantenbewertung, Bestandsverwaltung und Was-wäre-wenn-Kostenszenarien.
mcp-name: io.github.icohangar-ops/battery-erp
Worum es sich handelt
Battery ERP verwaltet die komplette Batterie-Wertschöpfungskette – von der Rohstoffbeschaffung über die Zellfertigung bis zur Packmontage. Jede Kostenposition ist einem bestimmten Material, Lieferanten und Preisniveau zuordenbar.
Ebene | Rolle |
Datenmodelle | RawMaterial, CellChemistry, BatteryCell, BatteryPack, BOMItem, Supplier, InventoryRecord, PurchaseOrder, ManufacturingBatch |
Geschäftsregeln | BOM-Kostenkonsolidierung, Bestandsstatusverwaltung, Lieferantenbewertung (zusammengesetzte Note A–D), Fertigungsausbeutenverfolgung, Preistrendanalyse, Was-wäre-wenn-Kostenszenarien |
Preis-Engine | Standard-Preistabelle für Materialien (20+ Materialien), AlphaVantage-Integration für Live-Rohstoffpreise, FRED-Makro-Overlay |
Analysen | Bestandsgesundheitsberichte, Lieferkettenberichte, Fertigungsausbeuteberichte, Dashboards zum Kostenvergleich der Chemien |
Fabric Lakehouse | 11 Delta-Tabellen für dauerhafte Speicherung und SQL-Analysen |
Related MCP server: foundry net-industrial
Schnellstart
# From PyPI — https://pypi.org/project/battery-erp/
python3 -m pip install 'battery-erp[mcp]' # MCP tools
python3 -m pip install 'battery-erp[api]' # REST adapter
# From source
git clone https://github.com/icohangar-ops/battery-erp.git
cd battery-erp
python3 -m pip install -e '.[dev]'
PYTHONPATH=src python3 -m pytest tests/ -v
# Domain modules
python3 -c "
from battery_erp.pricing import calculate_cell_cost_summary, get_material_price_table
prices = get_material_price_table()
for chem in ['NMC-811', 'NMC-622', 'NCA', 'LFP', 'LMO']:
r = calculate_cell_cost_summary(chem, 50.0, prices)
print(f'{chem}: \${r[\"cost_per_kwh\"]:.1f}/kWh (BOM: \${r[\"bom_cost_usd\"]:.2f})')
"Architektur
┌──────────────────────────────────────┐
│ Raw Materials (20+ tracked) │
│ Lithium · Cobalt · Nickel · Mn · Gr │
└──────────────┬───────────────────────┘
│ BOM
┌──────────────▼───────────────────────┐
│ Cell Chemistries │
│ NMC-811 · NMC-622 · NCA · LFP · LMO │
└──────────────┬───────────────────────┘
│ cells + components
┌──────────────▼───────────────────────┐
│ Battery Packs │
│ EV · ESS · Consumer · Industrial │
└──────────────────────────────────────┘
Side modules:
┌─────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Supplier Scoring │ │ Inventory Mgmt │ │ Cost Scenarios │
│ Composite 0-100 │ │ Reorder logic │ │ What-if analysis │
│ A/B/C/D grades │ │ Status tracking │ │ Price shock model │
└─────────────────┘ └──────────────────┘ └──────────────────┘Kernmodule
battery_erp.core.models
Alle Domänen-Dataclasses:
RawMaterial– Materialkatalog mit Preisen, HS-Codes, GefahrstoffenCellChemistry– NMC-111/622/811, NCA, LFP, LMO mit Energiedichte und ZyklenlebensdauerBatteryCell– Zellspezifikationen (Kapazität, Spannung, Bauform, Gewicht)BatteryPack– Packmontage (Zellen + BMS + Thermik)BOMItem– BOM-Position mit VerschnittfaktorSupplier– Lieferantenkatalog mit Qualitätsbewertung, Lieferzeit, ZertifizierungenInventoryRecord– Lagerpositionen mit MeldebestandslogikPurchaseOrder– Verfolgung des BestelllebenszyklusManufacturingBatch– Verfolgung der Fertigungsausbeute von ProduktionschargenPriceHistory– Zeitreihen der Rohstoffpreise
battery_erp.core.rules
Deterministische Geschäftsregeln:
rollup_bom_cost()– Gesamte BOM-Kosten mit Materialaufschlüsselung und Verschnittkostencalculate_cell_bom()– Repräsentative BOM für jede Chemie erzeugencalculate_pack_bom()– BOM auf Packebene (Zellen + Gehäuse + BMS + Kühlung)update_inventory_status()– in_stock/low/out_of_stock neu berechnencheck_reorder_suggestions()– Bestellvorschläge erzeugencalculate_batch_metrics()– Fertigungsausbeute aggregierenanalyze_price_history()– Preistrendanalyse mit Volatilitätestimate_cell_cost_impact()– Was-wäre-wenn-Kostenszenarien modellierencalculate_pack_metrics()– Energiedichte und Effizienz des Packs
battery_erp.supply_chain
Lieferkettenmanagement:
score_supplier()– Zusammengesetzter Score (Qualität 35 %, OTD 35 %, Lieferzeit 20 %, Zertifikate 10 %)rank_suppliers()– Nach Score einstufen, nach Material filterncreate_purchase_order()– Bestellung aus Lieferantendaten erstellenanalyze_po_pipeline()– Analyse der Bestellpipeline (Erkennung überfälliger Bestellungen, Lieferzeitverfolgung)suggest_dual_sourcing()– Empfehlung für Dual-Sourcing-Strategie
battery_erp.pricing
Rohstoffpreise:
get_material_price_table()– Standardpreise für 20+ Batteriematerialiencalculate_cell_cost_summary()– Schnelle Kostenschätzung pro Chemieupdate_prices_from_alpha_vantage()– Live-Abruf der Rohstoffpreiseupdate_prices_from_fred()– Makroökonomische Indikatoren
battery_erp.analytics
Berichtswesen:
generate_inventory_report()– Vollständiges Dashboard zur Bestandsgesundheitgenerate_supply_chain_report()– Bericht zu Lieferanten + Bestellpipelinegenerate_manufacturing_report()– Ausbeutekennzahlengenerate_pricing_report()– Kostenvergleich der Chemien + Preistrends
Kostenvergleich der Chemien (Standardpreise, 50-Ah-Zelle)
Chemie | BOM-Kosten | $/kWh | Kathoden-% | Hauptmerkmal |
LFP | Am niedrigsten | ~$50-55 | ~35% | Kein Co/Ni, extrem sicher, 4000+ Zyklen |
LMO | Niedrig | ~$55-60 | ~40% | Günstig, Elektrowerkzeuge |
NMC-111 | Mittel | ~$70-80 | ~50% | Ausgewogen, bewährt |
NMC-622 | Mittel | ~$75-85 | ~48% | Gutes Energie-Kosten-Verhältnis |
NMC-811 | Höher | ~$80-90 | ~52% | Hohe Energiedichte, EV-dominant |
NCA | Am höchsten | ~$85-95 | ~55% | Tesla-Flaggschiff, 270 Wh/kg |
Microsoft-Fabric-Integration
Fabric-Notebooks
Notebook | Zweck |
| Alle 11 Delta-Tabellen mit Beispieldaten erstellen |
| Vollständiges Kostenanalyse-Dashboard (Chemievergleich, Packkalkulation, Bestand, Lieferanten, Preistrends, Szenarien) |
Delta-Tabellenschema
Tabelle | Wichtige Spalten |
| material_id, name, category, unit_price_usd, price_source, hs_code |
| chemistry_id, name, cathode_type, energy_density_wh_per_kg, cycle_life |
| cell_id, sku, chemistry, form_factor, nominal_capacity_ah, energy_wh, weight_kg |
| pack_id, sku, cell_sku, total_cells, nominal_capacity_kwh, pack_weight_kg |
| bom_id, parent_sku, material_name, quantity_per_unit, unit_cost_usd, waste_factor_pct |
| supplier_id, name, country, materials_supplied, quality_rating, lead_time_days |
| record_id, sku, material_name, quantity_on_hand, quantity_reserved, reorder_point |
| po_id, po_number, supplier_name, quantity, total_usd, status, expected_delivery |
| material_name, price_usd, as_of, source |
| batch_id, product_sku, chemistry, quantity_produced, quantity_pass, yield_pct |
| scenario_id, scenario_name, material_name, current_price_usd, scenario_price_usd, pct_change |
Fabric-Schnellstart
Führen Sie
fabric_setup_lakehouse.pyaus, um alle 11 Delta-Tabellen zu erstellenFühren Sie
fabric_cost_dashboard.pyfür das vollständige Analyse-Dashboard ausDas Dashboard umfasst: Kostenvergleich der Chemien, Kalkulation auf Packebene, Bestandsgesundheit, Lieferanten-Scorecard, Preistrends, Fertigungsausbeute, Kostenszenarien
Bestandsadapter (REST + MCP)
Battery ERP ist eine Domänenbibliothek, kein gehostetes ERP. Für SMS-/Textzeilen- und Agenten-Workflows liegt ein gemeinsamer InventoryService sowohl unter einer schlanken REST-API als auch unter einem MCP-Server. Ausführliche Details: docs/INTEGRATION.md.
SMS / ClickSend Cursor / Claude (stdio MCP)
│ │
▼ ▼
REST API (port 8088) battery_erp.mcp
└──────────┬──────────────┘
▼
InventoryService
▼
InMemoryInventoryStore (demo)
▼
Human bin confirmationRufen Sie MCP nicht aus einem Browser auf. Halten Sie REST und MCP in getrennten Terminals.
Installation (macOS / zsh)
Verwenden Sie python3. Setzen Sie pip-Extras in Anführungszeichen, damit zsh sie nicht als Glob-Muster interpretiert:
cd ~/Desktop/icohangar-repos/battery-erp
python3 -m pip install -e '.[dev]' # api + mcp + pytestTerminal A – REST (Textzeilen-Backend)
cd ~/Desktop/icohangar-repos/battery-erp
export BATTERY_ERP_CONFIRM_TOKEN=dev-secret
export BATTERY_ERP_AUDIT_LOG=/tmp/battery-erp-audit.jsonl
PYTHONPATH=src python3 -m battery_erp.api
# Uvicorn → http://127.0.0.1:8088curl -s http://127.0.0.1:8088/health
curl -s http://127.0.0.1:8088/inventory/lookup/lithiumTerminal B – MCP (nur Agents / Cursor)
Lassen Sie Terminal A laufen. In einem neuen Terminal:
cd ~/Desktop/icohangar-repos/battery-erp
export BATTERY_ERP_CONFIRM_TOKEN=dev-secret
PYTHONPATH=src python3 -m battery_erp.mcpDieser Prozess bleibt auf stdio still – normal für MCP-Hosts. Fügen Sie dies nicht in das API-Terminal ein.
Cursor-MCP-Konfiguration
Fügen Sie Folgendes zu ~/.cursor/mcp.json hinzu (absolute Pfade; python3 statt python):
{
"mcpServers": {
"battery-erp": {
"command": "python3",
"args": ["-m", "battery_erp.mcp"],
"env": {
"PYTHONPATH": "/Users/YOU/Desktop/icohangar-repos/battery-erp/src",
"BATTERY_ERP_CONFIRM_TOKEN": "replace-me",
"BATTERY_ERP_AUDIT_LOG": "/tmp/battery-erp-audit.jsonl"
}
}
}
}Laden Sie dann die MCP-Server in Cursor neu. Verfügbare Tools: lookup_inventory,
get_inventory_status, get_inventory_record, list_inventory,
create_bin_check_request, record_bin_confirmation.
Schnittstelle | Einstieg | Gemeinsame Ebene |
REST |
|
|
MCP | Tools oben (mcp SDK 2.x | gleich |
Für die mutierende Behälterbestätigung ist BATTERY_ERP_CONFIRM_TOKEN erforderlich; optional wird ein JSONL-Prüfprotokoll nach BATTERY_ERP_AUDIT_LOG geschrieben.
Verzeichnis-/Registry-Paketierung: siehe PUBLISH.md (glama.json,
Dockerfile, server.json). Nach dem Merge in main auf Glama als
@icohangar-ops/battery-erp beanspruchen.
Tests
PYTHONPATH=src python3 -m pytest tests/ -v
# Domain tests + inventory service / REST / MCP scaffoldAnwendungsfälle
Zellhersteller – BOM-Kostenverfolgung über Chemien hinweg, Ausbeuteoptimierung
Pack-Integratoren – Kostenkalkulation auf Packebene, Lieferantenauswahl
Einkauf – Lieferantenbewertung, Dual Sourcing, Bestellpipeline-Verwaltung
Finanzen – Rohstoffpreisrisiko, Was-wäre-wenn-Szenarien, Bestandsbewertung
Führungsebene – Dashboard mit $-/kWh-Trends, Resilienz der Lieferkette, Kostensenkungspotenziale
Lizenz
MIT. Siehe LICENSE.
CHP-Governance
Dieses Repository ist mit dem Consensus Hardening Protocol (CHP) abgesichert, der Entscheidungs-Governance-Ebene von Cubiczan für Multi-Agenten-KI-Systeme.
Protokollebenen
R0-Gate: Alle Entscheidungen müssen die Prüfungen „Lösbar, Abgegrenzt, Gültig, Lohnend" bestehen
Offenlegung der Grundlage: 1–3 schwächste Annahmen, 1–2 Ungültigkeitsbedingungen, 1 zentrale Schwachstelle
Adversariale Ebene: Verpflichtender Advocatus Diaboli in Phase 0 und Runde 3
Zustandsautomat: EXPLORING → PROVISIONAL → PROVISIONAL_LOCK → LOCKED
Validierung durch Dritte: Unabhängiges BESTÄTIGEN/ABLEHNEN vor der Sperrung
Domänenkonfiguration
Kategorie: Bergbau / Lieferkette
Schwellenwert für die Grundlage: 75
CFO-Genauigkeitsschutz: Deaktiviert
Compliance-Artefakte
Datei | Zweck |
| Übergänge von Entscheidungszuständen |
| Domänenkalibrierte Schwellenwerte |
| Standardisierte Challenge-Vorlagen |
| Compliance-Tracking und Prüfpfad |
CHP-Version
cognitive-mesh-orchestrator 0.1.0 | Protokolldokumentation
Demo
Handheld — Parts Bin Text Line
Mobile Aufnahme von der Live-Lead-Seite (parts-bin-text-line--icohangar.replit.app). SMS → text-line → Battery-ERP-Bestandsprüfung → menschliche Behälterbestätigung.
Available Tools
6 toolscreate_bin_check_requestC
Create a human bin-count verification task for SMS / warehouse workflows.
Inputs: part_number (required), notes.
get_inventory_recordB
Return the full inventory record for a SKU (on-hand, reserved, reorder, cost).
Inputs: sku (required).
get_inventory_statusC
Get inventory status plus reorder suggestion when below reorder point.
Inputs: part_number (required).
list_inventoryB
List status for all seeded inventory SKUs (demo store).
Inputs: no named parameters.
lookup_inventoryB
Look up available quantity and stock status for a part number or SKU.
Inputs: part_number (required).
record_bin_confirmationC
Record a human-confirmed on-hand quantity. Requires auth_token matching BATTERY_ERP_CONFIRM_TOKEN.
Inputs: auth_token (required), part_number (required), actual_quantity (required), actor, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
lookup_inventory, get_inventory_status, and get_inventory_record all take a SKU and return overlapping inventory quantities/status, so their boundaries are unclear. list_inventory and the two bin-check tools are distinct, but the three inventory getters could easily be misselected.
All names are snake_case and verb-led, with read operations using lookup/get/list and write operations using create/record. The pattern is mostly predictable, with only a minor inconsistency between lookup_inventory and the get_inventory_* family.
Six tools is a well-scoped set for a focused inventory ERP demo: four query variants plus two bin-count workflow actions. Each tool has a reasonable role, and the count is neither bloated nor too thin.
The set covers inventory queries and the bin-confirmation workflow, but lacks lifecycle operations such as SKU creation/update or any way to list pending bin-check requests. Reorder suggestions are generated but there is no tool to act on them, creating a dead end.
Related MCP Connectors
Supply chain operations: dock scheduling, check-in, doors, inventory, orders and freight.
Warehouse digital twin: what-if simulation and AI optimisation of slotting, batching and labour.
Real-time supply chain risk intelligence — 24 tools, proprietary indices, predictive signals
Cross-OEM industrial machine intelligence: identity, normalization, automation, attestation.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA custom implementation for real-time supply chain optimization that enables parallel tool calling to provide intelligent inventory management recommendations and actionable insights in response to live supply chain events.6-
- FlicenseAqualityBmaintenanceCross-OEM industrial machine intelligence. Normalizes telemetry across 16 manufacturer families (Fanuc, Siemens, Haas, DMG Mori, Mazak), enables plain-English operational automation, and produces tamper-evident work records. 14 MCP tools.14-
- FlicenseNot gradedqualityBmaintenanceAn AI-powered EV Digital Twin platform for battery health monitoring, predictive maintenance, fleet analytics, and intelligent decision support using MCP tools for SOH prediction and RUL estimation.6-
- FlicenseNot gradedqualityCmaintenanceEnables supply chain management tasks such as tracking shipments, managing inventory, and supplier scorecards through MCP protocol.24 PyPI-