Documentation
¶
Overview ¶
Package emauth provides MCP Enterprise-Managed Authorization support for mcp-google: audit logging and scope-based tool gating driven by the identity verified from an ID-JAG-derived access token.
The identity (subject, RFC 8693 act delegation chain, scope) is placed in the request context by omniskill's ExternalBearerMiddleware; this package consumes it at the MCP method layer via a receiving middleware.
Index ¶
Constants ¶
const ( ScopeDocs = "docs:read" ScopeSheets = "sheets:read" ScopeSlides = "slides:read" ScopeDrive = "drive:read" // ScopeDriveWrite authorizes the write tools, which exist only when the // server is started with --enable-write. ScopeDriveWrite = "drive:write" )
Scopes understood by mcp-google. When the verified token carries a scope claim, every tool call requires the tool's mapped scope; tokens without a scope claim are not gated (identity is still audit-logged).
Variables ¶
This section is empty.
Functions ¶
func HasScope ¶
HasScope reports whether the space-delimited scope string contains the required scope.
func Middleware ¶
func Middleware(logger *slog.Logger) mcp.Middleware
Middleware returns an MCP receiving middleware that audit-logs the verified identity on every tool call and, when the token carries a scope claim, denies calls to unmapped tools and calls whose token scope does not cover the tool's mapped scope. Non-tool methods pass through untouched.
func RequiredScope ¶
RequiredScope returns the policy scope that authorizes the tool with the given exact name, and whether the tool is mapped at all. Unmapped tools report ok == false and are denied when a scope claim is present.
func ToolScopes ¶ added in v0.5.0
ToolScopes returns a copy of the tool → scope authorization map.
Types ¶
This section is empty.