@wrongstack/sage-mcp 0.306.0 → 0.306.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/adapter.d.ts CHANGED
@@ -24,6 +24,23 @@ import type { MemoryPort } from '@wrongstack/core/types';
24
24
  import { type SageServiceLike } from '@wrongstack/sage';
25
25
  import { type SageMcpPolicyOptions } from './policy.js';
26
26
  export interface SageMcpToolHostOptions extends SageMcpPolicyOptions {
27
+ /**
28
+ * Project root the served memory belongs to, used for the synthetic
29
+ * `Context`. Defaults to `process.cwd()`.
30
+ *
31
+ * The CLI already requires and canonicalizes `--project-root` to build the
32
+ * port, so defaulting the Context to the server's cwd meant the two could
33
+ * disagree: every tool would be told it was operating on whatever directory
34
+ * the MCP server happened to be launched from. No SAGE tool reads
35
+ * `ctx.projectRoot` today — the store resolves anchors against its OWN root
36
+ * (`SqliteCreateCandidateContext`), and the middleware that does read it
37
+ * (`path-remap`, `tool-call-memory`) only runs in the agent loop, never
38
+ * here — so this is a trap rather than a live defect. It is worth closing
39
+ * anyway: a tool that later reads the field would mis-resolve paths
40
+ * silently, and "silently anchored to the wrong root" is not a failure that
41
+ * announces itself.
42
+ */
43
+ projectRoot?: string | undefined;
27
44
  }
28
45
  /**
29
46
  * Resolve the SAGE service capability from any `MemoryPort`. Both
package/dist/cli.js CHANGED
@@ -80,7 +80,7 @@ function createSageMcpToolHost(port, opts = {}) {
80
80
  const allTools = createSageTools(service);
81
81
  const allowed = selectAllowedTools(allTools, opts);
82
82
  const allowedByName = new Map(allowed.map((entry) => [entry.name, entry.tool]));
83
- const ctx = createSyntheticContext();
83
+ const ctx = createSyntheticContext(opts.projectRoot);
84
84
  const ac = new AbortController();
85
85
  const signal = ac.signal;
86
86
  function jsonSchemaToObject(schema) {
@@ -127,11 +127,12 @@ function createSageMcpToolHost(port, opts = {}) {
127
127
  }
128
128
  };
129
129
  }
130
- function createSyntheticContext() {
130
+ function createSyntheticContext(projectRoot) {
131
+ const root = projectRoot ?? process.cwd();
131
132
  return {
132
133
  systemPrompt: [],
133
- cwd: process.cwd(),
134
- projectRoot: process.cwd(),
134
+ cwd: root,
135
+ projectRoot: root,
135
136
  allowOutsideProjectRoot: false,
136
137
  model: "sage-mcp",
137
138
  tools: [],
@@ -254,7 +255,7 @@ async function main() {
254
255
  );
255
256
  return 3;
256
257
  }
257
- const server = createSageMcpServer(port, { writable: args.writable });
258
+ const server = createSageMcpServer(port, { writable: args.writable, projectRoot });
258
259
  if (args.transport === "http") {
259
260
  const handle2 = await serveHttp(server, {
260
261
  port: args.httpPort,
package/dist/index.js CHANGED
@@ -70,7 +70,7 @@ function createSageMcpToolHost(port, opts = {}) {
70
70
  const allTools = createSageTools(service);
71
71
  const allowed = selectAllowedTools(allTools, opts);
72
72
  const allowedByName = new Map(allowed.map((entry) => [entry.name, entry.tool]));
73
- const ctx = createSyntheticContext();
73
+ const ctx = createSyntheticContext(opts.projectRoot);
74
74
  const ac = new AbortController();
75
75
  const signal = ac.signal;
76
76
  function jsonSchemaToObject(schema) {
@@ -117,11 +117,12 @@ function createSageMcpToolHost(port, opts = {}) {
117
117
  }
118
118
  };
119
119
  }
120
- function createSyntheticContext() {
120
+ function createSyntheticContext(projectRoot) {
121
+ const root = projectRoot ?? process.cwd();
121
122
  return {
122
123
  systemPrompt: [],
123
- cwd: process.cwd(),
124
- projectRoot: process.cwd(),
124
+ cwd: root,
125
+ projectRoot: root,
125
126
  allowOutsideProjectRoot: false,
126
127
  model: "sage-mcp",
127
128
  tools: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/sage-mcp",
3
- "version": "0.306.0",
3
+ "version": "0.306.2",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack SAGE Memory as an MCP (Model Context Protocol) server: STDIO and loopback HTTP, additive to the existing SAGE IPC server.",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "!dist/**/*.map"
32
32
  ],
33
33
  "dependencies": {
34
- "@wrongstack/sage": "0.306.0",
35
- "@wrongstack/mcp": "0.306.0",
36
- "@wrongstack/core": "0.306.0"
34
+ "@wrongstack/mcp": "0.306.2",
35
+ "@wrongstack/sage": "0.306.2",
36
+ "@wrongstack/core": "0.306.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26.1.2",