PythonParts Local MCP Server
An MCP server that exposes the local ALLPLAN Python runtime to AI coding assistants. It is started once per ALLPLAN version and gives any MCP-compatible agent accurate, live information about the interpreter, import paths, installed packages, and type correctness — without guessing or hallucinating.
Transport: stdio (spawned as a subprocess by the MCP client).
Protocol: Model Context Protocol via FastMCP.
Release history: CHANGELOG.md.
Prerequisites
-
uv — Python package manager used to run the server without a manual install step.
winget install astral-sh.uv
Attaching to your AI agent
Add the following entry to your MCP configuration:
"pythonparts-local-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"--index", "https://test.pypi.org/simple",
"--index-strategy", "unsafe-best-match",
"pythonparts-mcp",
"--allplan-version", "2027"
]
}
Arguments:
| Argument | Required | Description | Example |
|---|---|---|---|
--allplan-version |
yes | Installed ALLPLAN version | 2027 |
--std-path |
no | Path to ALLPLAN's Std directory |
C:\Data\Allplan\Allplan 2027\Std |
--usr-path |
no | Path to ALLPLAN's user directory. Located under Usr\<username> or Usr\Local depending on your ALLPLAN configuration. |
C:\Users\Jane\Documents\Nemetschek\Allplan\2027\Usr\Local |
The prg and etc paths are resolved automatically from the Windows registry, so
ALLPLAN must be installed. The server starts without the Std and Usr paths.
Std and Usr paths
Each of the two paths is resolved on its own, in this order:
- The
--std-path/--usr-pathargument. std_path/usr_pathinPLUGIN_DATA\config.json, wherePLUGIN_DATAis the environment variable the plugin host sets for the server. IfPLUGIN_DATAis not set,COPILOT_PLUGIN_DATAand thenCLAUDE_PLUGIN_DATAare used instead; Claude Code sets only the latter.- Otherwise the path is not set.
An empty value, a value starting with REPLACE-WITH-, or an unreadable config.json
counts as not set. With a path not set, the server still works: its sys.path entries
are left out, and the tools add a note saying so.
To set the paths, call set_allplan_paths. It applies them at once and writes them to
PLUGIN_DATA\config.json, which plugin updates leave alone:
{"std_path": "C:\\Data\\Allplan\\Allplan 2027\\Std", "usr_path": "C:\\Users\\Jane\\Documents\\Nemetschek\\Allplan\\2027\\Usr\\Local"}
Arguments win over config.json. Leave them out unless the host does not provide
PLUGIN_DATA.
Available Tools
get_allplan_info()
Returns the installed ALLPLAN version string and the four resolved file-system paths (prg, etc, std, usr). No input required. An unset std or usr is reported as "Not set. Use set_allplan_paths()". If a set path does not exist, data.warnings says so.```json
{
"ok": true,
"data": {
"version": "2027.0.0",
"paths": {
"prg": "C:\Program Files\Allplan\Allplan 2027\Prg",
"etc": "C:\ProgramData\Nemetschek\Allplan\2027\etc",
"std": "X:\Path\To\Allplan\Std",
"usr": "Not set. Use set_allplan_paths()"
}
}
}
### `set_allplan_paths(std_path: str = None, usr_path: str = None)`
Sets the ALLPLAN Std and/or Usr directory. Each value must be an absolute path to an existing directory; if any value is rejected, nothing changes. A path you leave out keeps its value. The new paths apply immediately to every tool, including type checks, without a restart.
With `PLUGIN_DATA` set, the paths are saved to `PLUGIN_DATA\config.json` and loaded on every start. Without it, they apply to the current session only and `data.persisted` is `false`. `data.warnings` appears when a `--std-path`/`--usr-path` argument will override the saved value after a restart.
```json
{
"ok": true,
"data": {
"std": "C:\\Data\\Allplan\\Allplan 2027\\Std",
"usr": "C:\\Users\\Jane\\Documents\\Nemetschek\\Allplan\\2027\\Usr\\Local",
"persisted": true,
"config_file": "C:\\Users\\Jane\\.copilot\\installed-plugins\\...\\data\\config.json"
},
"note": "Paths are active now and saved to C:\\Users\\Jane\\.copilot\\...\\config.json."
}
Note on unset paths
get_python_env_info, list_site_packages, typecheck_file, inspect_symbol and run_snippet_in_sandbox work with the Std or Usr path unset. Their result then has a top-level note naming the missing path, for example:
{"ok": true, "data": [], "note": "The ALLPLAN Std and Usr paths are not set, so the matching sys.path entries are omitted and modules from there cannot be resolved. Use set_allplan_paths() to set them."}
get_python_env_info()
Returns the path to the ALLPLAN-embedded Python interpreter, its version, and the ordered sys.path ALLPLAN uses when executing PythonParts scripts. No input required.
{
"ok": true,
"data": {
"interpreter_path": "C:\\...\\Prg\\Python\\python.exe",
"python_version": "3.11.9",
"sys_path": ["C:\\...\\Prg\\Python", "..."]
}
}
list_site_packages()
Lists all Python packages installed in the ALLPLAN-embedded Python environment, deduplicated and sorted alphabetically. No input required.
{
"ok": true,
"data": [
{"name": "requests", "version": "2.31.0"},
{"name": "shapely", "version": null}
]
}
typecheck_file(file_path: str)
Type-checks a .py file against the ALLPLAN runtime using Pyright. Input: absolute path to the file.
{
"ok": true,
"data": {
"error_count": 2,
"warning_count": 0,
"diagnostics": [
{
"severity": "error",
"message": "...",
"file": "C:\\...\\main.py",
"line": 12,
"column": 5,
"rule": "reportMissingImports"
}
]
}
}
inspect_symbol(symbol: str)
Inspects a Python symbol in the live ALLPLAN runtime — returns its category, signature, docstring, and public members. Use this to verify a symbol exists and discover its API before writing code against it.
Input: dotted Python path to the symbol.
{
"ok": true,
"data": {
"symbol": "NemAll_Python_Geometry.Point3D",
"category": "class",
"module": "NemAll_Python_Geometry",
"docstring": "...",
"signature": null,
"members": ["X", "Y", "Z", "..."]
}
}
run_snippet_in_sandbox(code: str)
Runs a Python snippet against the ALLPLAN libraries in a separate process, outside ALLPLAN, and returns its print() output. ALLPLAN does not need to be running, and the snippet cannot touch the open drawing or project data. This is the tool to reach for when verifying geometry math or API behaviour.
The ALLPLAN interface modules are pre-imported as globals (AllplanGeometry, AllplanBasisElements, …). There is no document and no coordinate input, so document and coord_input are not available — anything that needs the open drawing, the project or user settings will fail or return a meaningless value.
Globals do not persist between calls, so each snippet must be self-contained. The first call spends a second or two loading the ALLPLAN DLLs; the process is then reused. Snippets are abandoned after 60 seconds.
Snippets must not show a user interface — AllplanUtility.ShowMessageBox, file dialogs and the like. There is no ALLPLAN window to host them, so the call never returns and the snippet runs into the timeout.
{
"ok": true,
"data": {
"output": "(30000.0, NemAll_Python_Geometry.eServiceResult.POSITIVE_ORIENTATION)\n"
}
}
Changelog
All notable changes to pythonparts-mcp are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
[0.3.0] — 2026-10-30
Added
set_allplan_paths— sets the ALLPLAN Std and/or Usr directory at runtime. Each value must be an absolute path to an existing directory; if one is rejected, nothing changes. The paths apply at once to every tool, including type checks, without a restart. When the host providesPLUGIN_DATA, they are saved toPLUGIN_DATA/config.json, so they survive plugin updates; otherwise they last for the session and the response says they were not persisted.COPILOT_PLUGIN_DATAandCLAUDE_PLUGIN_DATAare used whenPLUGIN_DATAis not set, since Claude Code sets onlyCLAUDE_PLUGIN_DATA.
Changed
--std-pathand--usr-pathare now optional. Each path is taken from its argument, else fromPLUGIN_DATA/config.json, else it stays unset. Empty values,REPLACE-WITH-placeholders and a missing or invalidconfig.jsoncount as unset and never stop the server.- With the Std or Usr path unset,
get_allplan_inforeports it as"Not set. Use set_allplan_paths()".get_python_env_info,list_site_packages,typecheck_file,inspect_symbolandrun_snippet_in_sandboxstill work, leave that path's entries out ofsys.path, and add a top-levelnotenaming the unset path. get_allplan_infoaddsdata.warningswhen a set Std or Usr path does not exist.- The
inspect_symbolandrun_snippet_in_sandboxworkers restart on their next call after the paths change, so they pick up the newsys.path.
[0.2.0] — 2026-09-16
Added
-
run_snippet_in_sandbox— runs a Python snippet against the ALLPLAN libraries and returns itsprint()output, so an agent can check geometry math or API behaviour instead of guessing at it.The snippet runs in a separate process under ALLPLAN's own interpreter, which means ALLPLAN does not need to be running and the snippet cannot reach the user's drawing or project data. The ALLPLAN interface modules are pre-imported as globals;
documentandcoord_inputdo not exist, and calls that open a user interface will hang until the 60-second timeout. Each call gets a fresh set of globals, so snippets must be self-contained.The worker process is started on first use and reused, so only the first call pays for loading the ALLPLAN DLLs.
Fixed
inspect_symboldeclared a 30-second timeout but never applied it, so a wedged worker could hang the server indefinitely. The timeout is now enforced, and a worker that times out, crashes or desyncs is replaced on the next call.
[0.1.2] — 2026-09-03
Fixed
- FastMCP imports updated for the current FastMCP release.
[0.1.1] — 2026-08-06
Changed
get_runtime_contextsplit intoget_allplan_info,get_python_env_infoandlist_site_packages.inspect_symbolnow keeps one worker process alive for the lifetime of the server instead of spawning one per call.
Fixed
- Corrected the declared project dependencies.
[0.1.0] — 2026-07-23
Initial packaged release, exposing get_runtime_context, typecheck_file and
inspect_symbol.
Metadata
Release files for pythonparts-mcp 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pythonparts_mcp-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for pythonparts_mcp-0.3.0-py3-none-any.whl |
Release files / pythonparts_mcp-0.3.0-py3-none-any.whl
| Download URL | pythonparts_mcp-0.3.0-py3-none-any.whl |
|---|---|
| Size | 40.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4dccf5defe2f325405feeeab009660559349965d885005550c308673902e2e87
|
|
BLAKE2b-256 checksum How to use checksums |
b8c5d3f50c8e49ed452f85bf7ccb392dca5254a2fa56141baa203c4ca1c19494
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for pythonparts-mcp 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.