include/entropic/mcp/permission_manager.h

← API

include/entropic/mcp/permission_manager.h

entropic::PermissionManager

Permission manager for MCP tool access control.

entropic::PermissionManager::PermissionManager(std::vector< std::string > allow_patterns={}, std::vector< std::string > deny_patterns={})

Construct with initial allow/deny lists.

Parameters
  • allow_patterns — Allow list patterns.
  • deny_patterns — Deny list patterns.

bool entropic::PermissionManager::is_denied(const std::string &tool_name, const std::string &pattern) const

Check if a tool call is explicitly denied.

Consulted before the allow list, so deny takes precedence whenever both lists match the same call.

Parameters
  • tool_name — Fully-qualified tool name (e.g., "filesystem.read_file").
  • pattern — Tool pattern with args (e.g., "filesystem.read_file:/path").
  • tool_name — Fully-qualified tool name (<server>.<tool>).
  • pattern — The <tool>:<args-summary> pattern for this call.
Returns
  • true if denied.
  • true when any deny pattern matches (the match is logged); false when the deny list is empty or nothing matches. A false here is NOT an approval — the engine's callback still prompts.

bool entropic::PermissionManager::is_allowed(const std::string &tool_name, const std::string &pattern) const

Check if a tool call is explicitly allowed (skip prompting).

Check if a tool call is explicitly allowed.

Parameters
  • tool_name — Fully-qualified tool name.
  • pattern — Tool pattern with args.
  • tool_name — Fully-qualified tool name (<server>.<tool>).
  • pattern — The <tool>:<args-summary> pattern for this call.
Returns
  • true if explicitly in allow list.
  • true when any allow pattern matches (the match is logged); false otherwise. Callers must still honour is_denied(), which wins over any allow match.

void entropic::PermissionManager::add_permission(const std::string &pattern, bool allow)

Add a permission pattern at runtime.

Backs the operator's "always allow / always deny" decision; the new pattern takes effect on the next call. Re-adding an identical pattern is a no-op so repeated approvals do not grow the list.

Parameters
  • pattern — Permission pattern string.
  • allow — true for allow list, false for deny list.
  • pattern — Permission pattern string, at whatever granularity the owning server's get_permission_pattern chose.
  • allow — true to insert into the allow list, false for the deny list.