purecontext-mcp 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/AGENT_INSTRUCTIONS.md +509 -0
  2. package/AGENT_INSTRUCTIONS_SHORT.md +97 -0
  3. package/CHANGELOG.md +212 -0
  4. package/docs/01-introduction.md +69 -0
  5. package/docs/02-installation.md +267 -0
  6. package/docs/03-quick-start.md +135 -0
  7. package/docs/04-configuration.md +214 -0
  8. package/docs/05-cli-reference.md +130 -0
  9. package/docs/06-tools-reference.md +499 -0
  10. package/docs/07-language-support.md +88 -0
  11. package/docs/08-framework-adapters.md +324 -0
  12. package/docs/09-dependency-graph.md +182 -0
  13. package/docs/10-semantic-search.md +153 -0
  14. package/docs/11-search-quality.md +110 -0
  15. package/docs/12-ai-summarization.md +106 -0
  16. package/docs/13-token-savings.md +110 -0
  17. package/docs/14-transport-modes.md +167 -0
  18. package/docs/15-team-setup.md +251 -0
  19. package/docs/16-docker.md +186 -0
  20. package/docs/17-web-ui.md +157 -0
  21. package/docs/18-git-history.md +157 -0
  22. package/docs/19-cross-repo.md +177 -0
  23. package/docs/20-architecture-analysis.md +228 -0
  24. package/docs/21-ecosystem-tools.md +189 -0
  25. package/docs/22-distribution.md +240 -0
  26. package/docs/23-performance.md +121 -0
  27. package/docs/24-security.md +144 -0
  28. package/docs/25-architecture-overview.md +240 -0
  29. package/docs/26-troubleshooting.md +234 -0
  30. package/docs/27-api-stability.md +114 -0
  31. package/docs/README.md +71 -0
  32. package/guide/README.md +57 -0
  33. package/guide/ai-summaries.md +127 -0
  34. package/guide/code-health.md +190 -0
  35. package/guide/code-history.md +149 -0
  36. package/guide/finding-code.md +157 -0
  37. package/guide/navigating-new-code.md +121 -0
  38. package/guide/safe-changes.md +156 -0
  39. package/guide/team-setup.md +191 -0
  40. package/guide/web-ui.md +154 -0
  41. package/guide/why-purecontext.md +73 -0
  42. package/guide/workflow-onboarding.md +114 -0
  43. package/guide/workflow-pr-review.md +199 -0
  44. package/guide/workflow-refactoring.md +172 -0
  45. package/package.json +9 -2
@@ -0,0 +1,214 @@
1
+ # Configuration
2
+
3
+
4
+ ## Config file location
5
+
6
+ ```
7
+ ~/.purecontext/config.json
8
+ ```
9
+
10
+ Generate a default file with:
11
+
12
+ ```bash
13
+ purecontext-mcp config --init
14
+ ```
15
+
16
+ View the effective configuration (defaults merged with your overrides):
17
+
18
+ ```bash
19
+ purecontext-mcp config
20
+ ```
21
+
22
+ Validate the config and check prerequisites:
23
+
24
+ ```bash
25
+ purecontext-mcp config --check
26
+ ```
27
+
28
+ ## Full schema reference
29
+
30
+ ```json
31
+ {
32
+ "indexDir": "~/.purecontext/indexes",
33
+ "fileLimit": 1000,
34
+ "watchDebounceMs": 2000,
35
+ "excludePatterns": [],
36
+ "adapters": "auto",
37
+ "maxFileSizeBytes": 1048576,
38
+ "allowSymlinks": false,
39
+ "transport": "stdio",
40
+
41
+ "ai": {
42
+ "provider": "none",
43
+ "allowRemoteAI": false,
44
+ "apiKey": "",
45
+ "endpoint": null,
46
+ "model": "claude-haiku-4-5-20251001",
47
+ "batchSize": 50,
48
+ "embeddingModel": null,
49
+ "embeddingProvider": null,
50
+ "openaiApiKey": ""
51
+ },
52
+
53
+ "semantic": {
54
+ "enabled": false,
55
+ "provider": "none",
56
+ "localEmbeddingEndpoint": null,
57
+ "dimension": null,
58
+ "threshold": 50000,
59
+ "batchSize": 500,
60
+ "concurrency": 2
61
+ },
62
+
63
+ "http": {
64
+ "port": 3000,
65
+ "host": "127.0.0.1",
66
+ "corsOrigins": ["http://localhost:*"],
67
+ "auth": {
68
+ "enabled": false,
69
+ "token": ""
70
+ }
71
+ },
72
+
73
+ "rateLimit": {
74
+ "enabled": true,
75
+ "maxTokens": 100,
76
+ "refillRate": 10,
77
+ "perToolLimits": {
78
+ "index_folder": 10,
79
+ "index_repo": 10,
80
+ "get_context_bundle": 3,
81
+ "get_blast_radius": 3,
82
+ "get_repo_outline": 2,
83
+ "find_dead_code": 5
84
+ }
85
+ },
86
+
87
+ "telemetry": {
88
+ "enabled": false,
89
+ "endpoint": "https://telemetry.purecontext.dev/v1/event"
90
+ },
91
+
92
+ "layers": {
93
+ "definitions": [],
94
+ "rules": []
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Field reference
100
+
101
+ ### Storage and indexing
102
+
103
+ | Field | Type | Default | Description |
104
+ |-------|------|---------|-------------|
105
+ | `indexDir` | `string` | `~/.purecontext/indexes` | Directory where SQLite index files are stored |
106
+ | `fileLimit` | `number` | `1000` | Max files indexed per project. Increase for large repos. `0` means unlimited. |
107
+ | `watchDebounceMs` | `number` | `2000` | Milliseconds to wait after a file change before re-indexing |
108
+ | `excludePatterns` | `string[]` | `[]` | Additional glob patterns to exclude (on top of built-ins: `node_modules/`, `.git/`, `dist/`, etc.) |
109
+ | `adapters` | `string` or `string[]` | `"auto"` | `"auto"` = detect from project files; `"none"` = disable all; `["vue", "nuxt"]` = explicit list |
110
+ | `maxFileSizeBytes` | `number` | `1048576` | Files larger than this (default: 1 MB) are skipped |
111
+ | `allowSymlinks` | `boolean` | `false` | When `false`, symlinks that resolve outside the project root are blocked |
112
+
113
+ ### Transport
114
+
115
+ | Field | Type | Default | Description |
116
+ |-------|------|---------|-------------|
117
+ | `transport` | `string` | `"stdio"` | `"stdio"` for Claude Code; `"http"` for browser/remote; `"both"` for both simultaneously |
118
+
119
+ ### AI summarization (`ai.*`)
120
+
121
+ | Field | Type | Default | Description |
122
+ |-------|------|---------|-------------|
123
+ | `ai.provider` | `string` | `"none"` | `"none"`, `"anthropic"`, `"openai"`, `"openai-compatible"`, `"google"` |
124
+ | `ai.allowRemoteAI` | `boolean` | `false` | Must be `true` to enable any outbound AI API calls |
125
+ | `ai.apiKey` | `string` | `""` | API key. Prefer environment variable interpolation: `"${ANTHROPIC_API_KEY}"` |
126
+ | `ai.model` | `string` | `"claude-haiku-4-5-20251001"` | Model for summarization |
127
+ | `ai.batchSize` | `number` | `50` | Symbols per AI batch request |
128
+ | `ai.endpoint` | `string \| null` | `null` | Custom endpoint for `openai-compatible` providers (e.g., Ollama) |
129
+
130
+ ### Semantic search (`semantic.*`)
131
+
132
+ | Field | Type | Default | Description |
133
+ |-------|------|---------|-------------|
134
+ | `semantic.enabled` | `boolean` | `false` | Enable HNSW vector search |
135
+ | `semantic.provider` | `string` | `"none"` | `"openai"`, `"local"`, or `"none"` |
136
+ | `semantic.localEmbeddingEndpoint` | `string \| null` | `null` | Local embedding server URL (e.g., Ollama) |
137
+ | `semantic.threshold` | `number` | `50000` | Min symbols before HNSW index is built. Lower for small repos. |
138
+ | `semantic.batchSize` | `number` | `500` | Symbols per embedding batch |
139
+ | `semantic.concurrency` | `number` | `2` | Concurrent embedding requests |
140
+
141
+ ### HTTP server (`http.*`)
142
+
143
+ | Field | Type | Default | Description |
144
+ |-------|------|---------|-------------|
145
+ | `http.port` | `number` | `3000` | Port for HTTP transport |
146
+ | `http.host` | `string` | `"127.0.0.1"` | Bind address. Use `"0.0.0.0"` for network access. |
147
+ | `http.corsOrigins` | `string[]` | `["http://localhost:*"]` | Allowed CORS origins |
148
+ | `http.auth.enabled` | `boolean` | `false` | Require bearer token authentication |
149
+ | `http.auth.token` | `string` | `""` | Bearer token. If empty and auth is enabled, a random token is generated at startup. |
150
+
151
+ ### Rate limiting (`rateLimit.*`)
152
+
153
+ | Field | Type | Default | Description |
154
+ |-------|------|---------|-------------|
155
+ | `rateLimit.enabled` | `boolean` | `true` | Enable token-bucket rate limiting |
156
+ | `rateLimit.maxTokens` | `number` | `100` | Bucket capacity |
157
+ | `rateLimit.refillRate` | `number` | `10` | Tokens refilled per second |
158
+ | `rateLimit.perToolLimits` | `object` | see above | Per-tool token cost overrides |
159
+
160
+ ### Telemetry (`telemetry.*`)
161
+
162
+ | Field | Type | Default | Description |
163
+ |-------|------|---------|-------------|
164
+ | `telemetry.enabled` | `boolean` | `false` | Opt-in anonymous usage telemetry. **Never enabled without explicit opt-in.** |
165
+ | `telemetry.endpoint` | `string` | `"https://telemetry.purecontext.dev/v1/event"` | Override the telemetry endpoint |
166
+
167
+ See [Telemetry](TELEMETRY.md) for full details on what is and is not collected.
168
+
169
+ ### Architecture layer rules (`layers.*`)
170
+
171
+ Used by the `get_layer_violations` tool to enforce import boundaries.
172
+
173
+ ```json
174
+ {
175
+ "layers": {
176
+ "definitions": [
177
+ { "name": "core", "paths": ["src/core/**"] },
178
+ { "name": "handlers", "paths": ["src/handlers/**"] }
179
+ ],
180
+ "rules": [
181
+ { "from": "core", "to": "handlers", "allowed": false }
182
+ ]
183
+ }
184
+ }
185
+ ```
186
+
187
+ ## Environment variable interpolation
188
+
189
+ API keys in `config.json` can reference environment variables to avoid storing secrets in the file:
190
+
191
+ ```json
192
+ {
193
+ "ai": {
194
+ "apiKey": "${ANTHROPIC_API_KEY}"
195
+ },
196
+ "http": {
197
+ "auth": {
198
+ "token": "${PURECONTEXT_API_TOKEN}"
199
+ }
200
+ }
201
+ }
202
+ ```
203
+
204
+ The server also reads the following environment variables directly (they override `config.json`):
205
+
206
+ | Variable | Config field |
207
+ |----------|-------------|
208
+ | `PCTX_ADMIN_KEY` | Admin key for multi-tenant deployments |
209
+ | `PCTX_DATA_DIR` | `indexDir` |
210
+ | `PCTX_PORT` | `http.port` |
211
+ | `PCTX_HOST` | `http.host` |
212
+ | `ANTHROPIC_API_KEY` | `ai.apiKey` (when `ai.provider = "anthropic"`) |
213
+ | `OPENAI_API_KEY` | `ai.openaiApiKey` |
214
+ | `GEMINI_API_KEY` | Used when `ai.provider = "google"` |
@@ -0,0 +1,130 @@
1
+ # CLI Reference
2
+
3
+
4
+ ## Synopsis
5
+
6
+ ```
7
+ purecontext-mcp [command] [options]
8
+ npx purecontext-mcp [command] [options]
9
+ ```
10
+
11
+ ## Commands
12
+
13
+ ### (default — no command)
14
+
15
+ Start the MCP server. The default transport is `stdio` (for Claude Code).
16
+
17
+ ```bash
18
+ purecontext-mcp
19
+ purecontext-mcp --transport http --port 3001
20
+ purecontext-mcp --transport both
21
+ ```
22
+
23
+ CLI flags override the corresponding `config.json` fields.
24
+
25
+ ### `config`
26
+
27
+ Manage configuration.
28
+
29
+ ```bash
30
+ # Generate ~/.purecontext/config.json with defaults and comments
31
+ purecontext-mcp config --init
32
+
33
+ # Validate config + check all prerequisites (grammars, DB, API keys)
34
+ purecontext-mcp config --check
35
+
36
+ # Print effective configuration as JSON (defaults merged with overrides)
37
+ purecontext-mcp config
38
+ ```
39
+
40
+ ### `keys`
41
+
42
+ Manage API keys for hosted deployments.
43
+
44
+ ```bash
45
+ # Create a key for a tenant/workspace
46
+ purecontext-mcp keys create --tenant <tenantId> --permissions read,write --label "alice-laptop"
47
+
48
+ # List keys for a tenant
49
+ purecontext-mcp keys list --tenant <tenantId>
50
+
51
+ # Revoke a key by prefix
52
+ purecontext-mcp keys revoke <key-prefix>
53
+ ```
54
+
55
+ ## Global options
56
+
57
+ | Flag | Default | Description |
58
+ |------|---------|-------------|
59
+ | `--version` | — | Print version and exit |
60
+ | `--help` | — | Print help and exit |
61
+ | `--log-level` | `info` | Log verbosity: `debug`, `info`, `warn`, `error` |
62
+ | `--config <path>` | `~/.purecontext/config.json` | Path to config file |
63
+ | `--transport` | `stdio` | `stdio`, `http`, or `both` |
64
+ | `--port <n>` | `3000` | HTTP port (overrides `http.port`) |
65
+ | `--host <addr>` | `127.0.0.1` | Bind address (overrides `http.host`) |
66
+
67
+ ## Health check
68
+
69
+ ```bash
70
+ purecontext-mcp --health
71
+ ```
72
+
73
+ Checks server health without starting the MCP server. Output is JSON:
74
+
75
+ ```json
76
+ {
77
+ "status": "ok",
78
+ "version": "1.2.0",
79
+ "uptime": 0,
80
+ "nodeVersion": "20.11.0",
81
+ "platform": "linux",
82
+ "indexDir": "/home/user/.purecontext/indexes",
83
+ "repoCount": 3,
84
+ "grammars": {
85
+ "tree-sitter-typescript.wasm": true,
86
+ "tree-sitter-javascript.wasm": true
87
+ }
88
+ }
89
+ ```
90
+
91
+ If anything is wrong, the corresponding field is `false` and the exit code is non-zero.
92
+
93
+ HTTP health check (when running in server mode):
94
+
95
+ ```bash
96
+ curl http://localhost:3000/health
97
+ ```
98
+
99
+ ## Exit codes
100
+
101
+ | Code | Meaning |
102
+ |------|---------|
103
+ | `0` | Success |
104
+ | `1` | Configuration error |
105
+ | `2` | Fatal startup error (missing grammar, SQLite failure, etc.) |
106
+
107
+ ## Examples
108
+
109
+ ```bash
110
+ # Start MCP server for Claude Code (default)
111
+ purecontext-mcp
112
+
113
+ # Start HTTP server for Web UI or team use
114
+ purecontext-mcp --transport http --port 3000
115
+
116
+ # Start both stdio and HTTP simultaneously (development)
117
+ purecontext-mcp --transport both
118
+
119
+ # Generate a config file
120
+ purecontext-mcp config --init
121
+
122
+ # Validate everything before deploying
123
+ purecontext-mcp config --check
124
+
125
+ # Debug startup issues
126
+ purecontext-mcp --log-level debug
127
+
128
+ # Check health without starting the server
129
+ purecontext-mcp --health
130
+ ```