@mayamemo/mcp 0.1.1 → 0.2.0

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/tools.d.ts CHANGED
@@ -12,6 +12,9 @@ export interface McpDeps {
12
12
  status: number;
13
13
  body: unknown;
14
14
  }>;
15
+ /** Hosted transports pin a default project (most recently active in the workspace)
16
+ * so remote agents can omit project_id entirely. */
17
+ fallbackProjectId?: string;
15
18
  }
16
19
  export interface McpToolResult {
17
20
  text: string;
package/dist/tools.js CHANGED
@@ -63,8 +63,9 @@ function entityRefs(args, key, cap) {
63
63
  }
64
64
  /** project_id is optional: an explicit value wins; otherwise fall back to the
65
65
  * project linked to the working directory (MAYAMEMO_PROJECT_ID env or the
66
- * nearest .mayamemo/project.json). */
67
- function resolveProjectId(args) {
66
+ * nearest .mayamemo/project.json), then to the transport's fallback (hosted
67
+ * MCP pins the workspace's most recently active project). */
68
+ function resolveProjectId(args, deps) {
68
69
  const raw = args.project_id;
69
70
  if (raw !== undefined && raw !== null) {
70
71
  if (typeof raw !== 'string')
@@ -73,10 +74,14 @@ function resolveProjectId(args) {
73
74
  if (trimmed.length > 0 && !isPlaceholderProjectId(trimmed))
74
75
  return trimmed;
75
76
  }
77
+ // Hosted transports pin their default first: on a shared server the process
78
+ // cwd/env is meaningless (it belongs to the server, not the caller).
79
+ if (deps.fallbackProjectId)
80
+ return deps.fallbackProjectId;
76
81
  const mapped = resolveDefaultProjectId();
77
82
  if (mapped)
78
83
  return mapped;
79
- throw new ToolInputError('No MayaMemo project is linked to this folder. Run `npx -y @mayamemo/cli init` (or `mayamemo install opencode`) in the repo to link one, or pass project_id explicitly.');
84
+ throw new ToolInputError('No MayaMemo project is linked to this folder. Run `npx -y @mayamemo/cli init` (or `mayamemo install opencode`) in the repo to link one, pass project_id explicitly, or use the hosted MCP at mcp.mayamemo.com where your most recently active project is used by default.');
80
85
  }
81
86
  function apiErrorText(status, body) {
82
87
  const error = body.error;
@@ -123,7 +128,7 @@ export const TOOLS = [
123
128
  },
124
129
  async handler(args, deps) {
125
130
  const payload = {
126
- project_id: resolveProjectId(args),
131
+ project_id: resolveProjectId(args, deps),
127
132
  statement: requireString(args, 'statement'),
128
133
  type: requireString(args, 'type'),
129
134
  };
@@ -175,7 +180,7 @@ export const TOOLS = [
175
180
  },
176
181
  async handler(args, deps) {
177
182
  const payload = {
178
- project_id: resolveProjectId(args),
183
+ project_id: resolveProjectId(args, deps),
179
184
  query: requireString(args, 'query'),
180
185
  };
181
186
  const status = optionalString(args, 'status');
@@ -220,7 +225,7 @@ export const TOOLS = [
220
225
  },
221
226
  async handler(args, deps) {
222
227
  const payload = {
223
- project_id: resolveProjectId(args),
228
+ project_id: resolveProjectId(args, deps),
224
229
  title: requireString(args, 'query'),
225
230
  token_budget: Math.min(Math.max(optionalNumber(args, 'token_budget') ?? 4000, 64), 50000),
226
231
  max_items: MAX_CONTEXT_ITEMS,
@@ -280,7 +285,7 @@ export const TOOLS = [
280
285
  required: [],
281
286
  },
282
287
  async handler(args, deps) {
283
- const projectId = resolveProjectId(args);
288
+ const projectId = resolveProjectId(args, deps);
284
289
  const res = await deps.callApi('GET', `/v1/projects/${encodeURIComponent(projectId)}/state`);
285
290
  if (res.status >= 400)
286
291
  return apiErrorText(res.status, res.body);
@@ -318,7 +323,7 @@ export const TOOLS = [
318
323
  },
319
324
  async handler(args, deps) {
320
325
  const payload = {
321
- project_id: resolveProjectId(args),
326
+ project_id: resolveProjectId(args, deps),
322
327
  title: requireString(args, 'title'),
323
328
  summary: requireString(args, 'summary'),
324
329
  };
@@ -383,7 +388,7 @@ export const TOOLS = [
383
388
  required: [],
384
389
  },
385
390
  async handler(args, deps) {
386
- const payload = { project_id: resolveProjectId(args) };
391
+ const payload = { project_id: resolveProjectId(args, deps) };
387
392
  const entities = entityRefs(args, 'entities', 50);
388
393
  if (entities)
389
394
  payload.entities = entities;
@@ -434,7 +439,7 @@ export const TOOLS = [
434
439
  text: `Neighbors of ${graph.root.kind} ${graph.root.name} (${graph.nodes.length} nodes, ${graph.edges.length} edges${graph.truncated ? ', truncated' : ''}):\n${lines.join('\n')}`,
435
440
  };
436
441
  }
437
- const projectId = resolveProjectId(args);
442
+ const projectId = resolveProjectId(args, deps);
438
443
  const params = new URLSearchParams();
439
444
  const q = optionalString(args, 'q');
440
445
  if (q)
@@ -469,7 +474,7 @@ export const TOOLS = [
469
474
  },
470
475
  async handler(args, deps) {
471
476
  const payload = {
472
- project_id: resolveProjectId(args),
477
+ project_id: resolveProjectId(args, deps),
473
478
  filename: requireString(args, 'filename'),
474
479
  content_base64: requireString(args, 'content_base64'),
475
480
  };
@@ -562,7 +567,7 @@ export const TOOLS = [
562
567
  required: [],
563
568
  },
564
569
  async handler(args, deps) {
565
- const payload = { project_id: resolveProjectId(args) };
570
+ const payload = { project_id: resolveProjectId(args, deps) };
566
571
  const agent = optionalString(args, 'agent');
567
572
  if (agent)
568
573
  payload.agent = agent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mayamemo/mcp",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "MayaMemo MCP server — durable project memory, checkpoints and handoffs for coding agents over stdio.",
5
5
  "license": "MIT",
6
6
  "type": "module",