An MCP server for interfacing with the Maxima Computer Algebra System (CAS) using the D language.
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.
- 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
- 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)
dub build./bin/maxima-mcpOnce 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
- Parameters:
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
- 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
source/app.d: Main application and MCP tool registrationsource/maxima/client.d: Maxima batch mode client implementationmemory-bank/: Project documentation
MIT