Skip to content

[Feature request] optional spend-gate hook before cost-incurring actions (manage_browsers, browser_pools, shell) #121

Description

@Billionaire664

Is your feature request related to a problem? Please describe.
manage_browsers (and similarly manage_browser_pools, and the shell/Playwright execution tools) call directly into client.browsers.create(...) with no cost or budget check beforehand. For anyone self-hosting this server to drive an autonomous agent, there's currently no way to cap how much an agent can spend on these actions — a stuck loop or a misbehaving agent could spin up unbounded browser sessions with no ceiling at all.

Describe the solution you'd like
An optional, non-breaking spend-gate hook wrapping the cost-incurring tool handlers (manage_browsers create/update, manage_browser_pools, shell command execution). Configured via two optional env vars (e.g. SPEND_GATE_API_KEY, SPEND_GATE_AGENT_ID) — if unset, the server behaves exactly as it does today, zero change in behavior. If set, each cost-incurring action checks against a configurable spend limit before executing, and cleanly denies the action (returning a proper MCP tool error, not a crash) if it would exceed the configured budget.

We build exactly this kind of spend-gating infrastructure for AI agents (https://valta.co) and would be glad to submit a PR implementing this, scoped narrowly to the tools above, fully optional and env-var-gated so it changes nothing for anyone not using it.

Describe alternatives you've considered
Doing this entirely outside the MCP server (e.g. a proxy in front of it) is possible, but a proxy can't distinguish a free action (e.g. listing browsers) from a billed one (creating a browser) without duplicating this server's own routing logic — putting the check at the tool-handler level is more precise and avoids that duplication.

Additional context
Happy to narrow or adjust the exact tools covered based on maintainer feedback before writing the actual PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions