Add MCP server actions limits #216
Replies: 4 comments
|
This problem is exactly what gets surfaced the moment agents start calling write-side payment APIs autonomously, and it doesn't really resolve at the MCP-server layer alone — the agent ends up sitting between an LLM (which can be jailbroken or misread instructions) and a payments API (which is non-reversible). Restricted keys help, but they're a coarse instrument: they say "this key can do refunds", not "this key can do at most 5 refunds totaling under $X today, only for customers in this allowlist". I've been working on this from the agent-side governance angle (project: PayJarvis, https://github.com/Josepassinato/payjarvis-core, Apache 2.0). The pattern that turned out to matter in practice maps cleanly to what you're describing:
The reason I think this lives partially outside Stripe (or any single payment provider) is that owners typically run agents that touch multiple destinations — Stripe for refunds, Shopify for orders, AWS for infra, etc. — and they want one consistent policy/audit trail across all of them. But there's also a clear case for Stripe-native MCP-level limits (rate limit, daily cap, simulation mode) for the specific Stripe surface, and I'd +1 that strongly. Happy to share the BDIT spec or compare notes if useful: https://github.com/Josepassinato/payjarvis-core/blob/main/docs/bdit-spec/BDIT-SPEC.md — José Passinato (PayJarvis) |
|
For payment-side tools, I would not rely on the restricted key alone. The key defines which API families are technically reachable, but the missing control is an action envelope around each agent task. A useful design is to make the MCP server or gateway enforce a policy object before every write-side call: subject, intent, exact resource scope, max amount, max count, aggregate window, retry limit, idempotency key, approval threshold, and evidence fields. That prevents the “refund all charges” failure mode because even if the agent loops, the gateway sees the second, third, or thousandth refund attempt as outside the approved envelope. I would also add a dry-run mode for high-impact actions: the agent can propose affected payments or subscriptions, but execution requires a separate approval bound to those exact IDs and amounts. |
|
This is the right failure mode to model: restricted keys define reachable API families, but they do not fully define the authorized action envelope for an autonomous agent. For write-side payment actions, I would separate three layers:
A minimal policy object for the “refund all charges” case could be: agent_action_envelope:
action: refund_payment
scope:
customer_ids: [explicit IDs only]
payment_ids: [explicit IDs only]
limits:
max_refund_count: 1
max_total_amount: "100.00"
currency: USD
window: per_task
controls:
dry_run_required: true
owner_approval_required_above: "0.00"
idempotency_key_required: true
loop_detection: block_after_first_unapproved_attempt
evidence:
approval_source: human | policy_engine
audit_record_required: true
revocation_path: reduce_key_or_disable_policyThe important boundary is that the agent should first produce the candidate affected objects in dry-run mode. Execution should require a separate approval bound to those exact IDs and amounts. If the model loops or broadens the scope, the second call falls outside the envelope and blocks. For docs, a short “before enabling write-side MCP tools” checklist could help operators:
This stays secret-free: no API keys, customer data, or payment credentials need to be shared to define the envelope. |
|
I like the direction of the policy and envelope ideas above. The one split I would keep very clear is that the limit object should not become the proof of authority. Limits and policies can say what the agent is allowed to try, but for something like a mass refund I would want the first tool call to stop at a dry run and show the exact customers, payments, amounts, and reason. Execution should need a separate receipt for that exact set before anything moves. If the agent changes scope, retries with different parameters, or broadens the list, the receipt no longer matches and the payment call does not go through. That keeps Stripe keys and MCP permissions focused on what the agent can reach, policies focused on what it should stay within, and the receipt focused on the human question that matters later. Who approved exactly what before money moved. |
Uh oh!
There was an error while loading. Please reload this page.
Scenario
I want to let AI agents interact with the MCP Server having autonomy to make refunds, cancel subscriptions, and so on.
What can I do right now: Enable the Stripe MCP server in my account, create a restricted key allowing these kind of actions, configure my agent with that MCP server and API key.
Problem
I am not limiting the option that the agent refunds the last 1.000 payments, cancels all the active subscriptions, or any other harmful action.
How this could be possible:
Ideas
One solution could be something like being able to limit the amount of refunds to perform per day via MCP + having thresholds for warnings in these kind of operations.
It would be similar to managing spending limits in server providers such as Vercel. Some kind of "Stripe MCP server limits" configuration page with options for the different write permissions such as:
10refunds perday.75%of that limit.Thanks!
All reactions