Skip to main content
Glama

Mathematica MCP

A front-end / notebook automation layer for Mathematica, built for AI agents.

Your AI agent can write Mathematica code. This server lets it run that code in your live Mathematica session: create and edit notebooks, build interactive Manipulate panels, capture screenshots, verify derivations step by step, and read .nb files even without a kernel. Works with Claude, Cursor, VS Code, Codex, and Gemini.

It runs beside the official Wolfram Local MCP, not instead of it: Wolfram's server is the reference evaluator and documentation surface; this one owns the live notebook. See How it compares.

License: MIT Python 3.10+ Mathematica 14+ CI Repo Published

Upgrading from an earlier version? See the Migration Guide.

Watch it in action

Mathematica MCP Demo

An AI agent solving math, generating plots, and controlling a live Mathematica notebook. Errors are returned directly to the agent, no copy-pasting notebook output back into chat.


Why this exists

LLMs can write Wolfram Language, but they cannot run it, see the result, or fix their own mistakes. This server closes that loop:

  • Live notebook control: the agent creates, edits, evaluates, and screenshots real notebooks in your running Mathematica front end. Interactive content (Manipulate, Dynamic, sliders) renders as live panels.

  • Fast by default: computation runs on a persistent kernel session that starts warming the moment the server launches; calls return in milliseconds, not the ~13 seconds of a cold wolframscript start per request.

  • Self-debugging agents: Mathematica errors flow back with a suggested_fix and, when derivable, a ready-to-run retry_with call. No copying red text from the notebook into chat.

  • Derivation checking: verify_derivation validates a chain of mathematical steps and pinpoints the first invalid one.

  • Reads notebooks without a license: read_notebook_file parses .nb files in pure Python when no kernel is available (a kernel is used for higher fidelity when present).

  • Local and private: core execution stays on your machine. Cloud services are contacted only by opt-in tools like wolfram_alpha.


Related MCP server: Wolfram Language MCP

What you can ask for

"Integrate x^2 sin(x) from 0 to pi, then verify the result."

evaluate("Integrate[x^2 Sin[x], {x, 0, Pi}]")   =>  -4 + Pi^2
verify_derivation(steps=["Integrate[x^2 Sin[x], {x, 0, Pi}]", "-4 + Pi^2"])
=> Step 1 → 2: ✓ VALID
   All steps are valid!

"Plot the sombrero function in a new notebook."

notebooks(action="create", title="Sombrero")
evaluate("Plot3D[Sinc[Sqrt[x^2+y^2]], {x,-4,4}, {y,-4,4}]", target="notebook")
=> [3D surface plot rendered in the live notebook]

"Give me a Chebyshev polynomial explorer with a degree slider."

evaluate("Manipulate[Plot[ChebyshevT[n, x], {x, -1, 1}], {n, 0, 30, 1}]", target="notebook")
=> [live slider panel in the notebook; interactive code is auto-routed to the front end]

Quick start

Prerequisites: Mathematica 14.0+ (15+ recommended) with wolframscript on your PATH, and the uv package manager.

# One command, pick your client:
uvx mathematica-mcp-full setup claude-desktop   # or: cursor | vscode | codex | gemini | claude-code

Restart Mathematica (so the addon loads) and restart your editor. Then verify:

uvx mathematica-mcp-full doctor

Done - ask your agent for a plot.

The PyPI package and CLI are named mathematica-mcp-full.

Manual installation, per-client configuration details, and troubleshooting live in the Installation Guide.


The lean default

Agents see a consolidated 12-tool surface (~2.9k tokens of schema) instead of the classic 82 tools (~15k tokens) - a 5x cut in the context an agent pays before doing any work, with the same engine underneath. Prefer everything? MATHEMATICA_PROFILE=classic restores the full pre-1.0 surface, and MATHEMATICA_TOOLSETS adds opt-in extras to lean.


How it compares

Runs alongside the official Wolfram Local MCP (setup <client> --with-official configures both side by side). The differentiator is live notebook / front-end automation:

