Companion MCP服务器

用于Bitfocus Companion的MCP服务器,使AI助手能够控制按钮、触发器、变量和连接。

  • by yannisgu
  • TypeScript
  • 本地部署
  • 4 星标
  • 更新于
在 GitHub 查看 yannisgu/companion-mcp-server

使用说明

配套MCP服务器

MCP(模型上下文协议)服务器 Bitfocus伴侣,使AI助手能够控制按钮、触发器、变量和连接。

特性

  • 连接:列出连接及其动作/反馈定义
  • 变量:列出、搜索、获取值、创建和设置自定义变量
  • 页面和按钮:创建、配置和按下带有操作和反馈的按钮
  • 触发器:创建、克隆、更新和批量更新触发器,完全支持事件、条件、操作和集合

安装

无需安装-直接使用npx运行:

npx companion-mcp-server [companion-url]

或全局安装:

npm install -g companion-mcp-server

配置

克劳德桌面

添加到您的Claude Desktop配置中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "companion": {
      "command": "npx",
      "args": ["-y", "companion-mcp-server", "http://localhost:8889"]
    }
  }
}

克劳德代码

添加到您的Claude Code MCP设置中(~/.claude/settings.json):

{
  "mcpServers": {
    "companion": {
      "command": "npx",
      "args": ["-y", "companion-mcp-server", "http://localhost:8889"]
    }
  }
}

或添加到特定项目 .claude/settings.json 在您的项目根目录中。

光标

添加到Cursor的MCP配置(~/.cursor/mcp.json):

{
  "mcpServers": {
    "companion": {
      "command": "npx",
      "args": ["-y", "companion-mcp-server", "http://localhost:8889"]
    }
  }
}

帆板运动

添加到Windsurf的MCP配置(~/.codeium/windsurf/mcp_config.json):

{
  "mcpServers": {
    "companion": {
      "command": "npx",
      "args": ["-y", "companion-mcp-server", "http://localhost:8889"]
    }
  }
}

自定义伴侣URL

替换 http://localhost:8889 如果Companion实例在其他主机或端口上运行,请使用您的Companion实例URL:

"args": ["-y", "companion-mcp-server", "http://192.168.1.100:8889"]

环境变量

您还可以通过环境变量设置URL:

{
  "mcpServers": {
    "companion": {
      "command": "npx",
      "args": ["-y", "companion-mcp-server"],
      "env": {
        "COMPANION_URL": "http://localhost:8889"
      }
    }
  }
}

可用工具

变量

工具 说明
list_variables 列出按连接分组的所有变量定义
search_variables 按名称/标签模式搜索变量
get_variable_value 获取变量的当前值
create_custom_variable 创建新的自定义变量
set_custom_variable 设置自定义变量的值

连接

工具 说明
list_connections 列出所有已配置的连接及其ID和状态
list_connection_definitions 获取连接的操作/反馈定义

页面和按钮

工具 说明
list_pages 列出所有带有按钮网格的页面
create_page 在某个位置创建新页面
remove_page 删除页面及其所有控件
set_page_name 重命名页面
move_page 将页面移动到其他位置
clear_page 将页面重置为默认值
get_button 获取按钮的完整配置
create_button 在某个位置创建一个新按钮
delete_button 删除按钮
update_button 更新按钮样式、操作和反馈
press_button 模拟按钮按下/释放

触发器

工具 说明
list_triggers 列出所有包含集合信息的触发器
list_trigger_collections 列出所有触发器集合
get_trigger 获取触发器的完整配置
create_trigger 使用可选的内联配置创建触发器
clone_trigger 克隆具有选项覆盖的现有触发器
update_trigger 使用多个操作更新触发器
batch_update_triggers 批量更新多个触发器
create_trigger_collection 创建触发器集合
delete_trigger 删除触发器

资源

服务器为快速上下文公开MCP资源:

资源 描述
companion://guide MCP工具使用指南
companion://connections 配置的连接摘要
companion://presets 按连接可用的按钮预设

例子

创建一个切换到相机1的按钮

1. Use list_connections to find your ATEM connection ID
2. Use list_connection_definitions with that ID to find the "program" action
3. Use create_button to create a button at page 1, row 0, column 0
4. Use update_button with set_style (text: "CAM 1") and add_action (the program action with input: 1)

克隆多个摄像头的触发器

1. Use get_trigger to inspect an existing camera trigger
2. Use clone_trigger with the source trigger ID, new name, and optionOverrides to change the camera number
3. Repeat for each camera, or use batch_update_triggers for bulk operations

搜索计数变量

Use search_variables with query "tally" to find all tally-related variables across connections

发展

# Clone the repo
git clone https://github.com/yannisgu/companion-mcp-server.git
cd companion-mcp-server

# Install dependencies
yarn install

# Run in development mode
yarn dev

# Build for production
yarn build:ts

需求

许可证

麻省理工学院