@grec0/memory-bank-mcp 0.2.6 → 0.2.7

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.
@@ -5,6 +5,9 @@
5
5
  */
6
6
  import { databaseManager } from './database.js';
7
7
  import * as crypto from 'crypto';
8
+ import * as fs from 'fs';
9
+ import * as path from 'path';
10
+ import * as os from 'os';
8
11
  // ============================================================================
9
12
  // Agent Board SQLite Implementation
10
13
  // ============================================================================
@@ -20,6 +23,7 @@ export class AgentBoardSqlite {
20
23
  * Register a new agent for this project.
21
24
  * Automatically deactivates any previous active agent.
22
25
  * The MCP generates the hash suffix - client only provides base ID.
26
+ * Also syncs project keywords/responsibilities from registry to SQLite.
23
27
  */
24
28
  registerAgent(baseAgentId, sessionId) {
25
29
  const db = databaseManager.getConnection();
@@ -29,6 +33,23 @@ export class AgentBoardSqlite {
29
33
  // Generate session ID if not provided
30
34
  const effectiveSessionId = sessionId || crypto.randomUUID();
31
35
  const now = new Date().toISOString();
36
+ // Get project metadata from registry (keywords, responsibilities) - sync read
37
+ let keywords = [];
38
+ let responsibilities = [];
39
+ try {
40
+ const registryPath = path.join(os.homedir(), '.memorybank', 'global_registry.json');
41
+ if (fs.existsSync(registryPath)) {
42
+ const registryData = JSON.parse(fs.readFileSync(registryPath, 'utf-8'));
43
+ const project = registryData.projects?.find((p) => p.projectId === this.projectId);
44
+ if (project) {
45
+ keywords = project.keywords || [];
46
+ responsibilities = project.responsibilities || [];
47
+ }
48
+ }
49
+ }
50
+ catch (e) {
51
+ // Registry not available, continue without metadata
52
+ }
32
53
  return databaseManager.transaction(() => {
33
54
  // Deactivate any currently active agents for this project
34
55
  db.prepare(`
@@ -36,11 +57,11 @@ export class AgentBoardSqlite {
36
57
  SET status = 'INACTIVE', last_heartbeat = ?
37
58
  WHERE project_id = ? AND status = 'ACTIVE'
38
59
  `).run(now, this.projectId);
39
- // Insert new agent as ACTIVE
60
+ // Insert new agent as ACTIVE with project metadata
40
61
  db.prepare(`
41
- INSERT INTO agents (id, project_id, session_id, status, focus, last_heartbeat)
42
- VALUES (?, ?, ?, 'ACTIVE', '-', ?)
43
- `).run(fullAgentId, this.projectId, effectiveSessionId, now);
62
+ INSERT INTO agents (id, project_id, session_id, status, focus, last_heartbeat, keywords, responsibilities)
63
+ VALUES (?, ?, ?, 'ACTIVE', '-', ?, ?, ?)
64
+ `).run(fullAgentId, this.projectId, effectiveSessionId, now, JSON.stringify(keywords), JSON.stringify(responsibilities));
44
65
  // Log the registration
45
66
  this.logMessage(fullAgentId, `Agent registered and activated`);
46
67
  return { agentId: fullAgentId, sessionId: effectiveSessionId };
@@ -7,7 +7,7 @@ import Database from 'better-sqlite3';
7
7
  import * as path from 'path';
8
8
  import * as os from 'os';
9
9
  import * as fs from 'fs';
10
- const SCHEMA_VERSION = 2; // v2: Added orchestrator_logs table
10
+ const SCHEMA_VERSION = 3; // v2: Added orchestrator_logs table, v3: Added keywords/responsibilities to agents
11
11
  /**
12
12
  * SQL Schema for Agent Board
13
13
  */
@@ -21,6 +21,8 @@ CREATE TABLE IF NOT EXISTS agents (
21
21
  status TEXT NOT NULL DEFAULT 'ACTIVE', -- ACTIVE, INACTIVE
22
22
  focus TEXT DEFAULT '-', -- Current task/file being worked on
23
23
  last_heartbeat TEXT NOT NULL, -- ISO timestamp of last activity
24
+ keywords TEXT, -- JSON array of project keywords (synced from registry)
25
+ responsibilities TEXT, -- JSON array of project responsibilities (synced from registry)
24
26
  created_at TEXT NOT NULL DEFAULT (datetime('now')),
25
27
  PRIMARY KEY (id, project_id)
26
28
  );
@@ -180,6 +182,26 @@ class DatabaseManager {
180
182
  console.error(`[Database] Migrating schema from v${currentVersion} to v${SCHEMA_VERSION}`);
181
183
  // Run schema creation (IF NOT EXISTS makes it safe)
182
184
  this.db.exec(SCHEMA_SQL);
185
+ // v3 migration: Add keywords and responsibilities columns to agents table
186
+ if (currentVersion < 3) {
187
+ try {
188
+ // Check if columns already exist
189
+ const tableInfo = this.db.prepare("PRAGMA table_info(agents)").all();
190
+ const hasKeywords = tableInfo.some(col => col.name === 'keywords');
191
+ const hasResponsibilities = tableInfo.some(col => col.name === 'responsibilities');
192
+ if (!hasKeywords) {
193
+ this.db.exec('ALTER TABLE agents ADD COLUMN keywords TEXT');
194
+ console.error('[Database] Added keywords column to agents table');
195
+ }
196
+ if (!hasResponsibilities) {
197
+ this.db.exec('ALTER TABLE agents ADD COLUMN responsibilities TEXT');
198
+ console.error('[Database] Added responsibilities column to agents table');
199
+ }
200
+ }
201
+ catch (alterError) {
202
+ console.error(`[Database] Warning during v3 migration: ${alterError.message}`);
203
+ }
204
+ }
183
205
  // Record/update schema version
184
206
  this.db.prepare('INSERT OR REPLACE INTO schema_version (version) VALUES (?)').run(SCHEMA_VERSION);
185
207
  console.error(`[Database] Schema initialized at v${SCHEMA_VERSION}`);
@@ -1,2 +1,2 @@
1
1
  // Version of the MCP Kanban server
2
- export const VERSION = "0.2.5";
2
+ export const VERSION = "0.2.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grec0/memory-bank-mcp",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "MCP server for semantic code indexing with Memory Bank - AI-powered codebase understanding",
5
5
  "license": "MIT",
6
6
  "author": "@grec0",