session-collab-mcp 0.3.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "session-collab-mcp",
3
- "version": "0.3.0",
3
+ "version": "0.4.2",
4
4
  "description": "MCP server for Claude Code session collaboration - prevents conflicts between parallel sessions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,8 +16,6 @@
16
16
  "start": "node dist/cli.js",
17
17
  "start:dev": "tsx src/cli.ts",
18
18
  "prepublishOnly": "npm run build",
19
- "dev": "wrangler dev",
20
- "deploy": "wrangler deploy",
21
19
  "typecheck": "tsc --noEmit",
22
20
  "lint": "eslint src/",
23
21
  "test": "vitest"
@@ -28,12 +26,10 @@
28
26
  "zod": "^3.24.1"
29
27
  },
30
28
  "devDependencies": {
31
- "@cloudflare/workers-types": "^4.20241218.0",
32
29
  "@types/better-sqlite3": "^7.6.12",
33
30
  "eslint": "^9.17.0",
34
31
  "tsup": "^8.5.1",
35
32
  "typescript": "^5.7.2",
36
- "vitest": "^2.1.8",
37
- "wrangler": "^3.99.0"
33
+ "vitest": "^2.1.8"
38
34
  }
39
35
  }
@@ -1,6 +1,6 @@
1
1
  // Authentication API handlers
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from '../db/sqlite-adapter.js';
4
4
  import { hashPassword, verifyPassword, validatePasswordStrength } from './password';
5
5
  import { createAccessToken, createRefreshToken, verifyJwt, getTokenExpiry } from './jwt';
6
6
  import {
@@ -1,6 +1,6 @@
1
1
  // Authentication middleware
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from '../db/sqlite-adapter.js';
4
4
  import { verifyJwt } from './jwt';
5
5
  import { getApiTokenByHash, updateApiTokenLastUsed } from '../db/auth-queries';
6
6
  import { sha256, timingSafeEqual } from '../utils/crypto';
@@ -50,7 +50,7 @@ export async function verifyPassword(password: string, stored: string): Promise<
50
50
  const hash = await crypto.subtle.deriveBits(
51
51
  {
52
52
  name: 'PBKDF2',
53
- salt,
53
+ salt: salt as BufferSource,
54
54
  iterations,
55
55
  hash: 'SHA-256',
56
56
  },
package/src/cli.ts CHANGED
@@ -107,7 +107,7 @@ async function main(): Promise<void> {
107
107
 
108
108
  case 'tools/call': {
109
109
  const result = await handleMcpRequest(
110
- db as unknown as import('@cloudflare/workers-types').D1Database,
110
+ db,
111
111
  params.name,
112
112
  params.arguments ?? {}
113
113
  );
@@ -1,6 +1,6 @@
1
1
  // Database queries for authentication
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from './sqlite-adapter.js';
4
4
  import type { User, UserPublic, ApiToken, ApiTokenPublic, RefreshToken } from './types';
5
5
  import { generateId, sha256 } from '../utils/crypto';
6
6
 
package/src/db/queries.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Database queries for Session Collaboration MCP
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from './sqlite-adapter.js';
4
4
  import type {
5
5
  Session,
6
6
  Claim,
package/src/mcp/server.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // MCP Server implementation for Session Collaboration
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from '../db/sqlite-adapter.js';
4
4
  import {
5
5
  JsonRpcRequestSchema,
6
6
  type JsonRpcRequest,
@@ -22,13 +22,45 @@ import type { AuthContext } from '../auth/types';
22
22
 
23
23
  const SERVER_INFO: McpServerInfo = {
24
24
  name: 'session-collab-mcp',
25
- version: '0.2.0',
25
+ version: '0.3.0',
26
26
  };
27
27
 
28
28
  const CAPABILITIES: McpCapabilities = {
29
29
  tools: {},
30
30
  };
31
31
 
32
+ const SERVER_INSTRUCTIONS = `
33
+ # Session Collaboration
34
+
35
+ This MCP server coordinates multiple Claude Code sessions working on the same codebase.
36
+
37
+ ## Required Behaviors
38
+
39
+ 1. **On conversation start**: Immediately call \`collab_session_start\` with:
40
+ - project_root: Current working directory
41
+ - name: Descriptive session name (e.g., "feature-auth", "bugfix-api")
42
+
43
+ 2. **Before editing any file**: Call \`collab_check\` with the file path to verify no conflicts
44
+
45
+ 3. **If conflicts detected**:
46
+ - Show warning to user
47
+ - Ask if they want to proceed or coordinate
48
+ - Consider using \`collab_message_send\` to notify other session
49
+
50
+ 4. **For significant changes**: Call \`collab_claim\` before starting work on files
51
+
52
+ 5. **When done with files**: Call \`collab_release\` to free them for others
53
+
54
+ 6. **On conversation end**: Call \`collab_session_end\` to clean up
55
+
56
+ ## Best Practices
57
+
58
+ - Claim files early, release when done
59
+ - Use descriptive intents when claiming (e.g., "Refactoring auth module")
60
+ - Check for messages periodically with \`collab_message_list\`
61
+ - Record architectural decisions with \`collab_decision_add\`
62
+ `.trim();
63
+
32
64
  // Combine all tools
33
65
  const ALL_TOOLS: McpTool[] = [...sessionTools, ...claimTools, ...messageTools, ...decisionTools];
34
66
 
@@ -74,6 +106,7 @@ export class McpServer {
74
106
  protocolVersion: '2024-11-05',
75
107
  serverInfo: SERVER_INFO,
76
108
  capabilities: CAPABILITIES,
109
+ instructions: SERVER_INSTRUCTIONS,
77
110
  });
78
111
  }
79
112
 
@@ -1,6 +1,6 @@
1
1
  // Claim management tools (WIP declarations)
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from '../../db/sqlite-adapter.js';
4
4
  import type { McpTool, McpToolResult } from '../protocol';
5
5
  import { createToolResult } from '../protocol';
6
6
  import type { ClaimScope } from '../../db/types';
@@ -1,6 +1,6 @@
1
1
  // Decision recording tools
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from '../../db/sqlite-adapter.js';
4
4
  import type { McpTool, McpToolResult } from '../protocol';
5
5
  import { createToolResult } from '../protocol';
6
6
  import type { DecisionCategory } from '../../db/types';
@@ -1,6 +1,6 @@
1
1
  // Inter-session messaging tools
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from '../../db/sqlite-adapter.js';
4
4
  import type { McpTool, McpToolResult } from '../protocol';
5
5
  import { createToolResult } from '../protocol';
6
6
  import { sendMessage, listMessages, getSession } from '../../db/queries';
@@ -1,6 +1,6 @@
1
1
  // Session management tools
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from '../../db/sqlite-adapter.js';
4
4
  import type { McpTool, McpToolResult } from '../protocol';
5
5
  import { createToolResult } from '../protocol';
6
6
  import {
@@ -1,6 +1,6 @@
1
1
  // Token management API handlers
2
2
 
3
- import type { D1Database } from '@cloudflare/workers-types';
3
+ import type { D1Database } from '../db/sqlite-adapter.js';
4
4
  import { z } from 'zod';
5
5
  import { generateApiToken } from './generator';
6
6
  import { createApiToken, listApiTokens, revokeApiToken } from '../db/auth-queries';