B&R Automation Studio MCP Server

B&R Automation Studio MCP Server

Enables AI assistants to interact with B\&R Automation Studio projects by building code, running ARsim simulators, and reading or writing OPC UA variables. It facilitates industrial automation development and real-time variable integration through natural language commands.

Category
访问服务器

README

B&R Automation Studio MCP Server

An MCP (Model Context Protocol) server that enables AI assistants like Claude to interact with B&R Automation Studio projects. Build projects, run simulators, and read/write OPC UA variables - all through natural language.

Features

  • Build Projects - Compile Automation Studio projects for simulation
  • Run Simulator - Launch ARsim and connect automatically
  • OPC UA Integration - Read and write PLC variables in real-time

Prerequisites

  • Windows 10/11 with B&R Automation Studio 4.x installed
  • Python 3.10+ on Windows (with pip)
  • Claude Code (native Windows or WSL2)

Installation

1. Clone this repository

git clone https://github.com/AndrewMusser/br-automation-mcp.git
cd br-automation-mcp

2. Install Python dependencies

pip install -r requirements.txt

3. Configure server settings

Edit server.py to match your environment:

3a. B&R Tool Paths

Update these paths to match your Automation Studio installation:

AS_BUILD_PATH = "C:\\BrAutomation\\AS412\\bin-en\\BR.AS.Build.exe"
PVI_TRANSFER_PATH = "C:\\BrAutomation\\PVI\\V4.12\\PVI\\Tools\\PVITransfer\\PVITransfer.exe"

Common installation locations:

  • AS 4.12: C:\BrAutomation\AS412\bin-en\BR.AS.Build.exe
  • AS 4.9: C:\BrAutomation\AS49\bin-en\BR.AS.Build.exe
  • PVI: Typically under C:\BrAutomation\PVI\V4.x\PVI\Tools\PVITransfer\

3b. OPC UA Parameters

Configure the OPC UA connection settings for communicating with ARsim:

OPCUA_HOST = "localhost"
OPCUA_PORT = 4840
OPCUA_USERNAME = "Admin"
OPCUA_PASSWORD = "password"

Important: These credentials must match your Automation Studio project's OPC UA configuration:

  • User/role settings: Physical/<Config>/<CPU>/AccessAndSecurity/UserRoleSystem/
  • OPC UA config: Physical/<Config>/<CPU>/Connectivity/OpcUA/

4. Configure Claude Code

Choose the setup that matches how you run Claude Code:


Option A: Native Windows (Recommended)

Claude Code now runs natively on Windows via Git Bash, PowerShell, or CMD. This is the simplest setup since both Claude Code and Automation Studio run on the same machine.

Install Claude Code on Windows:

winget install Anthropic.ClaudeCode

Configuration file: %APPDATA%\Claude\settings.json

Add to settings:

{
  "mcpServers": [
    {
      "name": "br-automation-mcp",
      "type": "stdio",
      "command": "python",
      "args": ["D:\\path\\to\\br-automation-mcp\\server.py"],
      "enabled": true
    }
  ]
}

Architecture:

┌─────────────────────────────────────────────────────────────┐
│  Windows                                                    │
│                                                             │
│  ┌─────────────┐    ┌─────────────────────────────────────┐ │
│  │ Claude Code │───▶│  server.py (MCP STDIO Server)       │ │
│  │ (Git Bash)  │    └───────────────┬─────────────────────┘ │
│  └─────────────┘                    │                       │
│                                     │                       │
│         ┌───────────────────────────┼───────────────┐       │
│         ▼                           ▼               ▼       │
│  ┌─────────────┐          ┌──────────────┐  ┌─────────┐     │
│  │ BR.AS.Build │          │ PVITransfer  │  │  OPC UA │     │
│  │   (Build)   │          │  (Simulate)  │  │  (Test) │     │
│  └─────────────┘          └──────────────┘  └─────────┘     │
└─────────────────────────────────────────────────────────────┘

Option B: WSL2 (Cross-Platform)

If you run Claude Code in WSL2, it can invoke the Windows Python server via PowerShell interop.

Configuration file: ~/.claude/settings.json

Add to settings:

{
  "mcpServers": [
    {
      "name": "br-automation-mcp",
      "type": "stdio",
      "command": "powershell.exe",
      "args": [
        "-ExecutionPolicy",
        "Bypass",
        "-File",
        "D:\\path\\to\\br-automation-mcp\\run-server.ps1"
      ],
      "enabled": true
    }
  ]
}

Architecture:

┌─────────────────────────────────────────────────────────────┐
│  WSL2 (Linux)                                               │
│  ┌─────────────────┐                                        │
│  │   Claude Code   │                                        │
│  │                 │──── powershell.exe ────┐               │
│  └─────────────────┘                        │               │
└─────────────────────────────────────────────│───────────────┘
                                              │
┌─────────────────────────────────────────────│───────────────┐
│  Windows                                    ▼               │
│  ┌─────────────────┐    ┌─────────────────────────────────┐ │
│  │  run-server.ps1 │───▶│  server.py (MCP STDIO Server)   │ │
│  └─────────────────┘    └───────────────┬─────────────────┘ │
│                                         │                   │
│         ┌───────────────────────────────┼───────────────┐   │
│         ▼                               ▼               ▼   │
│  ┌─────────────┐              ┌──────────────┐  ┌─────────┐ │
│  │ BR.AS.Build │              │ PVITransfer  │  │  ARsim  │ │
│  │   (Build)   │              │  (Simulate)  │  │ (OPC UA)│ │
│  └─────────────┘              └──────────────┘  └─────────┘ │
└─────────────────────────────────────────────────────────────┘

5. Restart Claude Code

After updating the configuration, restart Claude Code to load the MCP server.

Available Tools

build_automation_studio_project

Compiles an Automation Studio project for simulation.

Parameters:

  • project_file - Path to the .apj file (Windows path)
  • configuration - Name of the configuration to build

Example prompt: "Build my project at D:\Projects\MyApp\MyApp.apj using the X20CPU configuration"

run_automation_studio_simulator

Creates ARsim structure and launches the simulator.

Parameters:

  • ruc_package - Path to RUCPackage.zip (generated by build)
  • start_simulator - Whether to start immediately (default: true)

Example prompt: "Start the simulator using the RUC package at D:\Projects\MyApp\Binaries\X20CPU\X20CP1686X\RUCPackage\RUCPackage.zip"

opcua_read_write

Reads or writes OPC UA variables on the running simulator.

Parameters:

  • node_id - OPC UA node identifier (e.g., ns=6;s=::TaskName:varName)
  • operation - "read" or "write"
  • value - Value to write (for write operations)
  • value_type - Data type: Boolean, Int16, Int32, Float, Double, String

Example prompts:

  • "Read the temperature variable from the TempCtrl task"
  • "Set the targetTemp to 75.0 in the TempCtrl task"

OPC UA Node ID Format

For task-local variables:

ns=6;s=::<TaskName>:<VariableName>

For global variables:

ns=6;s=::AsGlobalPV:<VariablePath>

Note: Variables must be exposed in the OPC UA configuration (OpcUaMap.uad) to be accessible.

Troubleshooting

"Command not found" errors

Ensure Python is in your Windows PATH and the B&R tool paths in server.py are correct.

OPC UA connection failures

  • Verify the simulator is running
  • Check that variables are exposed in OpcUaMap.uad
  • Default credentials are Admin/password

WSL2 can't find powershell.exe

Ensure WSL2 has Windows interop enabled (default). Check with:

which powershell.exe

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

Acknowledgments

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选