codecalc MCP server
Code & logic calculator for AI agents: 31 languages, symbolic math, SMT/logic solving, Big-O.
3 stars
Reviews
Write oneNobody has reviewed codecalc yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
codecalc tools (55, 12 write)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
_completion_languagesEvery registry key plus every alias, e.g. "py" alongside "python3".
_toolWrap `mcp.tool`, stamping the group taxonomy on registration.
algebraic_equivAre two expressions algebraically identical? 'is (a*b)/c the same as a*(b/c)?' answered exactly. Use symbolic(op="simplify"), not this, to see one expression's own simplified/factored/expanded forms rather than compare two; use verify_translation to compare running PROGRAMS, not expressions. Caveat: symbolic identity says nothing about float rounding, integer truncation or modular overflow.
analyze_complexityEstimate the asymptotic (Big-O) time complexity of a code snippet via structural analysis.
benchmarkEmpirically measure time complexity by running code at increasing input sizes.
bitsProgrammer-mode integer facts and operations, selected by `mode` — replaces the four former standalone tools bit_analysis, bitop, int_widths and base_repr, retired in 0.12.0 (CHANGELOG.md). Every mode returns exactly its former tool's own result, plus `mode` (additive).
branch_reachabilityWhich if/elif/else arms and while/for loops of this python3 function can ever run, which are dead code, and what inputs reach each — decided with z3, without running the program.
calc_exactUse calc_exact, not evaluate_expression, for a literal arithmetic expression with no symbols in it. EXACT arithmetic: 0.1 + 0.2 == 0.3 is True here (False in plain Python).
calc_statsMean, median, sample stdev, and coefficient of variation (CV) for a sample of numbers. Pairs with percentiles for distribution shape (p50/p90/p95/p99) on the same sample, and with benchmark or verify_optimization, which are common sources of the timing samples this tool summarizes. CV > 0.2 flags run-to-run noise that swamps the effect. Returns n/mean/median/stdev/cv plus a cv_note.
collision_probabilityBirthday-bound hash collision probability: 1 - exp(-n^2 / (2*2^b)).
compare_edge_caseswrite actionRun the same logic in N languages on edge-case inputs and flag divergence.
compare_executionwrite actionRun the same code in multiple languages side by side.
compare_thresholdExact threshold check with a verdict and the shortfall when it fails. Use calc_exact, not this, when you want the computed VALUE rather than a threshold comparison.
convert_unitsConvert a value between units (dimensional analysis via sympy).
data_sizesByte counts for a plain integer, both binary and decimal — the gap between them is where '291 MB' and '277 MiB' silently disagree by 5%. For units other than bytes, use convert_units. For a duration, not a byte count, use human_duration. Returns `bytes` plus `binary` and `decimal` dicts of unit -> value.
decoepoch_timeEpoch seconds/millis/micros/nanos to ISO 8601 UTC (implausible readings suppressed).
evaluate_expressionUse evaluate_expression, not calc_exact, for something other than plain arithmetic on literal values. Symbolically evaluate to a value or closed form via sympify: 'sqrt(144) + 2**10'. Not simplification — for simplified/factored/expanded forms, use symbolic(op="simplify").
execute_codewrite actionexecute_code_streamwrite actionExecute code and STREAM progress + partial output as it runs. Use this, not execute_code/run_submit/session_run, for the same run when you want output while it runs, up to a 300s cap.
extract_functionExtract a named function (with its imports + referenced helpers) into a standalone program and run it in the sandbox.
float_reprWhat binary64 actually stores for X: exact value, raw bits, ULP, both neighbours, and whether the literal is representable. `float_repr(0.1)` shows 0.1000000000000000055511151231257827...; `float_repr(0.25)` says EXACT. Above 2^53 warns consecutive integers are indistinguishable.
human_durationConvert a SPAN of elapsed seconds into a humanised duration (e.g. '2d 3h 4m 5s') plus per-day and per-30d rates. For an epoch timestamp to a calendar date, use epoch_time instead. For byte counts, not seconds, use data_sizes. Returns `human`, `per_day`, `per_30d`, and the echoed `seconds`.
install_packageInstall a package for a language (uv pip / npm / gem / go get / cargo add...).
list_execution_providersList execution providers (execution BACKENDS — local subprocess, gVisor-strict, remote) and their machine-readable capabilities.
list_languagesList every language codecalc can execute, with extension, compile flag, and what this machine resolved. `status` is `installed` (its command was found on the sandbox PATH) or `supported` (nothing for it here); `status_basis` is `resolved`, meaning nothing was executed to check. Run `codecalc doctor --deep` to promote a runtime to `available` by actually running it.
list_unitsList every supported unit alias — all aliases and spellings — for convert_units.
matrixStructured matrix operations: det, inverse, eigenvalues, transpose, rank, trace.
percent_changeExact percent change from FROM_VALUE to TO_VALUE. Use percentage, not this, for PART / TOTAL rather than a before/after change.
percentageExact share and percentage of PART / TOTAL. Use calc_exact for a single arithmetic expression, or compare_threshold to check the result against a threshold rather than just compute it.
percentilesp50/p90/p95/p99 (the 50th/90th/95th/99th percentile cutoffs) by nearest-rank AND linear interpolation. Pairs with calc_stats, which gives mean/median/stdev/CV on the same sample instead of these distribution points.
physical_constantsLook up a physical constant (speed_of_light, planck, avogadro, gravity, electron_mass, gas_constant, ...) or list all 22 with values.
radix_convertConvert a value between ANY bases 2..36, fractions included; bases that cannot represent the fraction (e.g. 0.1 in base 2) are flagged non-terminating. `radix_convert('zz', 36, 7)` is one call.
run_cancelwrite actionCancel a background run started with run_submit.
run_inspectwrite actionPoll a background run started with run_submit.
run_submitwrite actionSubmit code for BACKGROUND execution; returns a run_id immediately. Use this, not execute_code/execute_code_stream/session_run, when you do not want to hold the call open — poll run_inspect(run_id), and run_cancel(run_id) to stop it early.
runtimes_statusCheck every language runtime for available updates (NON-MUTATING).
session_artifactsList files created by executed code in a session (excluding runner internals like main.py/run.out).
session_delete_filewrite actionDelete one file (or symlink entry — never the directory or symlink's target) from a session workspace. This is the recovery path when a session is refused for being over CODECALC_MAX_ARTIFACT_COUNT: neither session_write_file (creates/overwrites, never removes) nor session_run/ execute_code (refused by the same cap) can shrink the count, so this is the only in-session way to get back under it shor
session_filesList workspace files, optionally using a bounded cursor page. Use session_artifacts, not this, for only the files executed code produced; use session_read_file for one file's contents.
session_listList active sessions and their languages/state.
session_read_fileRead a file from a session workspace.
session_runwrite actionRun a multi-file program already written into a session workspace (via session_write_file). Use this, not execute_code/execute_code_stream/run_submit, when `entry_file` may import other files already in that workspace (helper.py, data/...).
session_snapshotArchive or restore a session's workspace files. `action`:
session_startStart a persistent session. python3/node get a stateful REPL worker (variables/imports persist across execute_code calls); other languages get a persistent workspace directory. Returns session_id.
session_stopStop a session: kill its REPL worker (if any) and delete its workspace. Also deletes every session_snapshot saved for it, unless keep_snapshots=True.
session_write_filewrite actionWrite a file into a session workspace (relative path, no escapes). Use this to seed input data for executed code.
startwrite actionCreate a session: fresh workspace dir; REPL worker for supported langs.
symbolicSymbolic algebra, selected by `op` — replaces the four former standalone tools solve_expression, solve_linear, simplify_expression and limit_expression, retired in 0.12.0 (CHANGELOG.md). Every op returns exactly its former tool's own result, plus `op` (additive).
trace_executiontruth_tableBuild the truth table for a boolean expression over and/or/not/xor/ implies/iff (plus true/false constants and variables): 'a and b or not c', 'p xor q', 'a implies b'. Use z3_check, not this, for satisfiability over inequalities or non-boolean variables; use evaluate_expression for symbolic (non-boolean) math.
update_runtimeswrite actionUpdate language runtimes. SAFE BY DEFAULT: with apply=False this is a dry run — it returns the update commands that WOULD run without changing anything. Pass apply=True to actually execute them (mise up, rustup update, swiftly update, apt-get upgrade of language packages, npm -g update, uv tool upgrade).
verify_optimizationPROVE an optimisation: same outputs, measurably AND SIGNIFICANTLY faster.
verify_translationPROVE that a port is equivalent: run both programs, compare their output.
z3_checkUse z3_check, not symbolic(op="solve"), for satisfiability over inequalities, boolean combinations, or several variables at once: sat/ unsat/unknown plus a model. Example: '(declare-const x Int)(assert (> x 5))(check-sat)'.
Public scan report
scanner v0.1.10 · 2026-10-02 · same rubric, same numbers if you re-run it
- Code scan53 source files scanned20/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitylocal package, no credentials required12/15
- Maintenancelast push 8 days ago15/15
- Maintainer identityregistry namespace matches repository owner7/10
Findings (1)
- mediumeval / new Function used
exec.evalx/codecalc/branch_reachability.py: …indexing, not the model's own `.eval(..., model_completion=True)` — this pack…
How codecalc compares
Against every graded MCP server, from our own scans and uptime checks. Updated after each scan run.
- Safety score
- 83/100
- higher than 65% of 48,255 servers
- Tools
- 55
- the typical server has 7
- Tools that change things
- 22%
- typical: 0%. Fewer write tools means less an agent can break
- GitHub stars
- 3
- more than 80% of 28,688 servers
What its tools let an agent do: 40 read · 6 change · 9 run or deploy
Release history: 2 versions in the registry since 2026-09-09, latest 2026-09-21, typically one every 12 days.
Install codecalc in Claude Code, Cursor or VS Code
claude mcp add codecalc -- uvx codecalc
What the publisher says
From the codecalc repository's README, as published. We do not edit it. Read it on GitHub
codecalc — universal code & logic calculator for AI models
<!-- mcp-name: io.github.The-40-Thieves/codecalc -->
codecalc is an offline, self-hosted MCP server that gives an AI agent a calculator, a code runner, and a logic checker — so it gets a correct answer instead of a guessed one. It runs code in 31 languages, does exact symbolic math, solves SMT/logic problems, and measures complexity, all exposed as 51 MCP tools.
Fastest path: uvx 'codecalc[full]' setup --write registers codecalc with your MCP client automatically. New to MCP, or want more detail first? See QUICKSTART.md, or the Install section below.
Three things nobody else offers together cleanly:
The core opens no sockets; network access is opt-in and only where a specific tool's job needs it (the Piston provider, installpackage, the runtime-update tools, executed code unless nonet, and a one-time in-process grammar download on first analyze_complexity — full breakdown in the network-boundary table below).
- Offline-core — ships no model, no API key, no gateway, no telemetry.
boundary (gVisor+Docker on Linux, AppContainer on Windows) layered above the default rlimit sandbox, fail-closed and attested.
- Safe execution of untrusted code — an opt-in strict isolation
language behaves identically, verifyoptimization proves an optimization preserved behavior, and z3check proves or refutes logic with an SMT solver.
- Verification tools — verify_translation proves a port to another
When to use codecalc
Use it when you want a free, local, private, hardened code-runner and verifier that an MCP agent can call directly — no vendor account, no cloud spend, nothing leaving the machine except where a tool's job explicitly requires it.
Reach for something else when you want managed cloud scale instead of self-hosting (a hosted sandbox like E2B or Modal), or when you're not self-hosting at all and the model vendor's built-in code interpreter already covers what you need.
codecalc vs. the alternatives
codecalc is not a general cloud sandbox and not a vendor code interpreter. It overlaps with several things and beats them in only one narrow place — forcing a model to measure a claim instead of asserting it. Where that isn't what you need, one of these is the better tool, and this table says so plainly.
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
codecalc: common questions
- Is codecalc MCP server safe?
- Mostly: it is graded B (83/100). Read the codecalc safety report
- How do I install codecalc?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does codecalc need an API key?
- Not as far as the registry entry and our scan can tell: no credentials are declared or required.
- Is codecalc maintained?
- The last commit was 41 days ago (2026-09-24). The latest release is v0.13.0.
- How does codecalc compare with other MCP servers?
- safety score 83/100 (higher than 65% of 48,255 servers); tools 55 (the typical server has 7); tools that change things 22% (typical: 0%. Fewer write tools means less an agent can break). Full comparison.