gauss-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gauss-mcp run a regression of y on x and show the coefficient estimates"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gauss-mcp
Drive GAUSS from Python, and expose it to LLM clients over the Model Context Protocol.
Author: Dr Merwan Roudane
Built and tested against GAUSS 26.1.1 on Windows.
Why this exists
Aptech publishes a reference for AI assistants so they write better GAUSS, but writing is not running: an assistant that cannot execute the code never learns whether it worked or what the numbers were. This connects an assistant to a real GAUSS installation, so the results come from GAUSS rather than from the model.
Related MCP server: julia-mcp
How it drives GAUSS
Through tgauss, the terminal build that ships with an ordinary GAUSS
installation — not the GAUSS Engine, which is richer but needs a separate
licence key from Aptech.
Each call is its own tgauss process, so nothing would normally carry over.
The workspace is saved on the way out and restored on the way in, which makes a
run of calls behave like one continuous session: a matrix built in one call is
still there in the next.
Install
The distribution is gauss-lang-mcp on PyPI: plain gauss-mcp was already
taken by an unrelated package about import workflows, nothing to do with the
Aptech language. The import name stays gauss_mcp.
pip install "gauss-lang-mcp[pandas]"GAUSS is found automatically under C:\gauss* and C:\Program Files\gauss*.
Set GAUSS_HOME to choose between installations.
Library use
from gauss_mcp import Gauss
with Gauss() as g:
g.run("""
rndseed 90210;
n = 400;
x = rndn(n, 1);
y = 1.25 + 0.8*x + 0.3*rndn(n, 1);
des = ones(n,1)~x;
bhat = invpd(des'des)*des'y;
""")
print(g.get_matrix("bhat")) # [[1.2489...], [0.8043...]]Values cross as CSV rather than as printed text, so they keep full double precision instead of GAUSS's display rounding:
g.run("pi_like = 3.14159265358979;")
g.get_scalar("pi_like") # 3.14159265358979, every digitpandas both ways:
frame = g.to_dataframe(["x", "y"])
g.from_dataframe(frame)MCP server use
{
"mcpServers": {
"gauss": { "command": "gauss-lang-mcp" }
}
}Tools
Tool | Purpose |
| Where GAUSS is, its version, what the workspace holds |
| Main tool. Run GAUSS code and return what it printed |
| Every symbol with its type and dimensions |
| Type and shape of one symbol |
| Read a matrix out at full precision |
| Create a matrix from numbers given in the conversation |
| Move data between files and the workspace |
| Start again from empty |
Errors
GAUSS reports its own code, message and line, and those are passed through:
GaussError: G0025: Undefined symbol: 'no_such_thing' on line 2The line refers to your code. The workspace restore is prepended to every generated program, which shifts GAUSS's own numbering by a line; that offset is corrected before you see it.
Behaviour worth knowing
Characteristics of GAUSS and of tgauss that this package handles for you,
each confirmed against a live installation rather than assumed.
The exit code is always 0, whether the program succeeded or died. It carries nothing, so errors are read from stderr instead.
stdout is clean. The banner and job header go to stderr, so the program's own output needs no filtering.
GAUSS compiles before it runs. An undefined symbol anywhere means nothing executed and no output appears. A runtime error leaves the output produced up to that point, followed by "Program execute failed".
Symbol names ignore case.
Xandxare the same symbol, so assigning to one overwrites the other. This surprises people arriving from R or Python.The child must not inherit stdin. Under MCP, the server's stdin is the JSON-RPC stream; a
tgaussthat inherited it would read the protocol itself. Every subprocess call detaches stdin.Restoring a workspace uses
use, notloadall.saveallwrites a.gcganduse <name>;must be the first statement of the program that reads it.
Tests
python tests/test_offline.py # 10 tests, no GAUSS needed
python tests/test_live.py # 24 tests, drives a real installationLicence
MIT. Copyright (c) 2026 Merwan Roudane.
Available Tools
9 toolsclear_workspaceA
Discard every symbol, so the next run starts from an empty workspace.
Matrices and results from earlier calls are lost. Write anything worth keeping to a file first.
Inputs: no named parameters. Returns: result
describe_symbolA
Report one symbol's type and dimensions.
Inputs: name (required). Returns: result
gauss_statusA
Report where GAUSS is, its version, and what the workspace holds.
Start here when anything looks wrong. A successful result means the installation was found and can be run.
Inputs: no named parameters. Returns: result
get_matrixA
Read a numeric matrix out of the workspace as a table.
The values travel through a CSV file rather than through printed output, so they keep full double precision instead of GAUSS's display rounding.
Inputs: name (required), digits, max_rows. Returns: result
list_symbolsA
List every symbol in the workspace with its type and dimensions.
Inputs: no named parameters. Returns: result
put_matrixB
Create a matrix in the workspace from numbers given here.
values: rows separated by semicolons, numbers within a row separated by commas or spaces, e.g. "1, 2; 3, 4" for a two-by-two matrix.
Inputs: name (required), values (required). Returns: result
read_csvB
Load a CSV file into the workspace as a matrix.
skip_header: skip the first row, which is usually column names. GAUSS matrices hold numbers only, so a header row would otherwise be read as data.
Inputs: name (required), path (required), skip_header. Returns: result
run_gauss_codeA
Run GAUSS code and return what it printed. This is the main tool.
The full GAUSS language is available: matrices, procedures, loops, the library routines, and anything the installation provides.
Symbols created here survive into later calls, so build up an analysis step by step. Use print to show a value; a bare expression prints nothing.
On failure GAUSS reports its own error code and the line of your code it objected to. Note that it compiles before running: an undefined symbol anywhere means nothing ran at all.
keep_state: set false for a throwaway calculation that should leave the workspace untouched.
Inputs: code (required), keep_state. Returns: result
write_csvC
Write a matrix to a CSV file, creating the folder if it is missing.
Inputs: name (required), path (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools are clearly distinct: listing, describing, getting, putting, reading, writing, status, clearing, and executing. The main overlap is between gauss_status reporting what the workspace holds and list_symbols listing every symbol, but the descriptions are clear enough to prevent serious confusion.
The overwhelming majority of tools follow a consistent verb_noun pattern such as list_symbols, put_matrix, read_csv, and run_gauss_code. The one outlier is gauss_status, which lacks a verb and breaks the otherwise predictable pattern.
With nine tools, the server is well-scoped for a GAUSS workspace MCP. Each tool covers a distinct need—inspection, data exchange, file I/O, status, reset, and arbitrary code execution—without feeling bloated or thin.
The server covers the core GAUSS workflow well: list and describe symbols, get and put matrices, import/export CSV, check status, clear the workspace, and run arbitrary GAUSS code. There is no dedicated delete-symbol or rename tool, but run_gauss_code can handle those cases, so the gap is minor.
Maintenance
Related MCP Connectors
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Persistent cloud workspaces for AI agents: run commands, edit files, use git and a browser.
Hosted one-shot code execution: send a snippet plus optional files, get stdout, stderr, exit...
Hosted runtime for persistent agent teams, durable workflows, memory, schedules, and goals.
Related MCP Servers
- FlicenseAqualityDmaintenanceAllows LLMs to execute Wolfram Language code in a secure, session-based environment by providing an interface to interact with a Wolfram Mathematica kernel.34-
- AlicenseAqualityCmaintenanceEnables AI assistants to execute Julia code efficiently with persistent sessions, avoiding startup costs and maintaining state across calls.396MIT
- AlicenseAqualityCmaintenanceEnables AI agents to interact with the Baltamatica scientific computing kernel, executing code, managing variables, and running scripts while preserving workspace state across calls.65MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLM clients to run Python code in a persistent, user-selected interpreter via MCP, with tools for data loading, summaries, regressions, diagnostics, and plotting, while keeping sessions alive between calls and isolating crashes.MIT