mcpField
M
mcp-parigp

mcp-parigp

Local
github.com/daedalusScience & Education1Updated 27w ago

About mcp-parigp

mcp-parigp exposes the cypari2 (PARI/GP) number theory library to MCP clients, with functions spanning arithmetic, polynomials, number fields, elliptic curves, and matrices. It is intended for mathematical computation through an MCP client or Python.

Key features

  1. 01Evaluate PARI/GP expressions
  2. 02Factor integers and test primality
  3. 03Work with polynomials and number fields
  4. 04Compute elliptic-curve properties
  5. 05Perform matrix and elementary-function operations

Use cases

  1. 01Factor an integer or test whether it is prime
  2. 02Find polynomial roots or derivatives
  3. 03Initialize number fields and manipulate ideals
  4. 04Compute elliptic-curve invariants

MCP support

The MCP server exposes cypari2 (PARI/GP) operations as tools for MCP clients, including expression evaluation and number-theory functions.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"daedalus-mcp-parigp": {
"command": "uvx",
"args": [
"mcp-parigp"
]
}
}
}
Run commanduvx mcp-parigp

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypimcp-parigp0.1.0

Tools

143

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
exprstringYesA PARI/GP expression as a string (e.g., "x^2 + 1", "factor(100)", "prime(10)").

Details

From the project README

mcp-parigp

MCP server exposing cypari2 (PARI/GP) number theory library

PyPI Python Coverage Ruff

mcp-name: io.github.daedalus/mcp-parigp

Install

pip install mcp-parigp

Usage

As MCP Server

Run directly:

mcp-parigp

Or use with an MCP client by configuring in your settings:

{
  "mcpServers": {
    "mcp-parigp": {
      "command": "mcp-parigp"
    }
  }
}
In Python
from mcp_parigp import eval_expression, factor, isprime

# Evaluate PARI/GP expressions
result = eval_expression("factor(100)")
print(result)  # [[2, 2], [5, 2]]

# Factor integers
print(factor(100))  # [[2, 2], [5, 2]]

# Test primality
print(isprime(29))  # True

API

Number Theory
  • factor(n) - Factor an integer
  • isprime(n) - Test if n is prime
  • gcd(a, b) - Greatest common divisor
  • phi(n) - Euler's totient function
  • sigma(n, k) - Sum of k-th power of divisors
  • jacobi(a, n) - Jacobi symbol
  • znorder(x, n) - Multiplicative order modulo n
  • primes(n) - First n primes
  • nextprime(n) - Next prime after n
Polynomials
  • polroots(pol) - Find roots of polynomial
  • polcyclo(n) - n-th cyclotomic polynomial
  • deriv(pol) - Derivative of polynomial
  • subst(pol, v, expr) - Substitute in polynomial
Number Fields
  • nfinit(pol) - Initialize number field
  • bnfinit(pol) - Initialize with Buchmann's algorithm
  • idealadd(nf, a, b) - Add ideals
  • idealmul(nf, a, b) - Multiply ideals
Elliptic Curves
  • ellinit(eq) - Initialize elliptic curve
  • ellap(E, p) - Trace of Frobenius at p
  • elltors(E) - Torsion subgroup
  • ellheight(E, P) - Canonical height
Matrices
  • matid(n) - n×n identity matrix
  • matdet(m) - Matrix determinant
  • matinv(m) - Matrix inverse
  • matrank(m) - Matrix rank
Elementary Functions
  • sin, cos, tan, asin, acos, atan
  • sinh, cosh, tanh, asinh, acosh, atanh
  • exp, log, sqrt, abs
  • pi(), euler(), I()

Development

git clone https://github.com/daedalus/mcp-parigp.git
cd mcp-parigp
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.