Capability

Official Wolfram Local MCP

This MCP

Wolfram-Language evaluation

WolframLanguageEvaluator

evaluate (warm persistent kernel)

Wolfram Alpha

WolframAlpha

wolfram_alpha (opt-in cloud)

Symbol docs / definitions

SymbolDefinition, CreateSymbolDoc

symbols extra (get_symbol_info)

Read a notebook file

ReadNotebook (needs kernel)

read_notebook_file - works with no kernel / license (Python fallback)

Write a notebook file

WriteNotebook

notebooks, edit_cells (live front-end)

Live notebook control (create/edit/eval/screenshot)

No

Yes

Interactive UIs (sliders, Manipulate)

No

Yes, in the live front-end

Derivation verification

No

verify_derivation

Doc search / code inspection / test reports

CodeInspector, TestReport

Deliberately not duplicated - use the official server


Who this is for

Audience

Use case

Researchers using LLM coding assistants

Run Mathematica from Claude/Cursor/VS Code without leaving your editor

Data scientists

Import, transform, and visualize data through natural language

Educators

Create interactive Mathematica notebooks through AI conversation

Not for

Production web services, untrusted multi-tenant environments


Documentation


License

MIT License

Available Tools

82 tools
batch_commandsC

Execute multiple commands in one round-trip.

Inputs: commands (required). Returns: result

cache_expressionC

Evaluate and cache a Wolfram expression for later reuse.

Inputs: name (required), expression (required). Returns: result

check_syntaxA

Validate Wolfram Language code syntax without executing it.

Inputs: code (required). Returns: result

clear_computation_journalC

Clear the computation journal.

Inputs: no named parameters. Returns: result

clear_expression_cacheB

Clear all cached expressions.

Inputs: no named parameters. Returns: result

clear_variablesA

Clear variables from the Mathematica kernel session.

Equivalent to Python's 'del' or clearing notebook state.

