Skip to main content

PyMemSim-MCP

PyPI Downloads PyPI Python Version License MCP

PyMemSim-MCP exposes PyMemSim membrane simulation capabilities through an MCP server.

Overview 🌐

PyMemSim-MCP is a next-generation framework that brings the Model Context Protocol into chemical engineering modeling and simulation, specifically for membrane-based separation systems.

Built on top of PyMemSim, this package introduces a model-source-driven architecture in which thermodynamic data, transport properties, and governing equations are defined externally in a structured, machine-readable format (e.g., YAML). These model sources are dynamically constructed using tools such as PyThermoLinkDB and PyThermoDB, and then supplied, alongside conventional inputs like temperature, pressure, and composition, to simulation workflows.

Unlike traditional tightly coupled simulation tools, PyMemSim-MCP decouples data, equations, and numerical solvers, enabling:

  • ✅ Consistent and unit-safe thermodynamic definitions across simulations
  • 🔗 Flexible integration with multiple modeling packages and workflows
  • ⚙️ Solver-agnostic execution of mass and heat balance equations
  • 🔍 Transparent and interpretable simulation pipelines

A key innovation of PyMemSim-MCP is its compatibility with agentic workflows, where specialized agents can:

  • 🧠 Extract and structure thermodynamic data from unstructured sources into validated model sources
  • 🤖 Interact with MCP-enabled endpoints to perform simulations, sensitivity analysis, and optimization

This approach addresses critical gaps in current LLM-integrated engineering tools, where inconsistencies in data formats, units, and equations often lead to unreliable results. By enforcing a unified scientific contract, PyMemSim-MCP allows LLMs to control both conventional inputs and structured model sources before executing physics-based computations, significantly improving robustness and reproducibility.

PyMemSim-MCP is particularly suited for:

  • 🧪 Membrane process modeling (e.g., hollow fiber modules, gas separation)
  • 🤝 AI-assisted simulation workflows
  • 🚀 Rapid prototyping and validation of process models
  • 🎓 Educational and research applications in computational chemical engineering

Overall, PyMemSim-MCP represents a step toward trustworthy AI-driven simulation environments, where domain knowledge, data, and numerical methods are seamlessly integrated under a standardized and extensible framework.

Requirements 📋

  • Python >=3.11
  • pip (or uv)

Install the package 📦

pip install pymemsim-mcp

This installs the CLI entrypoint:

  • pymemsim-mcp

Start / Activate the MCP Server ▶️

The server entrypoint is:

  • module: python -m pymemsim_mcp.server
  • script: pymemsim-mcp

Both support the same options.

Case A: STDIO transport (recommended for MCP desktop/agent clients) 🧵

pymemsim-mcp --mode stdio

Equivalent:

python -m pymemsim_mcp.server --mode stdio

Case B: HTTP transport (for network-accessible clients) 🌍

pymemsim-mcp --mode http --host 127.0.0.1 --port 8000 --path /mcp

Equivalent:

python -m pymemsim_mcp.server --mode http --host 127.0.0.1 --port 8000 --path /mcp

CLI Options ⌨️

  • --mode: stdio or http (default: stdio)
  • --host: HTTP bind host (default: 127.0.0.1)
  • --port: HTTP bind port (default: 8000)
  • --path: HTTP endpoint path (default: /mcp)

MCP Client Configuration Examples 🔌

STDIO client config (generic)

{
  "mcpServers": {
    "pymemsim": {
      "command": "pymemsim-mcp",
      "args": ["--mode", "stdio"]
    }
  }
}

HTTP client config (generic)

{
  "mcpServers": {
    "pymemsim": {
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}

Available Tool 🧩

  • simulate_gas_hfm: build thermo model source from reference content and run gas hollow-fiber membrane simulation.

Development Quick Check ✅

python -m py_compile pymemsim_mcp/server.py
python -m py_compile pymemsim_mcp/interface/gas_hfm.py

Troubleshooting 🩺

  • pymemsim-mcp: command not found

    • Run pip install -e . in the active environment.
    • Confirm environment is activated.
  • Port already in use (HTTP mode)

    • Change port, for example: --port 8010.
  • Import errors

    • Reinstall dependencies: pip install -e ..

❓ FAQ

For any questions, contact me on LinkedIn.

📄 License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

👨‍💻 Authors

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymemsim_mcp-0.5.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymemsim_mcp-0.5.0-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file pymemsim_mcp-0.5.0.tar.gz.

File metadata

  • Download URL: pymemsim_mcp-0.5.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for pymemsim_mcp-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c0d8a43b332c58ffec1aea7ff8b09812b1ff6bac2e52d474a669cd7d7b8e70f4
MD5 d191e1e754d2fc31bc579a9938159319
BLAKE2b-256 205beb312a67f55c7569ed1d4f0e8e9ffd14df7f823a3adc5c4460eb3e2a815d

See more details on using hashes here.

File details

Details for the file pymemsim_mcp-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymemsim_mcp-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4189bedbabf644f1a4e11c1020f46a202d57515637e3c335d482af0d850d96d4
MD5 77680e45cafb19b1f42203517411efc3
BLAKE2b-256 a16c53451907442ed0225535a4ea6033b65c37d31c2ff5d177528326c933c9ed

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page