feat(mcp): external registry + agent ctx + Streamable HTTP server
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -16,3 +16,25 @@ export function buildCtxFromEnv(env = process.env) {
|
||||
actor: { kind: 'user', id: null }
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the tool ctx for an authenticated EXTERNAL agent. The Space is taken
|
||||
* from the agent's own scope (never client-supplied) and `spaceScoped` is set
|
||||
* so read() denies entities it can't prove are in-Space.
|
||||
* @param {{id:string, capabilities?:object, scopes?:object}} agent
|
||||
*/
|
||||
export function buildCtxFromAgent(agent) {
|
||||
const actor = {
|
||||
kind: 'agent',
|
||||
id: agent.id,
|
||||
capabilities: agent.capabilities || {},
|
||||
scopes: agent.scopes || {}
|
||||
};
|
||||
return {
|
||||
agent: actor,
|
||||
space_id: (agent.scopes && agent.scopes.space_id) || null,
|
||||
view: null,
|
||||
spaceScoped: true,
|
||||
actor
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user