Skip to content

arch: add process/container isolation for MCP tool bridges #3229

Closed

Description

@mrveiss

Problem

AutoBot's MCP bridges run as in-process FastAPI endpoints, aggregated by api/mcp_registry.py. All bridges share the same backend process. If a bridge executes heavy or misbehaving tool logic (filesystem operations, browser automation, external process calls), it can affect the latency and stability of the entire backend.

Specific risks:

  • A blocking call in one bridge stalls other requests on the same event loop
  • An exception in a bridge that isn't caught cleanly can corrupt shared state
  • No resource limits per tool category — one runaway tool can exhaust memory/CPU for all

Desired State

MCP bridges that execute external tools, run subprocesses, or perform I/O-heavy work should run in isolated processes (subprocess or container), communicating with the main backend over a defined transport (stdin/stdout MCP protocol, or lightweight HTTP).

Bridges with no side effects (pure computation, in-memory lookups) can remain in-process.

Isolation Candidates

Bridge Risk Suggested Isolation
api/filesystem_mcp.py File I/O, path traversal risk Subprocess with chroot
api/browser_mcp.py External process, network Subprocess or container
api/vnc_mcp.py Network I/O Subprocess
api/knowledge_mcp.py In-memory, ChromaDB In-process OK
api/sequential_thinking_mcp.py Pure computation In-process OK

Affected Files

  • autobot-backend/api/mcp_registry.py
  • autobot-backend/services/mcp_dispatch.py
  • autobot-backend/api/filesystem_mcp.py
  • autobot-backend/api/browser_mcp.py
  • autobot-backend/api/vnc_mcp.py
  • autobot-backend/skills/sync/mcp_transport.py

Acceptance Criteria

  • High-risk bridges execute in isolated process or container
  • Backend stability unaffected by a misbehaving bridge
  • MCP registry and dispatcher unchanged from the caller's perspective
  • Resource limits (CPU/memory) configurable per bridge category

Activity

  1. github-actions commented on Apr 10, 2026

    @github-actions
    Contributor

    PR #4089 (merged to Dev_new_gui) references this issue with a close keyword.

    arch(mcp): add process/container isolation for MCP tool bridges

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  2. mrveiss commented on Apr 12, 2026

    @mrveiss
    OwnerAuthor

    All acceptance criteria from PR #4089 are met and merged to Dev_new_gui (commit 9840c93):

    • High-risk bridges (filesystem_mcp, browser_mcp, vnc_mcp) execute in isolated subprocess with RLIMIT_CPU/RLIMIT_AS/RLIMIT_NOFILE/RLIMIT_NPROC
    • Backend stability protected via circuit breaker + SIGKILL + auto-restart (restart budget)
    • MCP registry and dispatcher caller surface unchanged
    • Resource limits configurable per bridge via MCP_BRIDGE_CPU_LIMIT, MCP_BRIDGE_MEM_LIMIT_MB, MCP_BRIDGE_NOFILE_LIMIT, MCP_BRIDGE_RESTART_MAX env vars (and per-bridge overrides)
    • Docker compose overlay with cgroup limits, read-only root, cap_drop ALL available in docker/mcp-bridges.yml
    • Systemd unit template in autobot-mcp-bridge@.service.j2

    Closing as fully resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions