@millstone/synapse-context-mcp 0.3.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 +217 -0
- package/dist/bundled/code-structure.js +12427 -0
- package/dist/bundled/file-search.js +40278 -0
- package/dist/bundled/semantic-search.js +40245 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-bash.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-c.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-c_sharp.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-cpp.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-css.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-dart.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-elisp.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-elixir.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-elm.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-embedded_template.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-go.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-html.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-java.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-javascript.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-json.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-kotlin.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-lua.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-objc.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-ocaml.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-php.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-python.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-ql.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-rescript.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-ruby.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-rust.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-scala.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-solidity.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-swift.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-systemrdl.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-tlaplus.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-toml.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-tsx.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-typescript.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-vue.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-yaml.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter-zig.wasm +0 -0
- package/dist/bundled/tree-sitter-wasms/tree-sitter.wasm +0 -0
- package/dist/bundled/tree-sitter.wasm +0 -0
- package/dist/continue/ContinueIDE.d.ts +70 -0
- package/dist/continue/ContinueIDE.d.ts.map +1 -0
- package/dist/continue/ContinueIDE.js +251 -0
- package/dist/continue/ContinueIDE.js.map +1 -0
- package/dist/embeddings/embeddings-provider.d.ts +53 -0
- package/dist/embeddings/embeddings-provider.d.ts.map +1 -0
- package/dist/embeddings/embeddings-provider.js +138 -0
- package/dist/embeddings/embeddings-provider.js.map +1 -0
- package/dist/embeddings/index.d.ts +10 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +10 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/embeddings/vector-index.d.ts +43 -0
- package/dist/embeddings/vector-index.d.ts.map +1 -0
- package/dist/embeddings/vector-index.js +174 -0
- package/dist/embeddings/vector-index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/selection/SelectionManager.d.ts +90 -0
- package/dist/selection/SelectionManager.d.ts.map +1 -0
- package/dist/selection/SelectionManager.js +167 -0
- package/dist/selection/SelectionManager.js.map +1 -0
- package/dist/server.d.ts +28 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +480 -0
- package/dist/server.js.map +1 -0
- package/dist/shims/continue-worker-paths.d.ts +47 -0
- package/dist/shims/continue-worker-paths.d.ts.map +1 -0
- package/dist/shims/continue-worker-paths.js +94 -0
- package/dist/shims/continue-worker-paths.js.map +1 -0
- package/dist/shims/workerpool-shim.d.ts +43 -0
- package/dist/shims/workerpool-shim.d.ts.map +1 -0
- package/dist/shims/workerpool-shim.js +37 -0
- package/dist/shims/workerpool-shim.js.map +1 -0
- package/dist/tools/code-structure.d.ts +36 -0
- package/dist/tools/code-structure.d.ts.map +1 -0
- package/dist/tools/code-structure.js +131 -0
- package/dist/tools/code-structure.js.map +1 -0
- package/dist/tools/file-search.d.ts +35 -0
- package/dist/tools/file-search.d.ts.map +1 -0
- package/dist/tools/file-search.js +286 -0
- package/dist/tools/file-search.js.map +1 -0
- package/dist/tools/file-tree.d.ts +18 -0
- package/dist/tools/file-tree.d.ts.map +1 -0
- package/dist/tools/file-tree.js +45 -0
- package/dist/tools/file-tree.js.map +1 -0
- package/dist/tools/manage-selection.d.ts +28 -0
- package/dist/tools/manage-selection.d.ts.map +1 -0
- package/dist/tools/manage-selection.js +98 -0
- package/dist/tools/manage-selection.js.map +1 -0
- package/dist/tools/read-file.d.ts +19 -0
- package/dist/tools/read-file.d.ts.map +1 -0
- package/dist/tools/read-file.js +35 -0
- package/dist/tools/read-file.js.map +1 -0
- package/dist/tools/semantic-search.d.ts +50 -0
- package/dist/tools/semantic-search.d.ts.map +1 -0
- package/dist/tools/semantic-search.js +243 -0
- package/dist/tools/semantic-search.js.map +1 -0
- package/dist/tools/workspace-context.d.ts +20 -0
- package/dist/tools/workspace-context.d.ts.map +1 -0
- package/dist/tools/workspace-context.js +36 -0
- package/dist/tools/workspace-context.js.map +1 -0
- package/dist/tree-sitter/code-snippet-queries/bash.scm +7 -0
- package/dist/tree-sitter/code-snippet-queries/c.scm +34 -0
- package/dist/tree-sitter/code-snippet-queries/c_sharp.scm +42 -0
- package/dist/tree-sitter/code-snippet-queries/cpp.scm +34 -0
- package/dist/tree-sitter/code-snippet-queries/dart.scm +33 -0
- package/dist/tree-sitter/code-snippet-queries/elisp.scm +21 -0
- package/dist/tree-sitter/code-snippet-queries/elixir.scm +32 -0
- package/dist/tree-sitter/code-snippet-queries/elm.scm +17 -0
- package/dist/tree-sitter/code-snippet-queries/go.scm +28 -0
- package/dist/tree-sitter/code-snippet-queries/java.scm +34 -0
- package/dist/tree-sitter/code-snippet-queries/javascript.scm +22 -0
- package/dist/tree-sitter/code-snippet-queries/kotlin.scm +32 -0
- package/dist/tree-sitter/code-snippet-queries/lua.scm +34 -0
- package/dist/tree-sitter/code-snippet-queries/ocaml.scm +27 -0
- package/dist/tree-sitter/code-snippet-queries/php.scm +43 -0
- package/dist/tree-sitter/code-snippet-queries/python.scm +17 -0
- package/dist/tree-sitter/code-snippet-queries/rescript.scm +23 -0
- package/dist/tree-sitter/code-snippet-queries/ruby.scm +33 -0
- package/dist/tree-sitter/code-snippet-queries/rust.scm +42 -0
- package/dist/tree-sitter/code-snippet-queries/scala.scm +32 -0
- package/dist/tree-sitter/code-snippet-queries/solidity.scm +33 -0
- package/dist/tree-sitter/code-snippet-queries/swift.scm +40 -0
- package/dist/tree-sitter/code-snippet-queries/tsx.scm +54 -0
- package/dist/tree-sitter/code-snippet-queries/typescript.scm +28 -0
- package/dist/tree-sitter/code-snippet-queries/zig.scm +16 -0
- package/dist/utils/file-walker.d.ts +19 -0
- package/dist/utils/file-walker.d.ts.map +1 -0
- package/dist/utils/file-walker.js +82 -0
- package/dist/utils/file-walker.js.map +1 -0
- package/dist/utils/token-counter.d.ts +16 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +30 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Context MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server providing intelligent context management and code structure extraction for AI assistants like Claude.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **FTS5 Full-Text Search** - BM25-ranked search (220x faster than grep!)
|
|
8
|
+
- **Tree-Sitter Code Structure** - Extract signatures from 40+ languages
|
|
9
|
+
- **File Search** - Path pattern search with `.gitignore` support
|
|
10
|
+
- **Selection Management** - Track which files are in context
|
|
11
|
+
- **Token Counting** - GPT-4 tokenization with tiktoken
|
|
12
|
+
- **File Reading** - Full files or specific line ranges
|
|
13
|
+
- **Workspace Context** - Comprehensive snapshots of selected content
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Clone the repository
|
|
19
|
+
git clone <your-repo>
|
|
20
|
+
cd context-mcp-server
|
|
21
|
+
|
|
22
|
+
# Install dependencies
|
|
23
|
+
npm install
|
|
24
|
+
|
|
25
|
+
# Build
|
|
26
|
+
npm run build
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Note:** You'll see TypeScript warnings from Continue's node_modules during build - these are expected and safe to ignore. See [Build Guide](./docs/BUILD_GUIDE.md) for details.
|
|
30
|
+
|
|
31
|
+
## Usage with Claude Desktop
|
|
32
|
+
|
|
33
|
+
Add to your Claude Desktop config at:
|
|
34
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
35
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"context": {
|
|
41
|
+
"command": "node",
|
|
42
|
+
"args": ["/absolute/path/to/context-mcp-server/dist/index.js"],
|
|
43
|
+
"env": {
|
|
44
|
+
"WORKSPACE_DIR": "/absolute/path/to/your/project"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage with Claude Code
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"context-helper-code": {
|
|
56
|
+
"command": "node",
|
|
57
|
+
"args": [
|
|
58
|
+
"/absolute/path/to/context-helper-mcp/dist/index.js"
|
|
59
|
+
],
|
|
60
|
+
"env": {
|
|
61
|
+
"WORKSPACE_DIR": "/path/to/workspace/millstonehq/cc-templates/"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"context-helper-docs": {
|
|
65
|
+
"command": "node",
|
|
66
|
+
"args": [
|
|
67
|
+
"/absolute/path/to/context-helper-mcp/dist/index.js"
|
|
68
|
+
],
|
|
69
|
+
"env": {
|
|
70
|
+
"WORKSPACE_DIR": "/path/to/workspace/millstonehq/synapse/"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
```
|
|
75
|
+
```
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Important:**
|
|
79
|
+
- Use absolute paths! Relative paths will not work.
|
|
80
|
+
- After updating the config, restart Claude Desktop completely (quit and reopen)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## Quick Start
|
|
85
|
+
|
|
86
|
+
1. **Search** for files: Use `file_search` tool
|
|
87
|
+
2. **Add** to selection: Use `manage_selection` with `op: "add"`
|
|
88
|
+
3. **Review** selection: Use `manage_selection` with `op: "get"`
|
|
89
|
+
4. **Preview** before sending: Use `manage_selection` with `op: "preview"`
|
|
90
|
+
5. **Get context**: Use `workspace_context` tool
|
|
91
|
+
|
|
92
|
+
## Available Tools
|
|
93
|
+
|
|
94
|
+
### 1. `file_search`
|
|
95
|
+
Search files by path pattern or content.
|
|
96
|
+
|
|
97
|
+
**Example:**
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"pattern": "SelectionManager",
|
|
101
|
+
"mode": "content",
|
|
102
|
+
"filter": {
|
|
103
|
+
"extensions": ["ts"]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 2. `get_file_tree`
|
|
109
|
+
Get workspace file structure.
|
|
110
|
+
|
|
111
|
+
### 3. `read_file`
|
|
112
|
+
Read file contents with optional line ranges.
|
|
113
|
+
|
|
114
|
+
### 4. `manage_selection`
|
|
115
|
+
Manage context selection - the KEY feature for context management!
|
|
116
|
+
|
|
117
|
+
**Operations:**
|
|
118
|
+
- `get` - Get current selection
|
|
119
|
+
- `add` - Add files to selection
|
|
120
|
+
- `remove` - Remove files from selection
|
|
121
|
+
- `set` - Replace entire selection
|
|
122
|
+
- `clear` - Clear all selections
|
|
123
|
+
- `preview` - Preview what would be sent to LLM
|
|
124
|
+
- `promote` - Upgrade codemap_only to full content
|
|
125
|
+
- `demote` - Downgrade full to codemap_only
|
|
126
|
+
|
|
127
|
+
### 5. `get_code_structure`
|
|
128
|
+
Extract code structure using tree-sitter.
|
|
129
|
+
|
|
130
|
+
### 6. `workspace_context`
|
|
131
|
+
Get comprehensive workspace context including selection, code structures, files, and token counts.
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Watch mode
|
|
137
|
+
npm run dev
|
|
138
|
+
|
|
139
|
+
# Build
|
|
140
|
+
npm run build
|
|
141
|
+
|
|
142
|
+
# Test
|
|
143
|
+
npm test
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Documentation
|
|
147
|
+
|
|
148
|
+
- **[Build Guide](./docs/BUILD_GUIDE.md)** - Build process and troubleshooting
|
|
149
|
+
- **[Bundling Solution](./docs/BUNDLING_SOLUTION.md)** - How Continue integration works
|
|
150
|
+
- **[Testing Guide](./docs/TESTING.md)** - Testing procedures and verification
|
|
151
|
+
- **[Verification](./docs/VERIFICATION.md)** - System verification steps
|
|
152
|
+
|
|
153
|
+
## Architecture
|
|
154
|
+
|
|
155
|
+
Uses **esbuild bundling** to integrate Continue's advanced features:
|
|
156
|
+
- Bundles Continue's FTS5 and tree-sitter modules automatically
|
|
157
|
+
- Polyfills `__dirname` for ESM compatibility
|
|
158
|
+
- Externalizes native modules (sqlite3, tree-sitter)
|
|
159
|
+
- Zero manual maintenance - just run `npm run build`
|
|
160
|
+
|
|
161
|
+
See [Bundling Solution](./docs/BUNDLING_SOLUTION.md) for technical details.
|
|
162
|
+
|
|
163
|
+
## Performance
|
|
164
|
+
|
|
165
|
+
| Operation | Traditional (Grep) | FTS5 Search | Improvement |
|
|
166
|
+
|-----------|-----------|-----------|-------------|
|
|
167
|
+
| Content search (1000 files) | ~2s | ~9ms | **220x faster** |
|
|
168
|
+
| Code structure extraction | N/A | ~5ms | New feature |
|
|
169
|
+
|
|
170
|
+
## Troubleshooting
|
|
171
|
+
|
|
172
|
+
### "MCP server not found"
|
|
173
|
+
- Ensure you used **absolute paths** in config
|
|
174
|
+
- Check that `dist/index.js` exists after building
|
|
175
|
+
- Restart Claude Desktop completely
|
|
176
|
+
|
|
177
|
+
### "Permission denied"
|
|
178
|
+
```bash
|
|
179
|
+
chmod +x dist/index.js
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### "Module not found"
|
|
183
|
+
```bash
|
|
184
|
+
rm -rf dist node_modules
|
|
185
|
+
npm install
|
|
186
|
+
npm run build
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Debug logging
|
|
190
|
+
The server logs to stderr. To see logs:
|
|
191
|
+
```bash
|
|
192
|
+
WORKSPACE_DIR=/path/to/project node dist/index.js
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Comparison to Other Tools
|
|
196
|
+
|
|
197
|
+
### vs RepoPrompt
|
|
198
|
+
- ✅ Integrates directly with Claude via MCP (no copy/paste)
|
|
199
|
+
- ✅ **220x faster search** with FTS5 instead of grep
|
|
200
|
+
- ✅ Selection tracking with token budgeting
|
|
201
|
+
- ✅ Tree-sitter code structure for 40+ languages
|
|
202
|
+
|
|
203
|
+
### vs Continue Extension
|
|
204
|
+
- ✅ Works with Claude Desktop (not just VS Code)
|
|
205
|
+
- ✅ Uses Continue's FTS5 and tree-sitter via bundling
|
|
206
|
+
- ✅ Focused on context management (not autocomplete)
|
|
207
|
+
- ✅ Simpler setup - just one MCP server
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
MIT
|
|
212
|
+
|
|
213
|
+
## Credits
|
|
214
|
+
|
|
215
|
+
- Inspired by [RepoPrompt](https://github.com/continuedev/repoprompt)
|
|
216
|
+
- Uses [Continue's](https://github.com/continuedev/continue) indexing features via bundling
|
|
217
|
+
- Built on [Model Context Protocol](https://modelcontextprotocol.io)
|