Get the FREE Ultimate OpenClaw Setup Guide →

mcp -mathematica

MCP server from texra-ai/mcp-server-mathematica

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio texra-ai-mcp-server-mathematica node build/index.js

How to use

The Mathematica MCP Server enables MCP clients to offload Mathematica computations to a local Mathematica installation by invoking wolframscript through a Node.js-based MCP server. It exposes two tools: execute_mathematica, which runs arbitrary Mathematica code and returns the result in a selectable format (text, latex, or mathematica), and verify_derivation, which checks a sequence of mathematical steps for logical consistency using Simplify[prev == current]. Clients such as Cursor or Cline can send tool requests with the appropriate input payloads to perform calculations, render results as LaTeX or Mathematica syntax, and validate derivations for correctness. The server is intended to be run locally so that your installed Mathematica environment is used for all computations.

To use the tools, start the server (node build/index.js after building) and configure your MCP client to point at the running server. You can call execute_mathematica with a code string, specify the desired output format, and receive the computed result. For verification tasks, provide an array of step strings to verify each transition, and choose an output format for the report. The server acts as a bridge between MCP clients and Wolfram Mathematica via wolframscript.

How to install

Prerequisites:

  • Mathematica installed on the system with wolframscript available in PATH
  • Node.js (recommended v16 or later)

Installation steps:

  1. Clone the repository and navigate to it:
git clone <repository-url>
cd <repository-directory>
  1. Install dependencies:
npm install
  1. Build the server (transpile TypeScript to JavaScript):
npm run build
  1. Run the server:
node build/index.js

If you prefer a production deployment, you can use a process manager like pm2 to keep the server running in the background:

pm2 start build/index.js --name mathematica-mcp

Additional notes

Notes and tips:

  • Ensure wolframscript is accessible in your system PATH by running wolframscript -help in a terminal.
  • The server communicates over stdio; keep the terminal open (or the process manager running) while using MCP clients.
  • If you modify the code, re-run npm run build to update build/index.js before restarting the server.
  • In client configurations (e.g., Cursor or Cline), specify the command as node and the path to build/index.js to connect to this MCP server. Environment variables can be added if your deployment requires custom Mathematica options or wolframscript behavior.
  • For robust deployments, monitor logs for errors from wolframscript and ensure licensing for Mathematica is valid on the host machine.

Related MCP Servers

Sponsor this space

Reach thousands of developers