Args: names: Specific variable names to clear (e.g., ["x", "y", "z"]) pattern: Wolfram pattern to match (e.g., "temp*" clears temp1, temp2, etc.) clear_all: If True, clear ALL Global` variables (use with caution!)

Returns: List of cleared variables

Example: clear_variables(names=["x", "y"]) -> {cleared: ["x", "y"], count: 2} clear_variables(pattern="temp*") -> {cleared: ["temp1", "temp2"], count: 2}

Inputs: names, pattern, clear_all. Returns: result

close_notebookC

Close a notebook.

Inputs: notebook, session_id. Returns: result

compare_plotsC

Generate a side-by-side comparison of multiple plots.

Inputs: expressions (required), labels. Returns: result

convert_notebookA

[LEGACY] Convert a notebook into markdown, LaTeX, plain text, or Wolfram code.

Prefer read_notebook() unless you specifically need this older or narrower workflow.

Inputs: path (required), output_format. Returns: result

convert_unitsA

Convert between units using Wolfram's comprehensive unit system.

Args: quantity: Value with unit (e.g., "5 miles", "100 kg", "25 Celsius") target_unit: Target unit (e.g., "kilometers", "pounds", "Fahrenheit")

Returns: Converted quantity

Example: convert_units("100 kilometers", "miles") -> "62.1371 miles" convert_units("0 Celsius", "Fahrenheit") -> "32 Fahrenheit"

Inputs: quantity (required), target_unit (required). Returns: result

create_animationC

Create an animation by varying a parameter.

Inputs: parameter (required), expression (required), range_spec (required), frames. Returns: result

create_notebookA

[ADVANCED] Create a new empty notebook.

Use when the user explicitly asks for a NEW notebook. This sets the active notebook so subsequent execute_code(style="notebook") calls write into it. Without this, execute_code reuses the currently open notebook.

For code execution in whatever notebook is already open, use execute_code(style="notebook") directly instead.

Inputs: title, session_id. Returns: result

delete_cellC

Delete a cell from a notebook.

Inputs: cell_id (required), notebook, session_id. Returns: result

entity_lookupA

Look up real-world entity data from Wolfram's curated knowledge base.

Entity types include: "Country", "City", "Chemical", "Planet", "Company", "Person", "Movie", "University", "Element", "Star", and many more.

Args: entity_type: Type of entity (e.g., "Country", "City", "Chemical") name: Name to look up (e.g., "France", "Tokyo", "Water") properties: Specific properties to retrieve (default: common properties)

Returns: Entity data with requested properties

Example: entity_lookup("Country", "Japan", ["Population", "Capital", "GDP"]) -> {name: "Japan", Population: "125.8 million", Capital: "Tokyo", GDP: "$4.94 trillion"}

Inputs: name (required), entity_type (required), properties. Returns: result

evaluate_cellA

[ADVANCED] Re-evaluate an existing cell in a notebook.

Prefer execute_code(style="notebook") for fresh execution. Use evaluate_cell only when you already have a notebook cell and need to re-run that specific cell.

Inputs: cell_id (required), sync, max_wait, notebook, +2 more. Returns: result

evaluate_selectionA

[ADVANCED] Evaluate the currently selected notebook cell or cells.

Prefer execute_code(style="notebook") for fresh execution. Use evaluate_selection only for explicit notebook-selection workflows.

Inputs: sync, max_wait, notebook, sync_wait, +1 more. Returns: result

execute_codeA

[PRIMARY] Execute Wolfram Language code. Prefer this for nearly all computation and plotting.

Choose a style:

  • style="compute" — fast kernel evaluation, result in chat

  • style="notebook" — evaluate in kernel, show in notebook cell

  • style="interactive" — front-end evaluation (required for Manipulate/Dynamic)

style is a high-level preset for output_target + mode. Individual params still work and override style. When style and output_target are both omitted, output_target defaults to the profile's default (notebook) and mode defaults to kernel.

response_detail accepts the canonical levels compact, standard, verbose, and diagnostic, plus the aliases short, medium, and long.

Prefer this over write_cell + evaluate_cell for running code. With output_target="notebook", it reuses the active notebook (or creates one if none exists), writes the code, and evaluates it in one call. If notebook transport fails, the request returns a notebook-targeted error instead of silently rerunning through CLI fallback. NOTE: if the user asks for a NEW notebook, call create_notebook first.

Inputs: code (required), mode, sync, style, +10 more. Returns: result

export_dataD

Export data or graphics to a file.

Inputs: path (required), expression (required), format. Returns: result

export_graphicsC

Export a graphics expression to an image file.

Inputs: path (required), expression (required), size, format. Returns: result

export_notebookC

Export a notebook to PDF, HTML, TeX, or Markdown.

Inputs: path (required), format, notebook, session_id. Returns: result

get_cachedC

Retrieve a previously cached expression result.

Inputs: name (required). Returns: result

get_cell_contentC

Get the full content of a specific cell.

Inputs: cell_id (required), notebook, session_id. Returns: result

get_cellsC

Get list of cells in a notebook.

Inputs: limit, style, offset, notebook, +2 more. Returns: result

get_computation_journalA

Get recent computation history: code previews, outputs, timing, success status.

Inputs: no named parameters. Returns: result

get_computation_resultC

Retrieve the result of a completed computation.

Inputs: job_id (required). Returns: result

get_constantA

Get a physical or mathematical constant.

Args: name: Constant name (e.g., "SpeedOfLight", "PlanckConstant", "Pi", "EulerGamma", "GoldenRatio", "Avogadro")

Returns: Constant value with unit (if applicable) and numeric approximation

Example: get_constant("SpeedOfLight") -> {value: "299792458 m/s", numeric: "2.998e8"}

Inputs: name (required). Returns: result

get_dataset_infoC

Get detailed information about a Wolfram Data Repository dataset.

Inputs: dataset_name (required). Returns: result

get_expression_infoA

Get detailed structural information about a Wolfram expression.

Like Python's type() on steroids - shows Head, FullForm, tree structure, depth, leaf count, and type checks (NumericQ, ListQ, etc.)

Args: expression: Wolfram Language expression to analyze

Returns: Structural information: head, full form, depth, leaf count, type flags

Example: get_expression_info("{{1,2},{3,4}}") -> {head: "List", depth: 3, dimensions: [2,2]} get_expression_info("Sin[x] + Cos[x]") -> {head: "Plus", leaf_count: 3}

Inputs: expression (required). Returns: result

get_feature_statusA

Get the status of all feature flags.

Inputs: no named parameters. Returns: result

get_function_repository_infoB

Get details about a Wolfram Function Repository function.

Inputs: function_name (required). Returns: result

get_kernel_stateA

Get current Wolfram kernel session state (memory, uptime, version).

Inputs: no named parameters. Returns: result

get_mathematica_statusB

Get connection status and system info.

Inputs: no named parameters. Returns: result

get_messagesA

Get recent Mathematica messages/warnings from the session.

Like Python's exception traceback - helps debug what went wrong. Includes recently captured evaluation and dispatch-level messages.

Args: count: Number of recent messages to retrieve (default 10)

Returns: List of recent messages with timestamps

Example: After a failed computation: get_messages() -> [{timestamp: "...", message: "Power::infy: Infinite expression 1/0 encountered."}]

Inputs: count. Returns: result

get_notebook_cellA

[LEGACY] Read a single notebook cell by index.

Prefer read_notebook() unless you specifically need this older or narrower workflow.

Inputs: path (required), cell_index (required), full. Returns: result

get_notebook_infoC

Get details about a notebook (filename, directory, cell count).

Inputs: notebook, session_id. Returns: result

get_notebook_outlineA

[LEGACY] Get the notebook's section outline.

Prefer read_notebook() unless you specifically need this older or narrower workflow.

Inputs: path (required). Returns: result

get_notebooksA

List all open Mathematica notebooks. Returns ID, filename, title.

Inputs: no named parameters. Returns: result

get_session_briefA

Compact session state summary: connection, profile, recent errors, routing advice.

Inputs: no named parameters. Returns: result

get_symbol_infoB

Get comprehensive information about a Wolfram Language symbol.

Inputs: symbol (required). Returns: result

get_variableC

Get detailed information about a specific variable.

Inputs: name (required). Returns: result

import_dataB

Import data from a file or URL into Mathematica.

Inputs: path (required), format. Returns: result

inspect_graphicsC

Analyze the structure of a graphics object.

Inputs: expression (required). Returns: result

interpret_natural_languageA

Convert natural language mathematical description to Wolfram Language code.

This is magic - describe what you want in English and get executable code.

Args: text: Natural language description (e.g., "the integral of x squared from 0 to 1", "solve x squared equals 4 for x", "plot sine of x from 0 to 2 pi")

Returns: Wolfram Language code and its evaluation result

Example: interpret_natural_language("the derivative of e to the x") -> {code: "D[E^x, x]", result: "E^x"}

Inputs: text (required). Returns: result

list_cacheA

List all cached expressions with their metadata.

Inputs: no named parameters. Returns: result

list_loaded_packagesA

List all currently loaded packages and contexts.

Inputs: no named parameters. Returns: result

list_supported_formatsA

List all supported import/export formats.

Inputs: no named parameters. Returns: result

list_variablesC

List all user-defined variables in the current Mathematica kernel session.

Inputs: include_system. Returns: result

load_datasetC

Load a dataset from the Wolfram Data Repository.

Inputs: dataset_name (required), sample_size. Returns: result

load_packageC

Load a Mathematica package (e.g., "Developer`").

