mma-mcp
mma-mcp
Сервер Model Context Protocol (MCP), который является оберткой для локального Wolfram Engine, позволяя ИИ-ассистентам (Claude, ChatGPT и др.) выполнять символьные вычисления, численный анализ и визуализацию данных с помощью языка Wolfram Language.
Отказ от ответственности: Это неофициальный, независимый, личный проект. Он не связан, не спонсируется, не поддерживается и не сертифицирован Wolfram Research, Inc. "Wolfram", "Wolfram Language", "Wolfram Engine", "Mathematica" и связанные с ними знаки являются торговыми марками Wolfram Research.
Данное программное обеспечение не включает в себя какие-либо бинарные файлы Wolfram Engine / Mathematica, ключи активации, файлы лицензий или другие проприетарные материалы. Пользователи должны самостоятельно получить и надлежащим образом лицензировать свою копию Wolfram Engine или Mathematica в соответствии с условиями лицензирования Wolfram.
Единственная цель этого проекта — позволить лицензированному пользователю вызывать свое локально установленное ядро Wolfram через ИИ-ассистентов на своем собственном компьютере в рамках, разрешенных их лицензией. Перераспределение доступа к Wolfram Engine третьим лицам не является предполагаемым сценарием использования и может нарушать условия лицензирования Wolfram.
Возможности
Инструменты MCP:
evaluate(текст) иevaluate_image(PNG, экспериментально) — все возможности Wolfram Language через два универсальных инструментаТранспорты: stdio (локальный) и потоковый HTTP
Безопасность: Фильтрация выражений перед отправкой в ядро с режимами черного/белого списка и 29 группами возможностей
RBAC для клиентов: Учетные данные для каждого клиента, контроль инструментов и политик безопасности для каждой роли — для изоляции различных ИИ-клиентов на одном компьютере
OAuth 2.1: Сервер авторизации для веб-клиентов MCP (Claude.ai, ChatGPT)
Конфигурация: Все поведение управляется одним файлом TOML
Related MCP server: MCP Mathematics
Предварительные требования
Python 3.11+
Wolfram Engine или Mathematica (с надлежащей лицензией)
Менеджер пакетов uv
Быстрый старт
# Clone and install
git clone https://github.com/siqiliu-tsinghua/mma-mcp.git
cd mma-mcp
uv sync
# Graphics export dependencies (headless servers only — desktops already have these)
sudo apt-get install -y libfontconfig1 libgl1 libasound2t64 libxkbcommon0 libegl1
# Generate default config
uv run mma-mcp init
# Generate security group files (requires Wolfram kernel, ~1 min)
uv run mma-mcp setup
# Start server (stdio, for local MCP clients)
uv run mma-mcp serveКонфигурация клиента
Claude Code / VS Code (stdio)
Добавьте в ваш .mcp.json:
{
"mcpServers": {
"mma-mcp": {
"command": "uv",
"args": ["--directory", "/path/to/mma-mcp", "run", "mma-mcp"]
}
}
}Claude Desktop (stdio)
Добавьте в ваш claude_desktop_config.json (Настройки -> Разработчик -> Редактировать конфигурацию):
{
"mcpServers": {
"mma-mcp": {
"command": "/path/to/mma-mcp/.venv/bin/mma-mcp"
}
}
}В macOS/Linux файл конфигурации находится по адресу
~/Library/Application Support/Claude/claude_desktop_config.jsonили~/.config/Claude/claude_desktop_config.json.
HTTP-транспорт
uv run mma-mcp serve --transport http --host 127.0.0.1 --port 8000Конфигурация
Все настройки находятся в mma_mcp.toml (или pyproject.toml в разделе [tool.mma-mcp]).
uv run mma-mcp init # generates mma_mcp.toml with commentsОсновные разделы:
Раздел | Описание |
| Путь к ядру Wolfram, тайм-аут, формат вывода |
| Режим транспорта, хост, порт |
| Режим черного/белого списка, группы возможностей |
| Какие инструменты MCP предоставлять |
| Домен и DNS-провайдер для HTTPS (Caddy) |
| Идентификация клиента и контроль доступа на основе ролей |
Безопасность
Выражения фильтруются до того, как попадут в ядро Wolfram. Символы извлекаются с помощью регулярных выражений и проверяются на соответствие активной политике.
Режим черного списка (по умолчанию): блокирует опасные группы (system_exec, файловый ввод-вывод, сеть, динамическое выполнение).
Режим белого списка: разрешает только символы из явно включенных групп.
29 групп возможностей (22 безопасные + 7 опасных) охватывают около 6000 символов Wolfram Language. Сгенерируйте их из вашего локального ядра:
uv run mma-mcp setup # required after cloning (generates from your local kernel)
uv run mma-mcp setup --force # force regeneration (e.g., after Wolfram Engine upgrade)Идентификация клиентов и роли
При использовании HTTP-транспорта вы можете настроить учетные данные и роли для каждого клиента, чтобы изолировать различных ИИ-клиентов (например, Claude и ChatGPT), подключающихся к одному и тому же ядру:
# Generate password hash
uv run mma-mcp hash-password
# Generate TOML snippet for a new client
uv run mma-mcp add-client alice --role adminКаждый клиент привязан к роли, которая определяет, к каким инструментам он имеет доступ, какие символы Wolfram может использовать, а также устанавливает ограничения ресурсов (тайм-аут, размер результата). Параллельные клиенты изолируются через пул рабочих процессов ядра — каждый вызов инструмента выполняется в отдельном процессе ядра с временным контекстом WL.
Подробности конфигурации см. в разделе [auth] в mma_mcp.toml.
Разработка
# Run tests
uv run pytest tests/ -v
# Inspect MCP tools interactively
uv run mcp dev src/mma_mcp/server.pyКоманды CLI
Команда | Описание |
| Запуск MCP-сервера (по умолчанию) |
| Генерация файла |
| Генерация JSON-файлов групп безопасности из локального ядра |
| Генерация Caddyfile для HTTPS |
| Хеширование пароля для конфигурации |
| Генерация фрагмента TOML для нового ИИ-клиента |
Совместимость с клиентами
Клиент | Длительные вычисления | Примечания |
Claude.ai | ✔ Поддерживается | Отправляет |
ChatGPT | ✘ Возможен тайм-аут | Не отправляет |
Claude Desktop / Claude Code | Не тестировалось | Локальный транспорт stdio |
Лицензия
MIT — применяется только к коду в этом репозитории. Использование Wolfram Engine / Mathematica регулируется собственными условиями лицензирования Wolfram Research.
Available Tools
2 toolsevaluateA
Evaluate a Wolfram Language expression and return the result as text.
Args: expression: A valid Wolfram Language expression string. form: Output format — TeXForm (default), OutputForm, InputForm, StandardForm, or TraditionalForm.
| Name | Required | Description | Default |
|---|---|---|---|
| expression | Yes | ||
| form | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It discloses the core behavior (evaluates expressions, returns text results) and mentions format options, but doesn't cover important behavioral aspects like error handling, computational limits, authentication requirements, or rate limits. The description adds value beyond what would be in annotations but leaves significant gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly structured and front-loaded: the first sentence states the core purpose, followed by a clean parameter section. Every sentence earns its place, with zero wasted words. The formatting with 'Args:' section enhances readability without verbosity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (expression evaluation), no annotations, and no output schema, the description does well but has gaps. It thoroughly documents parameters and purpose, but doesn't describe return value format beyond 'text' or potential error conditions. For a computational tool with no structured safety hints, more behavioral context would be beneficial.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description fully compensates by providing comprehensive parameter documentation. It clearly explains both parameters: 'expression' as 'a valid Wolfram Language expression string' and 'form' with its five possible values and default. This adds substantial meaning beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verb ('evaluate') and resource ('Wolfram Language expression'), and distinguishes it from sibling tool 'evaluate_image' by specifying it returns text rather than image results. The phrase 'return the result as text' explicitly differentiates it from the image-focused sibling.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context about when to use this tool (for evaluating Wolfram Language expressions to get text results) and implies when not to use it (when image results are needed, suggesting 'evaluate_image' as an alternative). However, it doesn't explicitly state exclusion criteria or name the alternative tool directly in the main description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
evaluate_imageA
Evaluate a Wolfram Language expression and return the result as a PNG image.
Useful for Plot, Graphics, or any expression with visual output.
Args: expression: A valid Wolfram Language expression string.
| Name | Required | Description | Default |
|---|---|---|---|
| expression | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool evaluates expressions and returns PNG images, it lacks critical behavioral details such as error handling, performance characteristics, rate limits, authentication requirements, or what happens with invalid expressions. This leaves significant gaps in understanding how the tool behaves in practice.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly concise and well-structured. It starts with the core purpose, provides usage guidelines, then clearly documents the parameter. Every sentence earns its place with no redundant information, making it easy to scan and understand quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (evaluating Wolfram Language expressions with visual output), no annotations, no output schema, and 0% schema description coverage, the description provides adequate basics but lacks completeness. It covers the purpose and parameter semantics well, but misses important behavioral context about how the tool operates, what errors might occur, and what the PNG output contains.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful context for the single parameter: 'expression: A valid Wolfram Language expression string.' This clarifies what type of input is expected beyond the schema's basic 'string' type. Since schema description coverage is 0% and there's only one parameter, the description adequately compensates by specifying the parameter's purpose and format requirements.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Evaluate a Wolfram Language expression and return the result as a PNG image.' It specifies both the action (evaluate) and the resource (Wolfram Language expression), and distinguishes it from the sibling tool 'evaluate' by mentioning the visual output format (PNG image).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context on when to use this tool: 'Useful for Plot, Graphics, or any expression with visual output.' This gives guidance on appropriate use cases. However, it doesn't explicitly state when NOT to use it or name alternatives (like the sibling 'evaluate' tool for non-visual results), which prevents a perfect score.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
evaluate - First observed
evaluate_image
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: evaluate returns text output in various formats, while evaluate_image returns PNG images for visual output. There is no overlap or ambiguity between them, as each targets a different output type for Wolfram Language expressions.
Both tools follow a consistent verb_noun pattern with 'evaluate' as the verb and descriptive suffixes ('_image') to differentiate them. The naming is predictable and aligned, making it easy to understand their relationship and functionality.
With only two tools, this server feels too thin for its apparent scope of evaluating Wolfram Language expressions. It covers text and image output but lacks other essential operations like querying Wolfram Alpha, handling errors, or managing sessions, which limits its utility in broader workflows.
The tool surface is severely incomplete for a Wolfram Language server. It only provides evaluation with text or image output, missing critical functionality such as data import/export, symbolic computation queries, step-by-step solutions, or integration with Wolfram Cloud services, leading to significant gaps in agent capabilities.
Maintenance
Related MCP Connectors
- ZapierOAuthcom.zapier
Hosted MCP server connecting AI assistants to 9,000+ apps and 40,000+ actions via Zapier.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
MCP server for building and testing AI agents with multi-model experimentation and insights.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server that integrates the MathJS library to provide AI models with advanced calculation capabilities, including support for complex numbers, matrices, and unit conversions. It supports both stdio and HTTP transports for seamless integration with clients like Claude Desktop and GitHub Copilot.139 npmMIT
- AlicenseCqualityDmaintenanceA comprehensive MCP server that turns any AI assistant into a powerful mathematical computation engine, providing 52 advanced functions, 158 unit conversions, financial calculations, and secure AST-based evaluation.1816MIT
- AlicenseAqualityDmaintenanceA symbolic mathematics MCP server supporting calculus, linear algebra, number theory, statistics, and unit conversion via natural language.8MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for scientific computing with multiple backends (Mathematica, Octave, Python, R, SageMath, etc.) enabling mathematical computation and visualization through AI coding assistants.5-