@usewhisper/mcp-server 2.7.0 → 2.8.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.
Files changed (2) hide show
  1. package/dist/server.js +55 -11
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -3069,6 +3069,19 @@ var WhisperContext = class _WhisperContext {
3069
3069
  }
3070
3070
  ]);
3071
3071
  }
3072
+ async listMemories(params) {
3073
+ const projectRef = this.getRequiredProject(params.project);
3074
+ return this.withProjectRefFallback(projectRef, async (project) => {
3075
+ const query = new URLSearchParams({
3076
+ project,
3077
+ ...params.user_id ? { user_id: params.user_id } : {},
3078
+ ...params.session_id ? { session_id: params.session_id } : {},
3079
+ ...params.agent_id ? { agent_id: params.agent_id } : {},
3080
+ limit: String(Math.min(Math.max(params.limit ?? 200, 1), 200))
3081
+ });
3082
+ return this.request(`/v1/memories?${query.toString()}`, { method: "GET" });
3083
+ });
3084
+ }
3072
3085
  async addMemory(params) {
3073
3086
  const projectRef = this.getRequiredProject(params.project);
3074
3087
  return this.withProjectRefFallback(projectRef, async (project) => {
@@ -3919,6 +3932,21 @@ async function resolveProjectRef(explicit) {
3919
3932
  return void 0;
3920
3933
  }
3921
3934
  }
3935
+ async function ingestSessionWithSyncFallback(params) {
3936
+ try {
3937
+ return await whisper.ingestSession({
3938
+ ...params,
3939
+ async: false,
3940
+ write_mode: "sync"
3941
+ });
3942
+ } catch (error) {
3943
+ const message = String(error?.message || error || "").toLowerCase();
3944
+ if (!message.includes("sync_write_restricted")) {
3945
+ throw error;
3946
+ }
3947
+ return whisper.ingestSession(params);
3948
+ }
3949
+ }
3922
3950
  function defaultMcpUserId() {
3923
3951
  const explicit = process.env.WHISPER_USER_ID?.trim();
3924
3952
  if (explicit) return explicit;
@@ -5148,8 +5176,12 @@ server.tool(
5148
5176
  },
5149
5177
  async ({ project, title, content, ingestion_profile, strategy_override, profile_config }) => {
5150
5178
  try {
5179
+ const resolvedProject = await resolveProjectRef(project);
5180
+ if (!resolvedProject) {
5181
+ return { content: [{ type: "text", text: "Error: No project resolved. Set WHISPER_PROJECT or provide project." }] };
5182
+ }
5151
5183
  await whisper.addContext({
5152
- project,
5184
+ project: resolvedProject,
5153
5185
  title,
5154
5186
  content,
5155
5187
  metadata: {
@@ -5290,7 +5322,7 @@ server.tool(
5290
5322
  content: message.content,
5291
5323
  timestamp: message.timestamp
5292
5324
  }));
5293
- const result = await whisper.ingestSession({
5325
+ const result = await ingestSessionWithSyncFallback({
5294
5326
  project: scope.project,
5295
5327
  session_id: scope.sessionId,
5296
5328
  user_id: scope.userId,
@@ -5404,8 +5436,12 @@ server.tool(
5404
5436
  },
5405
5437
  async ({ project, session_id, title, expiry_days }) => {
5406
5438
  try {
5439
+ const resolvedProject = await resolveProjectRef(project);
5440
+ if (!resolvedProject) {
5441
+ return { content: [{ type: "text", text: "Error: No project resolved. Set WHISPER_PROJECT or provide project." }] };
5442
+ }
5407
5443
  const result = await whisper.createSharedContext({
5408
- project,
5444
+ project: resolvedProject,
5409
5445
  session_id,
5410
5446
  title,
5411
5447
  expiry_days
@@ -5660,13 +5696,11 @@ server.tool(
5660
5696
  let memories = [];
5661
5697
  if (resolvedProject) {
5662
5698
  try {
5663
- const m = await whisper.searchMemoriesSOTA({
5699
+ const listed = await whisper.listMemories({
5664
5700
  project: resolvedProject,
5665
- query: "memory",
5666
- top_k: 100,
5667
- include_relations: true
5701
+ limit: 200
5668
5702
  });
5669
- memories = (m.results || []).map((r) => r.memory || r);
5703
+ memories = Array.isArray(listed?.memories) ? listed.memories : [];
5670
5704
  } catch {
5671
5705
  memories = [];
5672
5706
  }
@@ -5757,7 +5791,7 @@ server.tool(
5757
5791
  session_summaries: 0,
5758
5792
  documents: 0
5759
5793
  };
5760
- const resolvedProject = await resolveProjectRef(bundle.project);
5794
+ const resolvedProject = await resolveProjectRef(bundle.project || cachedProjectRef || DEFAULT_PROJECT || void 0);
5761
5795
  async function shouldSkipImportedMemory(memory) {
5762
5796
  if (dedupe_strategy === "none" || !resolvedProject) return false;
5763
5797
  const exactId = normalizeString2(memory?.id);
@@ -6711,7 +6745,13 @@ server.tool(
6711
6745
  content,
6712
6746
  timestamp
6713
6747
  });
6714
- const result = await whisper.ingestSession({ project, session_id, user_id, messages: normalizedMessages });
6748
+ const resolvedProject = await resolveProjectRef(project);
6749
+ const result = await ingestSessionWithSyncFallback({
6750
+ project: resolvedProject,
6751
+ session_id,
6752
+ user_id,
6753
+ messages: normalizedMessages
6754
+ });
6715
6755
  return primaryToolSuccess({
6716
6756
  tool: "record",
6717
6757
  session_id,
@@ -6769,7 +6809,11 @@ server.tool(
6769
6809
  },
6770
6810
  async ({ project, session_id, title, expiry_days }) => {
6771
6811
  try {
6772
- const result = await whisper.createSharedContext({ project, session_id, title, expiry_days });
6812
+ const resolvedProject = await resolveProjectRef(project);
6813
+ if (!resolvedProject) {
6814
+ return primaryToolError("No project resolved. Set WHISPER_PROJECT or provide project.");
6815
+ }
6816
+ const result = await whisper.createSharedContext({ project: resolvedProject, session_id, title, expiry_days });
6773
6817
  return primaryToolSuccess({
6774
6818
  tool: "share_context",
6775
6819
  share_id: result.share_id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usewhisper/mcp-server",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "whisperContractVersion": "2026.03.10",
5
5
  "scripts": {
6
6
  "build": "tsup ../src/mcp/server.ts --format esm --out-dir dist",