codecalc
Code & logic calculator for AI agents: 31 languages, symbolic math, SMT/logic solving, Big-O.
Connector by The-40-Thieves · GitHub account verified by the MCP Registry
Install
Works with Claude Code, Codex, VS Code, Cursor, Windsurf, Claude Desktop. Read the repository before you give any tool access to your data.
npx agentmarket install connector/the-40-thieves-codecalc
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this server can do and what it asks for, from its tool list, install config and code. Checked Oct 25, 2026.
- Tools
- 20 read · 9 write · 4 delete · 18 not yet classified
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Tools by what they do 51
Read from the source code; the running server may list different tools.
Read 20 · Look things up without changing anything.
analyze_complexitycalc_statscompare_thresholdconvert_unitsevaluate_expressionextract_functionhuman_durationlist_execution_providerslist_languageslist_unitsphysical_constantsradix_convert
Show 8 more tools
runtimes_statussession_artifactssession_filessession_listsession_read_fileverify_optimizationverify_translationz3_check
Write 9 · Create, change, send or run things.
install_packagerun_cancelrun_inspectrun_submitsession_runsession_startsession_write_filetruth_tableupdate_runtimes
Delete 4 · Delete, drop, revoke or wipe things.
execute_codeexecute_code_streamsession_delete_filesession_stop
Not yet classified 18 · We could not tell from the name and description.
algebraic_equivbenchmarkbitsbranch_reachabilitycalc_exactcollision_probabilitycompare_edge_casescompare_executiondata_sizesepoch_timefloat_reprmatrix
Show 6 more tools
percent_changepercentagepercentilessession_snapshotsymbolictrace_execution
Network hosts it talks to 8
100.78.123.100· found in codeavatars.githubusercontent.com· found in codegithub.com· found in codeglama.ai· found in codegvisor.dev· found in codellmstxt.org· found in coderaw.githubusercontent.com· found in codestorage.googleapis.com· found in code
Files it touches
~/.ssh/id_rsa/dev/null/dev/random/dev/urandom/dev/zero/etc/passwd/etc/shadow/home/home/ubuntu/.local/bin/Library/Preferences/private/etc/private/tmp/private/var/private/var/db/private/var/folders/.../tmp/codecalc-ab12/main.sh/Users/Users/someone/code/usr/lib/usr/libexec/usr/local/usr/sbin/usr/share/var/folders/.../var/lib- Your home directory (~)
~/.codecalc/audit~/.codecalc/audit/audit.log~/.codecalc/pkgs~/.codecalc/sessions~/.local/share/uvC:\\fooC:\\Windows\\System32\\drivers\\etc\\hosts- Any path the agent passes to its tools
Tools (51)
Read from the source code; the running server may differ. Descriptions are the server’s own words; hidden characters are shown as [U+…].
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. Contract: the code must read an integer N from stdin (first line) and do work sized by N. codecalc runs it at each size in `sizes` and fits the growth curve to estimate Big-O (O(1), O(log n), O(n), O(n log n), O(n^2)...). 3 sizes (the accepted minimum) can only return noise-floor O(1) or "inconclusive" — never a growth class, not even exponential; 4+ sizes are needed to trust the curve fit, 5+ doubling sizes for a robust ratio median — `estimate_basis` names which estimator decided. Example python: 'import sys\nn=i…
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). mode="analysis" (was bit_analysis) — facts about a single N: popcount, bit length, trailing zeros, power-of-two check, next power of two. Used by this mode: `n` (required), `align` (optional). mode="op" (was bitop) — combine two integers `a`/`b` with and/or/xor/nand/nor/xnor/not/shl/shr/sar/rol/ror at a fixed `width` (8/16/32…
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. Use trace_execution instead to see what happened on one run. Use z3_check, not this, when you already have an SMT-LIB2 script to solve directly rather than Python source to translate. Unannotated parameters default to int. Each branch reports `verdict` (reachable/dead/unknown), a `witness` when reachable, and `boundary_inputs` (min/max/equality-edge for each comparison in its own guard) — every input dict is shaped …
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). Everything is an exact rational, integers are arbitrary precision. Supports + - * / // % ** comparisons, bitwise ops (& | ^ << >> ~) on integers, and whitelisted math functions (sqrt, log, sin, ...) plus pi/e/tau. Use BEFORE asserting any computed number: thresholds, ratios, overflows, 'X is N% of Y'. Examples: '2**64 - 1', 'comb(52,5)', '0.1+0.2 == 0.3', '0xff & 0x0f'.
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)). Sizes hashes: 1e6 items into 64 bits is ~2.7e-8; 1e5 into 32 bits is ~0.69 — the answer to 'can I truncate this to 8 hex chars?' (no).
compare_edge_casesRun the same logic in N languages on edge-case inputs and flag divergence. Default inputs cover empty, zero, negative, and float-precision cases: ['', '0', '1', '-1', '10', '100', '0.1\n0.2']. Returns a per-input matrix plus a divergences list where languages disagree on identical input.
compare_executionRun the same code in multiple languages side by side. Returns per-language stdout/stderr/exit/duration plus which was fastest. Example: {"python3": "print(6*7)", "node": "console.log(6*7)"} This tool fans out across every language with no per-language install plumbing behind it; use `install_package`/`execute_code(dependencies=...)` beforehand instead. A `# /// script` block in a snippet is likewise never installed, but is DISCLOSED, not dropped: a python3 row that carries one gets `dependencies: {"status": "unsupported", "reason": ...}`.
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. `a OP b`. Both sides are evaluated exactly and printed as fractions — a threshold comparison written out cannot be gotten backwards. Example: ('1/25', '>', '0.05').
convert_unitsConvert a value between units (dimensional analysis via sympy). Supports metric/imperial length, mass, time, speed, energy, power, force, pressure, temperature (°C/°F/K), volume, area, data sizes, frequency. Examples: ('60','mph','km/h'), ('100','celsius','fahrenheit'), ('1','gb','mib'). Use list_units for the full alias table.
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.
epoch_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"). Also reaches calculus forms no other tool exposes: `diff(expr, x)` (derivative), `integrate(expr, x)` / `integrate(expr, (x, a, b))` (indefinite/definite), and `series(expr, x, x0, n)` (Taylor expansion) — see this parameter's own examples. Returns `value` (if the result is a number) or the evaluated expression, plus `type…
Show 36 more tools
execute_codeExecute `code` in `language` in a sandbox. Use this, not execute_code_stream/run_submit/session_run, for one program whose result you can wait for within a 120s cap. Returns stdout, stderr, exit_code, duration_ms, cpu_ms, peak_memory_kb, verdict (OK/TLE/MLE/OLE/RTE). - `session_id`: run inside a session workspace (see session_start); with a stateful session (python3/node) interpreter state persists across calls. Also reports `artifacts_created` (files just created/modified) since that workspace outlives the call; a sessionless run has none. See `session_run` for the same field plus i…
execute_code_streamExecute 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. Reports progress notifications to the client while the program runs, so agents can see output before the process finishes. Returns the same result shape and applies the SAME ceilings as execute_code: max_memory_mb, max_output_kb and max_cpu are forwarded to the executor exactly as execute_code forwards them, including the same 240 KiB per-stream clamp. `dependencies`: same as execute_code's (PEP 723 merge, `no_…
extract_functionExtract a named function (with its imports + referenced helpers) into a standalone program and run it in the sandbox. python3 gets exact ast extraction; other languages best-effort block extraction (pass `call` to execute non-python). Returns the extracted program and per-input runs.
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...). Asks the caller to confirm before installing (a protocol-level gate, not just the `anthropic/requiresUserInteraction` `_meta` hint — see codecalc/confirmation.py); a declined or malformed confirmation refuses with no install attempted. With session_id, executed code in that session can import the result. NETWORK: yes, always. The package manager fetches from its registry (PyPI, npm, rubygems, crates.io). codecalc opens no socket itself; the child process does. NOT SANDBOXED: the installer runs as a direct subpro…
list_execution_providersList execution providers (execution BACKENDS — local subprocess, gVisor-strict, remote) and their machine-readable capabilities. This is about which BACKEND runs your code, not which LANGUAGE it runs — a provider's `ready`/`strict` fields are resolution facts about the backend itself. Per-language reliability (how much codecalc's CI has actually verified a given language's toolchain, vs merely resolved it) is a separate axis reported by `list_languages`/`runtimes_status`/`codecalc doctor` as `tier`; a `ready` provider says nothing about whether a specific language running through it has ever …
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. `tier` is a DIFFERENT axis from `status`: `status` says whether THIS machine resolved the command (resolution); `tier` says whether codecalc's own CI has actually executed this language and asserted on its output (reliability) — `t…
list_unitsList every supported unit alias — all aliases and spellings — for convert_units.
matrixStructured matrix operations: det, inverse, eigenvalues, transpose, rank, trace. `evaluate_expression` refuses `Matrix([[1,2],[3,4]])` on purpose — `[`/`]` are denied there to block subscript-based RCE escapes, and a matrix literal is collateral from that (correctly aimed) screen. This tool is the structured replacement: `rows` is a JSON array of arrays (row-major), never a string to parse. Each entry is either a JSON number, used directly, or a scalar expression string ('1/2', 'sqrt(2)', 'x+1'), screened per-entry the same way evaluate_expression screens its input before anything reaches Sym…
percent_changeExact percent change from FROM_VALUE to TO_VALUE. Use percentage, not this, for PART / TOTAL rather than a before/after change. `(to_value - from_value) / abs(from_value) * 100` — the conventional finance definition, relative to the MAGNITUDE of the base so a negative from_value does not flip the sign (see `note` when it applies). Refuses from_value=0 (undefined) rather than returning infinity — report the absolute change instead. Returns `percent_exact` (exact rational), `percent_decimal` (rounded), `absolute_change`, `direction` ("increase"/"decrease"/"unchanged"), and `multiplier` (to_valu…
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. Warns when n < 100 that p99 is just the maximum wearing a label.
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_cancelCancel a background run started with run_submit. Idempotent: calling this on a run that is already finished/cleaned reports `cancelled: false, state: <its actual terminal state>` rather than erroring — matching execute_code's own "no partial result" rule, there is nothing partial to hand back either way. Propagation depends on the SELECTED PROVIDER (see list_execution_providers' `cancel` capability). The built-in `local` provider does not support stopping a run once it has started; that is reported honestly here rather than silently pretended to have worked — the computation keeps running to…
run_inspectPoll a background run started with run_submit. While running: {"ok": True, "state": "running"|"cancelling", "run_id", "provider_id", "started_at", "deadline"}. Once terminal (`state` "finished"/"cleaned"/"recovered"), this returns the SAME result shape execute_code returns — stdout/stderr/exit_code/ verdict/unenforced/provider (the interface_version/provider_id/limits receipt)/... — merged with a small set of run_* extras (run_id, provider_id, started_at, deadline, state, cleaned; see server.py's _RUN_EXTRA_KEYS). This terminal reply carries the same `anthropic/maxResultSizeChars` `_meta` ex…
run_submitSubmit 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. Same request shape as execute_code minus `session_id` (a run is a standalone process, not a session workspace). `timeout` bounds the WORK itself, not how long you wait to collect it. This call's own reply carries no output — a small run_id handle — so the `anthropic/maxResultSizeChars` hint lives on `run_inspect` instead, which returns the full envelope, s…
runtimes_statusCheck every language runtime for available updates (NON-MUTATING). Reports current vs latest version per language, which package manager owns it (mise/rustup/swiftly/apt/npm/uv), and the exact command that would run. Each entry also carries `tier` (registry.RELIABILITY_TIERS) — see list_languages for what `tested`/`best_effort`/`plan_only` mean. A current, up-to-date toolchain can still be `best_effort`: `tier` is orthogonal to whether the update check below found a newer version. NETWORK: yes. Non-mutating refers to this machine's runtimes, not to traffic — each package manager is asked wh…
session_artifactsList files created by executed code in a session (excluding runner internals like main.py/run.out).
session_delete_fileDelete 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 short of session_stop discarding the whole workspace. Refuses runner-internal paths (the same ones session_artifacts excludes) and directories.
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. Text files return content. With as_image=True (or for image files), the file is returned as an inline image the model can see. Use session_files to discover paths; session_artifacts lists what executed code produced.
session_runRun 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/...). Runs as a fresh process in the session workdir (not the REPL worker), so relative imports and data files resolve. Returns stdout/stderr/verdict plus the entry file's path. Oversized output spills into the session workspace the same way execute_code's does — see its docstring for `stdout_spill`/`stderr_spill`. Reports `artifacts_created` and inlines small …
session_snapshotArchive or restore a session's workspace files. `action`: - "save": tar.gz the session's current files (same rules as session_artifacts: .codecalc-run/ excluded, symlinks/hardlinks refused) into a snapshot stored OUTSIDE the workspace, so sandboxed code can never read or tamper with it. Returns snapshot_id. - "restore": extract snapshot_id's files into a brand-new session (default) or, with replace=True, wipe and recreate session_id's OWN workspace first. Only files are restored — a python3/node session's REPL variables/imports are never part of a snapshot. - "list": snapshots sav…
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 a file into a session workspace (relative path, no escapes). Use this to seed input data for executed code.
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). op="solve" (was solve_expression) — the roots of one equation: 'x**2 - 4 = 0', '2*x + 1 = 7'. For a system of several equations, use op="solve_linear". For general constraint satisfiability (inequalities, boolean constraints, multiple solvers), use z3_check. Returns `solutions` as a list of strings alongside the parsed `equation` and…
trace_executionDebug WHY, line by line, for the ONE input you actually ran it on: which statements fired, in what order, with what variable values at each step, and which if/elif/while/for/try branch was taken versus never taken. Want just the printed output instead? Use execute_code. Returns `events`: ordered `{step, line, event, func, locals}`, one entry per traced line/call/return/exception in YOUR code only (library internals excluded). `locals` on each entry is only the names that changed since the previous step in that same call — not a full dump every line. A `return` entry also carries `return_value…
truth_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. Returns `variables` (sorted names) and `rows` (one dict per assignment, each variable name -> bool plus `result`), plus `row_count`, `satisfiable` (any row true), and `tautology` (every row true).
update_runtimesUpdate 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). apply=True asks the caller to confirm first (a protocol-level gate, not just the `anthropic/requiresUserInteraction` `_meta` hint — see codecalc/confirmation.py); apply=False is never gated, since nothing runs. PRIVILEGE: the apt manager updates system packages and its command begins with `s…
verify_optimizationPROVE an optimisation: same outputs, measurably AND SIGNIFICANTLY faster. Two gates, in order. Correctness: runs `candidate` against `original` on shared inputs — a faster-but-wrong candidate fails here and is never timed. Speed: times both at increasing sizes; accepts only when the median ratio clears `min_speedup` AND a one-sided Mann-Whitney U test rejects "not faster" at every counted size (2-3), or a Bonferroni-corrected majority above that — one size never accepts alone. See `inference` for the per-size U statistic, p-value, effect size. A rejection names which gate failed and by how m…
verify_translationPROVE that a port is equivalent: run both programs, compare their output. You write the translation — you are the language model. This runs your source and your port on the same inputs and reports, per input, whether they matched, diverged, or could not be compared (a runtime that is missing or a program that failed on both sides is INCONCLUSIVE, never a pass). Use it after porting anything: python3 -> go, node -> rust, a rewritten function against the original. Pair with compare_edge_cases to find the inputs worth testing. Matching tolerates only line-ending/trailing-whitespace noise; stdo…
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)'. `unsat` is graded `solver_proven` — see `grade_basis` for the engine version and timeout bound it was decided within. `sat` is graded `ungraded`: it's a real decided answer, just not a proof — reserving `solver_proven` for `unsat` means a counterexample can never wear a proof grade. `unknown` carries no proof either way and is also graded `ungraded`.
Signals
- Stars
- 5
- Forks
- 1
- Open issues
- 10
- Weekly downloads
- 160
- Last commit
- Oct 24, 2026 (4 days ago)
- Last release
- Sep 21, 2026 (1 month ago)
- Last package publish
- Sep 21, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026) and the package registry.
Details
- Registry name
io.github.The-40-Thieves/codecalc- Version
- 0.13.0
- Auth
- No auth
- Packages
- pypi codecalc
- License
- Apache-2.0
- Repository
- github.com/The-40-Thieves/codecalc
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
More from The-40-Thieves
- 0.651score
Obsidian Turbocharged
The-40-Thieves
Governed Obsidian vault access: hybrid retrieval, Markdown-native memory, HITL confirmations.
ConnectorAFreshness: ALocal★ 13Claude Code +5 - 0.625score
Alexandria
The-40-Thieves
Search, read, and cite across 152 libraries: 11 tools, 3 prompts, and a full-text resource.
ConnectorAFreshness: ALocal★ 3Claude Code +5
Cite this page
codecalc MCP server. Agent Mart. https://agentmart.dev/connectors/the-40-thieves-codecalc (last updated 2026-10-24)