Local MCP tooling for controlling T-FLEX CAD from Codex or any MCP-compatible client.
T-FLEX Codex MCP connects an AI coding assistant to a running T-FLEX CAD session. It contains:
- a dependency-free Node.js MCP server;
- a managed T-FLEX plugin that exposes a localhost bridge;
- Windows GUI fallback tools for focusing windows, screenshots, clicks, hotkeys, and typing;
- install and configuration examples that keep local paths outside the repository.
- Open and inspect the active T-FLEX document.
- List, create, and update document variables.
- Rebuild, save, save as, and export documents.
- Execute short C# automation snippets inside the active T-FLEX document.
- Launch T-FLEX CAD and fall back to GUI control when API automation is not enough.
flowchart LR
A["Codex or MCP client"] --> B["Node MCP server"]
B --> C["localhost bridge<br/>http://127.0.0.1:38517/command"]
C --> D["T-FLEX managed plugin"]
D --> E["Active T-FLEX CAD document"]
B --> F["Windows GUI fallback"]
- Windows.
- T-FLEX CAD 17 or compatible installation.
- Node.js 18 or newer.
- Visual Studio or Build Tools capable of building .NET Framework 4.7.2 projects.
- Permission to copy the bridge plugin into the T-FLEX installation directory.
bridge/
BridgePlugin.cs T-FLEX plugin entry point
BridgeServer.cs localhost HTTP bridge
TflexOperations.cs T-FLEX automation commands
TflexCodexBridge.csproj .NET Framework plugin project
TflexCodexBridge.tfa T-FLEX plugin descriptor
mcp/
server.js MCP server
package.json Node package metadata
run-tflex-codex-mcp.cmd Windows launcher
examples/
codex-mcp.example.json MCP client configuration example
install-tflex-plugin.ps1 Plugin installer
You can either use a pre-compiled release or build from source.
- Download the latest
tflex-codex-mcp-release.zipfrom the GitHub Releases page and extract it. - Open PowerShell as Administrator (if T-FLEX is in
Program Files), navigate to the extracted folder, and run:
.\install-tflex-plugin.ps1- Skip to step 4 below (Start T-FLEX CAD).
git clone https://github.com/Faserdka/tflex-codex-mcp.git
cd tflex-codex-mcpOpen bridge/TflexCodexBridge.csproj in Visual Studio or build it with MSBuild.
If T-FLEX is installed somewhere other than the default location, pass TflexCadDir:
msbuild bridge\TflexCodexBridge.csproj /p:Configuration=Release /p:TflexCadDir="D:\Apps\T-FLEX CAD 17\Program"The default path is:
C:\Program Files\T-FLEX CAD 17\Program
Run PowerShell as Administrator if your T-FLEX installation is under Program Files.
.\install-tflex-plugin.ps1For a custom T-FLEX installation path:
.\install-tflex-plugin.ps1 -TflexRoot "D:\Apps\T-FLEX CAD 17"Launch T-FLEX CAD. The bridge plugin should auto-start and listen on:
http://127.0.0.1:38517/command
cd mcp
npm startor:
node .\server.jsCopy examples/codex-mcp.example.json into your MCP client's configuration and replace:
C:\Path\To\tflex-codex-mcp\mcp\server.js
with the absolute path on your machine.
tflex_bridge_pingtflex_bridge_calltflex_active_documenttflex_open_documenttflex_list_variablestflex_set_variabletflex_create_variabletflex_rebuildtflex_savetflex_save_astflex_exporttflex_execute_csharptflex_launch
gui_list_windowsgui_focus_windowgui_screenshot_windowgui_clickgui_hotkeygui_type_text
| Variable | Default | Description |
|---|---|---|
TFLEX_BRIDGE_URL |
http://127.0.0.1:38517/command |
Local bridge endpoint exposed by the T-FLEX plugin. |
TFLEX_MCP_TMP |
OS temp directory | Temporary folder for screenshots and helper scripts. |
TFLEX_EXE_PATH |
C:\Program Files\T-FLEX CAD 17\Program\TFlexCad.exe |
Optional T-FLEX executable path used by tflex_launch. |
Ask your MCP client:
Check whether the T-FLEX bridge is running.
List variables in the active T-FLEX document.
Create a variable named Width with value 120 and rebuild the model.
Export the active document as STEP to C:\Temp\part.stp.
Make sure T-FLEX CAD is running and the bridge plugin is installed. Then check:
Invoke-RestMethod -Method Post `
-Uri http://127.0.0.1:38517/command `
-ContentType application/json `
-Body '{"command":"ping","args":{}}'Build with a custom TflexCadDir:
msbuild bridge\TflexCodexBridge.csproj /p:TflexCadDir="C:\Your\T-FLEX\Program"Run PowerShell as Administrator or install to a T-FLEX location where your user account has write permission.
The bridge listens only on 127.0.0.1. It is intended for local automation on a trusted machine. The tflex_execute_csharp tool compiles and runs C# code inside the T-FLEX process, so expose this MCP server only to clients you trust.
MIT. See LICENSE.