Group Abstract Group Abstract

Message Boards Message Boards

Mathematica MCP: give your AI agent full control of your Wolfram kernel and notebooks

7 Replies

Yes, partially. Wolfram Engine should work for the kernel-only parts: running Wolfram Language code, symbolic/numeric computation, Solve, Integrate, Simplify, Import, Export, etc. I’d run it with MATHEMATICA_PROFILE=math so the notebook/frontend tools are hidden. The part that won’t work with Wolfram Engine alone is live notebook control like creating notebooks, screenshots, selected-cell evaluation, and interactive UI, which need the desktop Mathematica front end.

Ollama, only runs the local model, it doesn’t know how to call MCP tools by itself. You need an app in the middle that supports both Ollama and MCP, for example the Continue extension in VS Code/JetBrains, or any MCP host that can use Ollama/OpenAI-compatible local models.

One thing to note: MCP tool-calling needs a model that is reliably good at structured tool calls. Smaller local models, especially 7B/8B-class models, may produce malformed calls or skip tools entirely. So, use them with caution.

Can it be run with a local AI model on Ollama and Wolfram Engine?

POSTED BY: Antonius Paijens

Thanks! Good question. The official Wolfram MCPServer feels to me like having a broader and more mature implementation. It is an official paclet from Wolfram, it includes built-in Wolfram tools and server configurations, and it also gives you a framework for defining your own MCP tools and connect them into clients (like Claude Code). My project is basically aimed at a somewhat different workflow and is still improving. It leans more into letting an external AI agent work with a live local Mathematica session directly, creating and evaluating cells in a real notebook window, reading outputs, taking screenshots, and using structured error/message feedback to support retry and debugging loops.

The analogy is kind of like the difference between a web browsing API that you can wire up in all sorts of ways (which is what the paclet offers), versus a browser automation tool that actually opens the browser window and interacts with the page the way a user would.

The tradeoff is that it is a community project rather than an official one. It has more moving parts because it uses a Python MCP server plus the Mathematica addon, and it is still less polished overall than the official paclet, especially around reliability and some frontend edge cases.

Very cool project!

Without minimizing your work—could you compare/contrast to the official Wolfram MCP implementation? https://resources.wolframcloud.com/PacletRepository/resources/Wolfram/MCPServer/

What are the pros and cons of your implementation?

POSTED BY: Joshua Schrier

Thanks!! And yeah, that demo video is from the very first version, things have come a long way since then. On the error detection question, yes, it already does this now.

Every execution returns structured error data back to the AI agent: which errors fired (like Part::partw, Power::infy), whether they're errors vs warnings, and suggested fixes. There's also a "check syntax" tool that catches broken brackets and such before running anything, and a "get messages" tool that lets the AI agent review the full error history of the session. So the loop you're describing- spot the error, figure out what went wrong, fix it, re-run, that's exactly how it works today. No special tuning needed, the AI agent just naturally persists because it gets clear feedback on what broke.

Thanks for sharing those links btw, hadn't come across those before. Will definitely check them out.

What a great project! Thank you for sharing it. I noticed you telling the AI in the video that there were some errors in the notebook. Cannot AI be tuned to auto-check for errors in the notebook and persist with the task until all errors resolved (because it does have access to the notebook)?

BTW here are some potentially relevant Wolfram links:

POSTED BY: Vitaliy Kaurov

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard