sepia-mcp 0.9.6 → 0.10.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/README.md +2 -2
- package/dist/index.js +82 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A self-contained MCP server for [Sepia](https://sepia.fly.dev) — your personal
|
|
4
4
|
knowledge-graph memory server. It exposes the **same 7 tools** as the Sepia
|
|
5
|
-
server (`manage_namespace`, `manage_entity`, `manage_relation`,
|
|
6
|
-
`
|
|
5
|
+
server (`wake`, `manage_namespace`, `manage_entity`, `manage_relation`,
|
|
6
|
+
`manage_memory`, `search`, `prune_memories`), but every call is proxied to the
|
|
7
7
|
Sepia REST API. No database, no migrations — just a lightweight MCP wrapper.
|
|
8
8
|
|
|
9
9
|
## Install
|
package/dist/index.js
CHANGED
|
@@ -600,8 +600,8 @@ TYPES — use the canonical values, never invent new ones:
|
|
|
600
600
|
performance) for discovery — add 1-4 per write when the topic is recurring.
|
|
601
601
|
|
|
602
602
|
RULE 0 — THIS IS NOT OPTIONAL. If you skip memory, you WILL hallucinate preferences,
|
|
603
|
-
repeat questions, and contradict past decisions. Using sepia is not a suggestion —
|
|
604
|
-
your first tool
|
|
603
|
+
repeat questions, and contradict past decisions. Using sepia is not a suggestion — "wake"
|
|
604
|
+
then "briefing" are your first two tool calls, in that order, at the top of the session.
|
|
605
605
|
|
|
606
606
|
MANDATORY — ALMOST EVERY MESSAGE: Default to using Sepia on every turn — search BEFORE
|
|
607
607
|
you answer and persist AFTER you answer. Only skip for trivial chitchat ("hi", "thanks",
|
|
@@ -621,10 +621,16 @@ So they are loaded unconditionally, once per session, BEFORE any work starts.
|
|
|
621
621
|
- a rule tagged "always" applies in EVERY repo and EVERY session; a rule that is specific to
|
|
622
622
|
one project must NOT be tagged "always"
|
|
623
623
|
|
|
624
|
-
|
|
624
|
+
WAKE + BRIEFING — ONCE PER SESSION, AT THE TOP OF THE CHAT, BEFORE ANYTHING ELSE.
|
|
625
|
+
Neither step belongs to the every-turn loop below; do not repeat them on later messages.
|
|
625
626
|
|
|
626
|
-
|
|
627
|
-
|
|
627
|
+
0. Call "wake", and retry it until it succeeds. It is the cheapest call in the system and
|
|
628
|
+
the only one whose job is to be retried: the host sleeps when idle, so the first call of
|
|
629
|
+
a chat often lands mid-boot. If it errors or reports ready:false, retry up to 3 times,
|
|
630
|
+
a few seconds apart, before doing anything else. One failed "wake" means you called
|
|
631
|
+
early — NOT that memory is down. Never skip ahead to the briefing on a failed wake, and
|
|
632
|
+
never abandon memory for the rest of the chat because of one failure.
|
|
633
|
+
1. Call manage_memory action=briefing, and treat what it returns as BINDING for the whole
|
|
628
634
|
session. It returns the user's CORE standing rules — the ones that must hold before you
|
|
629
635
|
know anything about the task. The response also reports other_standing: the situational
|
|
630
636
|
rules it did NOT return. BEFORE anything slow, metered, destructive, or expensive (an
|
|
@@ -634,13 +640,15 @@ FIRST — once per session, before your first substantive action (NOT keyword-dr
|
|
|
634
640
|
max_chars at its maximum instead — the full standing set is only ~10k tokens (≈1% of your
|
|
635
641
|
window), it is read once per session, and core-by-default exists to protect small
|
|
636
642
|
contexts, not to withhold rules from big ones. If you don't know your window size, keep
|
|
637
|
-
the default.
|
|
643
|
+
the default. Do NOT call briefing again on later messages in this chat: you already have
|
|
644
|
+
the rules, and re-reading them every turn spends tokens to learn nothing. Re-briefing is
|
|
645
|
+
for a NEW chat only.
|
|
638
646
|
|
|
639
|
-
|
|
640
|
-
|
|
647
|
+
EVERY TURN AFTER THAT (except trivial chitchat) — search before you answer:
|
|
648
|
+
2. Call "search" with 2-5 keywords from the user's current message + task (e.g. query="auth rate limiting"). If sparse, also call manage_relation with action="traverse" (start_id = the top entity, depth 2-3) to pull its neighborhood.
|
|
641
649
|
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.
|
|
642
650
|
DIAGNOSTIC: identical results for different q values = the filter was NOT applied — wrong tool, or a parameter the schema lacks. Check the schema and the response's filters_applied/ignored_args before theorizing about ranking or tokenization. Ranked keyword search lives ONLY in the search tool.
|
|
643
|
-
|
|
651
|
+
3. Weave hits into your answer ("From your memory: ..."). If nothing, say so — never fabricate.
|
|
644
652
|
|
|
645
653
|
AFTER you answer (every turn where you learned something):
|
|
646
654
|
1. If you learned a durable fact — preference, decision + why, project fact, stack/tool choice, person/role, convention, user correction — persist IMMEDIATELY in the same turn after your response:
|
|
@@ -696,15 +704,17 @@ distills — you have the context, you are the best distiller. Rules:
|
|
|
696
704
|
digest first, then update with the full metadata + new status — metadata REPLACES).
|
|
697
705
|
When resuming a paused one, set it back to "active".
|
|
698
706
|
|
|
699
|
-
TRIGGERS —
|
|
700
|
-
|
|
707
|
+
TRIGGERS — at the top of a session, in this order and once each: "wake", then the briefing
|
|
708
|
+
(steps 0-1 above). NEVER a second time on later messages in that chat. Then every turn,
|
|
709
|
+
search when user says: "remember", "recall", "what do we know",
|
|
701
710
|
"save this", "do you remember", prefers, decided, uses, chose, convention.
|
|
702
711
|
ALSO ingest when user says: "save this conversation", "hand off", "migrate context",
|
|
703
712
|
"switch to another AI", "continue this elsewhere".
|
|
704
713
|
|
|
705
714
|
FAILURE MODE: if you answer without searching, you are guessing. If you start work without
|
|
706
715
|
the briefing, you are guessing about how the user wants you to work — which is how you burn
|
|
707
|
-
their bandwidth, their money, or their trust.
|
|
716
|
+
their bandwidth, their money, or their trust. Wake first, then briefing, then search: the
|
|
717
|
+
first two once per session, the last one every turn.`;
|
|
708
718
|
var MEMORY_TYPES = [
|
|
709
719
|
"fact",
|
|
710
720
|
"observation",
|
|
@@ -831,10 +841,6 @@ var SearchInput = v.looseObject({
|
|
|
831
841
|
min_terms: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(50), v.description("Drop hits covering fewer than this many query terms (precision dial; absent = best-effort recall). Too high returns 0 with `terms` present — that is the filter, not a missing memory."))),
|
|
832
842
|
engine: v.optional(v.pipe(v.picklist([...SEARCH_ENGINES]), v.description('Ranking engine: "coverage" (substring, coverage-first), "bm25" (tokenised, BM25-ranked), or "opensearch" (external cluster; falls back to coverage when unavailable or empty). Omit to use the server default.')))
|
|
833
843
|
});
|
|
834
|
-
var TraverseInput = v.looseObject({
|
|
835
|
-
start_id: v.pipe(uuidSchema, v.description("Entity UUID to start the BFS walk from")),
|
|
836
|
-
depth: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(TRAVERSE_DEPTH_MAX), v.description("Walk depth (default 1, max 3)")), 1)
|
|
837
|
-
});
|
|
838
844
|
var NamespaceToolInput = v.looseObject({
|
|
839
845
|
action: v.pipe(v.union([
|
|
840
846
|
v.literal("create"),
|
|
@@ -871,13 +877,20 @@ var EntityToolInput = v.looseObject({
|
|
|
871
877
|
batch_limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(500), v.description("batch_update: max rows to touch (default 100, max 500)")), 100)
|
|
872
878
|
});
|
|
873
879
|
var RelationToolInput = v.looseObject({
|
|
874
|
-
action: v.pipe(v.union([
|
|
880
|
+
action: v.pipe(v.union([
|
|
881
|
+
v.literal("create"),
|
|
882
|
+
v.literal("delete"),
|
|
883
|
+
v.literal("list"),
|
|
884
|
+
v.literal("traverse")
|
|
885
|
+
]), v.description("create (relation) | delete (id) | list (by entity_id or namespace) | traverse (BFS walk from start_id, optional depth 1-3)")),
|
|
875
886
|
relation: v.optional(v.pipe(RelationInput, v.description("Relation to create: {source_id, target_id, relation_type, weight?} — updates weight if the same relation exists"))),
|
|
876
887
|
id: v.optional(v.pipe(uuidSchema, v.description("Relation UUID"))),
|
|
877
888
|
entity_id: v.optional(v.pipe(uuidSchema, v.description("list: filter by entity (in + out)"))),
|
|
878
889
|
namespace: v.optional(v.pipe(v.string(), v.description("list: filter by namespace"))),
|
|
879
890
|
limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(1e4), v.description("list: max rows (default 200, max 10000)")), 200),
|
|
880
|
-
offset: v.optional(v.pipe(v.number(), v.minValue(0), v.description("list: rows to skip (pagination)")), 0)
|
|
891
|
+
offset: v.optional(v.pipe(v.number(), v.minValue(0), v.description("list: rows to skip (pagination)")), 0),
|
|
892
|
+
start_id: v.optional(v.pipe(uuidSchema, v.description("traverse: Entity UUID to start the BFS walk from"))),
|
|
893
|
+
depth: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(TRAVERSE_DEPTH_MAX), v.description("traverse: Walk depth (default 1, max 3)")), 1)
|
|
881
894
|
});
|
|
882
895
|
var MemoryToolInput = v.looseObject({
|
|
883
896
|
action: v.pipe(v.union([
|
|
@@ -914,7 +927,7 @@ var MemoryToolInput = v.looseObject({
|
|
|
914
927
|
batch_limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(500), v.description("batch_update: max rows to touch (default 100, max 500)")), 100)
|
|
915
928
|
});
|
|
916
929
|
var SearchToolInput = SearchInput;
|
|
917
|
-
var
|
|
930
|
+
var WakeToolInput = v.looseObject({});
|
|
918
931
|
var PruneMemoriesToolInput = v.looseObject({
|
|
919
932
|
confirm: v.pipe(v.literal(true), v.description("Must be true. Acknowledges that this archives stale memories and permanently deletes rows archived more than 30 days ago. Set it only after the user explicitly asked for the sweep."))
|
|
920
933
|
});
|
|
@@ -8696,9 +8709,32 @@ buffer/index.js:
|
|
|
8696
8709
|
* @license MIT
|
|
8697
8710
|
*)
|
|
8698
8711
|
*/
|
|
8712
|
+
// ../shared/src/db/lib/list-columns.ts
|
|
8713
|
+
var ENTITY_LIST_COLUMNS = {
|
|
8714
|
+
id: entities.id,
|
|
8715
|
+
name: entities.name,
|
|
8716
|
+
type: entities.type,
|
|
8717
|
+
summary: entities.summary,
|
|
8718
|
+
importance: entities.importance,
|
|
8719
|
+
tags: entities.tags,
|
|
8720
|
+
updatedAt: entities.updatedAt
|
|
8721
|
+
};
|
|
8722
|
+
var MEMORY_LIST_COLUMNS = {
|
|
8723
|
+
id: memories.id,
|
|
8724
|
+
content: memories.content,
|
|
8725
|
+
type: memories.type,
|
|
8726
|
+
importance: memories.importance,
|
|
8727
|
+
tags: memories.tags,
|
|
8728
|
+
archived: memories.archived,
|
|
8729
|
+
updatedAt: memories.updatedAt
|
|
8730
|
+
};
|
|
8731
|
+
var MEMORY_DIGEST_COLUMNS = {
|
|
8732
|
+
...MEMORY_LIST_COLUMNS,
|
|
8733
|
+
metadata: memories.metadata,
|
|
8734
|
+
source: memories.source
|
|
8735
|
+
};
|
|
8699
8736
|
// ../shared/src/db/lib/telemetry.ts
|
|
8700
8737
|
var tierCache = new Map;
|
|
8701
|
-
var PURGE_INTERVAL_MS = 15 * 60000;
|
|
8702
8738
|
var lastPurgeAt = new Map;
|
|
8703
8739
|
// src/client.ts
|
|
8704
8740
|
class SepiaApiError extends Error {
|
|
@@ -8750,6 +8786,9 @@ class SepiaClient {
|
|
|
8750
8786
|
return;
|
|
8751
8787
|
return await res.json();
|
|
8752
8788
|
}
|
|
8789
|
+
wake() {
|
|
8790
|
+
return this.request("GET", "/api/wake");
|
|
8791
|
+
}
|
|
8753
8792
|
listNamespaces() {
|
|
8754
8793
|
return this.request("GET", "/api/namespaces");
|
|
8755
8794
|
}
|
|
@@ -9064,7 +9103,7 @@ function registerRelationTools(server, client) {
|
|
|
9064
9103
|
server.tool({
|
|
9065
9104
|
name: "manage_relation",
|
|
9066
9105
|
title: "Manage Relations",
|
|
9067
|
-
description: "Create, delete, or
|
|
9106
|
+
description: "Create, delete, list, or traverse relations — directed, weighted edges between entities. `traverse` BFS-walks the graph from an entity in both directions.",
|
|
9068
9107
|
icons: [SEPIA_ICON],
|
|
9069
9108
|
schema: RelationToolInput
|
|
9070
9109
|
}, safe(RelationToolInput, async (args) => {
|
|
@@ -9095,6 +9134,16 @@ function registerRelationTools(server, client) {
|
|
|
9095
9134
|
offset: args.offset
|
|
9096
9135
|
})).relations
|
|
9097
9136
|
};
|
|
9137
|
+
case "traverse": {
|
|
9138
|
+
if (!args.start_id)
|
|
9139
|
+
throw new Error("action=traverse requires start_id");
|
|
9140
|
+
const graph = await client.traverseGraph(args.start_id, args.depth);
|
|
9141
|
+
return {
|
|
9142
|
+
action: "traverse",
|
|
9143
|
+
start_id: args.start_id,
|
|
9144
|
+
...graph
|
|
9145
|
+
};
|
|
9146
|
+
}
|
|
9098
9147
|
}
|
|
9099
9148
|
}));
|
|
9100
9149
|
}
|
|
@@ -9219,20 +9268,20 @@ function registerSearchTools(server, client) {
|
|
|
9219
9268
|
}));
|
|
9220
9269
|
}
|
|
9221
9270
|
|
|
9222
|
-
// src/tools/
|
|
9223
|
-
function
|
|
9271
|
+
// src/tools/wake.ts
|
|
9272
|
+
function registerWakeTool(server, client) {
|
|
9224
9273
|
server.tool({
|
|
9225
|
-
name: "
|
|
9226
|
-
title: "
|
|
9227
|
-
description: "
|
|
9274
|
+
name: "wake",
|
|
9275
|
+
title: "Wake Server",
|
|
9276
|
+
description: "Confirm the server and its database are up. Call this FIRST at the top of a chat, before the briefing — the remote host sleeps when idle, so the first call of a conversation often lands during boot and a failure here costs nothing to retry. Returns {awake, ready, server:{version, docs_version, uptime_sec}, db:{ok, latency_ms}, next}. Takes no arguments.",
|
|
9228
9277
|
icons: [SEPIA_ICON],
|
|
9229
|
-
schema:
|
|
9278
|
+
schema: WakeToolInput,
|
|
9230
9279
|
annotations: { readOnlyHint: true }
|
|
9231
|
-
}, safe(
|
|
9232
|
-
const
|
|
9280
|
+
}, safe(WakeToolInput, async (_args) => {
|
|
9281
|
+
const result = await client.wake();
|
|
9233
9282
|
return {
|
|
9234
|
-
|
|
9235
|
-
|
|
9283
|
+
...result,
|
|
9284
|
+
hint: "Succeeded → call manage_memory action=briefing next, once, then search on later turns. Failed → retry this up to 3 times a few seconds apart; do not skip the briefing and do not conclude sepia is down from one failed call."
|
|
9236
9285
|
};
|
|
9237
9286
|
}));
|
|
9238
9287
|
}
|
|
@@ -9253,7 +9302,7 @@ function registerPruneMemoriesTools(server, client) {
|
|
|
9253
9302
|
// package.json
|
|
9254
9303
|
var package_default = {
|
|
9255
9304
|
name: "sepia-mcp",
|
|
9256
|
-
version: "0.
|
|
9305
|
+
version: "0.10.0",
|
|
9257
9306
|
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.",
|
|
9258
9307
|
type: "module",
|
|
9259
9308
|
repository: {
|
|
@@ -9316,12 +9365,12 @@ function createSepiaServer(opts = {}) {
|
|
|
9316
9365
|
capabilities: { tools: {} },
|
|
9317
9366
|
instructions: MEMORY_CONTRACT
|
|
9318
9367
|
});
|
|
9368
|
+
registerWakeTool(server, client);
|
|
9319
9369
|
registerNamespaceTools(server, client);
|
|
9320
9370
|
registerEntityTools(server, client);
|
|
9321
9371
|
registerRelationTools(server, client);
|
|
9322
9372
|
registerMemoryTools(server, client);
|
|
9323
9373
|
registerSearchTools(server, client);
|
|
9324
|
-
registerTraverseTools(server, client);
|
|
9325
9374
|
registerPruneMemoriesTools(server, client);
|
|
9326
9375
|
return { server, client };
|
|
9327
9376
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sepia-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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": {
|