DEV Community

Discussion on: I Built and Authorized a Planning Agent with MCP and Keycard

Collapse
 
narnaiezzsshaa profile image
Narnaiezzsshaa Truong

This is a really thoughtful treatment of OAuth delegation and least-privilege—especially compared to the usual "just give the agent a long-lived token" pattern.

One thing I want to flag for readers planning to move this toward production: this architecture meaningfully improves identity and token handling, but it does not make the overall agent system "secure" in the broader sense.

In particular, the stack here still has:
— An unconstrained LLM reasoning loop (planning, re-planning, tool selection)
— No deterministic guardrails on multi-step tool-call sequences
— An agent that can read/write its own local state store
— No substrate-level containment or formal policy enforcement on agent behavior

That's not a criticism of this post—it's doing a great job at the OAuth/delegation layer. I just want beginners and implementers to be careful not to equate:

"Secure token issuance and least-privilege access" ≡ "Secure agent infrastructure suitable for production autonomy."

If you treat this as a secure way to delegate OAuth access to an otherwise non-contained agent, it's a strong pattern. If you treat it as a generally secure agent architecture for production deployment, you're going to miss the reasoning loop itself as an attack surface—and that's where the real exposure lives.

Collapse
 
kimmaida profile image
Kim Maida

Great callout and distinction. It's not end-to-end security, by any means. You'd certainly want to use something like Promptfoo for that. I didn't in this case because it's a personal, local tool I'm not exposing to the public internet. I'm the only person who uses it. There's an entire host of production deployment security horrors awaiting anyone who assumes not addressing the things you mentioned is okay to do in a deployed production multi-tenant version of this. I hope I was clear about the intent of this project and its scope, but it probably does bear repeating.