
Dinero
Exposes Dinero.js library functions via MCP for immutable currency object management. Handles creation, arithmetic operations (add, subtract, multiply, divide), formatting, and comparisons with integer precision. Fintech developers and AI agents use it for e-commerce pricing, billing, and financial computations.
Overview
The Dinero MCP server provides Model Context Protocol access to the Dinero.js library, which manages monetary values as immutable objects to avoid floating-point errors. It supports currency-specific arithmetic and formatting using minor units (e.g., cents for USD).
Key Capabilities
- dinero: Creates a money object, e.g., dinero({ amount: 1000, currency: 'USD' }) for $10.00.
- add: Adds two or more money objects of the same currency.
- subtract: Subtracts one money object from another.
- multiply: Multiplies a money object by a decimal number, preserving precision.
- divide: Divides a money object into parts or by a number with ratios.
- allocate: Splits a money object by percentages or ratios.
- format: Outputs formatted strings like '$10.00' using locale-aware providers.
- compare: Compares two money objects (equals, lessThan, greaterThan).
- getCurrency: Returns the ISO 4217 currency code.
- toUnit: Converts to decimal unit value.
Use Cases
-
Pricing Calculation: Create product prices with dinero, add shipping via add, apply discount with multiply(0.9), format for invoice.
-
Bill Splitting: Sum group expenses using add, allocate by shares, compare individual contributions with compare.
-
Budget Tracking: Subtract expenses from budget total, check lessThan zero for overdraft, format reports.
-
Tip Computation: Multiply bill by 0.15 using multiply, add to total, round with allocate.
Who This Is For
- Developers implementing financial logic in JavaScript/Node.js apps.
- AI model integrators needing precise money math for chatbots or automation.
- Fintech, e-commerce, and accounting software builders avoiding currency bugs.