ampl-mcp
An MCP server exposing AMPL optimisation modelling to coding agents, plus a matching Claude plugin.
README
ampl-mcp
An MCP server exposing AMPL optimisation modelling to coding agents, plus a matching Claude plugin.
Requirements
- An AMPL licence UUID (free community licences: https://ampl.com/ce) - optional, see below
uv/uvx
Install as a Claude Code plugin
This repository is its own plugin marketplace, so both steps take the repo URL:
/plugin marketplace add worc4021/ampl-mcp
/plugin install ampl@ampl-mcp
The plugin runs the server straight from its own checkout
(uv run --directory ${CLAUDE_PLUGIN_ROOT} ampl-mcp), so nothing needs to be
published to PyPI and no UV_INDEX has to be set - the AMPL package index is
declared in pyproject.toml.
Set your licence UUID first if you have one - it is optional, see "Licensing":
setx AMPLKEY_UUID "your-uuid-here" # Windows, then open a new terminal
export AMPLKEY_UUID=your-uuid-here # POSIX
Run the server directly
From a checkout, without installing the plugin:
uv run ampl-mcp
The package is not on PyPI, so uvx ampl-mcp will not resolve it. Use
uvx --from . ampl-mcp from a checkout if you want the uvx form.
Licensing
Without AMPLKEY_UUID the server still runs, on the wheel's shipped
size-limited demo licence - small models solve correctly; a model past the
demo's size limit fails with an error that reads like a modelling problem.
Call the ampl_version tool to see which tier is active before assuming a
failure is a modelling bug.
With AMPLKEY_UUID set, activation happens lazily on the first session and
is persisted to a durable directory so it survives across runs:
%LOCALAPPDATA%/ampl-mcp/licence on Windows,
~/.local/share/ampl-mcp/licence on POSIX (override with
AMPL_MCP_LICENCE_DIR).
Development
UV_INDEX=https://pypi.ampl.com uv run pytest
Tests marked licence are skipped when no AMPL engine can be constructed
(see tests/conftest.py) - AMPLKEY_UUID is not required, because the AMPL
wheel ships a size-limited demo licence that is enough to build an engine.
Set AMPL_MCP_REQUIRE_ENGINE=1 in CI to turn that skip into a hard failure.
Security note
The server blocks AMPL's shell and cd statements (in ampl_eval,
ampl_sweep's collect expressions, and in files loaded by
ampl_read_files) to prevent accidental shell/cd use. This is an
accident-preventer, not a sandbox: it is not a guarantee that shell execution
is impossible. Set AMPL_MCP_ALLOW_SHELL=1 if you need those statements.
Two things it deliberately does not stop:
- Loading a file runs that file's contents unchecked.
include,commands,model,dataandloadare permitted on purpose - by project ruling, whoever approves the call owns what the loaded file does. The guard sees only the text handed to the server, so ashellinside a loaded file (or inside anything it loads in turn) will run.ampl_eval,ampl_read_filesandampl_displayreturn awarningslist when they see such a statement; they do not refuse it. - AMPL expression text is not confined to the working directory. The
path guard applies to this server's own path arguments. AMPL's own
output redirection -
ampl_display("1 > 'C:/anywhere/file.txt'")- writes outside the session workdir, and anincludewith an absolute path reads from outside it.
Configuration
| Variable | Purpose |
|---|---|
AMPLKEY_UUID |
AMPL licence UUID. Read from the environment only. |
UV_INDEX |
Must include https://pypi.ampl.com. |
AMPL_MCP_LICENCE_DIR |
Override the durable licence directory. |
AMPL_MCP_ALLOW_SHELL |
Set to 1 to permit AMPL's shell and cd. |
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。