@contextstream/mcp-server 0.4.38 → 0.4.40

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/index.js +9 -98
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14545,16 +14545,14 @@ Use this in combination with session_init(is_post_compact=true) for seamless con
14545
14545
  structuredContent: toStructured(response2)
14546
14546
  };
14547
14547
  }
14548
- const listResult = await client.listMemoryEvents({
14548
+ const searchResult = await client.searchEvents({
14549
14549
  workspace_id: workspaceId,
14550
14550
  project_id: projectId,
14551
- limit: 50
14552
- // Fetch more to filter
14551
+ query: "session_snapshot",
14552
+ event_types: ["session_snapshot"],
14553
+ limit: input.max_snapshots || 1
14553
14554
  });
14554
- const allEvents = listResult?.data?.items || listResult?.items || listResult?.data || [];
14555
- const events = allEvents.filter(
14556
- (e) => e.event_type === "session_snapshot" || e.metadata?.original_type === "session_snapshot" || e.metadata?.tags?.includes("session_snapshot") || e.tags?.includes("session_snapshot")
14557
- ).slice(0, input.max_snapshots || 1);
14555
+ const events = searchResult?.data?.results || searchResult?.results || searchResult?.data || [];
14558
14556
  if (!events || events.length === 0) {
14559
14557
  return {
14560
14558
  content: [
@@ -16576,7 +16574,7 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16576
16574
  "session",
16577
16575
  {
16578
16576
  title: "Session",
16579
- description: `Session management operations. Actions: capture (save decision/insight), capture_lesson (save lesson from mistake), get_lessons (retrieve lessons), recall (natural language recall), remember (quick save), user_context (get preferences), summary (workspace summary), compress (compress chat), delta (changes since timestamp), smart_search (context-enriched search), decision_trace (trace decision provenance), restore_context (restore state after compaction). Plan actions: capture_plan (save implementation plan), get_plan (retrieve plan with tasks), update_plan (modify plan), list_plans (list all plans).`,
16577
+ description: `Session management operations. Actions: capture (save decision/insight), capture_lesson (save lesson from mistake), get_lessons (retrieve lessons), recall (natural language recall), remember (quick save), user_context (get preferences), summary (workspace summary), compress (compress chat), delta (changes since timestamp), smart_search (context-enriched search), decision_trace (trace decision provenance). Plan actions: capture_plan (save implementation plan), get_plan (retrieve plan with tasks), update_plan (modify plan), list_plans (list all plans).`,
16580
16578
  inputSchema: external_exports.object({
16581
16579
  action: external_exports.enum([
16582
16580
  "capture",
@@ -16594,9 +16592,7 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16594
16592
  "capture_plan",
16595
16593
  "get_plan",
16596
16594
  "update_plan",
16597
- "list_plans",
16598
- // Context restore
16599
- "restore_context"
16595
+ "list_plans"
16600
16596
  ]).describe("Action to perform"),
16601
16597
  workspace_id: external_exports.string().uuid().optional(),
16602
16598
  project_id: external_exports.string().uuid().optional(),
@@ -16618,8 +16614,7 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16618
16614
  "lesson",
16619
16615
  "warning",
16620
16616
  "frustration",
16621
- "conversation",
16622
- "session_snapshot"
16617
+ "conversation"
16623
16618
  ]).optional().describe("Event type for capture"),
16624
16619
  importance: external_exports.enum(["low", "medium", "high", "critical"]).optional(),
16625
16620
  tags: external_exports.array(external_exports.string()).optional(),
@@ -16669,10 +16664,7 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16669
16664
  status: external_exports.enum(["draft", "active", "completed", "archived", "abandoned"]).optional().describe("Plan status"),
16670
16665
  due_at: external_exports.string().optional().describe("Due date for plan (ISO timestamp)"),
16671
16666
  source_tool: external_exports.string().optional().describe("Tool that generated this plan"),
16672
- include_tasks: external_exports.boolean().optional().describe("Include tasks when getting plan"),
16673
- // Restore context params
16674
- snapshot_id: external_exports.string().uuid().optional().describe("Specific snapshot ID to restore (defaults to most recent)"),
16675
- max_snapshots: external_exports.number().optional().default(1).describe("Number of recent snapshots to consider (default: 1)")
16667
+ include_tasks: external_exports.boolean().optional().describe("Include tasks when getting plan")
16676
16668
  })
16677
16669
  },
16678
16670
  async (input) => {
@@ -16978,87 +16970,6 @@ Output formats: full (default, includes content), paths (file paths only - 80% t
16978
16970
  structuredContent: toStructured(result)
16979
16971
  };
16980
16972
  }
16981
- case "restore_context": {
16982
- if (!workspaceId) {
16983
- return errorResult(
16984
- "restore_context requires workspace_id. Call session_init first."
16985
- );
16986
- }
16987
- if (input.snapshot_id) {
16988
- const eventResult = await client.getEvent(input.snapshot_id);
16989
- const event = eventResult?.data || eventResult;
16990
- if (!event || !event.content) {
16991
- return errorResult(
16992
- `Snapshot not found: ${input.snapshot_id}. The snapshot may have been deleted or does not exist.`
16993
- );
16994
- }
16995
- let snapshotData;
16996
- try {
16997
- snapshotData = JSON.parse(event.content);
16998
- } catch {
16999
- snapshotData = { conversation_summary: event.content };
17000
- }
17001
- const response2 = {
17002
- restored: true,
17003
- snapshot_id: event.id,
17004
- captured_at: snapshotData.captured_at || event.created_at,
17005
- ...snapshotData,
17006
- hint: "Context restored. Continue the conversation with awareness of the above state."
17007
- };
17008
- return {
17009
- content: [{ type: "text", text: formatContent(response2) }],
17010
- structuredContent: toStructured(response2)
17011
- };
17012
- }
17013
- const listResult = await client.listMemoryEvents({
17014
- workspace_id: workspaceId,
17015
- project_id: projectId,
17016
- limit: 50
17017
- // Fetch more to filter
17018
- });
17019
- const allEvents = listResult?.data?.items || listResult?.items || listResult?.data || [];
17020
- const snapshotEvents = allEvents.filter(
17021
- (e) => e.event_type === "session_snapshot" || e.metadata?.original_type === "session_snapshot" || e.metadata?.tags?.includes("session_snapshot") || e.tags?.includes("session_snapshot")
17022
- ).slice(0, input.max_snapshots || 1);
17023
- if (!snapshotEvents || snapshotEvents.length === 0) {
17024
- return {
17025
- content: [
17026
- {
17027
- type: "text",
17028
- text: formatContent({
17029
- restored: false,
17030
- message: "No session snapshots found. Use session_capture_smart to save state before compaction.",
17031
- hint: "Start fresh or use session_init to get recent context."
17032
- })
17033
- }
17034
- ]
17035
- };
17036
- }
17037
- const snapshots = snapshotEvents.map((event) => {
17038
- let snapshotData;
17039
- try {
17040
- snapshotData = JSON.parse(event.content || "{}");
17041
- } catch {
17042
- snapshotData = { conversation_summary: event.content };
17043
- }
17044
- return {
17045
- snapshot_id: event.id,
17046
- captured_at: snapshotData.captured_at || event.created_at,
17047
- ...snapshotData
17048
- };
17049
- });
17050
- const response = {
17051
- restored: true,
17052
- snapshots_found: snapshots.length,
17053
- latest: snapshots[0],
17054
- all_snapshots: snapshots.length > 1 ? snapshots : void 0,
17055
- hint: "Context restored. Continue the conversation with awareness of the above state."
17056
- };
17057
- return {
17058
- content: [{ type: "text", text: formatContent(response) }],
17059
- structuredContent: toStructured(response)
17060
- };
17061
- }
17062
16973
  default:
17063
16974
  return errorResult(`Unknown action: ${input.action}`);
17064
16975
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
3
  "mcpName": "io.github.contextstreamio/mcp-server",
4
- "version": "0.4.38",
4
+ "version": "0.4.40",
5
5
  "description": "ContextStream MCP server - v0.4.x with consolidated domain tools (~11 tools, ~75% token reduction). Code context, memory, search, and AI tools.",
6
6
  "type": "module",
7
7
  "license": "MIT",