Inputs: package_name (required). Returns: result

load_resource_functionB

Load a function from the Wolfram Function Repository.

Inputs: function_name (required). Returns: result

mathematica_differentiateC

Compute derivative using D.

Inputs: variable (required), expression (required), order. Returns: result

mathematica_expandC

Expand a mathematical expression.

Inputs: expression (required). Returns: result

mathematica_factorC

Factor a mathematical expression.

Inputs: expression (required). Returns: result

mathematica_integrateC

Compute integral using Integrate.

Inputs: variable (required), expression (required), lower_bound, upper_bound. Returns: result

mathematica_limitC

Compute limit using Limit.

Inputs: point (required), variable (required), expression (required), direction. Returns: result

mathematica_seriesC

Compute Taylor/power series expansion.

Inputs: variable (required), expression (required), order, point. Returns: result

mathematica_simplifyC

Simplify a mathematical expression.

Inputs: expression (required), full, assumptions. Returns: result

mathematica_solveC

Solve an equation using Solve.

Inputs: equation (required), variable (required), domain. Returns: result

open_notebook_fileA

Open an existing Mathematica notebook file (.nb) in the Mathematica frontend.

Supports:

  • Absolute paths: /Users/foo/notebook.nb

  • Home-relative paths: ~/Documents/notebook.nb

  • Relative paths (resolved from current directory)

