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. /agents/x/stream, /route/history/x, /mcp/...). In "scoped" mode the allowlist is deliberately tight - the chat client only ever needs agent inference, read-only agent metadata, this plugin’s own OBO/resource-scoped /route/* routes, and (when enabled) MCP - so the whole admin / mutating / bulk-export surface Mastra also exposes is denied by default rather than enumerated.

string

string

MastraApiGateOptions

boolean