Skip to content

Repository files navigation

CalcLane

Open-source Standard and Scientific calculator — browser app, engine SDK, CLI, MCP, and hosted API for agents.

CalcLane is a Talocode product: self-hostable, local-first, and built for real use.

Surface Install / URL
Browser Open index.html or npm start
npm npm i @talocode/calclane
CLI npx @talocode/calclane eval "2+3*4"
MCP npx @talocode/calclane mcp
PyPI pip install talocode-calclane
Hosted API https://api.talocode.site/v1/calclane/*
Auth Authorization: Bearer $TALOCODE_API_KEY

v0.3 — Engine SDK + CLI + MCP + Python client + hosted evaluate/dispatch (1 credit each).


Principles (Talocode)

  • Open-source first — MIT, run it yourself
  • Local free, cloud metered — offline eval costs nothing; hosted API uses wallet credits
  • Agents first — JSON in/out, MCP tools, same contract on npm and PyPI

Quick start

Browser UI

cd calclane
npm start          # http://localhost:4173
npm run test:engine

Node SDK (local, free)

npm i @talocode/calclane
import { evaluateExpression, createCalcLaneClient } from '@talocode/calclane'

console.log(evaluateExpression('2 + 3 * 4'))
// { ok: true, result: 14, display: '14', mode: 'scientific', ... }

const client = createCalcLaneClient()
console.log(client.evaluateLocal('sin(90)', { angle: 'deg' }))

CLI

npx @talocode/calclane eval "2^10"
npx @talocode/calclane eval "sin(90)" --angle deg
npx @talocode/calclane pricing
npx @talocode/calclane mcp          # stdio MCP server

Hosted API (credits)

export TALOCODE_API_KEY=your_key
export TALOCODE_BASE_URL=https://api.talocode.site   # default

# 1 credit
curl -sS -X POST "$TALOCODE_BASE_URL/v1/calclane/evaluate" \
  -H "Authorization: Bearer $TALOCODE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expression":"2+3*4","mode":"scientific"}'
import { createCalcLaneClient } from '@talocode/calclane'

const cloud = createCalcLaneClient({ preferLocal: false })
const r = await cloud.evaluate('sqrt(144)')  // uses API when key set + preferLocal false
// or always:
await cloud.evaluateRemote('2^10')

Python

pip install talocode-calclane
from calclane import CalcLaneClient

client = CalcLaneClient()  # local free by default
print(client.evaluate("2 + 3 * 4"))

# Hosted (1 credit)
client = CalcLaneClient(prefer_local=False)  # needs TALOCODE_API_KEY
print(client.evaluate("sin(90)", angle="deg", remote=True))
calclane eval "5!"
calclane eval "2+3*4" --remote

Hosted API

Base: https://api.talocode.site

Auth (required for all /v1/calclane/* routes):

  • Authorization: Bearer $TALOCODE_API_KEY
  • or X-Api-Key: $TALOCODE_API_KEY
Method Path Credits Description
GET /v1/calclane/health free* Service health
GET /v1/calclane/pricing free* Credit table
GET /v1/calclane/capabilities free* Modes & endpoints
POST /v1/calclane/evaluate 1 Evaluate expression
POST /v1/calclane/dispatch 1 Run engine commands

*Still requires a valid API key; no credit charge.

POST /v1/calclane/evaluate

{
  "expression": "2 + 3 * 4",
  "mode": "scientific",
  "angle": "deg"
}

Response:

{
  "ok": true,
  "expression": "2 + 3 * 4",
  "result": 14,
  "display": "14",
  "mode": "scientific",
  "angle": "deg",
  "engine": "calclane",
  "version": "0.3.0",
  "usage": { "credits": 1, "action": "calclane.evaluate", "remaining": 99 }
}

Modes

Mode 2 + 3 * 4
scientific (default) 14 (precedence)
standard 20 (left-to-right)

Functions: sin cos tan asin acos atan log ln sqrt cbrt abs floor ceil round exp fact, constants pi e, operators + - * / % ^ ** !, parentheses.


Architecture

lib/           # TypeScript package (engine, evaluate, client, CLI, MCP)
src/engine/    # Browser pure-JS engine (web UI)
src/ui/        # Browser UI
python/        # talocode-calclane PyPI package
Layer Role
Engine Commands in → state out (CalcEngine)
Evaluate Expression string → result (agents)
Client Local or api.talocode.site
Hosted Stacklane /v1/calclane/* + wallet credits

MCP tools

Tool Description
calclane_evaluate Evaluate expression (local or remote: true)
calclane_dispatch Engine command stream
calclane_health Health
calclane_pricing Credits
calclane_capabilities Feature list

Stacklane Cloud MCP also exposes the same tools against the hosted routes.


Tests

npm run build
npm run test:pkg      # package evaluate/engine tests
npm run test:engine   # browser engine tests

Talocode ecosystem

Project What it is
Codra Local-first agentic coding
Tera AI learning companion
Stacklane Cloud control plane
SearchLane Agent web search
DocuLane Office document CLI
WorkLane Workflow engine
InvoiceLane Invoice / receipt intelligence
CalcLane (this repo) Open calculator

More: github.com/talocode · talocode.site · docs.talocode.site


Roadmap

  • Programmer mode (hex / bin / bit ops)
  • Unit converter
  • Session-based remote calculator state

License

MIT © Talocode

Support

Sponsor: https://github.com/sponsors/Abdulmuiz44

About

Open-source Standard and Scientific calculator by Talocode. Self-hostable, local-first history, keyboard-friendly. Zero-dependency browser app.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages