sepia-mcp 0.3.1 → 0.4.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/index.js +6 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -611,6 +611,7 @@ MANDATORY WORKFLOW — do this on ALMOST EVERY turn:
611
611
 
612
612
  BEFORE you answer (every turn except trivial chitchat):
613
613
  1. Call "search" with 2-5 keywords from the user's current message + task (e.g. query="auth rate limiting"). If sparse, also call "traverse_graph" from the top entity.
614
+ Search is best-effort: rows matching MORE of your words rank first, so it never returns 0 just because one word is absent. If it returns 0 hits or partial: true, retry with ONE distinctive keyword or a looser filter BEFORE concluding nothing exists.
614
615
  2. Weave hits into your answer ("From your memory: ..."). If nothing, say so — never fabricate.
615
616
 
616
617
  AFTER you answer (every turn where you learned something):
@@ -775,7 +776,7 @@ var ConversationInput = v.object({
775
776
  tags: v.optional(tagsSchema, [])
776
777
  });
777
778
  var SearchInput = v.object({
778
- q: v.pipe(v.string(), v.maxLength(200), v.description("Search query (required; empty returns recent items). Multi-word = AND-of-words; exact phrases rank first")),
779
+ q: v.pipe(v.string(), v.maxLength(200), v.description("Search query (required; empty returns recent items). Multi-word = best-effort: rows matching MORE of your words rank first, so a result set is never emptied by one absent word. Verbatim phrases rank highest. Check `partial` in the result (+ each hit's `matched_terms`) before concluding nothing exists.")),
779
780
  namespace: v.optional(v.pipe(v.string(), v.description("Restrict to a namespace"))),
780
781
  type: v.optional(v.pipe(v.string(), v.maxLength(64), v.description("Memory type (fact/observation/preference/instruction) OR entity type (person/project/tool/concept/repo)"))),
781
782
  tags: v.optional(v.pipe(tagsSchema, v.description("Match memories/entities carrying ALL of these tags"))),
@@ -3551,6 +3552,7 @@ var memories = pgTable("memories", {
3551
3552
  check("memories_importance_check", sql`${table.importance} >= 0 AND ${table.importance} <= 1`),
3552
3553
  check("memories_type_check", sql`${table.type} IN ('fact', 'observation', 'preference', 'instruction')`),
3553
3554
  index("idx_memories_content_trgm").using("gin", table.content.op("gin_trgm_ops")),
3555
+ index("idx_memories_metadata_trgm").using("gin", sql`(COALESCE(${table.metadata}->>'title', '') || ' ' || COALESCE(${table.metadata}->>'conversation_id', '') || ' ' || COALESCE(${table.metadata}->>'source_ai', '')) gin_trgm_ops`),
3554
3556
  index("idx_memories_tags").using("gin", table.tags),
3555
3557
  index("idx_memories_active").on(table.namespaceId.asc().nullsLast().op("uuid_ops"), table.importance.desc().nullsLast().op("float4_ops"), table.updatedAt.desc().nullsLast().op("timestamptz_ops")).where(sql`NOT ${table.archived}`),
3556
3558
  foreignKey({
@@ -8994,19 +8996,19 @@ function registerSearchTools(server, client) {
8994
8996
  server.tool({
8995
8997
  name: "search",
8996
8998
  title: "Search Memory",
8997
- description: "Unified keyword + metadata search across memories, entity names, and entity summaries.",
8999
+ description: "Unified keyword + metadata search across memories, entity names, and entity summaries. Multi-word queries are best-effort: rows matching more of your words rank first, and results are never emptied by one absent word. `partial: true` in the result means no single row covered the whole query.",
8998
9000
  icons: [SEPIA_ICON],
8999
9001
  schema: SearchToolInput,
9000
9002
  annotations: { readOnlyHint: true }
9001
9003
  }, safe(async (args) => {
9002
- const { count, results } = await client.search({
9004
+ const { count, results, terms, partial } = await client.search({
9003
9005
  q: args.q,
9004
9006
  namespace: args.namespace,
9005
9007
  type: args.type,
9006
9008
  tags: args.tags,
9007
9009
  limit: args.limit
9008
9010
  });
9009
- return { count, hits: results };
9011
+ return { count, terms, partial, hits: results };
9010
9012
  }));
9011
9013
  }
9012
9014
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sepia-mcp",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Self-contained MCP server for Sepia — a personal knowledge-graph memory server. Talks to the Sepia REST API (SEPIA_URL + SEPIA_API_KEY); stdio or HTTP transport.",
5
5
  "type": "module",
6
6
  "repository": {