
sdiehl/sympy-mcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
sdiehl/sympy-mcp - кандидат на сервер MCP, импортированный из https://github.com/sdiehl/sympy-mcp.
Обзор
sdiehl/sympy-mcp - кандидат на сервер MCP, импортированный из https://github.com/sdiehl/sympy-mcp.
Обзор (машинный перевод)
** Эта библиотека больше не поддерживается. Это Apache лицензируется, так что не стесняйтесь форк его.
Sympy-MCP - это сервер протокола Model Context, позволяющий LLM автономно выполнять символическую математику и компьютерную алгебру. Он предоставляет множество инструментов от основной функциональности SymPy для манипулирования математическими выражениями и уравнениями.
##Почему?
Языковые модели абсолютно ужасны при символическом манипулировании. Они галлюцинируют переменные, составляют случайные константы, промывают термины и обычно создают беспорядок. Но у нас есть компьютерные системы алгебры, специально созданные для символической манипуляции, поэтому мы можем использовать инструментальные вызовы для организации последовательности преобразований, чтобы символическое ядро выполняло всю тяжелую работу.
Хотя вы, безусловно, можете иметь LLM-код Mathematica или Python, если вы хотите использовать LLM в качестве агента или калькулятора на лету, лучше использовать MCP-сервер и напрямую разоблачать символические инструменты.
Сервер раскрывает подмножество возможностей символической математики, включая решение алгебраических уравнений, интеграцию и дифференциацию, векторное исчисление, тензорное исчисление для общей теории относительности и как обычные, так и частичные дифференциальные уравнения.
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
Symbolic Algebra MCP Server
This library is no longer maintained. It is Apache licensed, so feel free to fork it.
Sympy-MCP is a Model Context Protocol server for allowing LLMs to autonomously perform symbolic mathematics and computer algebra. It exposes numerous tools from SymPy’s core functionality to MCP clients for manipulating mathematical expressions and equations.
Why?
Language models are absolutely abysmal at symbolic manipulation. They hallucinate variables, make up random constants, permute terms and generally make a mess. But we have computer algebra systems specifically built for symbolic manipulation, so we can use tool-calling to orchestrate a sequence of transforms so that the symbolic kernel does all the heavy lifting.
While you can certainly have an LLM generate Mathematica or Python code, if you want to use the LLM as an agent or on-the-fly calculator, it’s a better experience to use the MCP server and expose the symbolic tools directly.
The server exposes a subset of symbolic mathematics capabilities including algebraic equation solving, integration and differentiation, vector calculus, tensor calculus for general relativity, and both ordinary and partial differential equations.
For example, you can ask it in natural language to solve a differential equation:
Solve the damped harmonic oscillator with forcing term: the mass-spring-damper system described by the differential equation where m is mass, c is the damping coefficient, k is the spring constant, and F(t) is an external force.
$$ m\frac{d^2x}{dt^2} + c\frac{dx}{dt} + kx = F(t) $$
Or involving general relativity:
Compute the trace of the Ricci tensor $R_{\mu\nu}$ using the inverse metric $g^{\mu\nu}$ for Anti-de Sitter spacetime to determine its constant scalar curvature $R$.
Usage
You need uv first.
- Homebrew :
brew install uv - Curl :
curl -LsSf https://astral.sh/uv/install.sh | sh
Then you can install and run the server with the following commands:
# Setup the project
git clone https://github.com/sdiehl/sympy-mcp.git
cd sympy-mcp
uv sync
# Install the server to Claude Desktop
uv run mcp install server.py
# Run the server
uv run mcp run server.py
You should see the server available in the Claude Desktop app now. For other clients, see below.
If you want a completely standalone version that just runs with a single command, you can use the following. Note this is running arbitrary code from Github, so be careful.
uv run --with https://github.com/sdiehl/sympy-mcp/releases/download/0.1/sympy_mcp-0.1.0-py3-none-any.whl python server.py
If you want to do general relativity calculations, you need to install the einsteinpy library.
uv sync --group relativity
Available Tools
The sympy-mcp server provides the following tools for symbolic mathematics:
Установка
docker run -i -p 8081:8081 --rm sympy-mcpКонфигурация
{
"mcpServers": {
"sympy-mcp": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run",
"--with",
"einsteinpy",
"--with",
"mcp[cli]",
"--with",
"pydantic",
"--with",
"sympy",
"mcp",
"run",
"/ABSOLUTE_PATH_TO_SYMPY_MCP/server.py"
]
}
}
}