@prmichaelsen/remember-mcp 3.19.3 → 3.20.1
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/AGENT.md +10 -3
- package/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/agent/commands/acp.artifact-glossary.md +530 -0
- package/agent/commands/acp.artifact-reference.md +591 -0
- package/agent/commands/acp.artifact-research.md +594 -0
- package/agent/commands/acp.audit.md +345 -0
- package/agent/commands/acp.clarification-address.md +185 -88
- package/agent/commands/acp.clarification-capture.md +44 -44
- package/agent/commands/acp.clarification-create.md +41 -42
- package/agent/commands/acp.command-create.md +49 -49
- package/agent/commands/acp.design-create.md +53 -35
- package/agent/commands/acp.design-reference.md +42 -42
- package/agent/commands/acp.handoff.md +35 -35
- package/agent/commands/acp.index.md +47 -47
- package/agent/commands/acp.init.md +105 -69
- package/agent/commands/acp.package-create.md +41 -41
- package/agent/commands/acp.package-info.md +40 -40
- package/agent/commands/acp.package-install.md +48 -48
- package/agent/commands/acp.package-list.md +40 -40
- package/agent/commands/acp.package-publish.md +62 -62
- package/agent/commands/acp.package-remove.md +41 -41
- package/agent/commands/acp.package-search.md +48 -48
- package/agent/commands/acp.package-update.md +50 -50
- package/agent/commands/acp.package-validate.md +52 -52
- package/agent/commands/acp.pattern-create.md +61 -43
- package/agent/commands/acp.plan.md +70 -47
- package/agent/commands/acp.proceed.md +188 -66
- package/agent/commands/acp.project-create.md +42 -42
- package/agent/commands/acp.project-info.md +46 -46
- package/agent/commands/acp.project-list.md +41 -41
- package/agent/commands/acp.project-remove.md +36 -36
- package/agent/commands/acp.project-set.md +33 -33
- package/agent/commands/acp.project-update.md +57 -57
- package/agent/commands/acp.projects-restore.md +37 -37
- package/agent/commands/acp.projects-sync.md +39 -39
- package/agent/commands/acp.report.md +50 -50
- package/agent/commands/acp.resume.md +36 -36
- package/agent/commands/acp.sessions.md +46 -46
- package/agent/commands/acp.status.md +43 -43
- package/agent/commands/acp.sync.md +109 -56
- package/agent/commands/acp.task-create.md +51 -49
- package/agent/commands/acp.update.md +66 -45
- package/agent/commands/acp.validate.md +110 -52
- package/agent/commands/acp.version-check-for-updates.md +40 -40
- package/agent/commands/acp.version-check.md +36 -36
- package/agent/commands/acp.version-update.md +43 -43
- package/agent/commands/command.template.md +40 -40
- package/agent/commands/git.commit.md +28 -28
- package/agent/commands/git.init.md +48 -48
- package/agent/design/design.template.md +9 -9
- package/agent/design/local.admin-debugging-tools.md +242 -0
- package/agent/design/requirements.template.md +8 -8
- package/agent/index/.gitkeep +0 -0
- package/agent/index/acp.core.yaml +137 -0
- package/agent/index/local.main.template.yaml +37 -0
- package/agent/index/local.main.yaml +48 -0
- package/agent/manifest.yaml +64 -0
- package/agent/milestones/milestone-1-{title}.template.md +8 -8
- package/agent/milestones/milestone-22-admin-debugging-tools.md +61 -0
- package/agent/patterns/pattern.template.md +22 -22
- package/agent/progress.template.yaml +13 -3
- package/agent/progress.yaml +78 -1
- package/agent/schemas/package.schema.yaml +276 -0
- package/agent/scripts/acp.project-update.sh +5 -6
- package/agent/tasks/milestone-22-admin-debugging-tools/task-520-admin-gate-infrastructure.md +99 -0
- package/agent/tasks/milestone-22-admin-debugging-tools/task-521-schema-and-collection-tools.md +108 -0
- package/agent/tasks/milestone-22-admin-debugging-tools/task-522-memory-inspection-tools.md +120 -0
- package/agent/tasks/milestone-22-admin-debugging-tools/task-523-user-inspection-tools.md +126 -0
- package/agent/tasks/milestone-22-admin-debugging-tools/task-524-health-and-drift-tools.md +120 -0
- package/agent/tasks/task-1-{title}.template.md +18 -18
- package/dist/server-factory.js +637 -41
- package/dist/tools/admin-collection-stats.d.ts +24 -0
- package/dist/tools/admin-detect-weaviate-drift.d.ts +26 -0
- package/dist/tools/admin-get-weaviate-schema.d.ts +24 -0
- package/dist/tools/admin-health-drift.spec.d.ts +5 -0
- package/dist/tools/admin-health.d.ts +15 -0
- package/dist/tools/admin-inspect-memory.d.ts +29 -0
- package/dist/tools/admin-inspect-user.d.ts +73 -0
- package/dist/tools/admin-inspect-user.spec.d.ts +5 -0
- package/dist/tools/admin-list-collections.d.ts +23 -0
- package/dist/tools/admin-memory-inspection.spec.d.ts +7 -0
- package/dist/tools/admin-schema-collection.spec.d.ts +8 -0
- package/dist/tools/admin-search-across-users.d.ts +42 -0
- package/dist/utils/admin.d.ts +21 -0
- package/dist/utils/admin.spec.d.ts +2 -0
- package/package.json +2 -2
- package/src/server-factory.ts +131 -42
- package/src/tools/admin-collection-stats.ts +67 -0
- package/src/tools/admin-detect-weaviate-drift.ts +110 -0
- package/src/tools/admin-get-weaviate-schema.ts +68 -0
- package/src/tools/admin-health-drift.spec.ts +193 -0
- package/src/tools/admin-health.ts +88 -0
- package/src/tools/admin-inspect-memory.ts +86 -0
- package/src/tools/admin-inspect-user.spec.ts +130 -0
- package/src/tools/admin-inspect-user.ts +148 -0
- package/src/tools/admin-list-collections.ts +73 -0
- package/src/tools/admin-memory-inspection.spec.ts +206 -0
- package/src/tools/admin-schema-collection.spec.ts +167 -0
- package/src/tools/admin-search-across-users.ts +104 -0
- package/src/utils/admin.spec.ts +70 -0
- package/src/utils/admin.ts +27 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_admin_collection_stats tool
|
|
3
|
+
* Returns stats for a specific Weaviate collection.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthContext } from '../types/auth.js';
|
|
6
|
+
export declare const adminCollectionStatsTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
collection_name: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
required: string[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export interface AdminCollectionStatsArgs {
|
|
21
|
+
collection_name: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function handleAdminCollectionStats(args: AdminCollectionStatsArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
24
|
+
//# sourceMappingURL=admin-collection-stats.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_admin_detect_weaviate_drift tool
|
|
3
|
+
* Compares expected schema properties (from code) against actual Weaviate schema.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthContext } from '../types/auth.js';
|
|
6
|
+
export declare const adminDetectWeaviateDriftTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
collection_ids: {
|
|
13
|
+
type: string;
|
|
14
|
+
items: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export interface AdminDetectWeaviateDriftArgs {
|
|
23
|
+
collection_ids?: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare function handleAdminDetectWeaviateDrift(args: AdminDetectWeaviateDriftArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
26
|
+
//# sourceMappingURL=admin-detect-weaviate-drift.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_admin_get_weaviate_schema tool
|
|
3
|
+
* Inspects a Weaviate collection's schema, property types, and index config.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthContext } from '../types/auth.js';
|
|
6
|
+
export declare const adminGetWeaviateSchemaTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
collection_name: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
required: string[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export interface AdminGetWeaviateSchemaArgs {
|
|
21
|
+
collection_name: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function handleAdminGetWeaviateSchema(args: AdminGetWeaviateSchemaArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
24
|
+
//# sourceMappingURL=admin-get-weaviate-schema.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_admin_health tool
|
|
3
|
+
* Deep health check — Weaviate and Firestore connectivity with latency.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthContext } from '../types/auth.js';
|
|
6
|
+
export declare const adminHealthTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare function handleAdminHealth(_args: Record<string, unknown>, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
15
|
+
//# sourceMappingURL=admin-health.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_admin_inspect_memory tool
|
|
3
|
+
* Fetches a raw memory object by UUID using the Firestore index for collection resolution.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthContext } from '../types/auth.js';
|
|
6
|
+
export declare const adminInspectMemoryTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
memory_id: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
include_vector: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
required: string[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export interface AdminInspectMemoryArgs {
|
|
25
|
+
memory_id: string;
|
|
26
|
+
include_vector?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function handleAdminInspectMemory(args: AdminInspectMemoryArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
29
|
+
//# sourceMappingURL=admin-inspect-memory.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin user inspection tools — granular Firestore data access per data type.
|
|
3
|
+
*
|
|
4
|
+
* - remember_admin_inspect_user_preferences
|
|
5
|
+
* - remember_admin_inspect_user_ghost_configs
|
|
6
|
+
* - remember_admin_inspect_user_escalation_records
|
|
7
|
+
* - remember_admin_inspect_user_api_tokens
|
|
8
|
+
*/
|
|
9
|
+
import type { AuthContext } from '../types/auth.js';
|
|
10
|
+
export declare const adminInspectUserPreferencesTool: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object";
|
|
15
|
+
properties: {
|
|
16
|
+
user_id: {
|
|
17
|
+
type: "string";
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
required: readonly ["user_id"];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const adminInspectUserGhostConfigsTool: {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: "object";
|
|
29
|
+
properties: {
|
|
30
|
+
user_id: {
|
|
31
|
+
type: "string";
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
required: readonly ["user_id"];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare const adminInspectUserEscalationRecordsTool: {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: "object";
|
|
43
|
+
properties: {
|
|
44
|
+
user_id: {
|
|
45
|
+
type: "string";
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
required: readonly ["user_id"];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare const adminInspectUserApiTokensTool: {
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: "object";
|
|
57
|
+
properties: {
|
|
58
|
+
user_id: {
|
|
59
|
+
type: "string";
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
required: readonly ["user_id"];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export interface AdminInspectUserArgs {
|
|
67
|
+
user_id: string;
|
|
68
|
+
}
|
|
69
|
+
export declare function handleAdminInspectUserPreferences(args: AdminInspectUserArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
70
|
+
export declare function handleAdminInspectUserGhostConfigs(args: AdminInspectUserArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
71
|
+
export declare function handleAdminInspectUserEscalationRecords(args: AdminInspectUserArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
72
|
+
export declare function handleAdminInspectUserApiTokens(args: AdminInspectUserArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
73
|
+
//# sourceMappingURL=admin-inspect-user.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_admin_list_collections tool
|
|
3
|
+
* Lists all Weaviate collections with type categorization.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthContext } from '../types/auth.js';
|
|
6
|
+
export declare const adminListCollectionsTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
filter: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export interface AdminListCollectionsArgs {
|
|
20
|
+
filter?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function handleAdminListCollections(args: AdminListCollectionsArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=admin-list-collections.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_admin_search_across_users tool
|
|
3
|
+
* Searches memories across multiple user tenants.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthContext } from '../types/auth.js';
|
|
6
|
+
export declare const adminSearchAcrossUsersTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
user_ids: {
|
|
13
|
+
type: string;
|
|
14
|
+
items: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
query: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
limit: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
content_type: {
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
required: string[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export interface AdminSearchAcrossUsersArgs {
|
|
36
|
+
user_ids: string[];
|
|
37
|
+
query: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
content_type?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function handleAdminSearchAcrossUsers(args: AdminSearchAcrossUsersArgs, userId: string, _authContext?: AuthContext): Promise<string>;
|
|
42
|
+
//# sourceMappingURL=admin-search-across-users.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin gate utilities
|
|
3
|
+
* Checks if a userId is in the ADMIN_USER_IDS env var.
|
|
4
|
+
* Re-reads env on each call (not cached) for hot-reload support.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check if a userId is an admin.
|
|
8
|
+
* Reads ADMIN_USER_IDS env var on each call.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isAdmin(userId: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Standard permission error response for non-admin users.
|
|
13
|
+
*/
|
|
14
|
+
export declare function adminPermissionError(): {
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
isError: boolean;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=admin.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prmichaelsen/remember-mcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.1",
|
|
4
4
|
"description": "Multi-tenant memory system MCP server with vector search and relationships",
|
|
5
5
|
"main": "dist/server.js",
|
|
6
6
|
"type": "module",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@google-cloud/documentai": "^9.5.0",
|
|
53
53
|
"@google-cloud/vision": "^5.3.4",
|
|
54
54
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
55
|
-
"@prmichaelsen/remember-core": "^0.
|
|
55
|
+
"@prmichaelsen/remember-core": "^0.71.1",
|
|
56
56
|
"dotenv": "^16.4.5",
|
|
57
57
|
"uuid": "^13.0.0",
|
|
58
58
|
"weaviate-client": "^3.2.0"
|
package/src/server-factory.ts
CHANGED
|
@@ -61,6 +61,24 @@ import { searchSpaceByTool, handleSearchSpaceBy } from './tools/search-space-by.
|
|
|
61
61
|
import { getGhostConfig } from './services/ghost-config.service.js';
|
|
62
62
|
import { resolveAccessorTrustLevel } from './services/access-control.js';
|
|
63
63
|
|
|
64
|
+
// Admin utilities
|
|
65
|
+
import { isAdmin, adminPermissionError } from './utils/admin.js';
|
|
66
|
+
|
|
67
|
+
// Admin tools
|
|
68
|
+
import { adminGetWeaviateSchemaTool, handleAdminGetWeaviateSchema } from './tools/admin-get-weaviate-schema.js';
|
|
69
|
+
import { adminListCollectionsTool, handleAdminListCollections } from './tools/admin-list-collections.js';
|
|
70
|
+
import { adminCollectionStatsTool, handleAdminCollectionStats } from './tools/admin-collection-stats.js';
|
|
71
|
+
import { adminInspectMemoryTool, handleAdminInspectMemory } from './tools/admin-inspect-memory.js';
|
|
72
|
+
import { adminSearchAcrossUsersTool, handleAdminSearchAcrossUsers } from './tools/admin-search-across-users.js';
|
|
73
|
+
import {
|
|
74
|
+
adminInspectUserPreferencesTool, handleAdminInspectUserPreferences,
|
|
75
|
+
adminInspectUserGhostConfigsTool, handleAdminInspectUserGhostConfigs,
|
|
76
|
+
adminInspectUserEscalationRecordsTool, handleAdminInspectUserEscalationRecords,
|
|
77
|
+
adminInspectUserApiTokensTool, handleAdminInspectUserApiTokens,
|
|
78
|
+
} from './tools/admin-inspect-user.js';
|
|
79
|
+
import { adminHealthTool, handleAdminHealth } from './tools/admin-health.js';
|
|
80
|
+
import { adminDetectWeaviateDriftTool, handleAdminDetectWeaviateDrift } from './tools/admin-detect-weaviate-drift.js';
|
|
81
|
+
|
|
64
82
|
export interface ServerOptions {
|
|
65
83
|
name?: string;
|
|
66
84
|
version?: string;
|
|
@@ -282,49 +300,69 @@ function registerHandlers(
|
|
|
282
300
|
accessToken: string,
|
|
283
301
|
internalContext?: import('./types/auth.js').InternalContext
|
|
284
302
|
): void {
|
|
285
|
-
//
|
|
303
|
+
// Admin tool definitions (hidden from non-admin users)
|
|
304
|
+
const adminTools = [
|
|
305
|
+
adminGetWeaviateSchemaTool,
|
|
306
|
+
adminListCollectionsTool,
|
|
307
|
+
adminCollectionStatsTool,
|
|
308
|
+
adminInspectMemoryTool,
|
|
309
|
+
adminSearchAcrossUsersTool,
|
|
310
|
+
adminInspectUserPreferencesTool,
|
|
311
|
+
adminInspectUserGhostConfigsTool,
|
|
312
|
+
adminInspectUserEscalationRecordsTool,
|
|
313
|
+
adminInspectUserApiTokensTool,
|
|
314
|
+
adminHealthTool,
|
|
315
|
+
adminDetectWeaviateDriftTool,
|
|
316
|
+
];
|
|
317
|
+
|
|
318
|
+
// List available tools (admin tools conditionally included)
|
|
286
319
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
287
|
-
|
|
288
|
-
tools
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
320
|
+
const tools = [
|
|
321
|
+
// Memory tools
|
|
322
|
+
createMemoryTool,
|
|
323
|
+
searchMemoryTool,
|
|
324
|
+
deleteMemoryTool,
|
|
325
|
+
updateMemoryTool,
|
|
326
|
+
findSimilarTool,
|
|
327
|
+
queryMemoryTool,
|
|
328
|
+
// Relationship tools
|
|
329
|
+
createRelationshipTool,
|
|
330
|
+
updateRelationshipTool,
|
|
331
|
+
searchRelationshipTool,
|
|
332
|
+
deleteRelationshipTool,
|
|
333
|
+
// Preference tools
|
|
334
|
+
setPreferenceTool,
|
|
335
|
+
getPreferencesTool,
|
|
336
|
+
// Space tools
|
|
337
|
+
publishTool,
|
|
338
|
+
retractTool,
|
|
339
|
+
reviseTool,
|
|
340
|
+
confirmTool,
|
|
341
|
+
denyTool,
|
|
342
|
+
searchSpaceTool,
|
|
343
|
+
querySpaceTool,
|
|
344
|
+
moderateTool,
|
|
345
|
+
ghostConfigTool,
|
|
346
|
+
// Search modes
|
|
347
|
+
searchByTool,
|
|
348
|
+
// Unified internal memory tools
|
|
349
|
+
createInternalMemoryTool,
|
|
350
|
+
updateInternalMemoryTool,
|
|
351
|
+
searchInternalMemoryTool,
|
|
352
|
+
queryInternalMemoryTool,
|
|
353
|
+
searchInternalMemoryByTool,
|
|
354
|
+
// Core introspection
|
|
355
|
+
getCoreTool,
|
|
356
|
+
// Space search modes
|
|
357
|
+
searchSpaceByTool,
|
|
358
|
+
];
|
|
359
|
+
|
|
360
|
+
// Only include admin tools for admin users
|
|
361
|
+
if (isAdmin(userId)) {
|
|
362
|
+
tools.push(...adminTools as typeof tools);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return { tools };
|
|
328
366
|
});
|
|
329
367
|
|
|
330
368
|
// Handle tool calls
|
|
@@ -455,7 +493,58 @@ function registerHandlers(
|
|
|
455
493
|
result = await handleSearchSpaceBy(args as any, userId, authContext);
|
|
456
494
|
break;
|
|
457
495
|
|
|
496
|
+
// Admin tools (gated by isAdmin check inside each handler)
|
|
497
|
+
case 'remember_admin_get_weaviate_schema':
|
|
498
|
+
result = await handleAdminGetWeaviateSchema(args as any, userId, authContext);
|
|
499
|
+
break;
|
|
500
|
+
|
|
501
|
+
case 'remember_admin_list_collections':
|
|
502
|
+
result = await handleAdminListCollections(args as any, userId, authContext);
|
|
503
|
+
break;
|
|
504
|
+
|
|
505
|
+
case 'remember_admin_collection_stats':
|
|
506
|
+
result = await handleAdminCollectionStats(args as any, userId, authContext);
|
|
507
|
+
break;
|
|
508
|
+
|
|
509
|
+
case 'remember_admin_inspect_memory':
|
|
510
|
+
result = await handleAdminInspectMemory(args as any, userId, authContext);
|
|
511
|
+
break;
|
|
512
|
+
|
|
513
|
+
case 'remember_admin_search_across_users':
|
|
514
|
+
result = await handleAdminSearchAcrossUsers(args as any, userId, authContext);
|
|
515
|
+
break;
|
|
516
|
+
|
|
517
|
+
case 'remember_admin_inspect_user_preferences':
|
|
518
|
+
result = await handleAdminInspectUserPreferences(args as any, userId, authContext);
|
|
519
|
+
break;
|
|
520
|
+
|
|
521
|
+
case 'remember_admin_inspect_user_ghost_configs':
|
|
522
|
+
result = await handleAdminInspectUserGhostConfigs(args as any, userId, authContext);
|
|
523
|
+
break;
|
|
524
|
+
|
|
525
|
+
case 'remember_admin_inspect_user_escalation_records':
|
|
526
|
+
result = await handleAdminInspectUserEscalationRecords(args as any, userId, authContext);
|
|
527
|
+
break;
|
|
528
|
+
|
|
529
|
+
case 'remember_admin_inspect_user_api_tokens':
|
|
530
|
+
result = await handleAdminInspectUserApiTokens(args as any, userId, authContext);
|
|
531
|
+
break;
|
|
532
|
+
|
|
533
|
+
case 'remember_admin_health':
|
|
534
|
+
result = await handleAdminHealth(args as any, userId, authContext);
|
|
535
|
+
break;
|
|
536
|
+
|
|
537
|
+
case 'remember_admin_detect_weaviate_drift':
|
|
538
|
+
result = await handleAdminDetectWeaviateDrift(args as any, userId, authContext);
|
|
539
|
+
break;
|
|
540
|
+
|
|
458
541
|
default:
|
|
542
|
+
// Admin tool gate: reject non-admin users calling admin tools
|
|
543
|
+
if (name.startsWith('remember_admin_')) {
|
|
544
|
+
if (!isAdmin(userId)) {
|
|
545
|
+
return adminPermissionError();
|
|
546
|
+
}
|
|
547
|
+
}
|
|
459
548
|
throw new McpError(
|
|
460
549
|
ErrorCode.MethodNotFound,
|
|
461
550
|
`Unknown tool: ${name}`
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_admin_collection_stats tool
|
|
3
|
+
* Returns stats for a specific Weaviate collection.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { handleToolError } from '../utils/error-handler.js';
|
|
7
|
+
import { createDebugLogger } from '../utils/debug.js';
|
|
8
|
+
import type { AuthContext } from '../types/auth.js';
|
|
9
|
+
import { isAdmin, adminPermissionError } from '../utils/admin.js';
|
|
10
|
+
import { getWeaviateClient } from '../weaviate/client.js';
|
|
11
|
+
|
|
12
|
+
export const adminCollectionStatsTool = {
|
|
13
|
+
name: 'remember_admin_collection_stats',
|
|
14
|
+
description: `[Admin] Get stats for a Weaviate collection — object count, property count, configuration.
|
|
15
|
+
|
|
16
|
+
Requires admin access (ADMIN_USER_IDS).`,
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
collection_name: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Collection name to get stats for',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['collection_name'],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export interface AdminCollectionStatsArgs {
|
|
30
|
+
collection_name: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function handleAdminCollectionStats(
|
|
34
|
+
args: AdminCollectionStatsArgs,
|
|
35
|
+
userId: string,
|
|
36
|
+
_authContext?: AuthContext
|
|
37
|
+
): Promise<string> {
|
|
38
|
+
const debug = createDebugLogger({ tool: 'remember_admin_collection_stats', userId, operation: 'collection stats' });
|
|
39
|
+
try {
|
|
40
|
+
if (!isAdmin(userId)) {
|
|
41
|
+
return JSON.stringify(adminPermissionError());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
debug.info('Tool invoked', { collection_name: args.collection_name });
|
|
45
|
+
|
|
46
|
+
const client = getWeaviateClient();
|
|
47
|
+
const collection = client.collections.get(args.collection_name);
|
|
48
|
+
|
|
49
|
+
// Get config and count in parallel
|
|
50
|
+
const [config, objectCount] = await Promise.all([
|
|
51
|
+
collection.config.get(),
|
|
52
|
+
collection.length(),
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
return JSON.stringify({
|
|
56
|
+
collection_name: args.collection_name,
|
|
57
|
+
object_count: objectCount,
|
|
58
|
+
property_count: config.properties.length,
|
|
59
|
+
properties: config.properties.map((p: any) => p.name),
|
|
60
|
+
vectorizers: config.vectorizers,
|
|
61
|
+
multiTenancy: config.multiTenancy,
|
|
62
|
+
replication: config.replication,
|
|
63
|
+
}, null, 2);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
return handleToolError(error, { toolName: 'remember_admin_collection_stats', userId, operation: 'collection stats' });
|
|
66
|
+
}
|
|
67
|
+
}
|