MCP Server#
The Dlubal MCP server lets AI clients such as Claude Code or Codex
work with Dlubal applications (RFEM, RSTAB, RSECTION) using human-readable
text. It translates the AI client’s requests into Dlubal API calls. On startup
it detects which of the applications are installed and offers the matching
tools.
You install it once, and your AI client starts it automatically whenever it needs it. No port, password or access token is involved.
Note
This installation guide is for Dlubal MCP version 1.0.17 and newer.
Warning
API requests made through AI tools count toward your monthly usage and may contribute to reaching your subscription limit (see Subscriptions & Pricing). These requests are monetized, even when using the local run of MCP server for Dlubal API.
What You Need First#
RFEM (or RSTAB / RSECTION) installed, with its API server switched on (see Starting Server).
Your Dlubal API key already saved on your PC. It is if you’ve used the Dlubal API before (see Authentication).
Python 3.11, 3.12 or 3.13 installed on your PC. It’s free from python.org. Python 3.14 is not supported yet.
VS Code with an AI assistant installed, such as Claude Code or Codex.
Install Dlubal MCP Package#
The setup is done once and takes about five minutes. No administrator rights are needed.
Open a Command Prompt: press the Windows key, type cmd and press Enter.
Do not use PowerShell (the VS Code terminal, for example), because the commands
below are written for the Command Prompt.
Create a separate folder for the MCP server.
This command creates a small, self-contained Python environment in your user folder. It is separate from the Dlubal application, so the application’s own Python cannot be affected:
py -3.12 -m venv %USERPROFILE%\dlubal-mcp
pyis the Python launcher that is installed together with Python from python.org, and-3.12selects the Python version. Runpy -0to list the versions installed on your PC, and use 3.11, 3.12 or 3.13 in the command.Install the MCP server and the Dlubal API client into that folder.
dlubal-mcpis the MCP server, which lets the AI client talk to the Dlubal application.dlubal.apiis the Dlubal API client, which sends the commands to the application. Its version must match your application version: the second number is the same. Use2.15for RFEM 6.15, RSTAB 9.15 and RSECTION 1.15,2.16for 6.16 / 9.16 / 1.16, and so on.
%USERPROFILE%\dlubal-mcp\Scripts\python.exe -m pip install dlubal-mcp "dlubal.api==2.15.*"
The Dlubal application comes with its own copy of the API client, but it is kept inside the application’s Python and cannot be shared, so the MCP server gets its own copy.
Note the path of the MCP server’s Python.
The AI client needs to know which program to start whenever it needs Dlubal. That program is the
python.exein the new folder. This command prints its exact path. Copy it for the next section:echo %USERPROFILE%\dlubal-mcp\Scripts\python.exe
The examples below show this path as
C:\Users\<username>\dlubal-mcp\Scripts\python.exe.
After a Dlubal application update, for example to RFEM 6.16, run the command
from step 2 again with the new version ("dlubal.api==2.16.*") and add
--upgrade. Nothing else changes.
Connect to MCP Server#
Choose your AI client and add the configuration. From then on, you do not start the MCP server yourself: the AI client starts it in the background whenever you ask it to work with a Dlubal application.
Claude Code#
Open the folder you want to work in with VS Code (File → Open Folder). In that folder, create a file named
.mcp.jsonand paste the path from step 3 of the installation:{ "mcpServers": { "dlubal-mcp": { "command": "C:\\Users\\<username>\\dlubal-mcp\\Scripts\\python.exe", "args": ["-m", "dlubal_mcp", "--transport", "stdio"] } } }
When you paste the path, double every backslash (
\becomes\\), because JSON requires it.Create a second file,
.claude/settings.local.json, to enable the server and allow its tools. Use the New File button in the VS Code Explorer and type the name including.claude/. VS Code then also creates the.claudefolder:{ "enabledMcpjsonServers": ["dlubal-mcp"], "permissions": { "allow": ["mcp__dlubal-mcp"] } }
mcp__dlubal-mcpallows all tools of the server to run without asking. To allow only some tools, list them individually instead, for examplemcp__dlubal-mcp__read_rfem_results.Restart VS Code, or press Ctrl+Shift+P and run Developer: Reload Window, so that Claude Code reads the new files.
Check the connection: type
/mcpin the Claude Code chat.dlubal-mcpshould be listed as connected. The first start can take a few seconds. If it shows Failed, check thepython.exepath in.mcp.json.Ask Claude Code to use the Dlubal MCP, for example “Do you have access to Dlubal MCP?”
Example setup. The path of
python.exedepends on where you created the virtual environment. In this example, the RFEM API server port was changed from the default9000to9100, soRFEM_API_PORTis set to match. With the default port, leave out theenvline.#
Codex#
Open Codex Settings → MCP servers and add a new server of the STDIO type.
Fill in:
Command to launch: the path from step 3 of the installation, for example
C:\Users\<username>\dlubal-mcp\Scripts\python.exeArguments:
-m,dlubal_mcp,--transport,stdio, each as a separate argumentEnvironment variables: leave empty, unless your application’s API server does not use the default port (see Configuration)
Save, then ask Codex to use the Dlubal MCP.
Example setup. The path of
python.exedepends on where you created the virtual environment. In this example, the RFEM API server port was changed from the default9000to9100, soRFEM_API_PORTis set to match. With the default port, leave the environment variables empty.#
Alternatively, add the server to the Codex configuration file
%USERPROFILE%\.codex\config.toml:
[mcp_servers.dlubal-mcp]
command = 'C:\Users\<username>\dlubal-mcp\Scripts\python.exe'
args = ["-m", "dlubal_mcp", "--transport", "stdio"]
startup_timeout_sec = 30
If Codex reports a timeout when it starts the server, startup_timeout_sec
gives it more time than the default of 10 seconds.
Configuration#
The MCP server connects to the gRPC API servers at these default addresses:
Application |
Environment variables |
Default |
|---|---|---|
RFEM |
|
|
RSTAB |
|
|
RSECTION |
|
|
If your application uses a different port, add the variable to the server
configuration, for example in .mcp.json:
{
"mcpServers": {
"dlubal-mcp": {
"command": "C:\\Users\\<username>\\dlubal-mcp\\Scripts\\python.exe",
"args": ["-m", "dlubal_mcp", "--transport", "stdio"],
"env": { "RFEM_API_PORT": "9100" }
}
}
}
In Codex, add env = { RFEM_API_PORT = "9100" } to the server section.
To offer only the typed tools and withhold the tools that run free-form Python
scripts (run_rfem_script and others), set DLUBAL_MCP_ALLOW_SCRIPTS to
false in the same way.