@iwo-szapar/data-mcp 0.2.1 → 0.3.2
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 +286 -0
- package/dist/server.js +2 -2
- package/dist/tools/memory/link-create.d.ts +4 -0
- package/dist/tools/memory/link-create.js +67 -0
- package/dist/tools/memory/link-delete.d.ts +4 -0
- package/dist/tools/memory/link-delete.js +27 -0
- package/dist/tools/memory/link-related.d.ts +4 -0
- package/dist/tools/memory/link-related.js +91 -0
- package/dist/tools/memory/link-suggest.d.ts +4 -0
- package/dist/tools/memory/link-suggest.js +83 -0
- package/dist/tools/register.js +10 -2
- package/migrations/pocketbase/001_core_schema.js +28 -24
- package/migrations/pocketbase/002_goals_tasks.js +18 -15
- package/migrations/pocketbase/003_contacts.js +12 -9
- package/migrations/pocketbase/004_entity_aliases.js +12 -9
- package/migrations/pocketbase/005_prospects.js +14 -11
- package/migrations/pocketbase/006_business.js +33 -29
- package/migrations/pocketbase/007_newsletter_affiliates.js +19 -16
- package/migrations/pocketbase/008_knowledge_links.js +41 -0
- package/migrations/supabase/009_align_to_production.sql +11 -14
- package/migrations/supabase/010_knowledge_links.sql +47 -0
- package/package.json +20 -5
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
-- Migration 010: Knowledge Links + pgvector embeddings
|
|
2
|
+
-- Adds graph-lite relationship system between MemoryOS entities
|
|
3
|
+
|
|
4
|
+
-- 1. Enable pgvector extension
|
|
5
|
+
CREATE EXTENSION IF NOT EXISTS vector;
|
|
6
|
+
|
|
7
|
+
-- 2. Add embedding column to knowledge
|
|
8
|
+
ALTER TABLE knowledge ADD COLUMN IF NOT EXISTS embedding vector(384);
|
|
9
|
+
|
|
10
|
+
-- 3. HNSW index for cosine similarity
|
|
11
|
+
CREATE INDEX IF NOT EXISTS idx_knowledge_embedding
|
|
12
|
+
ON knowledge USING hnsw (embedding vector_cosine_ops)
|
|
13
|
+
WITH (m = 16, ef_construction = 64);
|
|
14
|
+
|
|
15
|
+
-- 4. Knowledge links table
|
|
16
|
+
CREATE TABLE IF NOT EXISTS knowledge_links (
|
|
17
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
18
|
+
owner_id text NOT NULL DEFAULT 'default',
|
|
19
|
+
|
|
20
|
+
source_type text NOT NULL,
|
|
21
|
+
source_id uuid NOT NULL,
|
|
22
|
+
target_type text NOT NULL,
|
|
23
|
+
target_id uuid NOT NULL,
|
|
24
|
+
relation_type text NOT NULL,
|
|
25
|
+
|
|
26
|
+
confidence numeric DEFAULT 0.8 CHECK (confidence >= 0 AND confidence <= 1),
|
|
27
|
+
notes text,
|
|
28
|
+
auto_suggested boolean DEFAULT false,
|
|
29
|
+
created_at timestamptz DEFAULT now(),
|
|
30
|
+
|
|
31
|
+
CONSTRAINT knowledge_links_source_type_check CHECK (source_type IN ('knowledge', 'decision', 'session', 'blog_post', 'prospect', 'agent_learning')),
|
|
32
|
+
CONSTRAINT knowledge_links_target_type_check CHECK (target_type IN ('knowledge', 'decision', 'session', 'blog_post', 'prospect', 'agent_learning')),
|
|
33
|
+
CONSTRAINT knowledge_links_relation_type_check CHECK (relation_type IN ('supports', 'contradicts', 'derived_from', 'example_of', 'supersedes', 'part_of', 'prerequisite')),
|
|
34
|
+
CONSTRAINT knowledge_links_no_self_link CHECK (NOT (source_type = target_type AND source_id = target_id)),
|
|
35
|
+
CONSTRAINT knowledge_links_unique_link UNIQUE (owner_id, source_type, source_id, target_type, target_id, relation_type)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
-- 5. Indexes
|
|
39
|
+
CREATE INDEX idx_knowledge_links_source ON knowledge_links (owner_id, source_type, source_id);
|
|
40
|
+
CREATE INDEX idx_knowledge_links_target ON knowledge_links (owner_id, target_type, target_id);
|
|
41
|
+
CREATE INDEX idx_knowledge_links_relation ON knowledge_links (relation_type);
|
|
42
|
+
|
|
43
|
+
-- 6. RLS
|
|
44
|
+
ALTER TABLE knowledge_links ENABLE ROW LEVEL SECURITY;
|
|
45
|
+
|
|
46
|
+
CREATE POLICY "owner_all_access" ON knowledge_links
|
|
47
|
+
FOR ALL USING (owner_id = current_setting('app.owner_id', true) OR current_setting('app.owner_id', true) IS NULL);
|
package/package.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iwo-szapar/data-mcp",
|
|
3
|
-
"version": "0.2
|
|
4
|
-
"description": "Unified data MCP server for Second Brain
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "Unified data MCP server for Second Brain — PocketBase and Supabase adapters. 40 tools: knowledge, sessions, goals, tasks, contacts, CRM, blog, email, content calendar.",
|
|
5
|
+
"author": "Iwo Szapar <iwo.szapar@gmail.com> (https://iwoszapar.com)",
|
|
6
|
+
"homepage": "https://iwoszapar.com/second-brain-ai",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://iwoszapar.com/contact",
|
|
9
|
+
"email": "iwo.szapar@gmail.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://iwoszapar.com/second-brain-ai"
|
|
14
|
+
},
|
|
5
15
|
"type": "module",
|
|
6
16
|
"bin": {
|
|
7
17
|
"data-mcp": "./dist/index.js"
|
|
@@ -20,14 +30,19 @@
|
|
|
20
30
|
"files": [
|
|
21
31
|
"dist/",
|
|
22
32
|
"migrations/",
|
|
23
|
-
"seed/"
|
|
33
|
+
"seed/",
|
|
34
|
+
"README.md"
|
|
24
35
|
],
|
|
25
36
|
"keywords": [
|
|
26
37
|
"mcp",
|
|
38
|
+
"model-context-protocol",
|
|
27
39
|
"second-brain",
|
|
28
40
|
"pocketbase",
|
|
29
41
|
"supabase",
|
|
30
|
-
"knowledge-management"
|
|
42
|
+
"knowledge-management",
|
|
43
|
+
"claude-code",
|
|
44
|
+
"memory",
|
|
45
|
+
"crm"
|
|
31
46
|
],
|
|
32
47
|
"publishConfig": {
|
|
33
48
|
"access": "public"
|
|
@@ -48,4 +63,4 @@
|
|
|
48
63
|
"vitest": "^3.1.1",
|
|
49
64
|
"tsx": "^4.19.4"
|
|
50
65
|
}
|
|
51
|
-
}
|
|
66
|
+
}
|