feat(mcp): built-in playbooks get steward_url from Steward itself
CI / lint (push) Successful in 3s
CI / integration (push) Successful in 48s
CI / unit (push) Successful in 1m11s
CI / publish (push) Successful in 1m23s

#5015 "Built-in host-agent playbooks make an MCP caller supply steward_url"

- run_playbook, create_schedule and set_alert_action fill a steward-builtin
  playbook's steward_url when the caller leaves it out or empty, from
  Settings → General → Public base URL, else the scheme and host the MCP
  request arrived on — the same source the web actions use.
- run_playbook's reply names what it filled (filled_by_steward), and
  get_playbook shows that value as the variable's default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 10:30:23 -04:00
co-authored by Claude Opus 5.5
parent 06e89308a8
commit 1d9ac2b46a
4 changed files with 78 additions and 6 deletions
+3
View File
@@ -279,11 +279,14 @@ def mount_mcp(app) -> StewardMCPServer:
caller_token = _context._caller_ctx.set(caller)
app_token = _context._app_ctx.set(app)
host = headers.get("host", "")
url_token = _context._base_url_ctx.set(f"{scope.get('scheme', 'http')}://{host}" if host else "")
try:
await mcp_asgi(scope, receive, send)
finally:
_context._caller_ctx.reset(caller_token)
_context._app_ctx.reset(app_token)
_context._base_url_ctx.reset(url_token)
original_asgi = app.asgi_app