Args: path: Path to the .nb file

Returns: Notebook ID and metadata for use with other notebook commands

Example: open_notebook_file("~/Documents/analysis.nb") -> {id: "NotebookObject[...]", cell_count: 15}

Inputs: path (required), session_id. Returns: result

parse_notebook_pythonB

[LEGACY] Parse a notebook with the Python-native parser.

Prefer read_notebook() unless you specifically need this older or narrower workflow.

Inputs: path (required), output_format, truncation_threshold. Returns: result

poll_computationB

Check the status of a submitted computation.

Inputs: job_id (required). Returns: result

rasterize_expressionA

Render a Wolfram Language expression as an image.

Useful for visualizing plots, matrices, or formatted output without modifying any notebook.

Args: expression: Wolfram Language expression to render image_size: Size of the resulting image in pixels

Examples: rasterize_expression("Plot[Sin[x], {x, 0, 2 Pi}]") rasterize_expression("MatrixForm[{{1, 2}, {3, 4}}]") rasterize_expression("Graphics[Circle[]]", image_size=200)

Inputs: expression (required), image_size.

read_notebookA

[PRIMARY] Read a Mathematica notebook with backend-aware dispatch.

Prefer this over read_notebook_content, convert_notebook, get_notebook_outline, parse_notebook_python, and get_notebook_cell unless you need a specific legacy backend or narrow low-level operation.

Inputs: path (required), view, backend, cell_types, +4 more. Returns: result

read_notebook_contentA

[LEGACY] Read notebook content as structured text.

Prefer read_notebook() unless you specifically need this older or narrower workflow.

Inputs: path (required), include_outputs. Returns: result

resolve_functionC

Search for Wolfram Language functions and optionally auto-execute.

Inputs: query (required), expression, auto_execute, output_target, +1 more. Returns: result

restart_kernelA

Restart the Mathematica kernel, clearing all state.

This is the nuclear option - clears all variables, definitions, and state. Use when the kernel is in a bad state or you need a fresh start.

Returns: Confirmation of kernel restart

Inputs: no named parameters. Returns: result

run_scriptA

Execute a Wolfram Language script file (.wl, .m) and return the result.

This is equivalent to Get[path] - loads and executes the script in the current kernel session. Any definitions or side effects persist.

Args: path: Path to the .wl or .m script file

Returns: The result of the last expression in the script, plus timing info

Example: run_script("~/scripts/setup.wl") -> {result: "Null", timing_ms: 150}

Inputs: path (required). Returns: result

save_notebookC

Save a notebook to disk.

Inputs: path, format, notebook, session_id. Returns: result

screenshot_cellC

Capture a screenshot of a specific cell's content and output.

Useful for seeing plots, graphics, or formatted mathematical output.

Args: cell_id: The cell object ID to screenshot

Inputs: cell_id (required), notebook, session_id, use_rasterize.

screenshot_notebookC

Capture a screenshot of an entire notebook window.

