ampl-mcp

ampl-mcp

An MCP server exposing AMPL optimisation modelling to coding agents, plus a matching Claude plugin.

Category
Visit Server

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, data and load are 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 a shell inside a loaded file (or inside anything it loads in turn) will run. ampl_eval, ampl_read_files and ampl_display return a warnings list 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 an include with 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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured