Skip to main content
Glama
PLAXIS 2D MCP Server

PLAXIS 2D MCP Server

by northlarkhq
README.md
# PLAXIS 2D MCP Server

An unofficial [Model Context Protocol](https://modelcontextprotocol.io) server that lets Claude (or another MCP
client) work with **PLAXIS 2D Input and Output** through their remote scripting servers: inspect and change
models, stage construction phases, mesh and calculate, then read results, export tables and plots.

> Not affiliated with, endorsed by or supported by Bentley Systems or Seequent. PLAXIS is a trademark of its
> owner. Check every result yourself: this tool drives your FE software, it does not take engineering
> responsibility.

## What it does

One server, `plaxis-2d`, drives both programs. Tools that exist on both take `target="input"` or
`target="output"`; it connects on first use, and `status` shows both sides.

| Area | Tools |
|---|---|
| Connection | `status`, `connect`, `disconnect` |
| Project | `project_info`, `open_project`, `new_project`, `save_project`, `close_project`, `recover_project` |
| Reading the model | `list_phases`, `list_materials`, `list_objects`, `inspect`, `list_members`, `read_values` |
| Changing the model | `set_values`, `set_active`, `create`, `create_phase`, `delete_phase`, `set_mode`, `run_command` |
| Staging | `copy_staging`, `compare_phases` |
| Mesh and calculation | `generate_mesh`, `calculate`, `calculation_log`, `open_results` |
| Results | `list_result_types`, `get_results`, `list_steps`, `get_curve`, `list_structures`, `export_results` |
| Plots | `list_plots`, `create_plot`, `export_plot` |
| Checks | `check_model` (phase chain, design approaches), `factor_links` |
| Jobs | `job_status`, `cancel_job` |

Some things it takes care of:

- **Staged values and inheritance.** Read and write values per phase; a null value means "inherited from the
  previous phase". Every write is read back.
- **Long work runs as jobs** (open, save, mesh, calculate, copy staging, batch exports): a tool waits up to
  `wait_seconds`, then returns a job to follow. Calculation runs phase by phase in chain order, skips a phase
  whose parent has no valid results, and shows live progress (step, SumMstage, error) from PLAXIS's own files.
- **Results without traps.** Phases without results are refused instead of read as zeros; Output's whole-structure
  names are listed for you; envelopes over phases come with the phase of each extreme.
- **Clear failures.** When PLAXIS does not answer, the server says why: program not running, scripting server
  off, wrong port or password, a dialog waiting for a click, or Output still loading a large model.
- **Files stay where you put them.** Relative paths are inside a working folder; files are written only there
  and in the folders of projects opened through the server.
- **Passwords stay private.** They are passed to the PLAXIS connection over a pipe, never on a command line,
  and never shown.

## Requirements

- Windows with **PLAXIS 2D 2024 or later** (tested with 2024.2). No Python has to be installed: Claude Desktop
  provides one for the server, with PLAXIS's scripting package (`plxscripting`, from PyPI). If PLAXIS's own
  Python Distribution is installed (`C:\ProgramData\Seequent\PLAXIS Python Distribution V3`), the connection uses
  it instead, since its `plxscripting` matches the installed PLAXIS.
- In PLAXIS Input and in PLAXIS Output: **Expert > Configure remote scripting server**, switch it on and note the
  port and password (by default this server expects Input on 10000 and Output on 10001). PLAXIS Output started
  from Input (`open_results`) starts with its scripting server on.
- A recent Claude Desktop (the extension is an MCP Bundle of the `uv` type, manifest 0.4), or any MCP client.
  Internet access is needed the first time the extension starts, while Claude Desktop installs its Python
  packages (about 20 s).

## Install in Claude Desktop

