Skip to content

Function: isMastraRequestAllowed()

isMastraRequestAllowed(method, path, opts): boolean

Whether a request to the stock @mastra/express sub-app should be dispatched, given the configured MastraApiGateOptions.access.

path is mount-relative (what the plugin’s catch-all sees, e.g. /chat/x, /memory/threads, /mcp/...). In "scoped" mode the allowlist is deliberately tight - the chat client only ever needs agent inference, read-only agent metadata, resource-scoped memory, this plugin’s own /route/* routes, and (when enabled) MCP. The remaining admin, mutating, and bulk-export surface stays denied by default.

string

string

MastraApiGateOptions

boolean