session-collab-mcp 2.0.2 → 2.2.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/README.md CHANGED
@@ -3,11 +3,11 @@
3
3
  [![npm version](https://img.shields.io/npm/v/session-collab-mcp.svg)](https://www.npmjs.com/package/session-collab-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- A Model Context Protocol (MCP) server for Claude Code that prevents conflicts when multiple sessions work on the same codebase simultaneously.
6
+ A provider-agnostic Model Context Protocol (MCP) server that prevents conflicts when multiple agent sessions work on the same codebase simultaneously.
7
7
 
8
8
  ## Problem
9
9
 
10
- When using parallel Claude Code sessions or the parallel-dev workflow:
10
+ When using parallel coding-agent sessions or multi-agent workflows:
11
11
 
12
12
  - Session A is refactoring some code
13
13
  - Session B doesn't know and thinks the code "has issues" - deletes or reverts it
@@ -25,29 +25,20 @@ Session Collab MCP provides a **Work-in-Progress (WIP) Registry** that allows se
25
25
  4. **Protect** - Guard critical files from accidental changes
26
26
  5. **Release** - Free files when done
27
27
 
28
- ## Installation
28
+ ## Positioning
29
29
 
30
- ### Option 1: Claude Code Plugin (Recommended)
30
+ `session-collab-mcp` has two layers:
31
31
 
32
- Install as a Claude Code plugin for automatic MCP server setup, hooks, and skills:
32
+ - **Core server**: provider-agnostic MCP server over stdio or HTTP JSON-RPC
33
+ - **Optional integrations**: provider-specific packaging such as the Claude Code plugin in [`plugin/`](plugin/)
33
34
 
34
- ```bash
35
- # Add marketplace
36
- /plugin marketplace add leaf76/session-collab-mcp
37
-
38
- # Install plugin
39
- /plugin install session-collab@session-collab-plugins
40
- ```
35
+ The core server should be the default mental model. Claude Code is one integration target, not the product boundary.
41
36
 
42
- The plugin includes:
43
- - **MCP Server**: Automatically configured
44
- - **Hooks**: SessionStart and PreToolUse reminders
45
- - **Skills**: `collab-start` for full initialization
46
- - **Commands**: `/session-collab:status` and `/session-collab:end`
37
+ ## Installation
47
38
 
48
- ### Option 2: MCP Server Only
39
+ ### Option 1: Generic MCP Client over stdio
49
40
 
50
- Add to your `~/.claude.json`:
41
+ Use this with any MCP client that can launch a local stdio server:
51
42
 
52
43
  ```json
53
44
  {
@@ -60,7 +51,43 @@ Add to your `~/.claude.json`:
60
51
  }
61
52
  ```
62
53
 
63
- ### Option 3: Global Installation
54
+ The exact config wrapper depends on your MCP client, but the server contract is the same.
55
+
56
+ ### Option 2: HTTP Server + CLI
57
+
58
+ Use this when your client prefers MCP over HTTP JSON-RPC or when you want a generic shell-friendly wrapper:
59
+
60
+ ```bash
61
+ # Start HTTP server
62
+ session-collab-http --host 127.0.0.1 --port 8765
63
+
64
+ # CLI wrapper (convenience REST client)
65
+ session-collab health
66
+ session-collab tools
67
+ session-collab call --name collab_session_start --args '{"project_root":"/repo","name":"demo"}'
68
+ ```
69
+
70
+ For MCP-over-HTTP clients, use `POST /mcp` with JSON-RPC requests. The `/v1/*` endpoints are a convenience REST facade for lightweight automation and shell usage.
71
+
72
+ ### Option 3: Claude Code Plugin (Optional Integration)
73
+
74
+ Install as a Claude Code plugin only if Claude Code is your MCP client and you want automatic server setup, hooks, and skills:
75
+
76
+ ```bash
77
+ # Add marketplace
78
+ /plugin marketplace add leaf76/session-collab-mcp
79
+
80
+ # Install plugin
81
+ /plugin install session-collab@session-collab-plugins
82
+ ```
83
+
84
+ The plugin includes:
85
+ - **MCP Server**: Automatically configured
86
+ - **Hooks**: SessionStart, Stop, and PreCompact reminders
87
+ - **Skills**: `collab-start` for full initialization
88
+ - **Commands**: `/session-collab:status` and `/session-collab:end`
89
+
90
+ ### Option 4: Global Installation
64
91
 
65
92
  ```bash
66
93
  npm install -g session-collab-mcp
@@ -68,14 +95,15 @@ npm install -g session-collab-mcp
68
95
 
69
96
  ## Features
70
97
 
71
- ### Automatic Session Management
98
+ ### Guided Session Workflow
72
99
 
73
- Once installed, Claude will:
100
+ The MCP tools give you a stable collaboration workflow across providers:
74
101
 
75
- 1. Register a session when conversation starts
76
- 2. Check for conflicts before editing files
77
- 3. Warn you if another session is working on the same files
78
- 4. Clean up when the conversation ends
102
+ 1. Start a session with `collab_session_start`
103
+ 2. Check files with `collab_claim(action="check")`
104
+ 3. Reserve files with `collab_claim(action="create")`
105
+ 4. Save important context with `collab_memory_save`
106
+ 5. End the session with `collab_session_end`
79
107
 
80
108
  ### Working Memory
81
109
 
@@ -90,11 +118,11 @@ Context persistence that survives context compaction:
90
118
 
91
119
  ### File Protection
92
120
 
93
- Guard critical files from accidental changes:
121
+ Guard important plan files or created files from accidental deletion:
94
122
 
95
- - Register protected files with reasons and priorities
96
- - Automatic conflict detection for protected files
97
- - Configurable protection levels
123
+ - Register a protected plan with `collab_protect(action="register", type="plan", ...)`
124
+ - Register a created file with `collab_protect(action="register", type="file", ...)`
125
+ - Check protection status before deleting or replacing a file
98
126
 
99
127
  ### Conflict Handling Modes
100
128
 
@@ -117,7 +145,7 @@ Configure behavior with `collab_config`:
117
145
 
118
146
  ## MCP Tools Reference
119
147
 
120
- ### Session Management (4 tools)
148
+ ### Session Management (5 tools)
121
149
 
122
150
  | Tool | Purpose |
123
151
  |------|---------|
@@ -125,12 +153,13 @@ Configure behavior with `collab_config`:
125
153
  | `collab_session_end` | End session and release all claims |
126
154
  | `collab_session_list` | List active sessions |
127
155
  | `collab_config` | Configure session behavior |
156
+ | `collab_status` | Get session status summary |
128
157
 
129
158
  ### Claims (1 unified tool)
130
159
 
131
160
  | Tool | Actions |
132
161
  |------|---------|
133
- | `collab_claim` | `create`, `check`, `release`, `list` |
162
+ | `collab_claim` | `create`, `check`, `release`, `list` (check: `exclude_self` defaults to true) |
134
163
 
135
164
  ### Working Memory (3 tools)
136
165
 
@@ -152,6 +181,34 @@ Configure behavior with `collab_config`:
152
181
  |------|---------|
153
182
  | `collab_status` | Unified session status |
154
183
 
184
+ ### HTTP API (v1)
185
+
186
+ `/v1/*` endpoints map 1:1 to MCP tools and return JSON responses with `trace_id` on failures:
187
+
188
+ - `POST /v1/sessions/start` → `collab_session_start`
189
+ - `POST /v1/sessions/end` → `collab_session_end`
190
+ - `GET /v1/sessions` → `collab_session_list`
191
+ - `POST /v1/config` → `collab_config`
192
+ - `GET /v1/status` → `collab_status`
193
+ - `POST /v1/claims` → `collab_claim` (create)
194
+ - `POST /v1/claims/check` → `collab_claim` (check)
195
+ - `POST /v1/claims/release` → `collab_claim` (release)
196
+ - `GET /v1/claims` → `collab_claim` (list)
197
+ - `POST /v1/memory/save` → `collab_memory_save`
198
+ - `POST /v1/memory/recall` → `collab_memory_recall`
199
+ - `POST /v1/memory/clear` → `collab_memory_clear`
200
+ - `POST /v1/protect/register` → `collab_protect` (register)
201
+ - `POST /v1/protect/check` → `collab_protect` (check)
202
+ - `GET /v1/protect/list` → `collab_protect` (list)
203
+ - `POST /v1/tools/call` / `GET /v1/tools` (generic access)
204
+
205
+ ### MCP over HTTP
206
+
207
+ - `POST /mcp` accepts JSON-RPC `initialize`, `tools/list`, and `tools/call` requests
208
+ - `GET /mcp` currently returns a clear "stream not supported" response instead of pretending to be full Streamable HTTP SSE
209
+ - Localhost binds enforce Host and Origin validation
210
+ - Non-local binds require both `SESSION_COLLAB_HTTP_TOKEN` and an allowed-host list via `SESSION_COLLAB_ALLOWED_HOSTS` or repeated `--allowed-host`
211
+
155
212
  ## Usage Examples
156
213
 
157
214
  ### Basic Workflow
@@ -159,14 +216,17 @@ Configure behavior with `collab_config`:
159
216
  ```bash
160
217
  # Session A starts working
161
218
  collab_session_start(project_root="/my/project", name="feature-auth")
162
- collab_claim(action="create", files=["src/auth.ts"], intent="Adding JWT support")
219
+ collab_claim(session_id="session-a", action="create", files=["src/auth.ts"], intent="Adding JWT support")
163
220
 
164
221
  # Session B checks before editing
165
- collab_claim(action="check", files=["src/auth.ts"])
222
+ collab_claim(session_id="session-b", action="check", files=["src/auth.ts"])
166
223
  # Result: "CONFLICT: src/auth.ts is claimed by 'feature-auth'"
167
224
 
225
+ # If you want to include your own claims in the check
226
+ collab_claim(session_id="session-a", action="check", files=["src/auth.ts"], exclude_self=false)
227
+
168
228
  # Session A finishes
169
- collab_claim(action="release", claim_id="...")
229
+ collab_claim(session_id="session-a", action="release", claim_id="...")
170
230
  ```
171
231
 
172
232
  ### Working Memory
@@ -174,6 +234,7 @@ collab_claim(action="release", claim_id="...")
174
234
  ```bash
175
235
  # Save a finding
176
236
  collab_memory_save(
237
+ session_id="abc123",
177
238
  category="finding",
178
239
  key="auth_bug_root_cause",
179
240
  content="Missing token validation in refresh flow",
@@ -181,26 +242,29 @@ collab_memory_save(
181
242
  )
182
243
 
183
244
  # Recall active memories
184
- collab_memory_recall(active=true, priority_threshold=70)
245
+ collab_memory_recall(session_id="abc123", active=true)
185
246
  ```
186
247
 
187
248
  ### File Protection
188
249
 
189
250
  ```bash
190
- # Protect critical file
251
+ # Protect a plan document
191
252
  collab_protect(
192
253
  action="register",
193
- file_path="src/core/auth.ts",
194
- reason="Core authentication logic",
195
- priority=95
254
+ session_id="abc123",
255
+ type="plan",
256
+ file_path="docs/feature-plan.md",
257
+ title="Feature plan",
258
+ content_summary="Steps, risks, and rollout notes"
196
259
  )
197
260
 
198
261
  # Check before editing
199
262
  collab_protect(
200
263
  action="check",
201
- file_paths=["src/core/auth.ts"]
264
+ session_id="abc123",
265
+ file_path="docs/feature-plan.md"
202
266
  )
203
- # Result: "BLOCKED: File is protected - Core authentication logic"
267
+ # Result: "Protected (plan). Confirm before deleting."
204
268
  ```
205
269
 
206
270
  ### Status Monitoring
@@ -211,7 +275,7 @@ collab_status(session_id="abc123")
211
275
  # Result: {
212
276
  # session: { id: "abc123", name: "feature-auth", status: "active" },
213
277
  # claims: [...],
214
- # active_memories: 5,
278
+ # other_sessions: 1,
215
279
  # message: "Session active. 2 claim(s), 5 memories."
216
280
  # }
217
281
  ```
@@ -222,7 +286,7 @@ Version 2.0 introduces breaking changes with a simplified API. See [MIGRATION.md
222
286
 
223
287
  ### Key Changes
224
288
 
225
- - **Tool Consolidation**: 50+ tools → 9 core tools
289
+ - **Tool Consolidation**: 50+ tools → 10 core tools
226
290
  - **Action-Based Interface**: Single tools with multiple actions
227
291
  - **Simplified Responses**: Cleaner, flatter response formats
228
292
  - **Removed Features**: LSP integration, messaging, notifications, queuing
@@ -232,7 +296,8 @@ Version 2.0 introduces breaking changes with a simplified API. See [MIGRATION.md
232
296
  All data is stored locally in `~/.claude/session-collab/collab.db` (SQLite).
233
297
 
234
298
  - No remote server required
235
- - No API token needed
299
+ - Localhost HTTP usage works without an API token
300
+ - Non-local HTTP binds require `SESSION_COLLAB_HTTP_TOKEN`
236
301
  - Works offline
237
302
  - Uses WAL mode for multi-process safety
238
303
 
@@ -250,6 +315,16 @@ npm install
250
315
  npm run build
251
316
  ```
252
317
 
318
+ ### Legacy Build (Optional)
319
+
320
+ Legacy schemas/queries are kept out of the default bundle. To include a legacy entry for compatibility:
321
+
322
+ ```bash
323
+ SESSION_COLLAB_INCLUDE_LEGACY=true npm run build
324
+ ```
325
+
326
+ Maintenance note: legacy exports are for backward compatibility only and are not exposed in the v2 tool list.
327
+
253
328
  ### Scripts
254
329
 
255
330
  ```bash
@@ -261,13 +336,25 @@ npm run lint # Run ESLint
261
336
  npm run test # Run tests with Vitest
262
337
  ```
263
338
 
339
+ ### HTTP Integration Tests
340
+
341
+ HTTP integration tests require a local listen port. Enable them with:
342
+
343
+ ```bash
344
+ SESSION_COLLAB_HTTP_TESTS=true npx vitest run src/http/__tests__/server-integration.test.ts
345
+ ```
346
+
347
+ ### Historical Notes
348
+
349
+ The changelog entries below document historical milestones, including tools and workflows that were removed before the current v2 API. Treat the tool tables and examples above as the source of truth for the current public surface.
350
+
264
351
  ### Project Structure
265
352
 
266
353
  ```
267
354
  session-collab-mcp/
268
355
  ├── bin/ # Executable entry point
269
356
  ├── migrations/ # SQLite migration files
270
- ├── plugin/ # Claude Code Plugin
357
+ ├── plugin/ # Optional Claude Code integration
271
358
  ├── src/
272
359
  │ ├── cli.ts # CLI entry point
273
360
  │ ├── constants.ts # Version and server instructions
@@ -285,9 +372,17 @@ session-collab-mcp/
285
372
 
286
373
  ## Changelog
287
374
 
375
+ ### v2.1.0
376
+
377
+ - Add HTTP server + CLI wrapper for universal AI CLI usage
378
+ - Add HTTP API endpoints and utils tests
379
+ - Add legacy entry for deprecated schemas/queries (optional build)
380
+ - Improve claim conflict accuracy and release summaries
381
+ - Expand test coverage across MCP tools and DB flows
382
+
288
383
  ### v2.0.0 (Breaking)
289
384
 
290
- - **Major Simplification**: Reduced from 50+ tools to 9 core tools
385
+ - **Major Simplification**: Reduced from 50+ tools to 10 core tools
291
386
  - **Action-Based Design**: Unified tools with action parameters
292
387
  - **Removed Features**: LSP integration, messaging, notifications, queuing, decision tracking
293
388
  - **Improved Performance**: Faster startup and reduced complexity
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname, join } from 'path';
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ const cli = join(__dirname, '..', 'dist', 'http', 'client-cli.js');
7
+
8
+ import(cli).catch((err) => {
9
+ console.error('Failed to start:', err.message);
10
+ process.exit(1);
11
+ });
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname, join } from 'path';
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ const cli = join(__dirname, '..', 'dist', 'http', 'cli.js');
7
+
8
+ import(cli).catch((err) => {
9
+ console.error('Failed to start:', err.message);
10
+ process.exit(1);
11
+ });