@contextstream/mcp-server 0.2.5

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/.env.example ADDED
@@ -0,0 +1,5 @@
1
+ CONTEXTSTREAM_API_URL=http://localhost:8085/api/v1
2
+ CONTEXTSTREAM_API_KEY=
3
+ # CONTEXTSTREAM_JWT=
4
+ # CONTEXTSTREAM_WORKSPACE_ID=
5
+ # CONTEXTSTREAM_PROJECT_ID=
package/README.md ADDED
@@ -0,0 +1,255 @@
1
+ # ContextStream MCP Server
2
+
3
+ A powerful Model Context Protocol (MCP) server that provides code context, memory, knowledge graphs, and AI tools for developers. Connect your AI assistant to your codebase's semantic search, memory system, and dependency analysis.
4
+
5
+ ## Features
6
+
7
+ ### 🔍 Code Search & Context
8
+ - **Semantic search** — Find code by meaning, not just keywords
9
+ - **Hybrid search** — Combines semantic + keyword for best results
10
+ - **Pattern search** — Regex-based code search
11
+ - **AI context building** — Automatically gather relevant code, docs, and memory
12
+
13
+ ### 🧠 Memory & Knowledge
14
+ - **Memory events** — Store decisions, insights, and context
15
+ - **Knowledge nodes** — Build a graph of connected concepts
16
+ - **Decision tracking** — Never lose architectural decisions
17
+ - **Memory search** — Find relevant past context
18
+
19
+ ### 📊 Code Intelligence
20
+ - **Dependency analysis** — Understand what depends on what
21
+ - **Call path tracing** — Trace execution flows
22
+ - **Impact analysis** — Understand change impact
23
+ - **Circular dependency detection** — Find problematic cycles
24
+ - **Unused code detection** — Identify dead code
25
+
26
+ ### 🤖 AI Integration
27
+ - **Context building** — Build LLM-ready context from your codebase
28
+ - **Enhanced context** — Deep analysis with memory integration
29
+ - **Plan generation** — AI-powered development planning
30
+ - **Task generation** — Break down work into actionable tasks
31
+
32
+ ## Quickstart
33
+
34
+ ```bash
35
+ cd mcp/contextstream-mcp
36
+ cp .env.example .env # Edit with your API details
37
+ npm install
38
+ npm run dev # Start MCP server (stdio)
39
+ ```
40
+
41
+ ## Client Configuration
42
+
43
+ ### Cursor / VS Code MCP
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "contextstream": {
48
+ "command": "npm",
49
+ "args": ["run", "dev"],
50
+ "cwd": "/path/to/contextstream/mcp/contextstream-mcp",
51
+ "env": {
52
+ "CONTEXTSTREAM_API_URL": "http://localhost:3001/api/v1",
53
+ "CONTEXTSTREAM_API_KEY": "your-api-key",
54
+ "CONTEXTSTREAM_WORKSPACE_ID": "optional-default-workspace-uuid",
55
+ "CONTEXTSTREAM_PROJECT_ID": "optional-default-project-uuid"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### Claude Desktop
63
+ ```json
64
+ {
65
+ "mcpServers": {
66
+ "contextstream": {
67
+ "command": "node",
68
+ "args": ["/path/to/contextstream/mcp/contextstream-mcp/dist/index.js"],
69
+ "env": {
70
+ "CONTEXTSTREAM_API_URL": "http://localhost:3001/api/v1",
71
+ "CONTEXTSTREAM_API_KEY": "your-api-key"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ ## Environment Variables
79
+
80
+ | Variable | Required | Description |
81
+ |----------|----------|-------------|
82
+ | `CONTEXTSTREAM_API_URL` | Yes | API base URL (e.g., `http://localhost:3001/api/v1`) |
83
+ | `CONTEXTSTREAM_API_KEY` | One of | API key for authentication |
84
+ | `CONTEXTSTREAM_JWT` | One of | JWT token for authentication |
85
+ | `CONTEXTSTREAM_WORKSPACE_ID` | No | Default workspace for operations |
86
+ | `CONTEXTSTREAM_PROJECT_ID` | No | Default project for operations |
87
+ | `CONTEXTSTREAM_USER_AGENT` | No | Custom user agent string |
88
+
89
+ ## Available Tools
90
+
91
+ ### Authentication
92
+ | Tool | Description |
93
+ |------|-------------|
94
+ | `auth_me` | Get current user profile |
95
+
96
+ ### Workspaces
97
+ | Tool | Description |
98
+ |------|-------------|
99
+ | `workspaces_list` | List accessible workspaces |
100
+ | `workspaces_get` | Get workspace details |
101
+ | `workspaces_create` | Create a new workspace |
102
+ | `workspaces_overview` | Get workspace summary |
103
+ | `workspaces_analytics` | Get usage analytics |
104
+ | `workspaces_content` | List workspace content |
105
+
106
+ ### Projects
107
+ | Tool | Description |
108
+ |------|-------------|
109
+ | `projects_list` | List projects (by workspace) |
110
+ | `projects_get` | Get project details |
111
+ | `projects_create` | Create a new project |
112
+ | `projects_overview` | Get project summary |
113
+ | `projects_statistics` | Get code statistics |
114
+ | `projects_files` | List indexed files |
115
+ | `projects_index` | Trigger re-indexing |
116
+ | `projects_index_status` | Check indexing status |
117
+
118
+ ### Search
119
+ | Tool | Description |
120
+ |------|-------------|
121
+ | `search_semantic` | Semantic vector search |
122
+ | `search_hybrid` | Combined semantic + keyword |
123
+ | `search_keyword` | Traditional keyword search |
124
+ | `search_pattern` | Regex pattern search |
125
+ | `search_suggestions` | Get search suggestions |
126
+
127
+ ### Memory
128
+ | Tool | Description |
129
+ |------|-------------|
130
+ | `memory_create_event` | Store a memory event |
131
+ | `memory_get_event` | Retrieve an event |
132
+ | `memory_update_event` | Update an event |
133
+ | `memory_delete_event` | Remove an event |
134
+ | `memory_list_events` | List events in workspace |
135
+ | `memory_bulk_ingest` | Bulk import events |
136
+ | `memory_distill_event` | Extract key insights |
137
+ | `memory_create_node` | Create knowledge node |
138
+ | `memory_get_node` | Get knowledge node |
139
+ | `memory_update_node` | Update knowledge node |
140
+ | `memory_delete_node` | Remove knowledge node |
141
+ | `memory_supersede_node` | Replace with new version |
142
+ | `memory_list_nodes` | List knowledge nodes |
143
+ | `memory_search` | Search memory |
144
+ | `memory_decisions` | Get decision summaries |
145
+ | `memory_timeline` | Get chronological timeline |
146
+ | `memory_summary` | Get condensed summary |
147
+
148
+ ### Graph Analysis
149
+ | Tool | Description |
150
+ |------|-------------|
151
+ | `graph_related` | Find related knowledge nodes |
152
+ | `graph_path` | Find path between nodes |
153
+ | `graph_decisions` | Decision history in graph |
154
+ | `graph_dependencies` | Query code dependencies |
155
+ | `graph_call_path` | Trace call paths |
156
+ | `graph_impact` | Analyze change impact |
157
+ | `graph_circular_dependencies` | Find circular deps |
158
+ | `graph_unused_code` | Find dead code |
159
+ | `graph_contradictions` | Find conflicting info |
160
+
161
+ ### AI
162
+ | Tool | Description |
163
+ |------|-------------|
164
+ | `ai_context` | Build LLM context |
165
+ | `ai_enhanced_context` | Deep context with memory |
166
+ | `ai_embeddings` | Generate embeddings |
167
+ | `ai_plan` | Generate dev plan |
168
+ | `ai_tasks` | Generate tasks |
169
+
170
+ ### Session & Auto-Context (CORE-like)
171
+ These tools enable automatic context initialization for AI assistants:
172
+
173
+ | Tool | Description |
174
+ |------|-------------|
175
+ | `session_init` | **Initialize conversation** - First tool to call, returns workspace/project info, recent memory, decisions |
176
+ | `session_get_user_context` | Get user preferences and coding style from memory |
177
+ | `session_capture` | Store context (decisions, insights, preferences) to memory |
178
+ | `session_smart_search` | Search with automatic context enrichment (memory + code + decisions) |
179
+ | `session_remember` | Quick natural language memory storage ("Remember I prefer TypeScript strict mode") |
180
+ | `session_recall` | Quick natural language recall ("What were the auth decisions?") |
181
+
182
+ **Usage in AI Tools:**
183
+ ```
184
+ # In Cursor/Claude Code/Windsurf - start with:
185
+ "Initialize session for this workspace"
186
+
187
+ # Then use natural commands:
188
+ "Remember we decided to use PostgreSQL for the database"
189
+ "Recall the authentication decisions we made"
190
+ "What are my coding preferences?"
191
+ ```
192
+
193
+ ## Prompts
194
+
195
+ Pre-built prompts for common workflows:
196
+
197
+ | Prompt | Description |
198
+ |--------|-------------|
199
+ | `explore-codebase` | Get a codebase overview |
200
+ | `capture-decision` | Document an ADR |
201
+ | `review-context` | Build code review context |
202
+ | `investigate-bug` | Debug investigation helper |
203
+ | `explore-knowledge` | Navigate knowledge graph |
204
+ | `onboard-to-project` | Generate onboarding guide |
205
+ | `analyze-refactoring` | Find refactoring opportunities |
206
+ | `build-context` | Build comprehensive LLM context |
207
+
208
+ ## Resources
209
+
210
+ | Resource | Description |
211
+ |----------|-------------|
212
+ | `contextstream:openapi` | OpenAPI specification |
213
+ | `contextstream:workspaces` | Workspace listing |
214
+ | `contextstream:projects/{id}` | Projects for workspace |
215
+
216
+ ## Scripts
217
+
218
+ ```bash
219
+ npm run dev # Run with tsx (development)
220
+ npm run build # Compile TypeScript
221
+ npm start # Run compiled version
222
+ npm run typecheck # Type check without emit
223
+ ```
224
+
225
+ ## Architecture
226
+
227
+ ```
228
+ src/
229
+ ├── index.ts # Server bootstrap
230
+ ├── config.ts # Environment configuration
231
+ ├── http.ts # HTTP client with retries
232
+ ├── client.ts # ContextStream API client
233
+ ├── tools.ts # MCP tools (55+ tools)
234
+ ├── resources.ts # MCP resources
235
+ └── prompts.ts # MCP prompts (8 workflows)
236
+ ```
237
+
238
+ ## Error Handling
239
+
240
+ The client includes:
241
+ - **Automatic retries** for transient failures (429, 500, 502, 503, 504)
242
+ - **Exponential backoff** with configurable delays
243
+ - **Detailed error codes** (NETWORK_ERROR, UNAUTHORIZED, RATE_LIMITED, etc.)
244
+ - **Request timeouts** (180s default)
245
+
246
+ ## Security
247
+
248
+ - No secrets are bundled — provide your own API key/JWT
249
+ - No internal endpoints hardcoded — API URL is required
250
+ - Minimal logging — credentials are not echoed
251
+ - Public REST API only — no proprietary logic included
252
+
253
+ ## License
254
+
255
+ MIT