Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MCP_MATH_HOSTNoHost to bind to for HTTP transport0.0.0.0
MCP_MATH_PORTNoPort to use for HTTP transport8000
MCP_MATH_LOG_LEVELNoLogging level (DEBUG, INFO, WARNING, ERROR)INFO
MCP_MATH_TRANSPORTNoTransport type (http or stdio)stdio
MCP_MATH_CACHE_SIZENoSize of the function result cache1000
MCP_MATH_ENABLE_CORSNoEnable CORS for HTTP transporttrue
MCP_MATH_CACHE_STRATEGYNoCaching strategy for function resultssmart
MCP_MATH_DOMAIN_WHITELISTNoComma-separated list of allowed function domains
MCP_MATH_FUNCTION_BLACKLISTNoComma-separated list of disabled functions
MCP_MATH_COMPUTATION_TIMEOUTNoTimeout for function computations in seconds30.0
MCP_MATH_MAX_CONCURRENT_CALLSNoMaximum number of concurrent function calls10

Tools

Functions exposed to the LLM to take actions

NameDescription
add

Add two numbers together. Pure arithmetic addition operation. (Domain: arithmetic, Category: core)

subtract

Subtract the second number from the first number. (Domain: arithmetic, Category: core)

multiply

Multiply two numbers together. (Domain: arithmetic, Category: core)

divide

Divide the first number by the second number. (Domain: arithmetic, Category: core)

power

Raise a number to a power. Handles integer and fractional exponents. (Domain: arithmetic, Category: core)

sqrt

Calculate the square root of a number. (Domain: arithmetic, Category: core)

abs_value

Calculate the absolute value of a number. (Domain: arithmetic, Category: core)

sign

Determine the sign of a number. Returns 1, -1, or 0. (Domain: arithmetic, Category: core)

negate

Negate a number (return its additive inverse). (Domain: arithmetic, Category: core)

round_number

Round a number to a specified number of decimal places. (Domain: arithmetic, Category: core)

floor

Return the floor of a number (largest integer less than or equal to x). (Domain: arithmetic, Category: core)

ceil

Return the ceiling of a number (smallest integer greater than or equal to x). (Domain: arithmetic, Category: core)

truncate

Truncate a number towards zero (remove decimal part). (Domain: arithmetic, Category: core)

ceiling_multiple

Round a number up to the nearest multiple of significance. Always rounds away from zero. (Domain: arithmetic, Category: general)

floor_multiple

Round a number down to the nearest multiple of significance. Always rounds toward zero. (Domain: arithmetic, Category: general)

mround

Round a number to the nearest multiple of significance. Uses standard rounding rules. (Domain: arithmetic, Category: general)

modulo

Calculate the modulo (remainder) of division. Returns a % b. (Domain: arithmetic, Category: core)

divmod_operation

Perform division and return both quotient and remainder. Returns (quotient, remainder). (Domain: arithmetic, Category: core)

mod_power

Calculate modular exponentiation: (base^exponent) mod modulus. Efficient for large numbers. (Domain: arithmetic, Category: core)

quotient

Return the integer quotient of division without remainder. Equivalent to a // b. (Domain: arithmetic, Category: general)

remainder

Calculate floating-point remainder of division (IEEE remainder operation). (Domain: arithmetic, Category: core)

fmod

Calculate floating-point modulo operation. Similar to % but for floats. (Domain: arithmetic, Category: core)

equal

Check if two numbers are exactly equal. For floating-point numbers, consider using approximately_equal instead. (Domain: arithmetic, Category: comparison)

not_equal

Check if two numbers are not equal. (Domain: arithmetic, Category: comparison)

less_than

Check if the first number is less than the second number. (Domain: arithmetic, Category: comparison)

less_than_or_equal

Check if the first number is less than or equal to the second number. (Domain: arithmetic, Category: comparison)

greater_than

Check if the first number is greater than the second number. (Domain: arithmetic, Category: comparison)

greater_than_or_equal

Check if the first number is greater than or equal to the second number. (Domain: arithmetic, Category: comparison)

in_range

Check if a number is within a specified range (inclusive by default). (Domain: arithmetic, Category: comparison)

between

Check if a value is between two bounds (exclusive by default, like mathematical interval notation). (Domain: arithmetic, Category: comparison)

minimum

Find the smaller of two numbers. (Domain: arithmetic, Category: comparison)

maximum

Find the larger of two numbers. (Domain: arithmetic, Category: comparison)

