mma-mcp

mma-mcp

An MCP server that connects AI assistants to a local Wolfram Engine, enabling symbolic math, numerical analysis, and data visualization through Wolfram Language. It provides secure expression filtering, client authentication, and supports both local stdio and HTTP transports.

Category
访问服务器

README

mma-mcp

Chinese / 中文版

A Model Context Protocol (MCP) server that wraps a local Wolfram Engine, enabling AI assistants (Claude, ChatGPT, etc.) to perform symbolic math, numerical analysis, and data visualization via Wolfram Language.

Disclaimer: This is an unofficial, independent, personal project. It is not affiliated with, sponsored by, endorsed by, or certified by Wolfram Research, Inc. "Wolfram", "Wolfram Language", "Wolfram Engine", "Mathematica", and related marks are trademarks of Wolfram Research.

This software does not include any Wolfram Engine / Mathematica binaries, activation keys, license files, or other proprietary materials. Users must independently obtain and properly license their own copy of the Wolfram Engine or Mathematica in accordance with Wolfram's licensing terms.

The sole purpose of this project is to allow a licensed individual to invoke their own, locally-installed Wolfram kernel through AI assistants on their own machine, within the scope permitted by their license. Redistribution of Wolfram Engine access to third parties is not an intended use case and may violate Wolfram's licensing terms.

Features

  • MCP Tools: evaluate (text) and evaluate_image (PNG, experimental) — all Wolfram Language capabilities through two universal tools
  • Transports: stdio (local) and Streamable HTTP
  • Security: Pre-kernel expression filtering with blacklist/whitelist modes and 29 capability groups
  • Client RBAC: Per-client credentials, per-role tool and security policy control — for isolating different AI clients on the same machine
  • OAuth 2.1: Authorization server for web-based MCP clients (Claude.ai, ChatGPT)
  • Config-driven: Single TOML file controls all behavior

Prerequisites

  • Python 3.11+
  • Wolfram Engine or Mathematica (properly licensed)
  • uv package manager

Quick Start

# 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

Client Configuration

Claude Code / VS Code (stdio)

Add to your .mcp.json:

{
  "mcpServers": {
    "mma-mcp": {
      "command": "uv",
      "args": ["--directory", "/path/to/mma-mcp", "run", "mma-mcp"]
    }
  }
}

Claude Desktop (stdio)

Add to your claude_desktop_config.json (Settings -> Developer -> Edit Config):

{
  "mcpServers": {
    "mma-mcp": {
      "command": "/path/to/mma-mcp/.venv/bin/mma-mcp"
    }
  }
}

On macOS/Linux, find the config at ~/Library/Application Support/Claude/claude_desktop_config.json or ~/.config/Claude/claude_desktop_config.json.

HTTP Transport

uv run mma-mcp serve --transport http --host 127.0.0.1 --port 8000

Configuration

All settings live in mma_mcp.toml (or pyproject.toml under [tool.mma-mcp]).

uv run mma-mcp init  # generates mma_mcp.toml with comments

Key sections:

Section Description
[kernel] Wolfram kernel path, timeout, output format
[server] Transport mode, host, port
[security] Blacklist/whitelist mode, capability groups
[tools] Which MCP tools to expose
[tls] Domain and DNS provider for HTTPS (Caddy)
[auth] Client identity and role-based access control

Security

Expressions are filtered before reaching the Wolfram kernel. Symbols are extracted via regex and checked against the active policy.

Blacklist mode (default): blocks dangerous groups (system_exec, file I/O, networking, dynamic eval).

Whitelist mode: only allows symbols from explicitly enabled groups.

29 capability groups (22 safe + 7 dangerous) cover ~6000 Wolfram Language symbols. Regenerate from your local kernel:

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)

Client Identity & Roles

When using HTTP transport, you can configure per-client credentials and roles to isolate different AI clients (e.g., Claude and ChatGPT) connecting to the same kernel:

# 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

Each client is bound to a role that controls which tools it can access, which Wolfram symbols it can use, and resource limits (timeout, result size). Concurrent clients are isolated via a kernel worker pool — each tool call runs in an exclusive kernel process with a temporary WL context.

See the [auth] section in mma_mcp.toml for configuration details.

Development

# Run tests
uv run pytest tests/ -v

# Inspect MCP tools interactively
uv run mcp dev src/mma_mcp/server.py

CLI Commands

Command Description
mma-mcp serve Start the MCP server (default)
mma-mcp init Generate default mma_mcp.toml
mma-mcp setup Generate security group JSONs from local kernel
mma-mcp caddyfile Generate Caddyfile for HTTPS
mma-mcp hash-password Hash a password for config
mma-mcp add-client Generate TOML snippet for a new AI client

Client Compatibility

Client Long computations Notes
Claude.ai ✔ Supported Sends progressToken; server heartbeat keeps connection alive
ChatGPT ✘ May timeout Does not send progressToken; has a hard timeout (~60s) independent of server heartbeat
Claude Desktop / Claude Code Not tested Local stdio transport

License

MIT — applies only to the code in this repository. Use of Wolfram Engine / Mathematica is governed by Wolfram Research's own license terms.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选