McpCaller class

The authenticated caller of the request currently being handled.

Handler signatures carry no request context, so the server publishes the caller on the zone for the duration of one request — the same mechanism the in-flight operation already uses. Tool, resource, and prompt handlers all read it the same way, no matter how many async hops from the dispatch:

final caller = McpCaller.current;
if (caller == null) return denied;          // anonymous
if (!caller.hasScope('knowledge:write')) return denied;

The server never interprets the token: AuthContext.userInfo is whatever the host's TokenValidator returned.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

current AuthContext?
The caller for the request in flight, or null for an anonymous one.
no setter