clamp

Clamp a value between a minimum and maximum bound. Ensures the value stays within specified limits. (Domain: arithmetic, Category: comparison)

sort_numbers

Sort a list of numbers in ascending or descending order. (Domain: arithmetic, Category: comparison)

rank_numbers

Get the rank (1-based position) of each number in a list when sorted. Handles ties appropriately. (Domain: arithmetic, Category: comparison)

min_list

Find the minimum value in a list of numbers. (Domain: arithmetic, Category: comparison)

max_list

Find the maximum value in a list of numbers. (Domain: arithmetic, Category: comparison)

approximately_equal

Check if two floating-point numbers are approximately equal within a tolerance. Handles floating-point precision issues. (Domain: arithmetic, Category: comparison)

close_to_zero

Check if a number is close to zero within a tolerance. Useful for floating-point comparisons. (Domain: arithmetic, Category: comparison)

is_finite

Check if a number is finite (not infinite and not NaN). (Domain: arithmetic, Category: comparison)

is_nan

Check if a number is NaN (Not a Number). (Domain: arithmetic, Category: comparison)

is_infinite

Check if a number is infinite (positive or negative infinity). (Domain: arithmetic, Category: comparison)

is_normal

Check if a number is normal (finite, non-zero, and not subnormal). (Domain: arithmetic, Category: comparison)

is_close

Relative tolerance comparison using both absolute and relative tolerances. (Domain: arithmetic, Category: comparison)

is_prime

Check if a number is prime. A prime number is only divisible by 1 and itself. (Domain: arithmetic, Category: number_theory)

next_prime

Find the next prime number greater than the given number. (Domain: arithmetic, Category: number_theory)

nth_prime

Find the nth prime number (1-indexed). Uses efficient prime generation. (Domain: arithmetic, Category: number_theory)

prime_factors

Find all prime factors of a number. Returns the prime factorization as a list. (Domain: arithmetic, Category: number_theory)

prime_count

Count the number of prime numbers less than or equal to n (prime counting function π(n)). (Domain: arithmetic, Category: number_theory)

is_coprime

Check if two numbers are coprime (their greatest common divisor is 1). (Domain: arithmetic, Category: number_theory)

first_n_primes

Generate the first n prime numbers using the Sieve of Eratosthenes algorithm. (Domain: arithmetic, Category: number_theory)

gcd

Calculate the Greatest Common Divisor (GCD) of two integers using Euclidean algorithm. (Domain: arithmetic, Category: number_theory)

lcm

Calculate the Least Common Multiple (LCM) of two integers. (Domain: arithmetic, Category: number_theory)

divisors

Find all positive divisors of a number in sorted order. (Domain: arithmetic, Category: number_theory)

is_divisible

Check if the first number is divisible by the second number (remainder is zero). (Domain: arithmetic, Category: number_theory)

is_even

Check if a number is even (divisible by 2). (Domain: arithmetic, Category: number_theory)

is_odd

Check if a number is odd (not divisible by 2). (Domain: arithmetic, Category: number_theory)

extended_gcd

Extended Euclidean algorithm. Returns gcd(a,b) and coefficients x,y such that ax + by = gcd(a,b). (Domain: arithmetic, Category: number_theory)

divisor_count

Count the number of positive divisors of a number (divisor function τ(n)). (Domain: arithmetic, Category: number_theory)

divisor_sum

Calculate the sum of all positive divisors of a number (divisor function σ(n)). (Domain: arithmetic, Category: number_theory)

is_perfect_square

Check if a number is a perfect square. (Domain: arithmetic, Category: basic_sequences)

perfect_squares

Generate the first n perfect squares. (Domain: arithmetic, Category: basic_sequences)

nth_perfect_square

Get the nth perfect square (0-indexed). (Domain: arithmetic, Category: basic_sequences)

is_power_of_two

Check if a number is a power of two. (Domain: arithmetic, Category: basic_sequences)

powers_of_two

Generate the first n powers of two. (Domain: arithmetic, Category: basic_sequences)

nth_power_of_two

Get the nth power of two (0-indexed). (Domain: arithmetic, Category: basic_sequences)

fibonacci

Calculate the nth Fibonacci number using efficient matrix exponentiation. (Domain: arithmetic, Category: basic_sequences)

fibonacci_sequence

Generate the first n Fibonacci numbers. (Domain: arithmetic, Category: basic_sequences)

is_fibonacci_number

