๐ A modular Python toolkit for building Model Context Protocol (MCP) modules focused on chemical engineering and chemistry applications.
MoziChem-Hub empowers researchers, engineers, and developers to seamlessly expose core computational chemistry and process modeling tools as MCP servers, making them accessible through standardized APIs and enabling integration with modern AI workflows.
MoziChem-Hub is a newly launched application currently in active development with continuous improvements and enhancements being made regularly. As an emerging tool in chemical engineering ecosystem.
Important: MoziChem-Hub is built on top of FastMCP, a powerful Python package that provides the core MCP (Model Context Protocol) functionality. FastMCP enables the seamless creation and deployment of MCP servers, making it the foundation that powers all MoziChem-Hub modules.
๐ฌ Build MCP modules for a comprehensive range of chemical engineering and chemistry calculations
โก Deploy instantly as REST APIs using FastAPI for production-ready applications
๐ Integrate universally with any client ecosystemโcloud platforms, VS Code, custom GUIs, and more
Advanced thermodynamic property calculations using state-of-the-art equations of state (EOS) models:
- ๐จ Gas & liquid phase fugacity calculations (gas, liquid, mixture)
- ๐ Mixture fugacity analysis
- ๐ EOS roots analysis for components and mixtures
Backed by: PyThermoModels
Comprehensive flash calculation suite supporting both ideal and non-ideal thermodynamic models:
- ๐ก๏ธ Bubble & dew point calculations
- โ๏ธ Flash equilibrium computations and advanced flash calculations
Backed by: PyThermoFlash
Robust database integration for reliable thermodynamic data management:
- ๐ Component property lookup from multiple data sources
- โ Data availability verification and validation
Backed by: PyThermoDB
Each module provides well-defined APIs optimized for LLMs, AI agents, and modern user interfaces.
Deploy anywhere, integrate everywhere:
- ๐ Local development scripts
- โ๏ธ Cloud environments (AWS, Azure, GCP)
- ๐ป IDE integration (VS Code, PyCharm)
- ๐ฅ๏ธ Custom applications and GUIs
Traditional LLMs and AI agents struggle to deliver reliable, validated results in chemistry and engineering without access to domain-specific computational tools.
MoziChem-Hub bridges this critical gap by:
โ Providing robust, field-tested Python tools through standardized protocols
โ Enabling modern web API integration for scalable applications
โ Supporting the next generation of intelligent, trustworthy engineering applications
Transform your chemical engineering workflows with the power of modern AI and reliable computational chemistry.
The following diagram illustrates the high-level architecture of MoziChem-Hub and how its components interact:
Explanation:
- MoziChem-Hub acts as the central hub, connecting various MCP modules (e.g., EOS models, flash calculations, property databases) and exposing them as standardized APIs.
- MCP Modules (top row) are individual computational tools or servers that implement the Model Context Protocol for specific domains (e.g., thermodynamics, property lookup).
- PyThermoDB provides a robust backend for thermodynamic data, which is accessed by MoziChem-Hub and MCP modules.
- Reference modules manage and validate data from multiple sources, ensuring reliable property lookups and calculations.
- Client applications (bottom right) such as Claude, VS Code, and Claude interact with MoziChem-Hub via MCP APIs, enabling seamless integration into AI workflows, IDEs, and automation tools.
- External Data (bottom left) can be incorporated through the Reference system, allowing for custom datasets and advanced data integration.
This architecture enables flexible, modular, and scalable deployment of chemical engineering tools, making them accessible to both humans and AI agents through modern interfaces.
MoziChem-Hub modules can be seamlessly integrated with MCP-compatible clients like Claude Desktop, VS Code, and other AI applications that support the Model Context Protocol.
To use MoziChem-Hub modules with Claude Desktop, add the server configuration to your Claude configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"mozichem-eos-models": {
"command": "uv",
"args": [
"--directory",
"C:\\ABSOLUTE\\PATH",
"run",
"eos-models-mcp.py"
]
},
"mozichem-flash-calc": {
"command": "uv",
"args": [
"--directory",
"C:\\ABSOLUTE\\PATH",
"run",
"flash-calculations-mcp.py"
]
},
"mozichem-thermo-db": {
"command": "uv",
"args": [
"--directory",
"C:\\ABSOLUTE\\PATH",
"run",
"thermodynamic-properties-mcp.py"
]
}
}
}
For VS Code integration, configure your MCP servers in the VS Code settings or workspace configuration:
{
"mcpServers": {
"mozichem-hub": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/",
"run",
"eos-models-mcp.py"
]
}
}
}
The uv
command provides fast, reliable Python environment management:
--directory
: Specifies the project directory containingpyproject.toml
run
: Executes the command in the project's virtual environment- Benefits: Automatic dependency resolution, faster execution, isolated environment
For systems without UV, use direct Python execution:
{
"mcpServers": {
"mozichem-hub": {
"command": "python",
"args": ["/absolute/path/to/mozichem-hub/examples/mcp/eos-models-mcp.py"],
"env": {
"PYTHONPATH": "/absolute/path/to/mozichem-hub"
}
}
}
}
Important: Always use absolute paths in MCP server configurations:
- โ
Windows:
C:\\Users\\YourName\\Projects\\mozichem-hub
- โ
macOS/Linux:
/home/username/projects/mozichem-hub
- โ Relative paths:
./mozichem-hub
or~/mozichem-hub
-
eos-models-mcp
: Thermodynamic property calculations Script Path:examples/mcp/eos-models-mcp.py
-
flash-calculations-mcp
: Flash equilibrium computations Script Path:examples/mcp/flash-calculations-mcp.py
-
thermodynamic-properties-mcp
: Component property database Script Path:examples/mcp/thermodynamic-properties-mcp.py
After configuration, restart your MCP client. You should see the MoziChem-Hub tools available for:
- ๐งฎ Thermodynamic calculations (fugacity, phase equilibrium)
- โ๏ธ Flash calculations (bubble/dew points, flash equilibrium)
- ๐ Property lookups (critical properties, molecular data)
- ๐ฌ EOS model analysis (equation of state computations)
๐ก Tip: Start with a single module first, then add additional modules as needed for your specific workflow.
MoziChem-Hub provides extensive examples to help you get started quickly. All examples are located in the examples/
directory and demonstrate different usage patterns:
Start an MCP server for thermodynamic calculations:
from mozichem_hub import __version__
from mozichem_hub.prebuilt import create_mozichem_mcp
# Create an EOS models MCP server
eos_models_mcp = create_mozichem_mcp(name="eos-models-mcp")
# Run the server
if __name__ == "__main__":
eos_models_mcp.run(transport='streamable-http')
๐ See: examples/mcp/eos-models-mcp.py
Execute thermodynamic calculations directly without MCP server:
from mozichem_hub.executors import ToolExecuter
from pythermodb_settings.models import Temperature, Pressure, Component
from mozichem_hub.prebuilt import create_mozichem_mcp
# Create MCP and tool executor
thermo_models_mcp = create_mozichem_mcp(name="eos-models-mcp")
tool_executer = ToolExecuter(mozichem_mcp=thermo_models_mcp)
# Define calculation parameters
temperature = Temperature(value=300.1, unit="K")
pressure = Pressure(value=9.99, unit="bar")
component = Component(name="propane", formula="C3H8", state="g")
# Execute fugacity calculation
result = tool_executer.execute_tool(
tool_name="calc_gas_component_fugacity",
temperature=temperature,
pressure=pressure,
component=component,
eos_model="SRK"
)
๐ See: examples/execute/fugacity.py
Deploy multiple MCP modules as a unified REST API:
import uvicorn
from mozichem_hub import create_api, __version__
from mozichem_hub.prebuilt import create_mozichem_mcp
# Create MCP modules
eos_models_mcp = create_mozichem_mcp(name="eos-models-mcp")
flash_calculations_mcp = create_mozichem_mcp(name="flash-calculations-mcp")
thermodynamic_properties_mcp = create_mozichem_mcp(name="thermodynamic-properties-mcp")
# Create unified API
mcp_api = create_api(
mcps=[eos_models_mcp, flash_calculations_mcp, thermodynamic_properties_mcp],
title="MoziChem Hub API",
description="API for MoziChem Hub with multiple MCPs.",
version=__version__
)
# Run the API server
if __name__ == "__main__":
uvicorn.run(mcp_api, host="127.0.0.1", port=8000)
๐ See: examples/api/create-api.py
Build your own MCP server with custom functions using the @app.tool
decorator:
from mozichem_hub import __version__
from mozichem_hub.docs import MoziChemMCP
from rich import print
# Create a custom MCP server
app = MoziChemMCP(name="custom-tools-mcp")
# Define custom functions with @tool decorator
@app.tool(name="multiply")
def multiply(a: int, b: int) -> int:
"""
Multiply two numbers.
Parameters
----------
a : int
The first number.
b : int
The second number.
Returns
-------
int
The product of the two numbers.
"""
return a * b
@app.tool(name="add")
def add(a: int, b: int) -> int:
"""
Add two numbers.
Parameters
----------
a : int
The first number.
b : int
The second number.
Returns
-------
int
The sum of the two numbers.
"""
return a + b
# Run the custom MCP server
if __name__ == "__main__":
app.run(transport="stdio")
# Or use HTTP transport: app.run(transport="streamable-http", port=8000)
๐ See: tests/custom_tools.py
This approach allows you to:
- ๐ ๏ธ Define any Python function as an MCP tool using the
@app.tool()
decorator - ๐ Provide detailed documentation through docstrings that become part of the MCP tool description
- ๐ง Use standard Python types for parameters and return values with automatic validation
- ๐ Deploy instantly via multiple transport options (stdio, HTTP, etc.)
MoziChem-Hub supports advanced integration with external thermodynamic databases using custom reference configurations. This powerful feature allows you to extend the built-in data with your own datasets or integrate with specialized databases.
The reference format is fully compatible with PyThermoDB, a comprehensive Python package for thermodynamic property databases. This integration enables seamless access to extensive thermodynamic data collections.
You can convert your own CSV thermodynamic data (such as vapor pressure, critical constants, etc.) into a custom reference and use it in MoziChem-Hub. The process is as follows:
-
Prepare your CSV files with the required columns for each property (e.g., Name, Formula, State, C1, C2, Tmin, Tmax, etc.).
-
Build a custom databook from CSV: Use the script
references/create-reference.py
to read your CSV files and create a PyThermoDB-compatible databook. This script demonstrates how to:- Add data tables and equation tables from CSV files using
ThermoDatabook
. - Build and save the databook as a YAML file (e.g.,
custom-databook.yml
).
- Add data tables and equation tables from CSV files using
-
Generate and load a custom reference: Use
references/load-custom-reference.py
to:- Load the databook and build a
ThermoReference
. - Save the reference as
custom-references.yml
. - Initialize a thermodynamic database with your custom reference and access properties/equations for components.
- Load the databook and build a
-
Integrate with MoziChem-Hub: You can now use your custom reference YAML in MoziChem-Hub for calculations and lookups, either by direct use in your scripts or by updating MCP modules as shown in the examples above.
๐ Reference Mapping Overview
This module ensures that all thermochemical properties (e.g., critical temperature, vapor pressure, heat capacity) used in calculations are traceable to their original reference sources. Data from ThermoDB
is processed by CompBuilder
, mapped to constant symbols (e.g., Tc, Cp_IG, VaPr), and made accessible in the application. These symbols are used consistently in sub-calculations, enabling transparency, validation, and scientific reliability.
See the scripts in references/
for a complete, working example of this workflow.
You can extend any MCP module with custom thermodynamic data using string-based reference definitions:
from mozichem_hub.prebuilt import create_mozichem_mcp
# Create MCP server
eos_models_mcp = create_mozichem_mcp(name="eos-models-mcp")
# Define custom reference content (PyThermoDB format)
REFERENCE_CONTENT = """
REFERENCES:
CUSTOM-REF-2:
DATABOOK-ID: 1
TABLES:
vapor-pressure:
TABLE-ID: 3
DESCRIPTION:
This table provides vapor pressure (P) in Pa as a function of temperature (T) in K.
EQUATIONS:
EQ-1:
BODY:
- res['vapor-pressure | VaPr | Pa'] = math.exp(parms['C1'] + parms['C2']/args['temperature'] + parms['C3']*math.log(args['temperature']))
STRUCTURE:
COLUMNS: [No.,Name,Formula,State,C1,C2,C3,Tmin,Tmax,Eq]
SYMBOL: [None,None,None,None,C1,C2,C3,Tmin,Tmax,VaPr]
UNIT: [None,None,None,None,1,1,1,K,K,Pa]
VALUES:
- [1,'propane','C3H8','g',59.078,-3492.6,-6.0669,85.47,369.83,1]
"""
# Define reference configuration
REFERENCE_CONFIG = """
# Configuration for all components
## ALL
vapor-pressure:
- databook: CUSTOM-REF-2
- table: vapor-pressure
- mode: EQUATIONS
- label: VaPr
general:
- databook: CUSTOM-REF-2
- table: general-data
- mode: DATA
- labels:
- critical-pressure: Pc
- critical-temperature: Tc
- acentric-factor: AcFa
"""
# Apply custom references to MCP server
eos_models_mcp.update_references(
reference_content=REFERENCE_CONTENT,
reference_config=REFERENCE_CONFIG
)
- ๐ Multi-table support - Define multiple data tables within a single reference
- ๐งฎ Equation-based data - Support for mathematical correlations and equations
- ๐ Tabular data - Direct data lookup from structured tables
- ๐ Mixed modes - Combine equations and tabular data as needed
- ๐ท๏ธ Flexible labeling - Custom property labels and units
- โ๏ธ Component-specific config - Different references for different components
- ๐ฌ Research data integration - Incorporate experimental or literature data
- ๐ Specialized databases - Connect to industry-specific property databases
- ๐งช Custom correlations - Implement proprietary thermodynamic models
- โ Data validation - Compare multiple data sources for accuracy verification
๐ See complete example: examples/mcp/eos-models-mcp-with-reference.py
๐ Learn more about PyThermoDB format: PyThermoDB Documentation
fugacity.py
- Gas and liquid phase fugacity calculationsfugacity_mixture.py
- Mixture fugacity analysisbubble-pressure.py
- Bubble point pressure calculationsbubble-temperature.py
- Bubble point temperature calculationsdew-pressure.py
- Dew point pressure calculationsdew-temperature.py
- Dew point temperature calculationsmethod-info.py
- Tool information and metadata
eos-models-mcp.py
- EOS models MCP serverflash-calculations-mcp.py
- Flash calculations MCP serverthermodynamic-properties-mcp.py
- Thermodynamic properties MCP servereos-models-mcp-with-reference.py
- EOS models with custom references
create-api.py
- Complete REST API deploymentmcp-api.py
- Single MCP API deploymenteos-models-mcp.py
- EOS-specific API
reference-config.py
- Custom thermodynamic database configurationreference-checker.py
- Database availability verificationdoc1.py
&doc2.py
- Documentation examples
-
Clone the repository:
git clone https://github.com/sinagilassi/mozichem-hub cd mozichem-hub
-
Install dependencies:
pip install -r requirements.txt
-
Run any example:
python examples/execute/fugacity.py python examples/mcp/eos-models-mcp.py python examples/api/create-api.py
๐ก Each example includes detailed comments and can be customized for your specific needs.
Contributions are welcome! Please feel free to submit a Pull Request to improve the project.
This project is licensed under the MIT License. You are free to use, modify, and distribute this software in your own applications or projects. However, if you choose to use this app in another app or software, please ensure that my name, Sina Gilassi, remains credited as the original author. This includes retaining any references to the original repository or documentation where applicable. By doing so, you help acknowledge the effort and time invested in creating this project.
For any questions, contact me on LinkedIn.