Maxima MCP server
  • Common Lisp 100%
Find a file
2026-04-24 11:10:10 +03:00
docs Update specs.md 2026-04-24 11:10:10 +03:00
.gitattributes Initial commit 2026-03-14 22:52:27 +01:00
.gitignore Update .gitignore 2026-04-10 11:21:35 +03:00
LICENSE Initial commit 2026-03-14 22:52:27 +01:00
mcp_server.lisp Add SSE support and graceful shutdown 2026-04-23 23:41:01 +03:00
mcp_wrapper.lisp fixes 2026-03-23 01:10:00 +02:00
README.md documentation update 2026-04-10 11:26:07 +03:00
testmcp.wxmx LM Studio compatibility 2026-03-21 13:25:24 +02:00

Experimental Maxima MCP Server

A lightweight, dependency-free HTTP server for Maxima symbolic computation. Exposes Maxima via JSON-over-HTTP endpoints for tool-calling integration (MCP protocol). Runs on vanilla SBCL/Maxima with SB-BSD-SOCKETS only—no Quicklisp, usockets, or external libs. Features

  • Pure SBCL: No dependencies (Uses native sb-bsd-sockets and sb-thread).

  • JSON API: Manual serialization/parsing for basic payloads.

  • Threaded: One thread per client, clean shutdown via server-running.

  • Maxima evaluation: Safe evaluation with auto-semicolon and error capture.

  • DoS protection: 100KB body limit

  • Debug mode: Verbose logging with debug = t.

  • Endpoints: /ping, /health, /tool-call, /mcp.

Starting w/o wrapper

load("mcp_server.lisp");

:lisp (maxima-mcp:start-server 8000)

Starting with wrapper

load("mcp_server.lisp");
load("mcp_wrapper.lisp");
mcp_start_server (8000);

Turning on/off debug output

mcp_debug_on();

mcp_debug_off();

Server status

mcp_status();

Examples Start a command shell. Next example is in PowerShell:

curl.exe -X POST http://127.0.0.1:8000/tool-call -H "Content-Type: application/json" -d '{ expression: erf(-0.5); }'
{"jsonrpc":"2.0","id":null,"result":{"content":[{"type":"text","text":"-0.5204998778130465"}]}}


curl.exe -X POST http://127.0.0.1:8000/tool-call -H "Content-Type: application/json" -d '{ "expression": "solve(x^2-2,x);" }' --max-time 5
{"jsonrpc":"2.0","id":null,"result":{"content":[{"type":"text","text":"[x = -sqrt(2),x = sqrt(2)]"}]}}

curl.exe -X POST http://127.0.0.1:8000/tool-call -H "Content-Type: application/json" -d '{\"expression\":\"integrate(erf(-x^2/2),x);\"}' --max-time 5
{"jsonrpc":"2.0","id":null,"result":{"content":[{"type":"text","text":"-(x*erf(x^2/2))-(sqrt(2)*gamma_incomplete(3/4,x^4/4)*x)
                             /(sqrt(%pi)*abs(x))"}]}}

curl.exe -X POST http://127.0.0.1:8000/mcp -H "Content-Type: application/json" -d '{"method":"load","package":"clifford.mac"}' --max-time 5
{"success":true,"result":"Package clifford.mac loaded."}

Getting the body of a custom function

curl.exe -X POST http://127.0.0.1:8000/functsource -H "Content-Type: application/json"  -d '{"name":"testf"}'
{"jsonrpc":"2.0","id":null,"result":{"content":[{"type":"text","text":"testf(x):=true"}]}}

Loading a custom package:

curl.exe -X POST http://127.0.0.1:8000/tool-call -H "Content-Type: application/json" -d '{ "expression": clifford(e,3); }' --max-time 5
{"jsonrpc":"2.0","id":null,"result":{"content":[{"type":"text","text":"[1,1,1]"}]}}


curl.exe -X POST http://127.0.0.1:8000/tool-call -H "Content-Type: application/json" -d '{ expression: e[2].e[1]; }'
{"jsonrpc":"2.0","id":null,"result":{"content":[{"type":"text","text":"-(e[1] . e[2])"}]}}

Stopping

:lisp (maxima-mcp:stop-server)

or

mcp_stop_server();

Example uses

  • Local LLM tool-calling (Ollama/LM Studio → Maxima)
  • Research workflows (Python → symbolic math API)