Check if a number is a Fibonacci number. (Domain: arithmetic, Category: basic_sequences)

factorial

Calculate factorial n! = n × (n-1) × ... × 2 × 1. (Domain: arithmetic, Category: basic_sequences)

double_factorial

Calculate the double factorial of a number. n!! = n × (n-2) × (n-4) × ... × 2 or 1. (Domain: arithmetic, Category: general)

subfactorial

Calculate subfactorial !n (derangements of n items). (Domain: arithmetic, Category: basic_sequences)

triangular_number

Calculate the nth triangular number T_n = n(n+1)/2. (Domain: arithmetic, Category: basic_sequences)

is_triangular_number

Check if a number is a triangular number. (Domain: arithmetic, Category: basic_sequences)

triangular_sequence

Generate the first n triangular numbers. (Domain: arithmetic, Category: basic_sequences)

pentagonal_number

Calculate the nth pentagonal number P_n = n(3n-1)/2. (Domain: arithmetic, Category: basic_sequences)

is_pentagonal_number

Check if a number is a pentagonal number. (Domain: arithmetic, Category: basic_sequences)

pentagonal_sequence

Generate the first n pentagonal numbers. (Domain: arithmetic, Category: basic_sequences)

square_pyramidal_number

Calculate the nth square pyramidal number. (Domain: arithmetic, Category: figurate_numbers)

tetrahedral_number

Calculate the nth tetrahedral number (sum of first n triangular numbers). (Domain: arithmetic, Category: basic_sequences)

catalan_number

Calculate the nth Catalan number C_n = (2n)!/(n+1)!n!. (Domain: arithmetic, Category: combinatorial_numbers)

is_mersenne_prime

Check if a number is a Mersenne prime (prime of form 2^p - 1 where p is prime). (Domain: arithmetic, Category: special_primes)

mersenne_prime_exponents

Get known Mersenne prime exponents up to a limit. (Domain: arithmetic, Category: special_primes)

lucas_lehmer_test

Perform Lucas-Lehmer primality test for Mersenne numbers. (Domain: arithmetic, Category: special_primes)

mersenne_numbers

Generate Mersenne numbers 2^p - 1 for prime exponents up to limit. (Domain: arithmetic, Category: special_primes)

is_fermat_prime

Check if a number is a Fermat prime (prime of form 2^(2^n) + 1). (Domain: arithmetic, Category: special_primes)

fermat_numbers

Generate Fermat numbers F_n = 2^(2^n) + 1 up to index limit. (Domain: arithmetic, Category: special_primes)

known_fermat_primes

Get the five known Fermat primes. (Domain: arithmetic, Category: special_primes)

is_sophie_germain_prime

Check if a prime p is a Sophie Germain prime (2p + 1 is also prime). (Domain: arithmetic, Category: special_primes)

is_safe_prime

Check if a prime q is a safe prime (q = 2p + 1 where p is prime). (Domain: arithmetic, Category: special_primes)

safe_prime_pairs

Find Sophie Germain and safe prime pairs up to limit. (Domain: arithmetic, Category: special_primes)

is_twin_prime

Check if a number is part of a twin prime pair (p, p+2). (Domain: arithmetic, Category: special_primes)

twin_prime_pairs

Find twin prime pairs up to limit. (Domain: arithmetic, Category: special_primes)

cousin_primes

Find all cousin prime pairs (primes differing by 4) up to limit. (Domain: arithmetic, Category: prime_patterns)

sexy_primes

Find all sexy prime pairs (primes differing by 6) up to limit. (Domain: arithmetic, Category: prime_patterns)

wilson_theorem_check

Check Wilson's theorem: p is prime iff (p-1)! ≡ -1 (mod p). (Domain: arithmetic, Category: primality_tests)

wilson_factorial_mod

Calculate k! mod m efficiently for Wilson's theorem. (Domain: arithmetic, Category: primality_tests)

is_fermat_pseudoprime

Check if n is a Fermat pseudoprime to base a. (Domain: arithmetic, Category: pseudoprimes)

fermat_primality_check

Perform Fermat primality check for base a. (Domain: arithmetic, Category: primality_tests)

is_carmichael_number

Check if n is a Carmichael number (absolute Fermat pseudoprime). (Domain: arithmetic, Category: pseudoprimes)

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
Available FunctionsList of currently available mathematical functions after filtering
Function StatisticsStatistics about function filtering and availability
Server ConfigurationCurrent server configuration

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/chrishayuk/chuk-mcp-math-server'

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