xs-studio-mcp
MCP server for XS Studio that integrates with CODESYS toolkit and adds a custom create_dut tool, enabling project management, code generation, and DUT creation workflows.
README
xs-studio-mcp
xs-studio-mcp is a Model Context Protocol server for XS Studio.exe. It keeps the public MCP interface of @codesys/mcp-toolkit, and adds an XS-specific create_dut tool for ST / FB / DUT generation workflows.
What it exposes
- Resources
codesys://project/statuscodesys://project/{+project_path}/structurecodesys://project/{+project_path}/pou/{+pou_path}/code
- Toolkit-compatible tools
open_projectcreate_projectsave_projectcreate_pouset_pou_codecreate_propertycreate_methodcompile_project
- XS extension
create_dut
Prerequisites
- XS Studio with scripting support
- Default executable path on this machine:
D:\Program Files\XS Studio\CODESYS\Common\XS Studio.exe - Default detected profile:
XS Studio V2.3.2
- Default executable path on this machine:
- Python 3.11
Setup
uv python install 3.11
uv venv --python 3.11 .venv
uv pip install --python .\.venv\Scripts\python.exe -e .
Run
.\.venv\Scripts\xs-studio-mcp-tool.exe
By default each script call starts XS Studio and closes the launched process after the script reports completion. On this XS Studio build, project scripting works more reliably with the visible UI than with --noUI:
$env:XS_STUDIO_RUN_WITH_UI = "1"
To avoid opening one XS Studio window per MCP tool call, enable the reusable scripting agent. The first call opens one MCP-managed XS Studio window; later calls reuse that window through a temp-file request queue:
$env:XS_STUDIO_RUN_WITH_UI = "1"
$env:XS_STUDIO_REUSE_WINDOW = "1"
The agent files are stored under %TEMP%\xs_studio_mcp_agent\... by default. Override that with XS_STUDIO_AGENT_DIR if needed. To stop the reusable agent, close the XS Studio window, create a file named stop inside the agent directory, or run examples\packml\stop_xs_agent.cmd.
Optional flags:
.\.venv\Scripts\xs-studio-mcp-tool.exe `
--codesys-path "D:\Program Files\XS Studio\CODESYS\Common\XS Studio.exe" `
--codesys-profile "XS Studio V2.3.2" `
--workspace "D:\Projects\XS-MCP" `
--template-path "C:\Users\zhouweihai\Desktop\未命名2\未命名2.project"
Cursor / Claude MCP config
See docs/mcpServers.sample.json.
The local-repo form is:
{
"mcpServers": {
"xs_studio_local": {
"command": "D:\\Projects\\XS-MCP\\.venv\\Scripts\\xs-studio-mcp-tool.exe",
"args": [
"--codesys-path",
"D:\\Program Files\\XS Studio\\CODESYS\\Common\\XS Studio.exe",
"--codesys-profile",
"XS Studio V2.3.2",
"--workspace",
"D:\\Projects\\XS-MCP",
"--template-path",
"C:\\Users\\zhouweihai\\Desktop\\未命名2\\未命名2.project"
]
}
}
}
Demo project
The demo project lives at examples/hello_xs/HelloXs.project. create_project defaults to C:\Users\zhouweihai\Desktop\未命名2\未命名2.project on this machine, and falls back to XS Studio Standard.project if no configured template is available. The demo is then extended with:
Application/MAINApplication/FB_DemoApplication/FB_Demo/ExecuteApplication/FB_Demo/StateApplication/DUT_RunMode
PackML demo:
examples\packml\run_packml_demo_admin.cmd
This demo runs elevated, enables XS_STUDIO_REUSE_WINDOW=1, creates a timestamped project under examples\packml, and should leave only one MCP-managed XS Studio window open.
Troubleshooting
- Path with spaces
- This implementation quotes executable, profile, and script paths explicitly. Keep
--codesys-path,--codesys-profile, and--workspaceas separate MCP args in client config.
- This implementation quotes executable, profile, and script paths explicitly. Keep
- Wrong profile
- Verify
--codesys-profilematches the installed profile name exactly.
- Verify
- Script engine failure
- Check tool output for
SCRIPT_ERRORdetails and verify XS Studio scripting is installed.
- Check tool output for
- Compile failure
compile_projectinspects XS Studio message objects after the build and returns MCP error output when compiler errors are present.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。