xs-studio-mcp

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.

Category
Visit Server

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/status
    • codesys://project/{+project_path}/structure
    • codesys://project/{+project_path}/pou/{+pou_path}/code
  • Toolkit-compatible tools
    • open_project
    • create_project
    • save_project
    • create_pou
    • set_pou_code
    • create_property
    • create_method
    • compile_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
  • 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/MAIN
  • Application/FB_Demo
  • Application/FB_Demo/Execute
  • Application/FB_Demo/State
  • Application/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 --workspace as separate MCP args in client config.
  • Wrong profile
    • Verify --codesys-profile matches the installed profile name exactly.
  • Script engine failure
    • Check tool output for SCRIPT_ERROR details and verify XS Studio scripting is installed.
  • Compile failure
    • compile_project inspects XS Studio message objects after the build and returns MCP error output when compiler errors are present.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured