Skip to content

Bug: MCP dispatch fallback doesn't forward user role for RBAC filtering #2629

@mrveiss

Description

@mrveiss

Problem

The _try_mcp_dispatch() function in chat_workflow/tool_handler.py (#2513) calls dispatcher.dispatch(tool_name, arguments) without passing the user's role. The RBAC filtering added in #2598 defaults role="user", so admin users can't access admin-only MCP tools (client_list, slowlog, etc.) through the chat dispatch path.

The user's role is available in the session/workflow context but isn't threaded through to the MCP dispatcher.

Fix

  1. Pass user role from the session context into _try_mcp_dispatch()
  2. Thread it through to dispatcher.dispatch(tool_name, arguments, role=user_role)
  3. Also pass to _get_mcp_tools_prompt() in ChatAgent so admin users see admin tools in their prompt

Files Affected

  • autobot-backend/chat_workflow/tool_handler.py_try_mcp_dispatch() and _dispatch_tool_call()
  • autobot-backend/agents/chat_agent.py_get_mcp_tools_prompt() and process_chat_message()

Discovered During

Review of #2596/#2598 implementation.

Impact

Medium — RBAC filtering works but admin users are incorrectly restricted to user-level tools.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions