feat(mcp): stdio MCP server exposing the four companion tools
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
18
lib/mcp/context.js
Normal file
18
lib/mcp/context.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Builds the tool ctx object from environment variables.
|
||||
* Used by companion-stdio.js when a tool call arrives, so each call reads
|
||||
* fresh env values (useful if the process restarts or env is injected at launch).
|
||||
*
|
||||
* Environment variables:
|
||||
* VOID_AGENT_JSON – JSON-serialised agent actor object (required for most tools)
|
||||
* VOID_SPACE_ID – UUID of the active space
|
||||
* VOID_VIEW_JSON – JSON-serialised view object (optional)
|
||||
*/
|
||||
export function buildCtxFromEnv(env = process.env) {
|
||||
return {
|
||||
agent: env.VOID_AGENT_JSON ? JSON.parse(env.VOID_AGENT_JSON) : null,
|
||||
space_id: env.VOID_SPACE_ID || null,
|
||||
view: env.VOID_VIEW_JSON ? JSON.parse(env.VOID_VIEW_JSON) : null,
|
||||
actor: { kind: 'user', id: null }
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user