1. Download `plaxis-2d-<version>.mcpb` from the releases (or build it, below).
2. Open it with Claude Desktop (double-click it, or install it from Claude Desktop's Extensions settings).
3. Fill in the dialog:

   | Field | What to enter |
   |---|---|
   | PLAXIS Input port / password | as set in PLAXIS Input's remote scripting server |
   | PLAXIS Output port / password | as set in PLAXIS Output's remote scripting server |
   | Working folder | where exports, plots and saved copies go; the default `${DOCUMENTS}/PLAXIS 2D MCP` is a folder in your Documents (empty means the same) |

4. Ask Claude for `status`: both sides should show as connected once PLAXIS is open with its servers on.

### The skill

`dist/plaxis-2d-skill.zip` is an Agent Skill (`plaxis-2d`) with working practice for PLAXIS 2D: safe ways of
working on a model, staged construction and groundwater, Eurocode 7 design approaches, checks before and after
calculating, and how to read results. Upload the zip in Claude's Skills settings.
The source is in [`skill/plaxis-2d`](skill/plaxis-2d).

## Use with another MCP client

The `.mcpb` file is a zip. Unpack it and run it with [uv](https://docs.astral.sh/uv/), with the settings as
environment variables:

```json
{
  "mcpServers": {
    "plaxis-2d": {
      "command": "uv",
      "args": ["run", "--directory", "C:\\path\\to\\unpacked\\bundle", "server/main.py"],
      "env": {
        "PLAXIS_INPUT_PORT": "10000", "PLAXIS_INPUT_PASSWORD": "...",
        "PLAXIS_OUTPUT_PORT": "10001", "PLAXIS_OUTPUT_PASSWORD": "...",
        "PLAXIS_WORKDIR": "C:\\Users\\me\\Documents\\PLAXIS 2D MCP"
      }
    }
  }
}
```

Alternatively install the package into any Python 3.10+ (`pip install .`) and run `plaxis-2d-mcp-server`. Either
way the server finds PLAXIS's Python by itself for the connections (or set `PLAXIS_PYTHON`). Optional: `PLAXIS_HOST` (default `127.0.0.1`), `PLAXIS_REQUEST_TIMEOUT`
(seconds for one PLAXIS request, default 45).

## How it works

The MCP server runs in the Python Claude Desktop provides. It starts two small helper processes, one for Input
and one for Output, and talks to them over pipes. The helpers run in a Python that has PLAXIS's scripting
package: PLAXIS's own Python Distribution when it is installed (its package matches the installed PLAXIS),
otherwise the extension's own Python with `plxscripting` from PyPI (tested with PLAXIS 2D 2024.2). The helpers
use only Python's standard library besides that package, so any Python version works; the extension copies them
into `<working folder>\.plaxis-2d-mcp\` first, because on the Microsoft Store version of Claude Desktop other
programs may not see the extension's own folder. Each helper holds the connection to one program, so a busy or blocked Output never
holds up Input. A helper that stops answering is restarted and reconnects on the next call. Disconnecting never
closes the project in PLAXIS.

`docs/tool-map.md` maps the tools of an earlier two-server design to these tools.

## Development

```powershell
py -3.11 -m venv .venv
.venv\Scripts\python -m pip install -e ".[dev]"
.venv\Scripts\python -m pytest
```

The tests run without PLAXIS, against a small fake of PLAXIS's scripting package (`tests/fake_plaxis`), both
in-process and through real helper processes and the MCP tools.

Against a running PLAXIS (settings from the environment or a git-ignored `.env`):

```powershell
.venv\Scripts\python scripts\live_check.py          # read-only
.venv\Scripts\python scripts\live_check.py --write  # saves a copy into the working folder and works on it
```

Build the extension and the skill zip (needs uv, to pin the dependencies in `uv.lock`):

```powershell
.venv\Scripts\python -m pip install uv
.venv\Scripts\python scripts\build_mcpb.py   # -> dist\plaxis-2d-<version>.mcpb, dist\plaxis-2d-skill.zip
```

The manifest follows the [MCPB specification](https://github.com/modelcontextprotocol/mcpb); where Node is
available, `npx @anthropic-ai/mcpb validate build\mcpb\manifest.json` checks it too.

## License

MIT, see [LICENSE](LICENSE).