maxima-mcp

maxima-mcp

3.2

If you are the rightful owner of maxima-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

An MCP server for interfacing with the Maxima Computer Algebra System (CAS) using the D language.

Maxima MCP Server

An MCP server for interfacing with the Maxima Computer Algebra System (CAS) using the D language.

Overview

This project implements an MCP server that provides a stateless interface to Maxima through batch mode execution. Each command runs in isolation with proper resource management and timeout handling. The server uses the D-MCP server library for MCP protocol implementation.

Features

  • Stateless batch mode execution
  • Configurable execution timeout
  • Complete output capture (stdout/stderr)
  • Automatic resource cleanup
  • Temporary file-based execution
  • Process isolation per command
  • Quiet mode operation
  • UUID-based temporary file management

Requirements

  • D compiler (DMD, LDC, or GDC)
  • DUB package manager
  • Maxima CAS installed and available in the PATH
  • D-MCP server library (located at ../d-mcp-server)

Building

dub build

Running

./bin/maxima-mcp

Usage

Once the server is running, you can use MCP clients to connect and use the provided tool:

  • run_maxima_code: Execute Maxima code in batch mode
    • Parameters:
      • code: The Maxima code to execute
    • Returns:
      • result: Complete output from Maxima execution

Batch Mode Operation

The server executes each command in isolation:

  • Creates temporary file with unique UUID
  • Launches new Maxima process in quiet mode
  • Uses --batch flag for file execution
  • Enforces configurable timeout (default: 30 seconds)
  • Captures complete stdout/stderr output
  • Ensures cleanup of temporary files and processes

Error Handling

  • Timeout enforcement with configurable duration
  • Process management with proper cleanup
  • Temporary file cleanup using scope(exit)
  • Complete output capture for error diagnosis
  • Process termination handling
  • Non-blocking output collection

Project Structure

  • source/app.d: Main application and MCP tool registration
  • source/maxima/client.d: Maxima batch mode client implementation
  • memory-bank/: Project documentation

License

MIT