@iwo-szapar/data-mcp 0.1.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/dist/adapter/factory.d.ts +9 -0
- package/dist/adapter/factory.d.ts.map +1 -0
- package/dist/adapter/factory.js +23 -0
- package/dist/adapter/factory.js.map +1 -0
- package/dist/adapter/pocketbase.d.ts +37 -0
- package/dist/adapter/pocketbase.d.ts.map +1 -0
- package/dist/adapter/pocketbase.js +350 -0
- package/dist/adapter/pocketbase.js.map +1 -0
- package/dist/adapter/schema-map.d.ts +45 -0
- package/dist/adapter/schema-map.d.ts.map +1 -0
- package/dist/adapter/schema-map.js +75 -0
- package/dist/adapter/schema-map.js.map +1 -0
- package/dist/adapter/supabase.d.ts +32 -0
- package/dist/adapter/supabase.d.ts.map +1 -0
- package/dist/adapter/supabase.js +294 -0
- package/dist/adapter/supabase.js.map +1 -0
- package/dist/adapter/types.d.ts +67 -0
- package/dist/adapter/types.d.ts.map +1 -0
- package/dist/adapter/types.js +9 -0
- package/dist/adapter/types.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +62 -0
- package/dist/config.js.map +1 -0
- package/dist/errors/adapter-error.d.ts +12 -0
- package/dist/errors/adapter-error.d.ts.map +1 -0
- package/dist/errors/adapter-error.js +15 -0
- package/dist/errors/adapter-error.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/search/alias-expansion.d.ts +53 -0
- package/dist/search/alias-expansion.d.ts.map +1 -0
- package/dist/search/alias-expansion.js +131 -0
- package/dist/search/alias-expansion.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +40 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/business/blog-create.d.ts +9 -0
- package/dist/tools/business/blog-create.d.ts.map +1 -0
- package/dist/tools/business/blog-create.js +53 -0
- package/dist/tools/business/blog-create.js.map +1 -0
- package/dist/tools/business/blog-delete.d.ts +9 -0
- package/dist/tools/business/blog-delete.d.ts.map +1 -0
- package/dist/tools/business/blog-delete.js +29 -0
- package/dist/tools/business/blog-delete.js.map +1 -0
- package/dist/tools/business/blog-list.d.ts +9 -0
- package/dist/tools/business/blog-list.d.ts.map +1 -0
- package/dist/tools/business/blog-list.js +37 -0
- package/dist/tools/business/blog-list.js.map +1 -0
- package/dist/tools/business/blog-update.d.ts +9 -0
- package/dist/tools/business/blog-update.d.ts.map +1 -0
- package/dist/tools/business/blog-update.js +66 -0
- package/dist/tools/business/blog-update.js.map +1 -0
- package/dist/tools/business/content-queue-add.d.ts +9 -0
- package/dist/tools/business/content-queue-add.d.ts.map +1 -0
- package/dist/tools/business/content-queue-add.js +40 -0
- package/dist/tools/business/content-queue-add.js.map +1 -0
- package/dist/tools/business/content-queue-list.d.ts +9 -0
- package/dist/tools/business/content-queue-list.d.ts.map +1 -0
- package/dist/tools/business/content-queue-list.js +41 -0
- package/dist/tools/business/content-queue-list.js.map +1 -0
- package/dist/tools/business/email-queue-add.d.ts +9 -0
- package/dist/tools/business/email-queue-add.d.ts.map +1 -0
- package/dist/tools/business/email-queue-add.js +47 -0
- package/dist/tools/business/email-queue-add.js.map +1 -0
- package/dist/tools/business/prospect-create.d.ts +9 -0
- package/dist/tools/business/prospect-create.d.ts.map +1 -0
- package/dist/tools/business/prospect-create.js +50 -0
- package/dist/tools/business/prospect-create.js.map +1 -0
- package/dist/tools/business/prospect-list.d.ts +9 -0
- package/dist/tools/business/prospect-list.d.ts.map +1 -0
- package/dist/tools/business/prospect-list.js +37 -0
- package/dist/tools/business/prospect-list.js.map +1 -0
- package/dist/tools/business/prospect-search.d.ts +9 -0
- package/dist/tools/business/prospect-search.d.ts.map +1 -0
- package/dist/tools/business/prospect-search.js +29 -0
- package/dist/tools/business/prospect-search.js.map +1 -0
- package/dist/tools/business/prospect-update.d.ts +9 -0
- package/dist/tools/business/prospect-update.d.ts.map +1 -0
- package/dist/tools/business/prospect-update.js +68 -0
- package/dist/tools/business/prospect-update.js.map +1 -0
- package/dist/tools/memory/brain-decay.d.ts +11 -0
- package/dist/tools/memory/brain-decay.d.ts.map +1 -0
- package/dist/tools/memory/brain-decay.js +58 -0
- package/dist/tools/memory/brain-decay.js.map +1 -0
- package/dist/tools/memory/brain-stats.d.ts +11 -0
- package/dist/tools/memory/brain-stats.d.ts.map +1 -0
- package/dist/tools/memory/brain-stats.js +63 -0
- package/dist/tools/memory/brain-stats.js.map +1 -0
- package/dist/tools/memory/contact-create.d.ts +9 -0
- package/dist/tools/memory/contact-create.d.ts.map +1 -0
- package/dist/tools/memory/contact-create.js +42 -0
- package/dist/tools/memory/contact-create.js.map +1 -0
- package/dist/tools/memory/contact-list.d.ts +9 -0
- package/dist/tools/memory/contact-list.d.ts.map +1 -0
- package/dist/tools/memory/contact-list.js +30 -0
- package/dist/tools/memory/contact-list.js.map +1 -0
- package/dist/tools/memory/contact-search.d.ts +9 -0
- package/dist/tools/memory/contact-search.d.ts.map +1 -0
- package/dist/tools/memory/contact-search.js +29 -0
- package/dist/tools/memory/contact-search.js.map +1 -0
- package/dist/tools/memory/contact-update.d.ts +9 -0
- package/dist/tools/memory/contact-update.d.ts.map +1 -0
- package/dist/tools/memory/contact-update.js +59 -0
- package/dist/tools/memory/contact-update.js.map +1 -0
- package/dist/tools/memory/goal-create.d.ts +9 -0
- package/dist/tools/memory/goal-create.d.ts.map +1 -0
- package/dist/tools/memory/goal-create.js +40 -0
- package/dist/tools/memory/goal-create.js.map +1 -0
- package/dist/tools/memory/goal-list.d.ts +9 -0
- package/dist/tools/memory/goal-list.d.ts.map +1 -0
- package/dist/tools/memory/goal-list.js +41 -0
- package/dist/tools/memory/goal-list.js.map +1 -0
- package/dist/tools/memory/goal-update.d.ts +9 -0
- package/dist/tools/memory/goal-update.d.ts.map +1 -0
- package/dist/tools/memory/goal-update.js +51 -0
- package/dist/tools/memory/goal-update.js.map +1 -0
- package/dist/tools/memory/knowledge-decide.d.ts +10 -0
- package/dist/tools/memory/knowledge-decide.d.ts.map +1 -0
- package/dist/tools/memory/knowledge-decide.js +39 -0
- package/dist/tools/memory/knowledge-decide.js.map +1 -0
- package/dist/tools/memory/knowledge-delete.d.ts +10 -0
- package/dist/tools/memory/knowledge-delete.d.ts.map +1 -0
- package/dist/tools/memory/knowledge-delete.js +33 -0
- package/dist/tools/memory/knowledge-delete.js.map +1 -0
- package/dist/tools/memory/knowledge-learn.d.ts +10 -0
- package/dist/tools/memory/knowledge-learn.d.ts.map +1 -0
- package/dist/tools/memory/knowledge-learn.js +39 -0
- package/dist/tools/memory/knowledge-learn.js.map +1 -0
- package/dist/tools/memory/knowledge-list.d.ts +9 -0
- package/dist/tools/memory/knowledge-list.d.ts.map +1 -0
- package/dist/tools/memory/knowledge-list.js +43 -0
- package/dist/tools/memory/knowledge-list.js.map +1 -0
- package/dist/tools/memory/knowledge-recall.d.ts +11 -0
- package/dist/tools/memory/knowledge-recall.d.ts.map +1 -0
- package/dist/tools/memory/knowledge-recall.js +79 -0
- package/dist/tools/memory/knowledge-recall.js.map +1 -0
- package/dist/tools/memory/knowledge-store.d.ts +10 -0
- package/dist/tools/memory/knowledge-store.d.ts.map +1 -0
- package/dist/tools/memory/knowledge-store.js +56 -0
- package/dist/tools/memory/knowledge-store.js.map +1 -0
- package/dist/tools/memory/knowledge-update.d.ts +10 -0
- package/dist/tools/memory/knowledge-update.d.ts.map +1 -0
- package/dist/tools/memory/knowledge-update.js +50 -0
- package/dist/tools/memory/knowledge-update.js.map +1 -0
- package/dist/tools/memory/knowledge-validate.d.ts +10 -0
- package/dist/tools/memory/knowledge-validate.d.ts.map +1 -0
- package/dist/tools/memory/knowledge-validate.js +40 -0
- package/dist/tools/memory/knowledge-validate.js.map +1 -0
- package/dist/tools/memory/session-list.d.ts +9 -0
- package/dist/tools/memory/session-list.d.ts.map +1 -0
- package/dist/tools/memory/session-list.js +30 -0
- package/dist/tools/memory/session-list.js.map +1 -0
- package/dist/tools/memory/session-log.d.ts +9 -0
- package/dist/tools/memory/session-log.d.ts.map +1 -0
- package/dist/tools/memory/session-log.js +56 -0
- package/dist/tools/memory/session-log.js.map +1 -0
- package/dist/tools/memory/task-create.d.ts +9 -0
- package/dist/tools/memory/task-create.d.ts.map +1 -0
- package/dist/tools/memory/task-create.js +38 -0
- package/dist/tools/memory/task-create.js.map +1 -0
- package/dist/tools/memory/task-list.d.ts +9 -0
- package/dist/tools/memory/task-list.d.ts.map +1 -0
- package/dist/tools/memory/task-list.js +41 -0
- package/dist/tools/memory/task-list.js.map +1 -0
- package/dist/tools/memory/task-update.d.ts +9 -0
- package/dist/tools/memory/task-update.d.ts.map +1 -0
- package/dist/tools/memory/task-update.js +50 -0
- package/dist/tools/memory/task-update.js.map +1 -0
- package/dist/tools/register.d.ts +7 -0
- package/dist/tools/register.d.ts.map +1 -0
- package/dist/tools/register.js +84 -0
- package/dist/tools/register.js.map +1 -0
- package/dist/tools/setup/setup-migrate.d.ts +10 -0
- package/dist/tools/setup/setup-migrate.d.ts.map +1 -0
- package/dist/tools/setup/setup-migrate.js +73 -0
- package/dist/tools/setup/setup-migrate.js.map +1 -0
- package/dist/tools/setup/setup-seed.d.ts +9 -0
- package/dist/tools/setup/setup-seed.d.ts.map +1 -0
- package/dist/tools/setup/setup-seed.js +133 -0
- package/dist/tools/setup/setup-seed.js.map +1 -0
- package/dist/tools/setup/setup-status.d.ts +9 -0
- package/dist/tools/setup/setup-status.d.ts.map +1 -0
- package/dist/tools/setup/setup-status.js +76 -0
- package/dist/tools/setup/setup-status.js.map +1 -0
- package/dist/tools/shared.d.ts +56 -0
- package/dist/tools/shared.d.ts.map +1 -0
- package/dist/tools/shared.js +93 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/types/records.d.ts +163 -0
- package/dist/types/records.d.ts.map +1 -0
- package/dist/types/records.js +8 -0
- package/dist/types/records.js.map +1 -0
- package/migrations/pocketbase/001_core_schema.js +72 -0
- package/migrations/pocketbase/002_goals_tasks.js +49 -0
- package/migrations/pocketbase/003_contacts.js +29 -0
- package/migrations/pocketbase/004_entity_aliases.js +40 -0
- package/migrations/pocketbase/005_prospects.js +33 -0
- package/migrations/pocketbase/006_business.js +80 -0
- package/migrations/pocketbase/007_newsletter_affiliates.js +50 -0
- package/migrations/supabase/001_core_schema.sql +78 -0
- package/migrations/supabase/002_goals_tasks.sql +38 -0
- package/migrations/supabase/003_contacts.sql +27 -0
- package/migrations/supabase/004_entity_aliases.sql +22 -0
- package/migrations/supabase/005_prospects.sql +31 -0
- package/migrations/supabase/006_business.sql +68 -0
- package/migrations/supabase/007_seed_aliases.sql +69 -0
- package/migrations/supabase/008_newsletter_affiliates.sql +39 -0
- package/package.json +48 -0
- package/seed/entity-aliases.json +57 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity alias expansion for knowledge recall.
|
|
3
|
+
*
|
|
4
|
+
* Loads aliases from the entity_aliases collection and expands query tokens.
|
|
5
|
+
* Example: "payment stuff" -> ["payment", "stuff", "stripe", "checkout", "pricing", "invoice"]
|
|
6
|
+
*
|
|
7
|
+
* Degrades silently if entity_aliases table is missing.
|
|
8
|
+
*/
|
|
9
|
+
const CACHE_TTL_MS = 5 * 60 * 1000;
|
|
10
|
+
/**
|
|
11
|
+
* AliasExpander — encapsulates alias cache and expansion logic.
|
|
12
|
+
*
|
|
13
|
+
* Takes a DataAdapter in its constructor. The cache is per-instance,
|
|
14
|
+
* making it easy to test without module-level singletons.
|
|
15
|
+
*/
|
|
16
|
+
export class AliasExpander {
|
|
17
|
+
adapter;
|
|
18
|
+
cache = null;
|
|
19
|
+
cacheTimestamp = 0;
|
|
20
|
+
constructor(adapter) {
|
|
21
|
+
this.adapter = adapter;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Expand a search query with entity aliases.
|
|
25
|
+
*
|
|
26
|
+
* Tokenizes the query, looks up each token in the alias map,
|
|
27
|
+
* and adds expanded terms to the result.
|
|
28
|
+
*
|
|
29
|
+
* Returns deduplicated array of all query terms (original + expansions).
|
|
30
|
+
*/
|
|
31
|
+
async expandQuery(query) {
|
|
32
|
+
const aliasMap = await this.loadAliases();
|
|
33
|
+
const tokens = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
34
|
+
const expanded = new Set(tokens);
|
|
35
|
+
for (const token of tokens) {
|
|
36
|
+
const aliases = aliasMap.get(token);
|
|
37
|
+
if (aliases) {
|
|
38
|
+
for (const alias of aliases) {
|
|
39
|
+
expanded.add(alias);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return Array.from(expanded);
|
|
44
|
+
}
|
|
45
|
+
/** Clear the internal alias cache (useful for testing) */
|
|
46
|
+
clearCache() {
|
|
47
|
+
this.cache = null;
|
|
48
|
+
this.cacheTimestamp = 0;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Load all aliases from the entity_aliases collection.
|
|
52
|
+
* Builds a map: alias -> [canonical, ...other_aliases_for_same_canonical]
|
|
53
|
+
* Also maps: canonical -> [all its aliases]
|
|
54
|
+
*/
|
|
55
|
+
async loadAliases() {
|
|
56
|
+
if (this.cache && Date.now() - this.cacheTimestamp < CACHE_TTL_MS) {
|
|
57
|
+
return this.cache;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const exists = await this.adapter.collectionExists('entity_aliases');
|
|
61
|
+
if (!exists) {
|
|
62
|
+
this.cache = new Map();
|
|
63
|
+
this.cacheTimestamp = Date.now();
|
|
64
|
+
return this.cache;
|
|
65
|
+
}
|
|
66
|
+
const result = await this.adapter.list('entity_aliases', {
|
|
67
|
+
page: { limit: 500, offset: 0 },
|
|
68
|
+
});
|
|
69
|
+
// Group by canonical
|
|
70
|
+
const byCanonical = new Map();
|
|
71
|
+
for (const row of result.items) {
|
|
72
|
+
const canonical = row.canonical.toLowerCase();
|
|
73
|
+
const alias = row.alias.toLowerCase();
|
|
74
|
+
if (!byCanonical.has(canonical)) {
|
|
75
|
+
byCanonical.set(canonical, []);
|
|
76
|
+
}
|
|
77
|
+
byCanonical.get(canonical).push(alias);
|
|
78
|
+
}
|
|
79
|
+
// Build expansion map: any term -> all related terms
|
|
80
|
+
const expansionMap = new Map();
|
|
81
|
+
for (const [canonical, aliases] of byCanonical) {
|
|
82
|
+
const allTerms = [canonical, ...aliases];
|
|
83
|
+
// Map canonical -> aliases
|
|
84
|
+
expansionMap.set(canonical, aliases);
|
|
85
|
+
// Map each alias -> [canonical, ...other aliases]
|
|
86
|
+
for (const alias of aliases) {
|
|
87
|
+
const others = allTerms.filter((t) => t !== alias);
|
|
88
|
+
expansionMap.set(alias, others);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
this.cache = expansionMap;
|
|
92
|
+
this.cacheTimestamp = Date.now();
|
|
93
|
+
return this.cache;
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
console.error('[alias-expansion] Failed to load aliases:', err);
|
|
97
|
+
this.cache = new Map();
|
|
98
|
+
this.cacheTimestamp = Date.now();
|
|
99
|
+
return this.cache;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/** Create an AliasExpander for the given adapter */
|
|
104
|
+
export function createAliasExpander(adapter) {
|
|
105
|
+
return new AliasExpander(adapter);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Convenience function: expand a search query with entity aliases.
|
|
109
|
+
*
|
|
110
|
+
* Uses a shared expander per adapter for caching. For repeated calls,
|
|
111
|
+
* prefer creating and reusing an AliasExpander instance directly.
|
|
112
|
+
*/
|
|
113
|
+
export async function expandQueryWithAliases(adapter, query) {
|
|
114
|
+
if (!sharedExpanders.has(adapter)) {
|
|
115
|
+
sharedExpanders.set(adapter, new AliasExpander(adapter));
|
|
116
|
+
}
|
|
117
|
+
return sharedExpanders.get(adapter).expandQuery(query);
|
|
118
|
+
}
|
|
119
|
+
/** Shared expanders for the convenience function */
|
|
120
|
+
const sharedExpanders = new Map();
|
|
121
|
+
/**
|
|
122
|
+
* Clear all shared alias caches.
|
|
123
|
+
* @deprecated Use AliasExpander class instances with clearCache() instead.
|
|
124
|
+
*/
|
|
125
|
+
export function clearAliasCache() {
|
|
126
|
+
for (const expander of sharedExpanders.values()) {
|
|
127
|
+
expander.clearCache();
|
|
128
|
+
}
|
|
129
|
+
sharedExpanders.clear();
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=alias-expansion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias-expansion.js","sourceRoot":"","sources":["../../src/search/alias-expansion.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAIK;IAHrB,KAAK,GAAiC,IAAI,CAAC;IAC3C,cAAc,GAAG,CAAC,CAAC;IAE3B,YAA6B,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAErD;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,CAAC;QAEzC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,OAAO,EAAE,CAAC;gBACZ,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;oBAC5B,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,C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ACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAoB,EACpB,KAAa;IAEb,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,eAAe,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,oDAAoD;AACpD,MAAM,eAAe,GAAG,IAAI,GAAG,EAA8B,CAAC;AAE9D;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,KAAK,MAAM,QAAQ,IAAI,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC;QAChD,QAAQ,CAAC,UAAU,EAAE,CAAC;IACxB,CAAC;IACD,eAAe,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server creation.
|
|
3
|
+
*
|
|
4
|
+
* Creates a configured McpServer with all tools registered.
|
|
5
|
+
*/
|
|
6
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { DataAdapter } from './adapter/types.js';
|
|
8
|
+
export declare function createServer(adapter: DataAdapter): McpServer;
|
|
9
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA0BtD,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,CAc5D"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server creation.
|
|
3
|
+
*
|
|
4
|
+
* Creates a configured McpServer with all tools registered.
|
|
5
|
+
*/
|
|
6
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import { registerAllTools } from './tools/register.js';
|
|
8
|
+
const SERVER_INSTRUCTIONS = `You are the user's AI Second Brain data layer. This MCP server provides tools to store, search, and manage knowledge, decisions, goals, tasks, contacts, and business data.
|
|
9
|
+
|
|
10
|
+
## Core Capabilities
|
|
11
|
+
- **Knowledge**: knowledge_store, knowledge_recall, knowledge_learn, knowledge_decide, knowledge_validate, knowledge_update, knowledge_delete, knowledge_list
|
|
12
|
+
- **Sessions**: session_log, session_list — log and review work sessions
|
|
13
|
+
- **Goals**: goal_create, goal_update, goal_list — track goals with key results
|
|
14
|
+
- **Tasks**: task_create, task_update, task_list — manage tasks with priorities
|
|
15
|
+
- **Contacts**: contact_create, contact_update, contact_list, contact_search — contact management
|
|
16
|
+
- **Brain Health**: brain_stats, brain_decay — monitor knowledge freshness
|
|
17
|
+
- **Setup**: setup_status, setup_migrate, setup_seed — database management
|
|
18
|
+
|
|
19
|
+
## Business Tools (if available)
|
|
20
|
+
- **Prospects**: prospect_create, prospect_update, prospect_list, prospect_search — CRM pipeline
|
|
21
|
+
- **Blog**: blog_create, blog_update, blog_list, blog_delete — content management
|
|
22
|
+
- **Email**: email_queue_add — queue emails (no sending)
|
|
23
|
+
- **Content**: content_queue_add, content_queue_list — content calendar
|
|
24
|
+
|
|
25
|
+
## Best Practices
|
|
26
|
+
- Use knowledge_recall to search before storing to avoid duplicates
|
|
27
|
+
- Use brain_decay periodically to find stale knowledge
|
|
28
|
+
- Use knowledge_validate to refresh items you've reviewed
|
|
29
|
+
- Use setup_status to check database readiness`;
|
|
30
|
+
export function createServer(adapter) {
|
|
31
|
+
const server = new McpServer({
|
|
32
|
+
name: '@second-brain/data-mcp',
|
|
33
|
+
version: '0.1.0',
|
|
34
|
+
}, {
|
|
35
|
+
instructions: SERVER_INSTRUCTIONS,
|
|
36
|
+
});
|
|
37
|
+
registerAllTools(server, adapter);
|
|
38
|
+
return server;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;+CAqBmB,CAAC;AAEhD,MAAM,UAAU,YAAY,CAAC,OAAoB;IAC/C,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;QACE,IAAI,EAAE,wBAAwB;QAC9B,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE,mBAAmB;KAClC,CACF,CAAC;IAEF,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: blog_create
|
|
3
|
+
*
|
|
4
|
+
* Create a blog post.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { DataAdapter } from '../../adapter/types.js';
|
|
8
|
+
export declare function registerBlogCreate(server: McpServer, adapter: DataAdapter): void;
|
|
9
|
+
//# sourceMappingURL=blog-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog-create.d.ts","sourceRoot":"","sources":["../../../src/tools/business/blog-create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAY1D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA2ChF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: blog_create
|
|
3
|
+
*
|
|
4
|
+
* Create a blog post.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
|
|
8
|
+
function slugify(text) {
|
|
9
|
+
return text
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
12
|
+
.replace(/^-|-$/g, '')
|
|
13
|
+
.substring(0, 200);
|
|
14
|
+
}
|
|
15
|
+
export function registerBlogCreate(server, adapter) {
|
|
16
|
+
server.tool('blog_create', 'Create a blog post. Auto-generates slug from title if not provided.', {
|
|
17
|
+
title: z.string().min(1).max(500).describe('Blog post title'),
|
|
18
|
+
slug: z.string().max(200).optional().describe('URL slug (auto-generated from title if not provided)'),
|
|
19
|
+
content: z.string().min(1).max(100000).describe('Blog post content (markdown, max 100KB)'),
|
|
20
|
+
excerpt: z.string().max(500).optional().describe('Short excerpt'),
|
|
21
|
+
status: z.enum(['draft', 'published', 'archived']).optional().describe('Post status (default: draft)'),
|
|
22
|
+
tags: z.array(z.string().max(100)).max(20).optional().describe('Tags'),
|
|
23
|
+
seo_title: z.string().max(200).optional().describe('SEO title override'),
|
|
24
|
+
seo_description: z.string().max(300).optional().describe('SEO meta description'),
|
|
25
|
+
og_image_url: z.string().max(500).optional().describe('Open Graph image URL'),
|
|
26
|
+
}, withGracefulDegradation('blog_posts', adapter, async (params) => {
|
|
27
|
+
try {
|
|
28
|
+
const status = params.status ?? 'draft';
|
|
29
|
+
const slug = params.slug ?? slugify(params.title);
|
|
30
|
+
const record = await adapter.create('blog_posts', {
|
|
31
|
+
title: params.title.trim(),
|
|
32
|
+
slug,
|
|
33
|
+
content: params.content,
|
|
34
|
+
excerpt: params.excerpt ?? null,
|
|
35
|
+
status,
|
|
36
|
+
published_at: status === 'published' ? new Date().toISOString() : null,
|
|
37
|
+
tags: params.tags ?? [],
|
|
38
|
+
seo_title: params.seo_title ?? null,
|
|
39
|
+
seo_description: params.seo_description ?? null,
|
|
40
|
+
og_image_url: params.og_image_url ?? null,
|
|
41
|
+
});
|
|
42
|
+
return makeToolResponse({
|
|
43
|
+
created: true,
|
|
44
|
+
item: { id: record.id, title: record.title, slug: record.slug, status: record.status, created_at: record.created_at },
|
|
45
|
+
message: `Blog post created: "${params.title}" (${status})`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return handleAdapterError(error, 'blog_create');
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=blog-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog-create.js","sourceRoot":"","sources":["../../../src/tools/business/blog-create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI;SACR,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,OAAoB;IACxE,MAAM,CAAC,IAAI,CACT,aAAa,EACb,qEAAqE,EACrE;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAA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C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: blog_delete
|
|
3
|
+
*
|
|
4
|
+
* Delete a blog post by ID.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { DataAdapter } from '../../adapter/types.js';
|
|
8
|
+
export declare function registerBlogDelete(server: McpServer, adapter: DataAdapter): void;
|
|
9
|
+
//# sourceMappingURL=blog-delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog-delete.d.ts","sourceRoot":"","sources":["../../../src/tools/business/blog-delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA0BhF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: blog_delete
|
|
3
|
+
*
|
|
4
|
+
* Delete a blog post by ID.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { makeToolResponse, makeErrorResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
|
|
8
|
+
export function registerBlogDelete(server, adapter) {
|
|
9
|
+
server.tool('blog_delete', 'Delete a blog post by ID. Requires confirm: true.', {
|
|
10
|
+
id: z.string().min(1).describe('ID of the blog post to delete'),
|
|
11
|
+
confirm: z.boolean().describe('Must be true to confirm deletion'),
|
|
12
|
+
}, withGracefulDegradation('blog_posts', adapter, async (params) => {
|
|
13
|
+
try {
|
|
14
|
+
if (!params.confirm) {
|
|
15
|
+
return makeErrorResponse('Deletion not confirmed. Set confirm: true to delete.');
|
|
16
|
+
}
|
|
17
|
+
await adapter.delete('blog_posts', params.id);
|
|
18
|
+
return makeToolResponse({
|
|
19
|
+
deleted: true,
|
|
20
|
+
id: params.id,
|
|
21
|
+
message: `Blog post ${params.id} deleted.`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return handleAdapterError(error, 'blog_delete');
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=blog-delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog-delete.js","sourceRoot":"","sources":["../../../src/tools/business/blog-delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEhH,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,OAAoB;IACxE,MAAM,CAAC,IAAI,CACT,aAAa,EACb,mDAAmD,EACnD;QACE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QAC/D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;KAClE,EACD,uBAAuB,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC9D,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,iBAAiB,CAAC,sDAAsD,CAAC,CAAC;YACnF,CAAC;YAED,MAAM,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;YAE9C,OAAO,gBAAgB,CAAC;gBACtB,OAAO,EAAE,IAAI;gBACb,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,OAAO,EAAE,aAAa,MAAM,CAAC,EAAE,WAAW;aAC3C,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: blog_list
|
|
3
|
+
*
|
|
4
|
+
* List blog posts with optional status filter.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { DataAdapter } from '../../adapter/types.js';
|
|
8
|
+
export declare function registerBlogList(server: McpServer, adapter: DataAdapter): void;
|
|
9
|
+
//# sourceMappingURL=blog-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog-list.d.ts","sourceRoot":"","sources":["../../../src/tools/business/blog-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,wBAAwB,CAAC;AAIxE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAoC9E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: blog_list
|
|
3
|
+
*
|
|
4
|
+
* List blog posts with optional status filter.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
|
|
8
|
+
export function registerBlogList(server, adapter) {
|
|
9
|
+
server.tool('blog_list', 'List blog posts with optional status filter.', {
|
|
10
|
+
status: z.enum(['draft', 'published', 'archived']).optional().describe('Filter by status'),
|
|
11
|
+
limit: z.number().int().min(1).max(100).optional().describe('Max results (default 20)'),
|
|
12
|
+
offset: z.number().int().min(0).optional().describe('Offset for pagination (default 0)'),
|
|
13
|
+
}, { readOnlyHint: true }, withGracefulDegradation('blog_posts', adapter, async (params) => {
|
|
14
|
+
try {
|
|
15
|
+
const clauses = [];
|
|
16
|
+
if (params.status) {
|
|
17
|
+
clauses.push({ field: 'status', op: 'eq', value: params.status });
|
|
18
|
+
}
|
|
19
|
+
const filter = clauses.length > 0 ? [clauses] : undefined;
|
|
20
|
+
const result = await adapter.list('blog_posts', {
|
|
21
|
+
filter,
|
|
22
|
+
sort: [{ field: 'created_at', direction: 'desc' }],
|
|
23
|
+
page: { limit: params.limit ?? 20, offset: params.offset ?? 0 },
|
|
24
|
+
});
|
|
25
|
+
return makeToolResponse({
|
|
26
|
+
items: result.items,
|
|
27
|
+
total: result.totalItems,
|
|
28
|
+
page: result.page,
|
|
29
|
+
per_page: result.perPage,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return handleAdapterError(error, 'blog_list');
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=blog-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog-list.js","sourceRoot":"","sources":["../../../src/tools/business/blog-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,OAAoB;IACtE,MAAM,CAAC,IAAI,CACT,WAAW,EACX,8CAA8C,EAC9C;QACE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAC1F,KAAK,EAAE,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AQ,EAAE,MAAM,CAAC,OAAO;aACzB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: blog_update
|
|
3
|
+
*
|
|
4
|
+
* Update a blog post by ID.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { DataAdapter } from '../../adapter/types.js';
|
|
8
|
+
export declare function registerBlogUpdate(server: McpServer, adapter: DataAdapter): void;
|
|
9
|
+
//# sourceMappingURL=blog-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog-update.d.ts","sourceRoot":"","sources":["../../../src/tools/business/blog-update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAuDhF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: blog_update
|
|
3
|
+
*
|
|
4
|
+
* Update a blog post by ID.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
|
|
8
|
+
export function registerBlogUpdate(server, adapter) {
|
|
9
|
+
server.tool('blog_update', 'Update a blog post. Change title, content, status, or other fields.', {
|
|
10
|
+
id: z.string().min(1).describe('ID of the blog post to update'),
|
|
11
|
+
title: z.string().min(1).max(500).optional().describe('New title'),
|
|
12
|
+
slug: z.string().max(200).optional().describe('New slug'),
|
|
13
|
+
content: z.string().optional().describe('New content (markdown)'),
|
|
14
|
+
excerpt: z.string().max(500).optional().describe('New excerpt'),
|
|
15
|
+
status: z.enum(['draft', 'published', 'archived']).optional().describe('New status'),
|
|
16
|
+
tags: z.array(z.string().max(100)).max(20).optional().describe('New tags'),
|
|
17
|
+
seo_title: z.string().max(200).optional().describe('New SEO title'),
|
|
18
|
+
seo_description: z.string().max(300).optional().describe('New SEO description'),
|
|
19
|
+
og_image_url: z.string().max(500).optional().describe('New OG image URL'),
|
|
20
|
+
}, withGracefulDegradation('blog_posts', adapter, async (params) => {
|
|
21
|
+
try {
|
|
22
|
+
const updates = {};
|
|
23
|
+
if (params.title !== undefined)
|
|
24
|
+
updates.title = params.title.trim();
|
|
25
|
+
if (params.slug !== undefined)
|
|
26
|
+
updates.slug = params.slug;
|
|
27
|
+
if (params.content !== undefined)
|
|
28
|
+
updates.content = params.content;
|
|
29
|
+
if (params.excerpt !== undefined)
|
|
30
|
+
updates.excerpt = params.excerpt;
|
|
31
|
+
if (params.status !== undefined) {
|
|
32
|
+
updates.status = params.status;
|
|
33
|
+
if (params.status === 'published') {
|
|
34
|
+
updates.published_at = new Date().toISOString();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
updates.published_at = null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (params.tags !== undefined)
|
|
41
|
+
updates.tags = params.tags;
|
|
42
|
+
if (params.seo_title !== undefined)
|
|
43
|
+
updates.seo_title = params.seo_title;
|
|
44
|
+
if (params.seo_description !== undefined)
|
|
45
|
+
updates.seo_description = params.seo_description;
|
|
46
|
+
if (params.og_image_url !== undefined)
|
|
47
|
+
updates.og_image_url = params.og_image_url;
|
|
48
|
+
if (Object.keys(updates).length === 0) {
|
|
49
|
+
return makeToolResponse({
|
|
50
|
+
updated: false,
|
|
51
|
+
message: 'No fields to update. Provide at least one field to change.',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const record = await adapter.update('blog_posts', params.id, updates);
|
|
55
|
+
return makeToolResponse({
|
|
56
|
+
updated: true,
|
|
57
|
+
item: { id: record.id, title: record.title, slug: record.slug, status: record.status, updated_at: record.updated_at },
|
|
58
|
+
message: `Blog post updated: "${record.title}"`,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return handleAdapterError(error, 'blog_update');
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=blog-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blog-update.js","sourceRoot":"","sources":["../../../src/tools/business/blog-update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,OAAoB;IACxE,MAAM,CAAC,IAAI,CACT,aAAa,EACb,qEAAqE,EACrE;QACE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QAC/D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;QAClE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;QACzD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACjE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAA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AAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;gBACrH,OAAO,EAAE,uBAAuB,MAAM,CAAC,KAAK,GAAG;aAChD,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: content_queue_add
|
|
3
|
+
*
|
|
4
|
+
* Add content to the content calendar.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { DataAdapter } from '../../adapter/types.js';
|
|
8
|
+
export declare function registerContentQueueAdd(server: McpServer, adapter: DataAdapter): void;
|
|
9
|
+
//# sourceMappingURL=content-queue-add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-queue-add.d.ts","sourceRoot":"","sources":["../../../src/tools/business/content-queue-add.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAoCrF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: content_queue_add
|
|
3
|
+
*
|
|
4
|
+
* Add content to the content calendar.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
|
|
8
|
+
export function registerContentQueueAdd(server, adapter) {
|
|
9
|
+
server.tool('content_queue_add', 'Add content to the content calendar. Track ideas, drafts, and published content across platforms.', {
|
|
10
|
+
title: z.string().min(1).max(500).describe('Content title'),
|
|
11
|
+
content: z.string().optional().describe('Content body or notes'),
|
|
12
|
+
platform: z.enum(['linkedin', 'newsletter', 'blog', 'twitter', 'other']).describe('Target platform'),
|
|
13
|
+
pillar: z.string().max(100).optional().describe('Content pillar category'),
|
|
14
|
+
status: z.enum(['idea', 'drafting', 'ready', 'published']).optional().describe('Content status (default: idea)'),
|
|
15
|
+
scheduled_date: z.string().max(50).optional().describe('Scheduled publish date (ISO format)'),
|
|
16
|
+
persona: z.string().max(100).optional().describe('Target audience persona'),
|
|
17
|
+
}, withGracefulDegradation('content_calendar', adapter, async (params) => {
|
|
18
|
+
try {
|
|
19
|
+
const record = await adapter.create('content_calendar', {
|
|
20
|
+
title: params.title.trim(),
|
|
21
|
+
content: params.content ?? null,
|
|
22
|
+
platform: params.platform,
|
|
23
|
+
pillar: params.pillar ?? null,
|
|
24
|
+
status: params.status ?? 'idea',
|
|
25
|
+
scheduled_date: params.scheduled_date ?? null,
|
|
26
|
+
published_url: null,
|
|
27
|
+
persona: params.persona ?? null,
|
|
28
|
+
});
|
|
29
|
+
return makeToolResponse({
|
|
30
|
+
created: true,
|
|
31
|
+
item: { id: record.id, title: record.title, platform: record.platform, status: record.status, created_at: record.created_at },
|
|
32
|
+
message: `Content added to calendar: "${params.title}" (${params.platform})`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return handleAdapterError(error, 'content_queue_add');
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=content-queue-add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-queue-add.js","sourceRoot":"","sources":["../../../src/tools/business/content-queue-add.ts"],"names":[],"mappings":"AAAA;;;;GAIG;A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E;QACpE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAwB,kBAAkB,EAAE;gBAC7E,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;gBAC1B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI;gBAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,IAAI;gBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM;gBAC/B,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,IAAI;gBAC7C,aAAa,EAAE,IAAI;gBACnB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI;aAChC,CAAC,CAAC;YAEH,OAAO,gBAAgB,CAAC;gBACtB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;gBAC7H,OAAO,EAAE,+BAA+B,MAAM,CAAC,KAAK,MAAM,MAAM,CAAC,QAAQ,GAAG;aAC7E,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;QACxD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: content_queue_list
|
|
3
|
+
*
|
|
4
|
+
* List upcoming content from the content calendar.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { DataAdapter } from '../../adapter/types.js';
|
|
8
|
+
export declare function registerContentQueueList(server: McpServer, adapter: DataAdapter): void;
|
|
9
|
+
//# sourceMappingURL=content-queue-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-queue-list.d.ts","sourceRoot":"","sources":["../../../src/tools/business/content-queue-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,wBAAwB,CAAC;AAIxE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAwCtF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: content_queue_list
|
|
3
|
+
*
|
|
4
|
+
* List upcoming content from the content calendar.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
|
|
8
|
+
export function registerContentQueueList(server, adapter) {
|
|
9
|
+
server.tool('content_queue_list', 'List content from the content calendar. Filter by platform or status.', {
|
|
10
|
+
platform: z.enum(['linkedin', 'newsletter', 'blog', 'twitter', 'other']).optional().describe('Filter by platform'),
|
|
11
|
+
status: z.enum(['idea', 'drafting', 'ready', 'published']).optional().describe('Filter by status'),
|
|
12
|
+
limit: z.number().int().min(1).max(100).optional().describe('Max results (default 20)'),
|
|
13
|
+
offset: z.number().int().min(0).optional().describe('Offset for pagination (default 0)'),
|
|
14
|
+
}, { readOnlyHint: true }, withGracefulDegradation('content_calendar', adapter, async (params) => {
|
|
15
|
+
try {
|
|
16
|
+
const clauses = [];
|
|
17
|
+
if (params.platform) {
|
|
18
|
+
clauses.push({ field: 'platform', op: 'eq', value: params.platform });
|
|
19
|
+
}
|
|
20
|
+
if (params.status) {
|
|
21
|
+
clauses.push({ field: 'status', op: 'eq', value: params.status });
|
|
22
|
+
}
|
|
23
|
+
const filter = clauses.length > 0 ? [clauses] : undefined;
|
|
24
|
+
const result = await adapter.list('content_calendar', {
|
|
25
|
+
filter,
|
|
26
|
+
sort: [{ field: 'created_at', direction: 'desc' }],
|
|
27
|
+
page: { limit: params.limit ?? 20, offset: params.offset ?? 0 },
|
|
28
|
+
});
|
|
29
|
+
return makeToolResponse({
|
|
30
|
+
items: result.items,
|
|
31
|
+
total: result.totalItems,
|
|
32
|
+
page: result.page,
|
|
33
|
+
per_page: result.perPage,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return handleAdapterError(error, 'content_queue_list');
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=content-queue-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-queue-list.js","sourceRoot":"","sources":["../../../src/tools/business/content-queue-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,OAAoB;IAC9E,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,uEAAuE,EACvE;QACE,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAClH,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAClG,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC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EH,OAAO,gBAAgB,CAAC;gBACtB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,KAAK,EAAE,MAAM,CAAC,UAAU;gBACxB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,MAAM,CAAC,OAAO;aACzB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: email_queue_add
|
|
3
|
+
*
|
|
4
|
+
* Add an email to the queue. Does NOT send — just inserts into email_queue table.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { DataAdapter } from '../../adapter/types.js';
|
|
8
|
+
export declare function registerEmailQueueAdd(server: McpServer, adapter: DataAdapter): void;
|
|
9
|
+
//# sourceMappingURL=email-queue-add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-queue-add.d.ts","sourceRoot":"","sources":["../../../src/tools/business/email-queue-add.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA2CnF"}
|