@contextstream/mcp-server 0.3.66 → 0.3.68

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.
Files changed (4) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +390 -390
  3. package/dist/index.js +149 -38
  4. package/package.json +57 -57
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 ContextStream
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ContextStream
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,390 +1,390 @@
1
- # ContextStream MCP Server
2
-
3
- Persistent memory, semantic search, and code intelligence for any MCP-compatible AI tool.
4
-
5
- ContextStream is a shared "brain" for your AI workflows. It stores decisions, preferences, and lessons, and lets your AI tools search and analyze your codebase with consistent context across sessions.
6
-
7
- ## Just Ask
8
-
9
- **You don't need to memorize tool names.** Just describe what you want and your AI uses the right ContextStream tools automatically:
10
-
11
- | You say... | ContextStream does... |
12
- |------------|----------------------|
13
- | "session summary" | Gets a summary of your workspace context |
14
- | "what did we decide about auth?" | Recalls past decisions about authentication |
15
- | "remember we're using PostgreSQL" | Saves this to memory for future sessions |
16
- | "search for payment code" | Searches your codebase semantically |
17
- | "what depends on UserService?" | Analyzes code dependencies |
18
-
19
- No special syntax. No commands to learn. Just ask.
20
-
21
- > **Tip:** For best results, add the [recommended editor rules](https://contextstream.io/docs/quickstart) so your AI consistently calls `session_init` / `context_smart` automatically.
22
-
23
- ![ContextStream in action](compare1.gif)
24
-
25
- ## Features
26
-
27
- - Session-aware context loading (`session_init`, `context_smart`)
28
- - Memory capture and recall (decisions, preferences, tasks, bugs, lessons)
29
- - Code search (semantic, hybrid, keyword, pattern)
30
- - Knowledge graph and code analysis (dependencies, impact, call paths, circular deps, unused code)
31
- - Graph ingestion for full graph builds (`graph_ingest`)
32
- - Local repo ingestion for indexing (`projects_ingest_local`)
33
- - Auto-context: on the first tool call in a new session, the server can auto-initialize context
34
-
35
- ## Graph tiers
36
-
37
- - **Pro (Graph-Lite):** module-level import graph, dependencies, and 1-hop impact
38
- - **Elite/Team (Full Graph):** module + call + dataflow + type layers, plus `graph_ingest`
39
-
40
- ## Requirements
41
-
42
- - Node.js 18+
43
- - A ContextStream account and either an API key or a JWT
44
-
45
- ## Quickstart
46
-
47
- ### Setup wizard (recommended)
48
-
49
- This interactive wizard sets up authentication, installs editor rules, and writes MCP config files for the tools you select.
50
-
51
- ```bash
52
- npx -y @contextstream/mcp-server setup
53
- ```
54
-
55
- Notes:
56
- - Uses browser/device login by default and creates an API key for you.
57
- - Prompts for **toolset selection**: `light` (~30 tools), `standard` (default, ~50 tools), or `complete` (~86 tools including workspaces, projects, search, memory, graph, AI, and integrations).
58
- - To avoid re-auth prompts on subsequent runs, the wizard saves that API key to `~/.contextstream/credentials.json` (and also writes it into the MCP config files it generates). Delete that file to force a fresh login.
59
- - Codex CLI MCP config is global-only (`~/.codex/config.toml`), so the wizard will always write Codex config globally when selected.
60
- - Some tools still require UI/CLI-based MCP setup (the wizard will tell you when it can't write a config).
61
- - Preview changes without writing files: `npx -y @contextstream/mcp-server setup --dry-run`
62
-
63
- ### Run the server
64
-
65
- Run directly (recommended for MCP configs):
66
-
67
- ```bash
68
- npx -y @contextstream/mcp-server
69
- ```
70
-
71
- Or install globally:
72
-
73
- ```bash
74
- npm install -g @contextstream/mcp-server
75
- contextstream-mcp
76
- ```
77
-
78
- ### Keeping updated
79
-
80
- To get the latest features and bug fixes, update periodically:
81
-
82
- ```bash
83
- npm update -g @contextstream/mcp-server
84
- ```
85
-
86
- The MCP server will warn you when a newer version is available. After updating, restart your AI tool to use the new version.
87
-
88
- ## Configure your MCP client
89
-
90
- ### Manual setup
91
-
92
- If you ran the [setup wizard](#setup-wizard-recommended), you can usually skip this section.
93
-
94
- If you prefer to configure things by hand (or your tool can't be auto-configured), add the ContextStream MCP server to your client using one of the examples below.
95
-
96
- **Toolset**: By default, the server exposes the `standard` toolset (~50 tools). Use `CONTEXTSTREAM_TOOLSET=light` to reduce tool count (~30 tools), or `CONTEXTSTREAM_TOOLSET=complete` to expose all ~86 tools (workspaces, projects, search, memory, graph, AI, integrations). See the [full tool catalog](https://contextstream.io/docs/mcp/tools).
97
-
98
- ### Cursor / Windsurf / Claude Desktop (JSON)
99
-
100
- These clients use the `mcpServers` JSON schema:
101
-
102
- - Cursor: `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project)
103
- - Windsurf: `~/.codeium/windsurf/mcp_config.json`
104
- - Claude Desktop:
105
- - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
106
- - Windows: `%APPDATA%\\Claude\\claude_desktop_config.json`
107
-
108
- Many other MCP JSON clients also use this same `mcpServers` shape (including Claude Code project scope via `.mcp.json`).
109
-
110
- **Standard toolset (default, ~50 tools):**
111
-
112
- ```json
113
- {
114
- "mcpServers": {
115
- "contextstream": {
116
- "command": "npx",
117
- "args": ["-y", "@contextstream/mcp-server"],
118
- "env": {
119
- "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
120
- "CONTEXTSTREAM_API_KEY": "your_api_key"
121
- }
122
- }
123
- }
124
- }
125
- ```
126
-
127
- **Complete toolset (~86 tools):**
128
-
129
- ```json
130
- {
131
- "mcpServers": {
132
- "contextstream": {
133
- "command": "npx",
134
- "args": ["-y", "@contextstream/mcp-server"],
135
- "env": {
136
- "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
137
- "CONTEXTSTREAM_API_KEY": "your_api_key",
138
- "CONTEXTSTREAM_TOOLSET": "complete"
139
- }
140
- }
141
- }
142
- }
143
- ```
144
-
145
- ### VS Code (`.vscode/mcp.json`)
146
-
147
- VS Code uses a different schema with a top-level `servers` map:
148
-
149
- **Core toolset (default):**
150
-
151
- ```json
152
- {
153
- "servers": {
154
- "contextstream": {
155
- "type": "stdio",
156
- "command": "npx",
157
- "args": ["-y", "@contextstream/mcp-server"],
158
- "env": {
159
- "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
160
- "CONTEXTSTREAM_API_KEY": "your_api_key"
161
- }
162
- }
163
- }
164
- }
165
- ```
166
-
167
- **Complete toolset (~86 tools):**
168
-
169
- ```json
170
- {
171
- "servers": {
172
- "contextstream": {
173
- "type": "stdio",
174
- "command": "npx",
175
- "args": ["-y", "@contextstream/mcp-server"],
176
- "env": {
177
- "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
178
- "CONTEXTSTREAM_API_KEY": "your_api_key",
179
- "CONTEXTSTREAM_TOOLSET": "complete"
180
- }
181
- }
182
- }
183
- }
184
- ```
185
-
186
- Strong recommendation: VS Code supports `inputs` so you don’t have to hardcode secrets in a committed file:
187
-
188
- ```json
189
- {
190
- "servers": {
191
- "contextstream": {
192
- "type": "stdio",
193
- "command": "npx",
194
- "args": ["-y", "@contextstream/mcp-server"],
195
- "env": {
196
- "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
197
- "CONTEXTSTREAM_API_KEY": "${input:contextstreamApiKey}"
198
- }
199
- }
200
- },
201
- "inputs": [
202
- {
203
- "id": "contextstreamApiKey",
204
- "type": "promptString",
205
- "description": "ContextStream API Key",
206
- "password": true
207
- }
208
- ]
209
- }
210
- ```
211
-
212
- ### Claude Code (CLI)
213
-
214
- User scope (all projects):
215
-
216
- **Standard toolset (default):**
217
-
218
- ```bash
219
- claude mcp add --transport stdio contextstream --scope user \
220
- --env CONTEXTSTREAM_API_URL=https://api.contextstream.io \
221
- --env CONTEXTSTREAM_API_KEY=YOUR_KEY \
222
- -- npx -y @contextstream/mcp-server
223
- ```
224
-
225
- **Complete toolset (~86 tools):**
226
-
227
- ```bash
228
- claude mcp add --transport stdio contextstream --scope user \
229
- --env CONTEXTSTREAM_API_URL=https://api.contextstream.io \
230
- --env CONTEXTSTREAM_API_KEY=YOUR_KEY \
231
- --env CONTEXTSTREAM_TOOLSET=complete \
232
- -- npx -y @contextstream/mcp-server
233
- ```
234
-
235
- Note: Claude Code may warn about large tool contexts when using `complete`. The default is `standard` (~50 tools). Use `light` for fewer tools.
236
-
237
- Windows caveat (native Windows, not WSL): if `npx` isn't found, use `cmd /c npx -y @contextstream/mcp-server` after `--`.
238
-
239
- **Alternative (JSON form):**
240
-
241
- Standard:
242
- ```bash
243
- claude mcp add-json contextstream \
244
- '{"type":"stdio","command":"npx","args":["-y","@contextstream/mcp-server"],"env":{"CONTEXTSTREAM_API_URL":"https://api.contextstream.io","CONTEXTSTREAM_API_KEY":"your_api_key"}}'
245
- ```
246
-
247
- Complete:
248
- ```bash
249
- claude mcp add-json contextstream \
250
- '{"type":"stdio","command":"npx","args":["-y","@contextstream/mcp-server"],"env":{"CONTEXTSTREAM_API_URL":"https://api.contextstream.io","CONTEXTSTREAM_API_KEY":"your_api_key","CONTEXTSTREAM_TOOLSET":"complete"}}'
251
- ```
252
-
253
- ### Codex CLI (`~/.codex/config.toml`)
254
-
255
- **Standard toolset (default):**
256
-
257
- ```toml
258
- [mcp_servers.contextstream]
259
- command = "npx"
260
- args = ["-y", "@contextstream/mcp-server"]
261
-
262
- [mcp_servers.contextstream.env]
263
- CONTEXTSTREAM_API_URL = "https://api.contextstream.io"
264
- CONTEXTSTREAM_API_KEY = "your_api_key"
265
- ```
266
-
267
- **Complete toolset (~86 tools):**
268
-
269
- ```toml
270
- [mcp_servers.contextstream]
271
- command = "npx"
272
- args = ["-y", "@contextstream/mcp-server"]
273
-
274
- [mcp_servers.contextstream.env]
275
- CONTEXTSTREAM_API_URL = "https://api.contextstream.io"
276
- CONTEXTSTREAM_API_KEY = "your_api_key"
277
- CONTEXTSTREAM_TOOLSET = "complete"
278
- ```
279
-
280
- After editing, restart your MCP client so it reloads the server configuration.
281
-
282
- ## Authentication
283
-
284
- You can authenticate using either:
285
-
286
- - `CONTEXTSTREAM_API_KEY` (recommended for local/dev)
287
- - `CONTEXTSTREAM_JWT` (useful for hosted or user-session flows)
288
-
289
- ## Environment variables
290
-
291
- | Variable | Required | Description |
292
- |----------|----------|-------------|
293
- | `CONTEXTSTREAM_API_URL` | Yes | Base API URL (e.g. `https://api.contextstream.io`) |
294
- | `CONTEXTSTREAM_API_KEY` | Yes* | API key (*required unless `CONTEXTSTREAM_JWT` is set) |
295
- | `CONTEXTSTREAM_JWT` | Yes* | JWT (*required unless `CONTEXTSTREAM_API_KEY` is set) |
296
- | `CONTEXTSTREAM_WORKSPACE_ID` | No | Default workspace ID fallback |
297
- | `CONTEXTSTREAM_PROJECT_ID` | No | Default project ID fallback |
298
- | `CONTEXTSTREAM_USER_AGENT` | No | Custom user agent string |
299
- | `CONTEXTSTREAM_TOOLSET` | No | Tool bundle to expose: `light` (~30 tools), `standard` (default, ~50 tools), or `complete` (~86 tools). Claude Code/Desktop may warn about large tool contexts with `complete`. |
300
- | `CONTEXTSTREAM_TOOL_ALLOWLIST` | No | Comma-separated tool names to expose (overrides toolset) |
301
- | `CONTEXTSTREAM_PRO_TOOLS` | No | Comma-separated tool names treated as PRO (default: `ai_context,ai_enhanced_context,ai_context_budget,ai_embeddings,ai_plan,ai_tasks`) |
302
- | `CONTEXTSTREAM_UPGRADE_URL` | No | Upgrade link shown when Free users call PRO tools (default: `https://contextstream.io/pricing`) |
303
-
304
- ### Server-side environment variables (API)
305
-
306
- The following environment variables are configured on the ContextStream API server (not in your MCP client config):
307
-
308
- | Variable | Required | Description |
309
- |----------|----------|-------------|
310
- | `QA_FILE_WRITE_ROOT` | No | Server-side root directory for `write_to_disk` file writes. When set, the API allows the `projects_ingest_local` tool to write ingested files to disk for testing/QA purposes. Files are written under `<QA_FILE_WRITE_ROOT>/<project_id>/<relative_path>`. If not set, `write_to_disk` requests are rejected. |
311
-
312
- #### File write parameters for `projects_ingest_local`
313
-
314
- The `projects_ingest_local` tool accepts two optional parameters for QA/testing scenarios:
315
-
316
- | Parameter | Type | Default | Description |
317
- |-----------|------|---------|-------------|
318
- | `write_to_disk` | boolean | `false` | When `true`, writes ingested files to disk on the API server under `QA_FILE_WRITE_ROOT` before indexing. Requires the API to have `QA_FILE_WRITE_ROOT` configured. |
319
- | `overwrite` | boolean | `false` | When `true` (and `write_to_disk` is enabled), allows overwriting existing files. Otherwise, existing files are skipped. |
320
-
321
- **Example usage:**
322
- ```json
323
- {
324
- "path": "/path/to/local/project",
325
- "write_to_disk": true,
326
- "overwrite": false
327
- }
328
- ```
329
-
330
- **Note:** The `write_to_disk` feature is intended for testing, QA, and development scenarios where you need to materialize files on a test server. In production, `QA_FILE_WRITE_ROOT` should typically be unset to disable file writes.
331
-
332
- ## Usage patterns
333
-
334
- ### Recommended flow for AI tools
335
-
336
- 1. Start of a conversation: call `session_init(folder_path="...", context_hint="<first user message>")`
337
- 2. Before subsequent responses: call `context_smart(user_message="<current user message>")`
338
- 3. After important outcomes: call `session_capture(...)` or `session_capture_lesson(...)`
339
-
340
- ### Omit workspace/project IDs (recommended)
341
-
342
- Most tools accept omitted `workspace_id` / `project_id` and will use the current session defaults.
343
-
344
- - If you see “workspace_id is required”, call `session_init` first (or pass the ID explicitly).
345
- - If you regularly work in the same repo, use `workspace_associate` once so the server can auto-select the right workspace for that folder.
346
-
347
- ### First-time setup (no workspaces yet)
348
-
349
- If your account has no workspaces, ContextStream will prompt your AI assistant to ask you for a workspace name.
350
-
351
- - Provide a workspace name (e.g., your company/team/product)
352
- - The current folder is created as a project inside that workspace
353
- - Recommended: call `workspace_bootstrap(workspace_name="...", folder_path="...")`
354
-
355
- ## Free vs PRO tools
356
-
357
- Tools are labeled as `(Free)` or `(PRO)` in the MCP tool list.
358
-
359
- - Default PRO tools: `ai_context`, `ai_enhanced_context`, `ai_context_budget`, `ai_embeddings`, `ai_plan`, `ai_tasks`
360
- - If a Free-plan user calls a PRO tool, the server returns an upgrade message with a link.
361
- - Override the PRO list via `CONTEXTSTREAM_PRO_TOOLS` and the upgrade link via `CONTEXTSTREAM_UPGRADE_URL`.
362
-
363
- ## Troubleshooting
364
-
365
- - Tools not appearing: restart the client after editing MCP config; confirm Node 18+ is available to the client runtime.
366
- - Unauthorized errors: verify `CONTEXTSTREAM_API_URL` and `CONTEXTSTREAM_API_KEY` (or `CONTEXTSTREAM_JWT`).
367
- - Wrong workspace/project: use `workspace_associate` to map the current repo folder to the correct workspace.
368
-
369
- ## Development
370
-
371
- ```bash
372
- git clone https://github.com/contextstream/mcp-server.git
373
- cd mcp-server
374
- npm install
375
- npm run dev
376
- npm run typecheck
377
- npm run build
378
- ```
379
-
380
- ## Links
381
-
382
- - Website: https://contextstream.io
383
- - Docs: https://contextstream.io/docs/mcp
384
- - Pricing: https://contextstream.io/pricing
385
- - npm: https://www.npmjs.com/package/@contextstream/mcp-server
386
- - GitHub: https://github.com/contextstream/mcp-server
387
-
388
- ## License
389
-
390
- MIT
1
+ # ContextStream MCP Server
2
+
3
+ Persistent memory, semantic search, and code intelligence for any MCP-compatible AI tool.
4
+
5
+ ContextStream is a shared "brain" for your AI workflows. It stores decisions, preferences, and lessons, and lets your AI tools search and analyze your codebase with consistent context across sessions.
6
+
7
+ ## Just Ask
8
+
9
+ **You don't need to memorize tool names.** Just describe what you want and your AI uses the right ContextStream tools automatically:
10
+
11
+ | You say... | ContextStream does... |
12
+ |------------|----------------------|
13
+ | "session summary" | Gets a summary of your workspace context |
14
+ | "what did we decide about auth?" | Recalls past decisions about authentication |
15
+ | "remember we're using PostgreSQL" | Saves this to memory for future sessions |
16
+ | "search for payment code" | Searches your codebase semantically |
17
+ | "what depends on UserService?" | Analyzes code dependencies |
18
+
19
+ No special syntax. No commands to learn. Just ask.
20
+
21
+ > **Tip:** For best results, add the [recommended editor rules](https://contextstream.io/docs/quickstart) so your AI consistently calls `session_init` / `context_smart` automatically.
22
+
23
+ ![ContextStream in action](compare1.gif)
24
+
25
+ ## Features
26
+
27
+ - Session-aware context loading (`session_init`, `context_smart`)
28
+ - Memory capture and recall (decisions, preferences, tasks, bugs, lessons)
29
+ - Code search (semantic, hybrid, keyword, pattern)
30
+ - Knowledge graph and code analysis (dependencies, impact, call paths, circular deps, unused code)
31
+ - Graph ingestion for full graph builds (`graph_ingest`)
32
+ - Local repo ingestion for indexing (`projects_ingest_local`)
33
+ - Auto-context: on the first tool call in a new session, the server can auto-initialize context
34
+
35
+ ## Graph tiers
36
+
37
+ - **Pro (Graph-Lite):** module-level import graph, dependencies, and 1-hop impact
38
+ - **Elite/Team (Full Graph):** module + call + dataflow + type layers, plus `graph_ingest`
39
+
40
+ ## Requirements
41
+
42
+ - Node.js 18+
43
+ - A ContextStream account and either an API key or a JWT
44
+
45
+ ## Quickstart
46
+
47
+ ### Setup wizard (recommended)
48
+
49
+ This interactive wizard sets up authentication, installs editor rules, and writes MCP config files for the tools you select.
50
+
51
+ ```bash
52
+ npx -y @contextstream/mcp-server setup
53
+ ```
54
+
55
+ Notes:
56
+ - Uses browser/device login by default and creates an API key for you.
57
+ - Prompts for **toolset selection**: `light` (~30 tools), `standard` (default, ~50 tools), or `complete` (~86 tools including workspaces, projects, search, memory, graph, AI, and integrations).
58
+ - To avoid re-auth prompts on subsequent runs, the wizard saves that API key to `~/.contextstream/credentials.json` (and also writes it into the MCP config files it generates). Delete that file to force a fresh login.
59
+ - Codex CLI MCP config is global-only (`~/.codex/config.toml`), so the wizard will always write Codex config globally when selected.
60
+ - Some tools still require UI/CLI-based MCP setup (the wizard will tell you when it can't write a config).
61
+ - Preview changes without writing files: `npx -y @contextstream/mcp-server setup --dry-run`
62
+
63
+ ### Run the server
64
+
65
+ Run directly (recommended for MCP configs):
66
+
67
+ ```bash
68
+ npx -y @contextstream/mcp-server
69
+ ```
70
+
71
+ Or install globally:
72
+
73
+ ```bash
74
+ npm install -g @contextstream/mcp-server
75
+ contextstream-mcp
76
+ ```
77
+
78
+ ### Keeping updated
79
+
80
+ To get the latest features and bug fixes, update periodically:
81
+
82
+ ```bash
83
+ npm update -g @contextstream/mcp-server
84
+ ```
85
+
86
+ The MCP server will warn you when a newer version is available. After updating, restart your AI tool to use the new version.
87
+
88
+ ## Configure your MCP client
89
+
90
+ ### Manual setup
91
+
92
+ If you ran the [setup wizard](#setup-wizard-recommended), you can usually skip this section.
93
+
94
+ If you prefer to configure things by hand (or your tool can't be auto-configured), add the ContextStream MCP server to your client using one of the examples below.
95
+
96
+ **Toolset**: By default, the server exposes the `standard` toolset (~50 tools). Use `CONTEXTSTREAM_TOOLSET=light` to reduce tool count (~30 tools), or `CONTEXTSTREAM_TOOLSET=complete` to expose all ~86 tools (workspaces, projects, search, memory, graph, AI, integrations). See the [full tool catalog](https://contextstream.io/docs/mcp/tools).
97
+
98
+ ### Cursor / Windsurf / Claude Desktop (JSON)
99
+
100
+ These clients use the `mcpServers` JSON schema:
101
+
102
+ - Cursor: `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project)
103
+ - Windsurf: `~/.codeium/windsurf/mcp_config.json`
104
+ - Claude Desktop:
105
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
106
+ - Windows: `%APPDATA%\\Claude\\claude_desktop_config.json`
107
+
108
+ Many other MCP JSON clients also use this same `mcpServers` shape (including Claude Code project scope via `.mcp.json`).
109
+
110
+ **Standard toolset (default, ~50 tools):**
111
+
112
+ ```json
113
+ {
114
+ "mcpServers": {
115
+ "contextstream": {
116
+ "command": "npx",
117
+ "args": ["-y", "@contextstream/mcp-server"],
118
+ "env": {
119
+ "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
120
+ "CONTEXTSTREAM_API_KEY": "your_api_key"
121
+ }
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ **Complete toolset (~86 tools):**
128
+
129
+ ```json
130
+ {
131
+ "mcpServers": {
132
+ "contextstream": {
133
+ "command": "npx",
134
+ "args": ["-y", "@contextstream/mcp-server"],
135
+ "env": {
136
+ "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
137
+ "CONTEXTSTREAM_API_KEY": "your_api_key",
138
+ "CONTEXTSTREAM_TOOLSET": "complete"
139
+ }
140
+ }
141
+ }
142
+ }
143
+ ```
144
+
145
+ ### VS Code (`.vscode/mcp.json`)
146
+
147
+ VS Code uses a different schema with a top-level `servers` map:
148
+
149
+ **Core toolset (default):**
150
+
151
+ ```json
152
+ {
153
+ "servers": {
154
+ "contextstream": {
155
+ "type": "stdio",
156
+ "command": "npx",
157
+ "args": ["-y", "@contextstream/mcp-server"],
158
+ "env": {
159
+ "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
160
+ "CONTEXTSTREAM_API_KEY": "your_api_key"
161
+ }
162
+ }
163
+ }
164
+ }
165
+ ```
166
+
167
+ **Complete toolset (~86 tools):**
168
+
169
+ ```json
170
+ {
171
+ "servers": {
172
+ "contextstream": {
173
+ "type": "stdio",
174
+ "command": "npx",
175
+ "args": ["-y", "@contextstream/mcp-server"],
176
+ "env": {
177
+ "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
178
+ "CONTEXTSTREAM_API_KEY": "your_api_key",
179
+ "CONTEXTSTREAM_TOOLSET": "complete"
180
+ }
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
186
+ Strong recommendation: VS Code supports `inputs` so you don’t have to hardcode secrets in a committed file:
187
+
188
+ ```json
189
+ {
190
+ "servers": {
191
+ "contextstream": {
192
+ "type": "stdio",
193
+ "command": "npx",
194
+ "args": ["-y", "@contextstream/mcp-server"],
195
+ "env": {
196
+ "CONTEXTSTREAM_API_URL": "https://api.contextstream.io",
197
+ "CONTEXTSTREAM_API_KEY": "${input:contextstreamApiKey}"
198
+ }
199
+ }
200
+ },
201
+ "inputs": [
202
+ {
203
+ "id": "contextstreamApiKey",
204
+ "type": "promptString",
205
+ "description": "ContextStream API Key",
206
+ "password": true
207
+ }
208
+ ]
209
+ }
210
+ ```
211
+
212
+ ### Claude Code (CLI)
213
+
214
+ User scope (all projects):
215
+
216
+ **Standard toolset (default):**
217
+
218
+ ```bash
219
+ claude mcp add --transport stdio contextstream --scope user \
220
+ --env CONTEXTSTREAM_API_URL=https://api.contextstream.io \
221
+ --env CONTEXTSTREAM_API_KEY=YOUR_KEY \
222
+ -- npx -y @contextstream/mcp-server
223
+ ```
224
+
225
+ **Complete toolset (~86 tools):**
226
+
227
+ ```bash
228
+ claude mcp add --transport stdio contextstream --scope user \
229
+ --env CONTEXTSTREAM_API_URL=https://api.contextstream.io \
230
+ --env CONTEXTSTREAM_API_KEY=YOUR_KEY \
231
+ --env CONTEXTSTREAM_TOOLSET=complete \
232
+ -- npx -y @contextstream/mcp-server
233
+ ```
234
+
235
+ Note: Claude Code may warn about large tool contexts when using `complete`. The default is `standard` (~50 tools). Use `light` for fewer tools.
236
+
237
+ Windows caveat (native Windows, not WSL): if `npx` isn't found, use `cmd /c npx -y @contextstream/mcp-server` after `--`.
238
+
239
+ **Alternative (JSON form):**
240
+
241
+ Standard:
242
+ ```bash
243
+ claude mcp add-json contextstream \
244
+ '{"type":"stdio","command":"npx","args":["-y","@contextstream/mcp-server"],"env":{"CONTEXTSTREAM_API_URL":"https://api.contextstream.io","CONTEXTSTREAM_API_KEY":"your_api_key"}}'
245
+ ```
246
+
247
+ Complete:
248
+ ```bash
249
+ claude mcp add-json contextstream \
250
+ '{"type":"stdio","command":"npx","args":["-y","@contextstream/mcp-server"],"env":{"CONTEXTSTREAM_API_URL":"https://api.contextstream.io","CONTEXTSTREAM_API_KEY":"your_api_key","CONTEXTSTREAM_TOOLSET":"complete"}}'
251
+ ```
252
+
253
+ ### Codex CLI (`~/.codex/config.toml`)
254
+
255
+ **Standard toolset (default):**
256
+
257
+ ```toml
258
+ [mcp_servers.contextstream]
259
+ command = "npx"
260
+ args = ["-y", "@contextstream/mcp-server"]
261
+
262
+ [mcp_servers.contextstream.env]
263
+ CONTEXTSTREAM_API_URL = "https://api.contextstream.io"
264
+ CONTEXTSTREAM_API_KEY = "your_api_key"
265
+ ```
266
+
267
+ **Complete toolset (~86 tools):**
268
+
269
+ ```toml
270
+ [mcp_servers.contextstream]
271
+ command = "npx"
272
+ args = ["-y", "@contextstream/mcp-server"]
273
+
274
+ [mcp_servers.contextstream.env]
275
+ CONTEXTSTREAM_API_URL = "https://api.contextstream.io"
276
+ CONTEXTSTREAM_API_KEY = "your_api_key"
277
+ CONTEXTSTREAM_TOOLSET = "complete"
278
+ ```
279
+
280
+ After editing, restart your MCP client so it reloads the server configuration.
281
+
282
+ ## Authentication
283
+
284
+ You can authenticate using either:
285
+
286
+ - `CONTEXTSTREAM_API_KEY` (recommended for local/dev)
287
+ - `CONTEXTSTREAM_JWT` (useful for hosted or user-session flows)
288
+
289
+ ## Environment variables
290
+
291
+ | Variable | Required | Description |
292
+ |----------|----------|-------------|
293
+ | `CONTEXTSTREAM_API_URL` | Yes | Base API URL (e.g. `https://api.contextstream.io`) |
294
+ | `CONTEXTSTREAM_API_KEY` | Yes* | API key (*required unless `CONTEXTSTREAM_JWT` is set) |
295
+ | `CONTEXTSTREAM_JWT` | Yes* | JWT (*required unless `CONTEXTSTREAM_API_KEY` is set) |
296
+ | `CONTEXTSTREAM_WORKSPACE_ID` | No | Default workspace ID fallback |
297
+ | `CONTEXTSTREAM_PROJECT_ID` | No | Default project ID fallback |
298
+ | `CONTEXTSTREAM_USER_AGENT` | No | Custom user agent string |
299
+ | `CONTEXTSTREAM_TOOLSET` | No | Tool bundle to expose: `light` (~30 tools), `standard` (default, ~50 tools), or `complete` (~86 tools). Claude Code/Desktop may warn about large tool contexts with `complete`. |
300
+ | `CONTEXTSTREAM_TOOL_ALLOWLIST` | No | Comma-separated tool names to expose (overrides toolset) |
301
+ | `CONTEXTSTREAM_PRO_TOOLS` | No | Comma-separated tool names treated as PRO (default: `ai_context,ai_enhanced_context,ai_context_budget,ai_embeddings,ai_plan,ai_tasks`) |
302
+ | `CONTEXTSTREAM_UPGRADE_URL` | No | Upgrade link shown when Free users call PRO tools (default: `https://contextstream.io/pricing`) |
303
+
304
+ ### Server-side environment variables (API)
305
+
306
+ The following environment variables are configured on the ContextStream API server (not in your MCP client config):
307
+
308
+ | Variable | Required | Description |
309
+ |----------|----------|-------------|
310
+ | `QA_FILE_WRITE_ROOT` | No | Server-side root directory for `write_to_disk` file writes. When set, the API allows the `projects_ingest_local` tool to write ingested files to disk for testing/QA purposes. Files are written under `<QA_FILE_WRITE_ROOT>/<project_id>/<relative_path>`. If not set, `write_to_disk` requests are rejected. |
311
+
312
+ #### File write parameters for `projects_ingest_local`
313
+
314
+ The `projects_ingest_local` tool accepts two optional parameters for QA/testing scenarios:
315
+
316
+ | Parameter | Type | Default | Description |
317
+ |-----------|------|---------|-------------|
318
+ | `write_to_disk` | boolean | `false` | When `true`, writes ingested files to disk on the API server under `QA_FILE_WRITE_ROOT` before indexing. Requires the API to have `QA_FILE_WRITE_ROOT` configured. |
319
+ | `overwrite` | boolean | `false` | When `true` (and `write_to_disk` is enabled), allows overwriting existing files. Otherwise, existing files are skipped. |
320
+
321
+ **Example usage:**
322
+ ```json
323
+ {
324
+ "path": "/path/to/local/project",
325
+ "write_to_disk": true,
326
+ "overwrite": false
327
+ }
328
+ ```
329
+
330
+ **Note:** The `write_to_disk` feature is intended for testing, QA, and development scenarios where you need to materialize files on a test server. In production, `QA_FILE_WRITE_ROOT` should typically be unset to disable file writes.
331
+
332
+ ## Usage patterns
333
+
334
+ ### Recommended flow for AI tools
335
+
336
+ 1. Start of a conversation: call `session_init(folder_path="...", context_hint="<first user message>")`
337
+ 2. Before subsequent responses: call `context_smart(user_message="<current user message>")`
338
+ 3. After important outcomes: call `session_capture(...)` or `session_capture_lesson(...)`
339
+
340
+ ### Omit workspace/project IDs (recommended)
341
+
342
+ Most tools accept omitted `workspace_id` / `project_id` and will use the current session defaults.
343
+
344
+ - If you see “workspace_id is required”, call `session_init` first (or pass the ID explicitly).
345
+ - If you regularly work in the same repo, use `workspace_associate` once so the server can auto-select the right workspace for that folder.
346
+
347
+ ### First-time setup (no workspaces yet)
348
+
349
+ If your account has no workspaces, ContextStream will prompt your AI assistant to ask you for a workspace name.
350
+
351
+ - Provide a workspace name (e.g., your company/team/product)
352
+ - The current folder is created as a project inside that workspace
353
+ - Recommended: call `workspace_bootstrap(workspace_name="...", folder_path="...")`
354
+
355
+ ## Free vs PRO tools
356
+
357
+ Tools are labeled as `(Free)` or `(PRO)` in the MCP tool list.
358
+
359
+ - Default PRO tools: `ai_context`, `ai_enhanced_context`, `ai_context_budget`, `ai_embeddings`, `ai_plan`, `ai_tasks`
360
+ - If a Free-plan user calls a PRO tool, the server returns an upgrade message with a link.
361
+ - Override the PRO list via `CONTEXTSTREAM_PRO_TOOLS` and the upgrade link via `CONTEXTSTREAM_UPGRADE_URL`.
362
+
363
+ ## Troubleshooting
364
+
365
+ - Tools not appearing: restart the client after editing MCP config; confirm Node 18+ is available to the client runtime.
366
+ - Unauthorized errors: verify `CONTEXTSTREAM_API_URL` and `CONTEXTSTREAM_API_KEY` (or `CONTEXTSTREAM_JWT`).
367
+ - Wrong workspace/project: use `workspace_associate` to map the current repo folder to the correct workspace.
368
+
369
+ ## Development
370
+
371
+ ```bash
372
+ git clone https://github.com/contextstream/mcp-server.git
373
+ cd mcp-server
374
+ npm install
375
+ npm run dev
376
+ npm run typecheck
377
+ npm run build
378
+ ```
379
+
380
+ ## Links
381
+
382
+ - Website: https://contextstream.io
383
+ - Docs: https://contextstream.io/docs/mcp
384
+ - Pricing: https://contextstream.io/pricing
385
+ - npm: https://www.npmjs.com/package/@contextstream/mcp-server
386
+ - GitHub: https://github.com/contextstream/mcp-server
387
+
388
+ ## License
389
+
390
+ MIT
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ '#!/usr/bin/env node'
2
2
  var __defProp = Object.defineProperty;
3
3
  var __export = (target, all) => {
4
4
  for (var name in all)
@@ -4915,12 +4915,14 @@ var ContextStreamClient = class {
4915
4915
  }
4916
4916
  withDefaults(input) {
4917
4917
  const { defaultWorkspaceId, defaultProjectId } = this.config;
4918
- const workspaceId = input.workspace_id || defaultWorkspaceId;
4919
- const useDefaultProject = !input.project_id && (!input.workspace_id || input.workspace_id === defaultWorkspaceId);
4918
+ const providedWorkspaceId = this.coerceUuid(input.workspace_id);
4919
+ const workspaceId = providedWorkspaceId || defaultWorkspaceId;
4920
+ const providedProjectId = this.coerceUuid(input.project_id);
4921
+ const useDefaultProject = !providedProjectId && (!providedWorkspaceId || providedWorkspaceId === defaultWorkspaceId);
4920
4922
  return {
4921
4923
  ...input,
4922
4924
  workspace_id: workspaceId,
4923
- project_id: input.project_id || (useDefaultProject ? defaultProjectId : void 0)
4925
+ project_id: providedProjectId || (useDefaultProject ? defaultProjectId : void 0)
4924
4926
  };
4925
4927
  }
4926
4928
  coerceUuid(value) {
@@ -6016,6 +6018,8 @@ var ContextStreamClient = class {
6016
6018
  event_type: apiEventType,
6017
6019
  title: params.title,
6018
6020
  content: params.content,
6021
+ provenance: params.provenance,
6022
+ code_refs: params.code_refs,
6019
6023
  metadata: {
6020
6024
  original_type: params.event_type,
6021
6025
  session_id: params.session_id,
@@ -6026,6 +6030,14 @@ var ContextStreamClient = class {
6026
6030
  }
6027
6031
  });
6028
6032
  }
6033
+ submitContextFeedback(body) {
6034
+ return request(this.config, "/context/smart/feedback", { body: this.withDefaults(body) });
6035
+ }
6036
+ decisionTrace(body) {
6037
+ return request(this.config, "/memory/search/decisions/trace", {
6038
+ body: this.withDefaults(body)
6039
+ });
6040
+ }
6029
6041
  /**
6030
6042
  * Remember something using the session/remember endpoint.
6031
6043
  * This is a simpler interface than captureContext and supports await_indexing.
@@ -6123,8 +6135,9 @@ var ContextStreamClient = class {
6123
6135
  let decisionCount = 0;
6124
6136
  let memoryCount = 0;
6125
6137
  try {
6126
- const ws = await this.getWorkspace(withDefaults.workspace_id);
6127
- workspaceName = ws?.name;
6138
+ const wsResponse = await this.getWorkspace(withDefaults.workspace_id);
6139
+ const ws = unwrapApiResponse(wsResponse);
6140
+ workspaceName = pickString(ws?.name) ?? void 0;
6128
6141
  if (workspaceName) {
6129
6142
  parts.push(`\u{1F4C1} Workspace: ${workspaceName}`);
6130
6143
  }
@@ -6132,8 +6145,9 @@ var ContextStreamClient = class {
6132
6145
  }
6133
6146
  if (withDefaults.project_id) {
6134
6147
  try {
6135
- const proj = await this.getProject(withDefaults.project_id);
6136
- projectName = proj?.name;
6148
+ const projResponse = await this.getProject(withDefaults.project_id);
6149
+ const proj = unwrapApiResponse(projResponse);
6150
+ projectName = pickString(proj?.name) ?? void 0;
6137
6151
  if (projectName) {
6138
6152
  parts.push(`\u{1F4C2} Project: ${projectName}`);
6139
6153
  }
@@ -6543,21 +6557,25 @@ var ContextStreamClient = class {
6543
6557
  const items = [];
6544
6558
  const errors = [];
6545
6559
  try {
6546
- const ws = await this.getWorkspace(withDefaults.workspace_id);
6547
- if (ws?.name) {
6548
- items.push({ type: "W", key: "workspace", value: ws.name, relevance: 1 });
6560
+ const wsResponse = await this.getWorkspace(withDefaults.workspace_id);
6561
+ const ws = unwrapApiResponse(wsResponse);
6562
+ const workspaceName = pickString(ws?.name);
6563
+ if (workspaceName) {
6564
+ items.push({ type: "W", key: "workspace", value: workspaceName, relevance: 1 });
6549
6565
  } else {
6550
- items.push({ type: "W", key: "workspace", value: withDefaults.workspace_id.slice(0, 8), relevance: 1 });
6566
+ items.push({ type: "W", key: "workspace", value: `id:${withDefaults.workspace_id}`, relevance: 1 });
6551
6567
  }
6552
6568
  } catch (e) {
6553
6569
  errors.push(`workspace: ${e?.message || "fetch failed"}`);
6554
- items.push({ type: "W", key: "workspace", value: `id:${withDefaults.workspace_id.slice(0, 8)}`, relevance: 0.5 });
6570
+ items.push({ type: "W", key: "workspace", value: `id:${withDefaults.workspace_id}`, relevance: 0.5 });
6555
6571
  }
6556
6572
  if (withDefaults.project_id) {
6557
6573
  try {
6558
- const proj = await this.getProject(withDefaults.project_id);
6559
- if (proj?.name) {
6560
- items.push({ type: "P", key: "project", value: proj.name, relevance: 1 });
6574
+ const projResponse = await this.getProject(withDefaults.project_id);
6575
+ const proj = unwrapApiResponse(projResponse);
6576
+ const projectName = pickString(proj?.name);
6577
+ if (projectName) {
6578
+ items.push({ type: "P", key: "project", value: projectName, relevance: 1 });
6561
6579
  }
6562
6580
  } catch (e) {
6563
6581
  errors.push(`project: ${e?.message || "fetch failed"}`);
@@ -6681,7 +6699,7 @@ var ContextStreamClient = class {
6681
6699
  candidateContext = candidateLines.join("\n");
6682
6700
  }
6683
6701
  if (context.length === 0 && withDefaults.workspace_id) {
6684
- const wsHint = items.find((i) => i.type === "W")?.value || withDefaults.workspace_id.slice(0, 8);
6702
+ const wsHint = items.find((i) => i.type === "W")?.value || withDefaults.workspace_id;
6685
6703
  context = format === "minified" ? `W:${wsHint}|[NO_MATCHES]` : `[CTX]
6686
6704
  W:${wsHint}
6687
6705
  [NO_MATCHES]
@@ -6713,6 +6731,8 @@ W:${wsHint}
6713
6731
  token_estimate: Math.ceil(context.length / 4),
6714
6732
  format,
6715
6733
  sources_used: items.filter((i) => context.includes(i.value.slice(0, 20))).length,
6734
+ workspace_id: withDefaults.workspace_id,
6735
+ project_id: withDefaults.project_id,
6716
6736
  ...versionNotice ? { version_notice: versionNotice } : {},
6717
6737
  ...errors.length > 0 && { errors }
6718
6738
  // Include errors for debugging
@@ -7272,6 +7292,7 @@ var CONTEXTSTREAM_TOOL_NAMES = [
7272
7292
  // Session/Context (standard)
7273
7293
  "session_init",
7274
7294
  "context_smart",
7295
+ "context_feedback",
7275
7296
  "session_summary",
7276
7297
  "session_capture",
7277
7298
  "session_capture_lesson",
@@ -7321,6 +7342,7 @@ var CONTEXTSTREAM_TOOL_NAMES = [
7321
7342
  "memory_list_nodes",
7322
7343
  "memory_search",
7323
7344
  "memory_decisions",
7345
+ "decision_trace",
7324
7346
  "memory_get_event",
7325
7347
  "memory_update_event",
7326
7348
  "memory_delete_event",
@@ -7488,7 +7510,7 @@ To expose all tools below, set \`CONTEXTSTREAM_TOOLSET=complete\` in your MCP co
7488
7510
  **Available tool categories (when \`CONTEXTSTREAM_TOOLSET=complete\`):**
7489
7511
 
7490
7512
  **Session/Context** (included in standard):
7491
- \`session_init\`, \`context_smart\`, \`session_summary\`, \`session_capture\`, \`session_capture_lesson\`, \`session_get_lessons\`, \`session_recall\`, \`session_remember\`, \`session_get_user_context\`, \`session_smart_search\`, \`session_compress\`, \`session_delta\`, \`generate_editor_rules\`, \`workspace_associate\`, \`workspace_bootstrap\`
7513
+ \`session_init\`, \`context_smart\`, \`context_feedback\`, \`session_summary\`, \`session_capture\`, \`session_capture_lesson\`, \`session_get_lessons\`, \`session_recall\`, \`session_remember\`, \`session_get_user_context\`, \`session_smart_search\`, \`session_compress\`, \`session_delta\`, \`generate_editor_rules\`, \`workspace_associate\`, \`workspace_bootstrap\`
7492
7514
 
7493
7515
  **Workspaces**:
7494
7516
  \`workspaces_list\`, \`workspaces_create\`, \`workspaces_update\`, \`workspaces_delete\`, \`workspaces_get\`, \`workspaces_overview\`, \`workspaces_analytics\`, \`workspaces_content\`
@@ -7500,7 +7522,7 @@ To expose all tools below, set \`CONTEXTSTREAM_TOOLSET=complete\` in your MCP co
7500
7522
  \`search_semantic\`, \`search_hybrid\`, \`search_keyword\`, \`search_pattern\`, \`search_suggestions\`
7501
7523
 
7502
7524
  **Memory**:
7503
- \`memory_create_event\`, \`memory_bulk_ingest\`, \`memory_list_events\`, \`memory_create_node\`, \`memory_list_nodes\`, \`memory_search\`, \`memory_decisions\`, \`memory_get_event\`, \`memory_update_event\`, \`memory_delete_event\`, \`memory_distill_event\`, \`memory_get_node\`, \`memory_update_node\`, \`memory_delete_node\`, \`memory_supersede_node\`, \`memory_timeline\`, \`memory_summary\`
7525
+ \`memory_create_event\`, \`memory_bulk_ingest\`, \`memory_list_events\`, \`memory_create_node\`, \`memory_list_nodes\`, \`memory_search\`, \`memory_decisions\`, \`decision_trace\`, \`memory_get_event\`, \`memory_update_event\`, \`memory_delete_event\`, \`memory_distill_event\`, \`memory_get_node\`, \`memory_update_node\`, \`memory_delete_node\`, \`memory_supersede_node\`, \`memory_timeline\`, \`memory_summary\`
7504
7526
 
7505
7527
  **Graph** (code analysis):
7506
7528
  \`graph_related\`, \`graph_path\`, \`graph_decisions\`, \`graph_dependencies\`, \`graph_call_path\`, \`graph_impact\`, \`graph_circular_dependencies\`, \`graph_unused_code\`, \`graph_ingest\`, \`graph_contradictions\`
@@ -7827,6 +7849,11 @@ var DEFAULT_PARAM_DESCRIPTIONS = {
7827
7849
  context_hint: "User message used to fetch relevant context.",
7828
7850
  context: "Context to match relevant reminders."
7829
7851
  };
7852
+ var uuidSchema2 = external_exports.string().uuid();
7853
+ function normalizeUuid(value) {
7854
+ if (!value) return void 0;
7855
+ return uuidSchema2.safeParse(value).success ? value : void 0;
7856
+ }
7830
7857
  var WRITE_VERBS = /* @__PURE__ */ new Set([
7831
7858
  "create",
7832
7859
  "update",
@@ -7847,6 +7874,7 @@ var WRITE_VERBS = /* @__PURE__ */ new Set([
7847
7874
  "add",
7848
7875
  "remove",
7849
7876
  "revoke",
7877
+ "feedback",
7850
7878
  "upload",
7851
7879
  "compress",
7852
7880
  "init"
@@ -7870,6 +7898,7 @@ var READ_ONLY_OVERRIDES = /* @__PURE__ */ new Set([
7870
7898
  "workspaces_get",
7871
7899
  "memory_search",
7872
7900
  "memory_decisions",
7901
+ "decision_trace",
7873
7902
  "memory_get_event",
7874
7903
  "memory_list_events",
7875
7904
  "memory_list_nodes",
@@ -8013,6 +8042,7 @@ var LIGHT_TOOLSET = /* @__PURE__ */ new Set([
8013
8042
  "session_init",
8014
8043
  "session_tools",
8015
8044
  "context_smart",
8045
+ "context_feedback",
8016
8046
  "session_summary",
8017
8047
  "session_capture",
8018
8048
  "session_capture_lesson",
@@ -8089,6 +8119,7 @@ var STANDARD_TOOLSET = /* @__PURE__ */ new Set([
8089
8119
  // Memory events (9)
8090
8120
  "memory_search",
8091
8121
  "memory_decisions",
8122
+ "decision_trace",
8092
8123
  "memory_create_event",
8093
8124
  "memory_list_events",
8094
8125
  "memory_get_event",
@@ -8478,14 +8509,16 @@ Upgrade: ${upgradeUrl2}` : "";
8478
8509
  };
8479
8510
  }
8480
8511
  function resolveWorkspaceId(explicitWorkspaceId) {
8481
- if (explicitWorkspaceId) return explicitWorkspaceId;
8512
+ const normalizedExplicit = normalizeUuid(explicitWorkspaceId);
8513
+ if (normalizedExplicit) return normalizedExplicit;
8482
8514
  const ctx = sessionManager?.getContext();
8483
- return typeof ctx?.workspace_id === "string" ? ctx.workspace_id : void 0;
8515
+ return normalizeUuid(typeof ctx?.workspace_id === "string" ? ctx.workspace_id : void 0);
8484
8516
  }
8485
8517
  function resolveProjectId(explicitProjectId) {
8486
- if (explicitProjectId) return explicitProjectId;
8518
+ const normalizedExplicit = normalizeUuid(explicitProjectId);
8519
+ if (normalizedExplicit) return normalizedExplicit;
8487
8520
  const ctx = sessionManager?.getContext();
8488
- return typeof ctx?.project_id === "string" ? ctx.project_id : void 0;
8521
+ return normalizeUuid(typeof ctx?.project_id === "string" ? ctx.project_id : void 0);
8489
8522
  }
8490
8523
  async function validateReadableDirectory(inputPath) {
8491
8524
  const resolvedPath = path4.resolve(inputPath);
@@ -8790,7 +8823,22 @@ Access: Free`,
8790
8823
  event_type: external_exports.string(),
8791
8824
  title: external_exports.string(),
8792
8825
  content: external_exports.string(),
8793
- metadata: external_exports.record(external_exports.any()).optional()
8826
+ metadata: external_exports.record(external_exports.any()).optional(),
8827
+ provenance: external_exports.object({
8828
+ repo: external_exports.string().optional(),
8829
+ branch: external_exports.string().optional(),
8830
+ commit_sha: external_exports.string().optional(),
8831
+ pr_url: external_exports.string().url().optional(),
8832
+ issue_url: external_exports.string().url().optional(),
8833
+ slack_thread_url: external_exports.string().url().optional()
8834
+ }).optional(),
8835
+ code_refs: external_exports.array(
8836
+ external_exports.object({
8837
+ file_path: external_exports.string(),
8838
+ symbol_id: external_exports.string().optional(),
8839
+ symbol_name: external_exports.string().optional()
8840
+ })
8841
+ ).optional()
8794
8842
  })
8795
8843
  },
8796
8844
  async (input) => {
@@ -8904,6 +8952,24 @@ Access: Free`,
8904
8952
  return { content: [{ type: "text", text: formatContent(result) }], structuredContent: toStructured(result) };
8905
8953
  }
8906
8954
  );
8955
+ registerTool(
8956
+ "decision_trace",
8957
+ {
8958
+ title: "Decision trace",
8959
+ description: "Trace decisions to provenance, code references, and impact",
8960
+ inputSchema: external_exports.object({
8961
+ query: external_exports.string(),
8962
+ workspace_id: external_exports.string().uuid().optional(),
8963
+ project_id: external_exports.string().uuid().optional(),
8964
+ limit: external_exports.number().optional(),
8965
+ include_impact: external_exports.boolean().optional().describe("Include impact analysis when graph data is available")
8966
+ })
8967
+ },
8968
+ async (input) => {
8969
+ const result = await client.decisionTrace(input);
8970
+ return { content: [{ type: "text", text: formatContent(result) }], structuredContent: toStructured(result) };
8971
+ }
8972
+ );
8907
8973
  registerTool(
8908
8974
  "graph_related",
8909
8975
  {
@@ -9704,11 +9770,12 @@ Memory: events(crud) nodes(knowledge) search(find) decisions(choices)`,
9704
9770
  description: `Retrieve user preferences, coding style, and persona from memory.
9705
9771
  Use this to understand how the user likes to work and adapt your responses accordingly.`,
9706
9772
  inputSchema: external_exports.object({
9707
- workspace_id: external_exports.string().uuid().optional().describe("Workspace to get user context from")
9773
+ workspace_id: external_exports.string().optional().describe("Workspace ID (UUID). Invalid values are ignored.")
9708
9774
  })
9709
9775
  },
9710
9776
  async (input) => {
9711
- const result = await client.getUserContext(input);
9777
+ const workspaceId = resolveWorkspaceId(input.workspace_id);
9778
+ const result = await client.getUserContext({ workspace_id: workspaceId });
9712
9779
  return { content: [{ type: "text", text: formatContent(result) }], structuredContent: toStructured(result) };
9713
9780
  }
9714
9781
  );
@@ -9924,7 +9991,22 @@ Use this to persist decisions, insights, preferences, or important information.`
9924
9991
  title: external_exports.string().describe("Brief title for the captured context"),
9925
9992
  content: external_exports.string().describe("Full content/details to capture"),
9926
9993
  tags: external_exports.array(external_exports.string()).optional().describe("Tags for categorization"),
9927
- importance: external_exports.enum(["low", "medium", "high", "critical"]).optional().describe("Importance level")
9994
+ importance: external_exports.enum(["low", "medium", "high", "critical"]).optional().describe("Importance level"),
9995
+ provenance: external_exports.object({
9996
+ repo: external_exports.string().optional(),
9997
+ branch: external_exports.string().optional(),
9998
+ commit_sha: external_exports.string().optional(),
9999
+ pr_url: external_exports.string().url().optional(),
10000
+ issue_url: external_exports.string().url().optional(),
10001
+ slack_thread_url: external_exports.string().url().optional()
10002
+ }).optional(),
10003
+ code_refs: external_exports.array(
10004
+ external_exports.object({
10005
+ file_path: external_exports.string(),
10006
+ symbol_id: external_exports.string().optional(),
10007
+ symbol_name: external_exports.string().optional()
10008
+ })
10009
+ ).optional()
9928
10010
  })
9929
10011
  },
9930
10012
  async (input) => {
@@ -10072,8 +10154,8 @@ Returns lessons filtered by:
10072
10154
  - Category: workflow, code_quality, verification, communication, project_specific
10073
10155
  - Severity: low, medium, high, critical`,
10074
10156
  inputSchema: external_exports.object({
10075
- workspace_id: external_exports.string().uuid().optional(),
10076
- project_id: external_exports.string().uuid().optional(),
10157
+ workspace_id: external_exports.string().optional().describe("Workspace ID (UUID). Invalid values are ignored."),
10158
+ project_id: external_exports.string().optional().describe("Project ID (UUID). Invalid values are ignored."),
10077
10159
  query: external_exports.string().optional().describe('Search for relevant lessons (e.g., "git push images")'),
10078
10160
  category: external_exports.enum(["workflow", "code_quality", "verification", "communication", "project_specific"]).optional().describe("Filter by category"),
10079
10161
  severity: external_exports.enum(["low", "medium", "high", "critical"]).optional().describe("Filter by minimum severity"),
@@ -10081,15 +10163,8 @@ Returns lessons filtered by:
10081
10163
  })
10082
10164
  },
10083
10165
  async (input) => {
10084
- let workspaceId = input.workspace_id;
10085
- let projectId = input.project_id;
10086
- if (!workspaceId && sessionManager) {
10087
- const ctx = sessionManager.getContext();
10088
- if (ctx) {
10089
- workspaceId = ctx.workspace_id;
10090
- projectId = projectId || ctx.project_id;
10091
- }
10092
- }
10166
+ const workspaceId = resolveWorkspaceId(input.workspace_id);
10167
+ const projectId = resolveProjectId(input.project_id);
10093
10168
  const searchQuery = input.query ? `${input.query} lesson prevention warning` : "lesson prevention warning mistake";
10094
10169
  const searchResult = await client.memorySearch({
10095
10170
  query: searchQuery,
@@ -10593,6 +10668,42 @@ This saves ~80% tokens compared to including full chat history.`,
10593
10668
  };
10594
10669
  }
10595
10670
  );
10671
+ registerTool(
10672
+ "context_feedback",
10673
+ {
10674
+ title: "Submit smart context feedback",
10675
+ description: "Send relevance feedback (relevant/irrelevant/pin) for context_smart items.",
10676
+ inputSchema: external_exports.object({
10677
+ workspace_id: external_exports.string().uuid().optional(),
10678
+ project_id: external_exports.string().uuid().optional(),
10679
+ item_id: external_exports.string().describe("Item ID returned by context_smart"),
10680
+ item_type: external_exports.enum(["memory_event", "knowledge_node", "code_chunk"]),
10681
+ feedback_type: external_exports.enum(["relevant", "irrelevant", "pin"]),
10682
+ query_text: external_exports.string().optional(),
10683
+ metadata: external_exports.record(external_exports.any()).optional()
10684
+ })
10685
+ },
10686
+ async (input) => {
10687
+ let workspaceId = input.workspace_id;
10688
+ let projectId = input.project_id;
10689
+ if (!workspaceId && sessionManager) {
10690
+ const ctx = sessionManager.getContext();
10691
+ if (ctx) {
10692
+ workspaceId = ctx.workspace_id;
10693
+ projectId = projectId || ctx.project_id;
10694
+ }
10695
+ }
10696
+ const result = await client.submitContextFeedback({
10697
+ ...input,
10698
+ workspace_id: workspaceId,
10699
+ project_id: projectId
10700
+ });
10701
+ return {
10702
+ content: [{ type: "text", text: formatContent(result) }],
10703
+ structuredContent: toStructured(result)
10704
+ };
10705
+ }
10706
+ );
10596
10707
  registerTool(
10597
10708
  "slack_stats",
10598
10709
  {
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "@contextstream/mcp-server",
3
- "mcpName": "io.github.contextstreamio/mcp-server",
4
- "version": "0.3.66",
5
- "description": "MCP server exposing ContextStream public API - code context, memory, search, and AI tools for developers",
6
- "type": "module",
7
- "license": "MIT",
8
- "main": "dist/index.js",
9
- "files": [
10
- "dist",
11
- "README.md"
12
- ],
13
- "bin": {
14
- "contextstream-mcp": "dist/index.js"
15
- },
16
- "scripts": {
17
- "dev": "tsx src/index.ts",
18
- "build": "esbuild src/index.ts --bundle --platform=node --target=node18 --outfile=dist/index.js --format=esm --external:@modelcontextprotocol/sdk && echo '#!/usr/bin/env node' | cat - dist/index.js > dist/index.tmp && mv dist/index.tmp dist/index.js && esbuild src/test-server.ts --bundle --platform=node --target=node18 --outfile=dist/test-server.js --format=esm --external:@modelcontextprotocol/sdk",
19
- "start": "node dist/index.js",
20
- "test-server": "tsx src/test-server.ts",
21
- "test-server:start": "node dist/test-server.js",
22
- "typecheck": "tsc --noEmit"
23
- },
24
- "dependencies": {
25
- "@modelcontextprotocol/sdk": "^1.22.0",
26
- "zod": "^3.23.8"
27
- },
28
- "devDependencies": {
29
- "@types/node": "^20.10.0",
30
- "esbuild": "^0.27.0",
31
- "tsx": "^4.15.4",
32
- "typescript": "^5.6.3"
33
- },
34
- "engines": {
35
- "node": ">=18"
36
- },
37
- "keywords": [
38
- "mcp",
39
- "model-context-protocol",
40
- "contextstream",
41
- "ai",
42
- "code-context",
43
- "memory",
44
- "knowledge-graph"
45
- ],
46
- "repository": {
47
- "type": "git",
48
- "url": "git+https://github.com/contextstream/mcp-server.git"
49
- },
50
- "homepage": "https://contextstream.io/docs/mcp",
51
- "bugs": {
52
- "url": "https://github.com/contextstream/mcp-server/issues"
53
- },
54
- "overrides": {
55
- "qs": "6.14.1"
56
- }
57
- }
1
+ {
2
+ "name": "@contextstream/mcp-server",
3
+ "mcpName": "io.github.contextstreamio/mcp-server",
4
+ "version": "0.3.68",
5
+ "description": "MCP server exposing ContextStream public API - code context, memory, search, and AI tools for developers",
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "main": "dist/index.js",
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
13
+ "bin": {
14
+ "contextstream-mcp": "dist/index.js"
15
+ },
16
+ "scripts": {
17
+ "dev": "tsx src/index.ts",
18
+ "build": "esbuild src/index.ts --bundle --platform=node --target=node18 --outfile=dist/index.js --format=esm --external:@modelcontextprotocol/sdk && echo '#!/usr/bin/env node' | cat - dist/index.js > dist/index.tmp && mv dist/index.tmp dist/index.js && esbuild src/test-server.ts --bundle --platform=node --target=node18 --outfile=dist/test-server.js --format=esm --external:@modelcontextprotocol/sdk",
19
+ "start": "node dist/index.js",
20
+ "test-server": "tsx src/test-server.ts",
21
+ "test-server:start": "node dist/test-server.js",
22
+ "typecheck": "tsc --noEmit"
23
+ },
24
+ "dependencies": {
25
+ "@modelcontextprotocol/sdk": "^1.22.0",
26
+ "zod": "^3.23.8"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^20.10.0",
30
+ "esbuild": "^0.27.0",
31
+ "tsx": "^4.15.4",
32
+ "typescript": "^5.6.3"
33
+ },
34
+ "engines": {
35
+ "node": ">=18"
36
+ },
37
+ "keywords": [
38
+ "mcp",
39
+ "model-context-protocol",
40
+ "contextstream",
41
+ "ai",
42
+ "code-context",
43
+ "memory",
44
+ "knowledge-graph"
45
+ ],
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/contextstream/mcp-server.git"
49
+ },
50
+ "homepage": "https://contextstream.io/docs/mcp",
51
+ "bugs": {
52
+ "url": "https://github.com/contextstream/mcp-server/issues"
53
+ },
54
+ "overrides": {
55
+ "qs": "6.14.1"
56
+ }
57
+ }