Since v1.12.0 meta.origin === 'agent' is stamped by the core,
from the __origin key createMcpHandler puts in the payload it
dispatches — so this plugin has nothing left to do and is a no-op kept for
one release.
It used to work off a module-level boolean raised around the handler's
dispatch call, which was exact on a sync bus and wrong on an async one: any
LOCAL dispatch entering the plugin chain while an MCP tool call was awaiting
an async handler got stamped 'agent' too. The doc admitted it ("advisory,
not a security boundary") — but the first thing anyone builds on origin
is an audit trail or a permission gate, which is exactly the consumer that
needs it exact, on exactly the bus type where it wasn't. A marker that
travels ON the dispatch cannot be misattributed by interleaving.
Remove the bus.use(agentOrigin(), ...) line; the stamp arrives without it.
Deprecated
Since v1.12.0
meta.origin === 'agent'is stamped by the core, from the__originkey createMcpHandler puts in the payload it dispatches — so this plugin has nothing left to do and is a no-op kept for one release.It used to work off a module-level boolean raised around the handler's dispatch call, which was exact on a sync bus and wrong on an async one: any LOCAL dispatch entering the plugin chain while an MCP tool call was awaiting an async handler got stamped
'agent'too. The doc admitted it ("advisory, not a security boundary") — but the first thing anyone builds onoriginis an audit trail or a permission gate, which is exactly the consumer that needs it exact, on exactly the bus type where it wasn't. A marker that travels ON the dispatch cannot be misattributed by interleaving.Remove the
bus.use(agentOrigin(), ...)line; the stamp arrives without it.