Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
SAGEMATH_MCP_STARTUPNoSage code executed during session bootstrap.from sage.all import *
SAGEMATH_MCP_IDLE_TTLNoSeconds of inactivity before a session is culled.900
SAGEMATH_MCP_MAX_STDOUTNoMaximum characters of stdout returned per call.100000
SAGEMATH_MCP_PURE_PYTHONNoWhen set to 1, load math stdlib instead of Sage modules.unset
SAGEMATH_MCP_SAGE_BINARYNoPath to the sage executable.sage
SAGEMATH_MCP_EVAL_TIMEOUTNoPer-evaluation timeout in seconds.30
SAGEMATH_MCP_SHUTDOWN_GRACENoGrace period before a stuck worker is terminated.2
SAGEMATH_MCP_SECURITY_ENABLEDNoEnable/disable AST-based code validation.true
SAGEMATH_MCP_FORCE_PYTHON_WORKERNoUse the pure-Python worker (helpful for tests/CI).false
SAGEMATH_MCP_SECURITY_MAX_SOURCENoMaximum source length in characters.8000
SAGEMATH_MCP_SECURITY_ALLOW_IMPORTSNoPermit import statements when set to true.false
SAGEMATH_MCP_SECURITY_FORBID_GLOBALNoBlock global statements when true.true
SAGEMATH_MCP_SECURITY_MAX_AST_DEPTHNoMaximum AST depth allowed.75
SAGEMATH_MCP_SECURITY_MAX_AST_NODESNoMaximum AST node count allowed.2500
SAGEMATH_MCP_SECURITY_LOG_VIOLATIONSNoEmit warnings when code is blocked.true
SAGEMATH_MCP_SECURITY_ALLOWED_IMPORTSNoComma-separated allowlist of importable modules.math,cmath,statistics,base64,io,sage,sage.all
SAGEMATH_MCP_SECURITY_FORBID_NONLOCALNoBlock nonlocal statements when true.true
SAGEMATH_MCP_SECURITY_ALLOWED_IMPORT_PREFIXESNoComma-separated prefixes treated as safe namespaces.sage.

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
extensions
{
  "io.modelcontextprotocol/ui": {}
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
solve_equationB

Solve an equation or system of equations

matrix_multiplyA

Multiply two matrices and return the result as nested lists

matrix_operationA

Linear algebra on one matrix: determinant, inverse, eigenvalues, rank, reduced row echelon form, transpose. Prefer this over evaluate_sage.

boolean_algebra_operationA

Boolean polynomials over GF(2): evaluate, list variables, degree, and zero/one tests. Prefer this over evaluate_sage for boolean algebra.

polynomial_ring_operationB

Polynomial ring operations: construct rings and compute Groebner bases, ideals, quotients

differentiate_expressionB

Differentiate an expression with respect to a variable

integrate_expressionA

Integrate an expression (indefinite or definite with bounds)

limit_expressionC

Compute the limit of an expression

series_expansionC

Compute a Taylor/Laurent series expansion

solve_odeA

Solve an ordinary differential equation of any order, returning the general solution with arbitrary constants. Prefer this over evaluate_sage.

symbolic_sumA

Closed form of a symbolic sum or product over an index variable, including infinite series. Prefer this over evaluate_sage for summations.

vector_calculus_operationC

Vector calculus operations: gradient, divergence, curl, laplacian

evaluate_sageA

Run arbitrary SageMath code in a persistent session; variables persist across calls.

LAST RESORT. A dedicated tool exists for most tasks and should be preferred: it validates arguments and returns a typed result instead of a repr string. Reach for one of these first:

  • calculus: differentiate_expression, integrate_expression, limit_expression, series_expansion, symbolic_sum, solve_ode

  • algebra: solve_equation, simplify_expression, expand_expression, factor_expression, find_root

  • linear algebra: matrix_operation (determinant, inverse, eigenvalues, rank, rref, transpose), matrix_multiply

  • discrete: number_theory_operation, combinatorics_operation (binomial, partitions, catalan, fibonacci, bell), graph_operation, group_operation

  • specialised: elliptic_curve_operation, coding_theory_operation, polynomial_ring_operation, boolean_algebra_operation, geometry_operation, vector_calculus_operation

  • data: statistics_summary, distribution_operation

  • plots: plot_expression, plot3d_expression, plot_multi_expression

Use evaluate_sage only for what those do not cover, for example:

Transforms: var('t s'); laplace(sin(t), t, s); inverse_laplace(1/(s^2+1), s, t) Modular arithmetic: Mod(17, 5); power_mod(3, 100, 97) Recurrences: var('n'); f = function('f'); desolve_rec(f(n+2)-f(n+1)-f(n), f, [0, 1]) Continued fractions: continued_fraction(pi).convergents()[:10] Number fields: K. = NumberField(x^3 - 2); K.class_number() Multi-step work that builds on values defined earlier in the same session.

calculate_expressionB

Evaluate a SageMath expression and return numeric/string forms

simplify_expressionC

Simplify a mathematical expression

expand_expressionC

Expand a mathematical expression

factor_expressionB

Factor a mathematical expression or integer

find_rootA

Find a numeric root of an expression in a given interval

evaluate_sage_streamingA

Execute SageMath code and stream intermediate print() output line by line. Final result is returned as usual.

number_theory_operationA

Number theory: primality testing, integer factorisation, the next prime above n, gcd and lcm. Prefer this over evaluate_sage for any of these.

combinatorics_operationA

Combinatorics: binomial coefficients, permutations, combinations, integer partitions, factorial, Catalan, Fibonacci and Bell numbers. Prefer this over evaluate_sage for any of these.

graph_operationA

Graph theory: create named graphs and compute properties (chromatic_number, is_connected, diameter, etc.)

group_operationA

Group theory: construct groups and query properties (order, is_abelian, center, etc.)

elliptic_curve_operationA

Elliptic curves over Q: rank, torsion order, discriminant, j-invariant, conductor and generators, from Weierstrass coefficients. Prefer this over evaluate_sage for curve invariants.

coding_theory_operationA

Error-correcting codes: length, dimension, minimum distance, rate and generator matrix for Hamming and generalized Reed-Solomon codes. Prefer this over evaluate_sage for code parameters.

plot3d_expressionA

Plot a 3D surface of a two-variable expression as base64 PNG

plot_multi_expressionA

Plot multiple expressions overlaid on a single 2D graph

plot_expressionB

Plot an expression and return a base64-encoded PNG image

geometry_operationA

Computational geometry on point sets: euclidean distance, polygon area, polytope volume, convex hull vertices and convexity tests. Prefer this over evaluate_sage for these.

reset_sage_sessionC

Reset the SageMath session state for the current MCP session

interrupt_sage_sessionA

Interrupt a running Sage computation while keeping variables defined so far

cancel_sage_sessionB

Cancel any running Sage computation and restart the worker

start_sage_sessionA

Start a named Sage workspace with its own independent variables

list_sage_sessionsA

List the named Sage workspaces belonging to this client

stop_sage_sessionA

Stop a named Sage workspace and release its worker

statistics_summaryA

Descriptive statistics for a list of numbers: mean, median, population and sample variance and standard deviation, min and max. Prefer this over evaluate_sage for summary statistics.

distribution_operationB

Probability distribution operations: PDF, CDF, quantile, mean, variance, sampling

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/XBP-Europe/sagemath-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server