OBS MCP

OBS MCP

Enables AI assistants to control and automate OBS Studio via natural language, covering scenes, sources, audio, recording, streaming, transitions, filters, media playback, diagnostics, and multi-step workflows over the OBS WebSocket protocol.

Category
访问服务器

README

OBS MCP — AI Broadcast Control & Automation for OBS Studio

An MCP (Model Context Protocol) server that turns an AI assistant into an AI broadcast operator for OBS Studio. Describe what you want in natural language — the server handles scenes, sources, audio, recording, streaming, transitions, filters, media playback, diagnostics and multi-step workflows over the OBS WebSocket 5.x protocol.

AI Assistant (Claude, opencode, Cursor, ...)
        │  MCP (stdio / sse / streamable-http)
        ▼
    OBS MCP Server
    ┌─────────────────────────────┐
    │ Control / Monitoring        │
    │ Diagnostics / Automation    │
    │ Safety layer (confirmation) │
    └──────────────┬──────────────┘
                   │ OBS WebSocket (default port 4455)
                   ▼
              OBS Studio
           (obs-websocket)

89 tools, 107 tests, no OBS required to run the test suite.


Table of contents

  1. What you can do
  2. Requirements
  3. Setup OBS (do this first)
  4. Installation
  5. Configuration
  6. Connecting an AI assistant (MCP client)
  7. Running the server
  8. Safety model
  9. Example session
  10. Testing
  11. Project structure
  12. Troubleshooting

What you can do

Connection & status get_obs_status · get_obs_stats · obs_help

Scene management list_scenes · get_current_scene · switch_scene · create_scene · rename_scene · delete_scene · duplicate_scene · get_scene_sources · add_source_to_scene · remove_source_from_scene

Source (input) management list_sources · get_source · get_source_available_kinds · create_source · update_source · delete_source · duplicate_source · show_source · hide_source · set_source_visibility_in_all_scenes

Positioning & layout get_source_transform · set_source_transform (move / scale / rotate / crop) · set_source_index (z-order)

Transitions & studio mode get_transitions · set_scene_transition · set_transition_duration · get_studio_mode_status · set_studio_mode · set_preview_scene · trigger_transition

Audio list_audio_sources · get_audio_status · get_volume · set_volume · mute_source · unmute_source · set_audio_monitor · set_audio_sync_offset · set_audio_track

Filters list_filters · add_filter · remove_filter · get_filter_settings · set_filter_settings · reorder_filters · toggle_filter

Recording & replay buffer get_recording_status · start_recording · stop_recording · pause_recording · resume_recording · get_record_directory · set_record_directory · get_replay_buffer_status · start_replay_buffer · stop_replay_buffer · save_replay_buffer

Streaming get_stream_status · start_stream · stop_stream · get_stream_health · get_stream_service_settings · set_stream_settings · get_output_settings · set_output_settings

Media & VLC playback media_control (play / pause / stop / restart / next / previous) · get_media_time · set_media_time

Hotkeys & configuration get_hotkey_list · trigger_hotkey · get_video_settings · set_video_settings · list_profiles · set_current_profile · create_profile · list_scene_collections · set_current_scene_collection · create_scene_collection

Diagnostics diagnose_obs (full health check) · diagnose_stream · diagnose_recording · diagnose_audio

Automation workflows prepare_recording · prepare_stream · start_recording_session · end_session


Requirements

  • Python 3.10+
  • OBS Studio (any recent version — 28+; tested on 32.x) with the built-in WebSocket server enabled
  • One of these AI assistants (any MCP client works):
    • opencode
    • Claude Desktop
    • Cursor
    • Any MCP-capable client

Setup OBS (do this first)

  1. Install OBS Studio from obsproject.com.
  2. Enable the WebSocket server:
    • OBS menu: Tools → WebSocket Server Settings…
    • Check Enable WebSocket server
    • Note the Server Port (default 4455)
    • Check Require authentication and set a password — the server refuses to connect without credentials for security reasons. Save it; you will need it in the next step.
  3. Prepare your scenes and sources (optional but recommended):
    • Create scenes (e.g. Intro, Coding, BrB) via Scene dock or + button in the Sources dock.
    • Add sources (webcam, display capture, audio, media) and arrange them.
    • If you plan to use the automation workflows, decide which scene is the "recording scene" and which is the "stream scene".
  4. Leave OBS running while you use the AI assistant. The server connects lazily and reconnects automatically if OBS restarts.
  5. (Optional) To verify everything works before wiring the AI assistant, run the included demo client — see Testing.

Installation

git clone <this-repo> && cd obs-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

This installs the obs-mcp command into the virtual environment (.venv/bin/obs-mcp). All examples below assume the venv is active or use the full path .venv/bin/obs-mcp.

Configuration

Copy the example file and fill in your OBS WebSocket password:

cp .env.example .env
# edit .env, set OBS_PASSWORD to the password you configured in OBS

The server reads the .env file in the project directory, plus any OBS_* environment variables you export (environment variables win).

Variable Default Description
OBS_HOST localhost OBS WebSocket host
OBS_PORT 4455 OBS WebSocket port (must match Tools → WebSocket Server Settings)
OBS_PASSWORD (empty) WebSocket auth password — required when OBS requires authentication
OBS_REQUIRE_CONFIRMATION_HIGH true Gate high-risk ops (stream start/stop, deletes) behind confirm=True
OBS_REQUIRE_CONFIRMATION_MEDIUM false Gate medium-risk ops (audio, recording) behind confirm=True
OBS_CONNECT_TIMEOUT 5 Seconds to wait for a connection attempt
OBS_RECORDING_SCENE (empty) Scene used by prepare_recording / start_recording_session (empty = current scene)
OBS_STREAM_SCENE (empty) Scene used by prepare_stream (empty = current scene)
OBS_LOG_LEVEL INFO Logging verbosity: DEBUG, INFO, WARNING, ERROR

