Consent and scoping

From RedHatProductSecurity/prodsec-skills · View interactive version

Consent and scoping is an AI agent skill from the GitHub repository RedHatProductSecurity/prodsec-skills. Enforce granular OAuth scopes and explicit user consent in MCP servers. Use when designing, building, or reviewing MCP server permission models, scope definitions, or consent flows.

How to use this skill

Skill file

Consent and Granular Scoping for MCP Servers

Security Requirement

MCP servers MUST implement granular OAuth scopes and ensure users explicitly consent to them. Scopes should map to specific tool capabilities, not broad "access everything" permissions.

Granular Scope Design

Define scopes at the tool and action level:

| Scope | Permission |

|---|---|

| email.send | Send emails via the email tool |

| email.read | Read emails via the email tool |

| files.read | Read files via the filesystem tool |

| files.write | Write files via the filesystem tool |

| database.query | Execute read-only database queries |

| database.modify | Execute write database operations |

Avoid overly broad scopes like tools.all or admin that grant blanket access.

Explicit Consent

Users MUST explicitly consent to the scopes being requested. The consent flow should:

  1. Clearly describe what each scope allows
  2. Let users see the specific tools and actions being authorized
  3. Allow users to selectively grant or deny individual scopes
  4. Record consent decisions for audit purposes

Confused Deputy Prevention

Granular scoping prevents confused deputy attacks where an MCP server is tricked into performing unauthorized actions:

Implementation Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.