Args: notebook: Notebook ID. If None, uses selected notebook. max_height: Maximum height in pixels (prevents huge images)

Returns the screenshot as an image that can be viewed directly.

Inputs: wait_ms, notebook, max_height, session_id, +1 more.

scroll_to_cellC

Scroll the notebook view to make a cell visible.

Inputs: cell_id (required), notebook, session_id. Returns: result

search_data_repositoryC

Search the Wolfram Data Repository.

Inputs: query (required), max_results. Returns: result

search_function_repositoryC

Search the Wolfram Function Repository.

Inputs: query (required), max_results. Returns: result

select_cellB

Select a cell in the notebook (moves cursor to it).

Inputs: cell_id (required), notebook, session_id. Returns: result

set_variableA

Set a variable in the Mathematica kernel session.

Args: name: Variable name (e.g., "x", "myData") value: Wolfram Language expression to assign (e.g., "5", "{1,2,3}", "Plot[Sin[x],{x,0,Pi}]")

Returns: Confirmation with the assigned value

Example: set_variable("x", "Range[10]") -> {success: true, value: "{1,2,3,4,5,6,7,8,9,10}"}

Inputs: name (required), value (required). Returns: result

submit_computationC

Submit a long-running computation for background execution.

Inputs: code (required), name, timeout. Returns: result

suggest_similar_functionsA

Find Wolfram functions similar to a query using fuzzy matching.

Inputs: query (required). Returns: result

time_expressionB

Time the evaluation of an expression with memory tracking.

Inputs: expression (required). Returns: result

trace_evaluationC

Trace the step-by-step evaluation of an expression.

Inputs: expression (required), max_depth. Returns: result

verify_derivationC

Verify a sequence of mathematical expressions steps.

Inputs: steps (required), format, timeout. Returns: result

wolfram_alphaA

Query Wolfram Alpha with natural language.

This gives Mathematica superpowers - ask questions in plain English and get computed answers, data, and more.

Args: query: Natural language question (e.g., "population of France", "integrate x^2 from 0 to 1", "weather in Tokyo") return_type: - "result": Simple text result (default) - "data": Structured data when available - "full": All available pods/information

Returns: Wolfram Alpha response in requested format

Example: wolfram_alpha("population of Tokyo") -> "13.96 million people (2021)" wolfram_alpha("derivative of sin(x^2)", "data") -> {result: "2 x cos(x^2)"}

Inputs: query (required), return_type. Returns: result

write_cellA

[ADVANCED] Write a cell without evaluating it.

Prefer execute_code(style="notebook") for code execution. Use write_cell only for deliberate manual notebook authoring, such as text, section headers, or carefully controlled cell-by-cell construction.

Inputs: content (required), sync, style, notebook, +3 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 82 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes guided by detailed descriptions and usage notes (e.g., PRIMARY vs LEGACY vs ADVANCED). Some overlap exists between execute_code, evaluate_cell, and write_cell, but the descriptions clarify when to use each.

    Naming Consistency3/5

    Naming is moderately consistent with a mix of snake_case (e.g., batch_commands) and camelCase (e.g., interpret_natural_language). Some tools use verb_noun pattern, others do not, leading to a readable but not fully uniform style.

    Tool Count3/5

    With 82 tools, the server is heavy but the Mathematica domain is broad, covering computation, notebooks, symbolic math, and external knowledge. The count is borderline; some tools are legacy or narrow, but they serve specific needs.

    Completeness4/5

    The tool surface covers core CRUD workflows (notebooks, variables, packages, caching) and extensive mathematical operations, unit conversion, entity lookup, and repository search. Minor gaps exist (e.g., no explicit matrix operations) but are covered by generic code execution.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to execute Jupyter notebook cells with persistent kernel state, output persistence, and structured JSON control surface.
      2
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables an AI agent to run Wolfram Language in a persistent Mathematica kernel, interrupt running computations while preserving state, and replay notebooks in a headless environment.
      14
      Do What The F*ck You Want To Public