Security note

OBS_PASSWORD is the same credential that grants full control of your OBS instance (start streams, delete scenes). Never commit it to version control (.env is git-ignored), and use a strong password if your machine is network-exposed.


Connecting an AI assistant (MCP client)

opencode

Add a mcp entry to opencode.json (usually ~/.config/opencode/opencode.json):

{
  "mcp": {
    "obs-mcp": {
      "type": "local",
      "command": [
        "/path/to/obs-mcp/.venv/bin/obs-mcp"
      ],
      "enabled": true,
      "environment": {
        "OBS_HOST": "localhost",
        "OBS_PORT": "4455",
        "OBS_PASSWORD": "your-obs-websocket-password"
      }
    }
  }
}

Restart opencode, then ask it things like "check OBS status".

Claude Desktop

Add to claude_desktop_config.json (Claude → Settings → Developer):

{
  "mcpServers": {
    "obs-mcp": {
      "command": "/path/to/obs-mcp/.venv/bin/obs-mcp",
      "args": [],
      "env": {
        "OBS_HOST": "localhost",
        "OBS_PORT": "4455",
        "OBS_PASSWORD": "your-obs-websocket-password"
      }
    }
  }
}

Other clients (Cursor, VS Code, generic)

Point the client at the stdio binary. If your client only supports HTTP servers, run the server with --transport sse or --transport streamable-http and give it the URL of the running server.


Running the server

The server is normally launched by your MCP client, but you can also run it standalone to check it starts cleanly:

obs-mcp                          # stdio transport (default, what MCP clients use)
obs-mcp --transport sse          # SSE HTTP transport
obs-mcp --transport streamable-http
python -m server.mcp_server      # equivalent to obs-mcp

A successful stdio start prints nothing but the MCP handshake — clients usually show the server as connected. You can verify OBS connectivity by calling get_obs_status from your assistant, or by running the demo client (needs OBS running):

python examples/demo_client.py

Safety model

Operations are classified by risk in server/safety/permissions.py:

Level Examples Default policy
Low status, lists, get_*, switch scene, show/hide source runs automatically
Medium volume/mute, create/rename scene, source settings, recording runs automatically (can be gated via OBS_REQUIRE_CONFIRMATION_MEDIUM=true)
High start/stop stream, delete scene/source, end_session requires confirm=true

High-risk tools return confirmation_required unless the caller passes confirm=True — i.e. the AI asks the human first, then proceeds only with explicit confirmation.


Example session

User: Check OBS.

AI: OBS is connected. Current scene: Coding. Microphone: Active. Webcam: Active. Recording: OFF. Streaming: OFF.

User: Add a camera in the bottom-right corner of Scene 2 with a full-screen background.

AI: creates a Background color source (1920×1080) and the webcam source, then positions the camera at the bottom-right using set_source_transform.

User: Prepare my coding recording.

AI: calls prepare_recording, reports the setup summary.

User: Everything looks good. Start recording.

AI: calls start_recording_session with confirm=True after asking, confirms, and reports the recording is live.

User: Stop recording and give me a summary.

AI: calls end_session, returns duration and the saved file path.


Testing

pip install -e ".[dev]"
pytest

Run the tests from the project root. The suite (107 tests) runs against an in-memory fake OBS — no OBS needed — plus one end-to-end test over the real stdio MCP transport.


Project structure

obs-mcp/
├── server/
│   ├── mcp_server.py        # MCP wiring, tool registration, entry point
│   ├── obs_client.py        # OBS WebSocket connection, auth, reconnect, helpers
│   ├── config.py            # OBS_* environment configuration
│   ├── tools/               # one module per feature area
│   │   ├── scenes.py  sources.py  audio.py
│   │   ├── recording.py  streaming.py  transitions helpers
│   │   ├── media.py  filters.py  config.py
│   │   ├── diagnostics.py  automation.py
│   ├── safety/permissions.py  # risk classification + confirmation policy
│   └── models/responses.py    # structured tool responses
├── tests/                   # pytest suite with an in-memory fake OBS
├── examples/demo_client.py  # stdio demo client
├── pyproject.toml
├── features.txt             # full feature checklist
└── .env.example

Troubleshooting

Problem Fix
get_obs_status reports "Could not reach OBS" OBS not running, or WebSocket server disabled (Tools → WebSocket Server Settings → Enable WebSocket server)
Authentication failed OBS_PASSWORD does not match the password in OBS WebSocket settings — check both, restart OBS after changing it
Connection refused on a remote machine Check OBS_HOST/OBS_PORT; make sure the port is reachable and OBS is listening on it
Tools return confirmation_required The operation is high-risk — pass confirm=true to execute it
set_source_transform does nothing Keys are snake_case (position_x, scale_y, bounds_width, …); the server converts them for the OBS protocol
Media source won't play media_control uses OBS_WEBSOCKET_MEDIA_INPUT_ACTION_* actions on media-capable sources (ffmpeg_source / VLC); set_media_time needs the source playing or paused
Assistant can't find the tools after adding the server Restart the MCP client so it re-reads the config
Tests fail when run from another directory Always run pytest from the project root

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选