@hasna/microservices 0.0.10 → 0.0.11
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/bin/index.js +86 -1
- package/bin/mcp.js +86 -1
- package/dist/index.js +86 -1
- package/microservices/microservice-analytics/package.json +27 -0
- package/microservices/microservice-analytics/src/cli/index.ts +373 -0
- package/microservices/microservice-analytics/src/db/analytics.ts +564 -0
- package/microservices/microservice-analytics/src/db/database.ts +93 -0
- package/microservices/microservice-analytics/src/db/migrations.ts +50 -0
- package/microservices/microservice-analytics/src/index.ts +37 -0
- package/microservices/microservice-analytics/src/mcp/index.ts +334 -0
- package/microservices/microservice-assets/package.json +27 -0
- package/microservices/microservice-assets/src/cli/index.ts +375 -0
- package/microservices/microservice-assets/src/db/assets.ts +370 -0
- package/microservices/microservice-assets/src/db/database.ts +93 -0
- package/microservices/microservice-assets/src/db/migrations.ts +51 -0
- package/microservices/microservice-assets/src/index.ts +32 -0
- package/microservices/microservice-assets/src/mcp/index.ts +346 -0
- package/microservices/microservice-compliance/package.json +27 -0
- package/microservices/microservice-compliance/src/cli/index.ts +467 -0
- package/microservices/microservice-compliance/src/db/compliance.ts +633 -0
- package/microservices/microservice-compliance/src/db/database.ts +93 -0
- package/microservices/microservice-compliance/src/db/migrations.ts +63 -0
- package/microservices/microservice-compliance/src/index.ts +46 -0
- package/microservices/microservice-compliance/src/mcp/index.ts +438 -0
- package/microservices/microservice-habits/package.json +27 -0
- package/microservices/microservice-habits/src/cli/index.ts +315 -0
- package/microservices/microservice-habits/src/db/database.ts +93 -0
- package/microservices/microservice-habits/src/db/habits.ts +451 -0
- package/microservices/microservice-habits/src/db/migrations.ts +46 -0
- package/microservices/microservice-habits/src/index.ts +31 -0
- package/microservices/microservice-habits/src/mcp/index.ts +313 -0
- package/microservices/microservice-health/package.json +27 -0
- package/microservices/microservice-health/src/cli/index.ts +484 -0
- package/microservices/microservice-health/src/db/database.ts +93 -0
- package/microservices/microservice-health/src/db/health.ts +708 -0
- package/microservices/microservice-health/src/db/migrations.ts +70 -0
- package/microservices/microservice-health/src/index.ts +63 -0
- package/microservices/microservice-health/src/mcp/index.ts +437 -0
- package/microservices/microservice-notifications/package.json +27 -0
- package/microservices/microservice-notifications/src/cli/index.ts +349 -0
- package/microservices/microservice-notifications/src/db/database.ts +93 -0
- package/microservices/microservice-notifications/src/db/migrations.ts +62 -0
- package/microservices/microservice-notifications/src/db/notifications.ts +509 -0
- package/microservices/microservice-notifications/src/index.ts +41 -0
- package/microservices/microservice-notifications/src/mcp/index.ts +422 -0
- package/microservices/microservice-products/package.json +27 -0
- package/microservices/microservice-products/src/cli/index.ts +416 -0
- package/microservices/microservice-products/src/db/categories.ts +154 -0
- package/microservices/microservice-products/src/db/database.ts +93 -0
- package/microservices/microservice-products/src/db/migrations.ts +58 -0
- package/microservices/microservice-products/src/db/pricing-tiers.ts +66 -0
- package/microservices/microservice-products/src/db/products.ts +452 -0
- package/microservices/microservice-products/src/index.ts +53 -0
- package/microservices/microservice-products/src/mcp/index.ts +453 -0
- package/microservices/microservice-projects/package.json +27 -0
- package/microservices/microservice-projects/src/cli/index.ts +480 -0
- package/microservices/microservice-projects/src/db/database.ts +93 -0
- package/microservices/microservice-projects/src/db/migrations.ts +65 -0
- package/microservices/microservice-projects/src/db/projects.ts +715 -0
- package/microservices/microservice-projects/src/index.ts +57 -0
- package/microservices/microservice-projects/src/mcp/index.ts +501 -0
- package/microservices/microservice-proposals/package.json +27 -0
- package/microservices/microservice-proposals/src/cli/index.ts +400 -0
- package/microservices/microservice-proposals/src/db/database.ts +93 -0
- package/microservices/microservice-proposals/src/db/migrations.ts +52 -0
- package/microservices/microservice-proposals/src/db/proposals.ts +532 -0
- package/microservices/microservice-proposals/src/index.ts +37 -0
- package/microservices/microservice-proposals/src/mcp/index.ts +375 -0
- package/microservices/microservice-reading/package.json +27 -0
- package/microservices/microservice-reading/src/cli/index.ts +464 -0
- package/microservices/microservice-reading/src/db/database.ts +93 -0
- package/microservices/microservice-reading/src/db/migrations.ts +59 -0
- package/microservices/microservice-reading/src/db/reading.ts +524 -0
- package/microservices/microservice-reading/src/index.ts +51 -0
- package/microservices/microservice-reading/src/mcp/index.ts +368 -0
- package/microservices/microservice-travel/package.json +27 -0
- package/microservices/microservice-travel/src/cli/index.ts +505 -0
- package/microservices/microservice-travel/src/db/database.ts +93 -0
- package/microservices/microservice-travel/src/db/migrations.ts +77 -0
- package/microservices/microservice-travel/src/db/travel.ts +802 -0
- package/microservices/microservice-travel/src/index.ts +60 -0
- package/microservices/microservice-travel/src/mcp/index.ts +495 -0
- package/microservices/microservice-wiki/package.json +27 -0
- package/microservices/microservice-wiki/src/cli/index.ts +345 -0
- package/microservices/microservice-wiki/src/db/database.ts +93 -0
- package/microservices/microservice-wiki/src/db/migrations.ts +55 -0
- package/microservices/microservice-wiki/src/db/wiki.ts +395 -0
- package/microservices/microservice-wiki/src/index.ts +32 -0
- package/microservices/microservice-wiki/src/mcp/index.ts +344 -0
- package/package.json +1 -1
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import {
|
|
7
|
+
createAsset,
|
|
8
|
+
getAsset,
|
|
9
|
+
listAssets,
|
|
10
|
+
updateAsset,
|
|
11
|
+
deleteAsset,
|
|
12
|
+
searchAssets,
|
|
13
|
+
listByType,
|
|
14
|
+
listByTag,
|
|
15
|
+
listByCategory,
|
|
16
|
+
getAssetStats,
|
|
17
|
+
} from "../db/assets.js";
|
|
18
|
+
import {
|
|
19
|
+
createCollection,
|
|
20
|
+
getCollection,
|
|
21
|
+
listCollections,
|
|
22
|
+
deleteCollection,
|
|
23
|
+
addToCollection,
|
|
24
|
+
removeFromCollection,
|
|
25
|
+
getCollectionAssets,
|
|
26
|
+
} from "../db/assets.js";
|
|
27
|
+
|
|
28
|
+
const server = new McpServer({
|
|
29
|
+
name: "microservice-assets",
|
|
30
|
+
version: "0.0.1",
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// --- Assets ---
|
|
34
|
+
|
|
35
|
+
server.registerTool(
|
|
36
|
+
"create_asset",
|
|
37
|
+
{
|
|
38
|
+
title: "Create Asset",
|
|
39
|
+
description: "Create a new digital asset.",
|
|
40
|
+
inputSchema: {
|
|
41
|
+
name: z.string(),
|
|
42
|
+
description: z.string().optional(),
|
|
43
|
+
type: z.enum(["image", "video", "document", "audio", "template", "logo", "font", "other"]).optional(),
|
|
44
|
+
file_path: z.string().optional(),
|
|
45
|
+
file_size: z.number().optional(),
|
|
46
|
+
mime_type: z.string().optional(),
|
|
47
|
+
dimensions: z.string().optional(),
|
|
48
|
+
tags: z.array(z.string()).optional(),
|
|
49
|
+
category: z.string().optional(),
|
|
50
|
+
metadata: z.record(z.unknown()).optional(),
|
|
51
|
+
uploaded_by: z.string().optional(),
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
async (params) => {
|
|
55
|
+
const asset = createAsset(params);
|
|
56
|
+
return { content: [{ type: "text", text: JSON.stringify(asset, null, 2) }] };
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
server.registerTool(
|
|
61
|
+
"get_asset",
|
|
62
|
+
{
|
|
63
|
+
title: "Get Asset",
|
|
64
|
+
description: "Get an asset by ID.",
|
|
65
|
+
inputSchema: { id: z.string() },
|
|
66
|
+
},
|
|
67
|
+
async ({ id }) => {
|
|
68
|
+
const asset = getAsset(id);
|
|
69
|
+
if (!asset) {
|
|
70
|
+
return { content: [{ type: "text", text: `Asset '${id}' not found.` }], isError: true };
|
|
71
|
+
}
|
|
72
|
+
return { content: [{ type: "text", text: JSON.stringify(asset, null, 2) }] };
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
server.registerTool(
|
|
77
|
+
"list_assets",
|
|
78
|
+
{
|
|
79
|
+
title: "List Assets",
|
|
80
|
+
description: "List assets with optional filters.",
|
|
81
|
+
inputSchema: {
|
|
82
|
+
search: z.string().optional(),
|
|
83
|
+
type: z.string().optional(),
|
|
84
|
+
category: z.string().optional(),
|
|
85
|
+
tag: z.string().optional(),
|
|
86
|
+
uploaded_by: z.string().optional(),
|
|
87
|
+
limit: z.number().optional(),
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
async (params) => {
|
|
91
|
+
const assets = listAssets(params);
|
|
92
|
+
return {
|
|
93
|
+
content: [
|
|
94
|
+
{ type: "text", text: JSON.stringify({ assets, count: assets.length }, null, 2) },
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
server.registerTool(
|
|
101
|
+
"update_asset",
|
|
102
|
+
{
|
|
103
|
+
title: "Update Asset",
|
|
104
|
+
description: "Update an existing asset.",
|
|
105
|
+
inputSchema: {
|
|
106
|
+
id: z.string(),
|
|
107
|
+
name: z.string().optional(),
|
|
108
|
+
description: z.string().optional(),
|
|
109
|
+
type: z.enum(["image", "video", "document", "audio", "template", "logo", "font", "other"]).optional(),
|
|
110
|
+
file_path: z.string().optional(),
|
|
111
|
+
file_size: z.number().optional(),
|
|
112
|
+
mime_type: z.string().optional(),
|
|
113
|
+
dimensions: z.string().optional(),
|
|
114
|
+
tags: z.array(z.string()).optional(),
|
|
115
|
+
category: z.string().optional(),
|
|
116
|
+
metadata: z.record(z.unknown()).optional(),
|
|
117
|
+
uploaded_by: z.string().optional(),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
async ({ id, ...input }) => {
|
|
121
|
+
const asset = updateAsset(id, input);
|
|
122
|
+
if (!asset) {
|
|
123
|
+
return { content: [{ type: "text", text: `Asset '${id}' not found.` }], isError: true };
|
|
124
|
+
}
|
|
125
|
+
return { content: [{ type: "text", text: JSON.stringify(asset, null, 2) }] };
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
server.registerTool(
|
|
130
|
+
"delete_asset",
|
|
131
|
+
{
|
|
132
|
+
title: "Delete Asset",
|
|
133
|
+
description: "Delete an asset by ID.",
|
|
134
|
+
inputSchema: { id: z.string() },
|
|
135
|
+
},
|
|
136
|
+
async ({ id }) => {
|
|
137
|
+
const deleted = deleteAsset(id);
|
|
138
|
+
return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
server.registerTool(
|
|
143
|
+
"search_assets",
|
|
144
|
+
{
|
|
145
|
+
title: "Search Assets",
|
|
146
|
+
description: "Search assets by name, description, or tags.",
|
|
147
|
+
inputSchema: { query: z.string() },
|
|
148
|
+
},
|
|
149
|
+
async ({ query }) => {
|
|
150
|
+
const results = searchAssets(query);
|
|
151
|
+
return {
|
|
152
|
+
content: [
|
|
153
|
+
{ type: "text", text: JSON.stringify({ results, count: results.length }, null, 2) },
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
server.registerTool(
|
|
160
|
+
"list_assets_by_type",
|
|
161
|
+
{
|
|
162
|
+
title: "List Assets by Type",
|
|
163
|
+
description: "List all assets of a specific type.",
|
|
164
|
+
inputSchema: { type: z.string() },
|
|
165
|
+
},
|
|
166
|
+
async ({ type }) => {
|
|
167
|
+
const assets = listByType(type);
|
|
168
|
+
return {
|
|
169
|
+
content: [
|
|
170
|
+
{ type: "text", text: JSON.stringify({ assets, count: assets.length }, null, 2) },
|
|
171
|
+
],
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
server.registerTool(
|
|
177
|
+
"list_assets_by_tag",
|
|
178
|
+
{
|
|
179
|
+
title: "List Assets by Tag",
|
|
180
|
+
description: "List all assets with a specific tag.",
|
|
181
|
+
inputSchema: { tag: z.string() },
|
|
182
|
+
},
|
|
183
|
+
async ({ tag }) => {
|
|
184
|
+
const assets = listByTag(tag);
|
|
185
|
+
return {
|
|
186
|
+
content: [
|
|
187
|
+
{ type: "text", text: JSON.stringify({ assets, count: assets.length }, null, 2) },
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
server.registerTool(
|
|
194
|
+
"list_assets_by_category",
|
|
195
|
+
{
|
|
196
|
+
title: "List Assets by Category",
|
|
197
|
+
description: "List all assets in a specific category.",
|
|
198
|
+
inputSchema: { category: z.string() },
|
|
199
|
+
},
|
|
200
|
+
async ({ category }) => {
|
|
201
|
+
const assets = listByCategory(category);
|
|
202
|
+
return {
|
|
203
|
+
content: [
|
|
204
|
+
{ type: "text", text: JSON.stringify({ assets, count: assets.length }, null, 2) },
|
|
205
|
+
],
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
server.registerTool(
|
|
211
|
+
"get_asset_stats",
|
|
212
|
+
{
|
|
213
|
+
title: "Get Asset Stats",
|
|
214
|
+
description: "Get asset statistics — totals, size, breakdown by type and category.",
|
|
215
|
+
inputSchema: {},
|
|
216
|
+
},
|
|
217
|
+
async () => {
|
|
218
|
+
const stats = getAssetStats();
|
|
219
|
+
return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] };
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
// --- Collections ---
|
|
224
|
+
|
|
225
|
+
server.registerTool(
|
|
226
|
+
"create_collection",
|
|
227
|
+
{
|
|
228
|
+
title: "Create Collection",
|
|
229
|
+
description: "Create a new asset collection.",
|
|
230
|
+
inputSchema: {
|
|
231
|
+
name: z.string(),
|
|
232
|
+
description: z.string().optional(),
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
async (params) => {
|
|
236
|
+
const collection = createCollection(params);
|
|
237
|
+
return { content: [{ type: "text", text: JSON.stringify(collection, null, 2) }] };
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
server.registerTool(
|
|
242
|
+
"get_collection",
|
|
243
|
+
{
|
|
244
|
+
title: "Get Collection",
|
|
245
|
+
description: "Get a collection by ID.",
|
|
246
|
+
inputSchema: { id: z.string() },
|
|
247
|
+
},
|
|
248
|
+
async ({ id }) => {
|
|
249
|
+
const collection = getCollection(id);
|
|
250
|
+
if (!collection) {
|
|
251
|
+
return { content: [{ type: "text", text: `Collection '${id}' not found.` }], isError: true };
|
|
252
|
+
}
|
|
253
|
+
return { content: [{ type: "text", text: JSON.stringify(collection, null, 2) }] };
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
server.registerTool(
|
|
258
|
+
"list_collections",
|
|
259
|
+
{
|
|
260
|
+
title: "List Collections",
|
|
261
|
+
description: "List all asset collections.",
|
|
262
|
+
inputSchema: {},
|
|
263
|
+
},
|
|
264
|
+
async () => {
|
|
265
|
+
const collections = listCollections();
|
|
266
|
+
return {
|
|
267
|
+
content: [
|
|
268
|
+
{ type: "text", text: JSON.stringify({ collections, count: collections.length }, null, 2) },
|
|
269
|
+
],
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
server.registerTool(
|
|
275
|
+
"delete_collection",
|
|
276
|
+
{
|
|
277
|
+
title: "Delete Collection",
|
|
278
|
+
description: "Delete a collection by ID.",
|
|
279
|
+
inputSchema: { id: z.string() },
|
|
280
|
+
},
|
|
281
|
+
async ({ id }) => {
|
|
282
|
+
const deleted = deleteCollection(id);
|
|
283
|
+
return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
server.registerTool(
|
|
288
|
+
"add_asset_to_collection",
|
|
289
|
+
{
|
|
290
|
+
title: "Add Asset to Collection",
|
|
291
|
+
description: "Add an asset to a collection.",
|
|
292
|
+
inputSchema: {
|
|
293
|
+
collection_id: z.string(),
|
|
294
|
+
asset_id: z.string(),
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
async ({ collection_id, asset_id }) => {
|
|
298
|
+
const added = addToCollection(collection_id, asset_id);
|
|
299
|
+
return { content: [{ type: "text", text: JSON.stringify({ collection_id, asset_id, added }) }] };
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
server.registerTool(
|
|
304
|
+
"remove_asset_from_collection",
|
|
305
|
+
{
|
|
306
|
+
title: "Remove Asset from Collection",
|
|
307
|
+
description: "Remove an asset from a collection.",
|
|
308
|
+
inputSchema: {
|
|
309
|
+
collection_id: z.string(),
|
|
310
|
+
asset_id: z.string(),
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
async ({ collection_id, asset_id }) => {
|
|
314
|
+
const removed = removeFromCollection(collection_id, asset_id);
|
|
315
|
+
return { content: [{ type: "text", text: JSON.stringify({ collection_id, asset_id, removed }) }] };
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
server.registerTool(
|
|
320
|
+
"get_collection_assets",
|
|
321
|
+
{
|
|
322
|
+
title: "Get Collection Assets",
|
|
323
|
+
description: "List all assets in a collection.",
|
|
324
|
+
inputSchema: { collection_id: z.string() },
|
|
325
|
+
},
|
|
326
|
+
async ({ collection_id }) => {
|
|
327
|
+
const assets = getCollectionAssets(collection_id);
|
|
328
|
+
return {
|
|
329
|
+
content: [
|
|
330
|
+
{ type: "text", text: JSON.stringify({ assets, count: assets.length }, null, 2) },
|
|
331
|
+
],
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
// --- Start ---
|
|
337
|
+
async function main() {
|
|
338
|
+
const transport = new StdioServerTransport();
|
|
339
|
+
await server.connect(transport);
|
|
340
|
+
console.error("microservice-assets MCP server running on stdio");
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
main().catch((error) => {
|
|
344
|
+
console.error("Fatal error:", error);
|
|
345
|
+
process.exit(1);
|
|
346
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hasna/microservice-compliance",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Compliance management microservice with SQLite — track requirements, licenses, and audits across regulatory frameworks",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"microservice-compliance": "./src/cli/index.ts",
|
|
8
|
+
"microservice-compliance-mcp": "./src/mcp/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/index.ts"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "bun run ./src/cli/index.ts",
|
|
15
|
+
"test": "bun test"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
19
|
+
"commander": "^12.1.0",
|
|
20
|
+
"zod": "^3.24.0"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"registry": "https://registry.npmjs.org",
|
|
25
|
+
"access": "public"
|
|
26
|
+
}
|
|
27
|
+
}
|