purecontext-mcp 1.1.1 → 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 (37) hide show
  1. package/package.json +1 -1
  2. package/docs/dev/API_STABILITY.md +0 -319
  3. package/docs/dev/DECISIONS.md +0 -22
  4. package/docs/dev/DOCUMENTATION_PLAN.md +0 -113
  5. package/docs/dev/PHASE10_TASKS.md +0 -476
  6. package/docs/dev/PHASE11_TASKS.md +0 -385
  7. package/docs/dev/PHASE12_TASKS.md +0 -335
  8. package/docs/dev/PHASE13_TASKS.md +0 -381
  9. package/docs/dev/PHASE14_TASKS.md +0 -371
  10. package/docs/dev/PHASE15_TASKS.md +0 -256
  11. package/docs/dev/PHASE16_TASKS.md +0 -314
  12. package/docs/dev/PHASE17_TASKS.md +0 -321
  13. package/docs/dev/PHASE18_TASKS.md +0 -345
  14. package/docs/dev/PHASE19_TASKS.md +0 -261
  15. package/docs/dev/PHASE1_TASKS.md +0 -443
  16. package/docs/dev/PHASE20_TASKS.md +0 -280
  17. package/docs/dev/PHASE21_TASKS.md +0 -355
  18. package/docs/dev/PHASE22_TASKS.md +0 -371
  19. package/docs/dev/PHASE23_TASKS.md +0 -274
  20. package/docs/dev/PHASE24_TASKS.md +0 -326
  21. package/docs/dev/PHASE25_TASKS.md +0 -452
  22. package/docs/dev/PHASE26_TASKS.md +0 -253
  23. package/docs/dev/PHASE27_TASKS.md +0 -410
  24. package/docs/dev/PHASE2_TASKS.md +0 -328
  25. package/docs/dev/PHASE3_TASKS.md +0 -571
  26. package/docs/dev/PHASE4_TASKS.md +0 -531
  27. package/docs/dev/PHASE5_TASKS.md +0 -835
  28. package/docs/dev/PHASE6_TASKS.md +0 -347
  29. package/docs/dev/PHASE7_TASKS.md +0 -257
  30. package/docs/dev/PHASE8_TASKS.md +0 -299
  31. package/docs/dev/PHASE9_TASKS.md +0 -320
  32. package/docs/dev/PureContext_MCP_PRD_v1.0.docx +0 -0
  33. package/docs/dev/SELF_HOSTING.md +0 -142
  34. package/docs/dev/TEAM_SETUP.md +0 -316
  35. package/docs/dev/TELEMETRY.md +0 -99
  36. package/docs/dev/feature-analysis.md +0 -305
  37. package/docs/dev/phase-1-notes.md +0 -3
@@ -1,142 +0,0 @@
1
- # Self-Hosting PureContext MCP
2
-
3
- This guide covers deploying PureContext as an always-on shared server for a team using Docker.
4
-
5
- ## Prerequisites
6
-
7
- - Docker and Docker Compose installed
8
- - A Linux/macOS host (or any Docker-capable machine)
9
- - Outbound network access for team members to reach the server
10
-
11
- ---
12
-
13
- ## Quick Start with Docker Compose
14
-
15
- 1. **Create a working directory:**
16
- ```bash
17
- mkdir purecontext && cd purecontext
18
- ```
19
-
20
- 2. **Download the compose file:**
21
- ```bash
22
- curl -O https://raw.githubusercontent.com/gococ/purecontext-mcp/main/docker-compose.yml
23
- ```
24
-
25
- 3. **Set the admin key** (required before starting):
26
- ```bash
27
- export PCTX_ADMIN_KEY="$(openssl rand -hex 32)"
28
- echo "Admin key: $PCTX_ADMIN_KEY" # Save this somewhere safe
29
- ```
30
-
31
- 4. **Start the server:**
32
- ```bash
33
- PCTX_ADMIN_KEY="$PCTX_ADMIN_KEY" docker compose up -d
34
- ```
35
-
36
- 5. **Verify it is running:**
37
- ```bash
38
- curl http://localhost:3000/health
39
- # {"status":"ok","version":"1.0.0","repoCount":0,...}
40
- ```
41
-
42
- ---
43
-
44
- ## Create a Workspace
45
-
46
- A workspace is the organizational unit for a team. Each workspace gets its own API keys.
47
-
48
- ```bash
49
- curl -X POST http://localhost:3000/admin/workspaces \
50
- -H "Authorization: Bearer $PCTX_ADMIN_KEY" \
51
- -H "Content-Type: application/json" \
52
- -d '{"name": "My Team"}'
53
- # {"id":"a1b2c3d4","name":"My Team","plan":"team",...}
54
- ```
55
-
56
- Save the workspace `id` — you need it when creating API keys.
57
-
58
- ---
59
-
60
- ## Create API Keys for Team Members
61
-
62
- Each developer gets their own API key. Keys are shown once on creation and never again.
63
-
64
- ```bash
65
- # Using the CLI (if purecontext-mcp is installed locally):
66
- purecontext-mcp keys create --label "Alice's laptop"
67
-
68
- # Or via the admin API:
69
- curl -X POST http://localhost:3000/admin/keys \
70
- -H "Authorization: Bearer $PCTX_ADMIN_KEY" \
71
- -H "Content-Type: application/json" \
72
- -d '{"label": "Alice'\''s laptop", "workspaceId": "a1b2c3d4"}'
73
- # {"key":"pctx_abc123...","id":"...","label":"Alice's laptop"}
74
- ```
75
-
76
- Give each developer their `pctx_...` key. They use it to connect Claude Code.
77
-
78
- ---
79
-
80
- ## Connect Claude Code to the Shared Server
81
-
82
- Each developer runs this once on their machine:
83
-
84
- ```bash
85
- claude mcp add purecontext-remote \
86
- --transport http \
87
- --url https://purecontext.mycompany.com/mcp \
88
- --header "Authorization: Bearer pctx_yourkey"
89
- ```
90
-
91
- Replace `purecontext.mycompany.com` with your server's hostname/IP and `pctx_yourkey` with the developer's personal API key.
92
-
93
- ---
94
-
95
- ## Environment Variables
96
-
97
- | Variable | Default | Description |
98
- |----------|---------|-------------|
99
- | `PCTX_ADMIN_KEY` | *(required)* | Admin key for `/admin/*` endpoints. Set this via environment, never in config files. |
100
- | `PCTX_DATA_DIR` | `/data` (Docker) | Directory for indexes and auth DB. Maps to `~/.purecontext` in local installs. |
101
- | `PCTX_PORT` | `3000` | TCP port to listen on. |
102
- | `PCTX_HOST` | `0.0.0.0` | Interface to bind to. |
103
-
104
- ---
105
-
106
- ## Updating
107
-
108
- The SQLite data lives in the Docker volume (`./data`), so it persists across image updates:
109
-
110
- ```bash
111
- docker compose pull
112
- docker compose up -d
113
- ```
114
-
115
- Your indexes and API keys are unaffected.
116
-
117
- ---
118
-
119
- ## Production Checklist
120
-
121
- - [ ] `PCTX_ADMIN_KEY` is set to a strong random value (at least 32 hex chars)
122
- - [ ] Server is behind a reverse proxy (nginx/Caddy) with TLS
123
- - [ ] Port 3000 is not directly exposed to the internet (terminate TLS at the proxy)
124
- - [ ] Volume (`./data`) is on a backed-up disk
125
- - [ ] `restart: unless-stopped` is set in compose (already in the example file)
126
-
127
- ---
128
-
129
- ## Troubleshooting
130
-
131
- **401 on all requests:**
132
- Make sure you are passing the API key in the `Authorization` header: `Authorization: Bearer pctx_...`
133
-
134
- **403 on `/admin/*` routes:**
135
- Admin routes require the `PCTX_ADMIN_KEY` value, not a regular user API key.
136
-
137
- **Connection timeout from Claude Code:**
138
- - Verify the server URL is reachable from the developer's machine: `curl https://purecontext.mycompany.com/health`
139
- - Check firewall rules and reverse proxy configuration
140
-
141
- **"Workspace not found" errors:**
142
- The API key must be associated with a workspace. Re-create the key using `POST /admin/keys` with the correct `workspaceId`.
@@ -1,316 +0,0 @@
1
- # PureContext Team Setup Guide
2
-
3
- This guide walks through deploying PureContext as a shared server for a development team, creating workspaces and API keys, and connecting each developer's Claude Code instance to the shared index.
4
-
5
- ## Overview
6
-
7
- ```
8
- Phase 1–17 (local mode): Phase 18+ (server mode):
9
- Claude Code (each dev) Claude Code (each dev)
10
- ↓ stdio ↓ HTTP + API key
11
- PureContext (local) PureContext (shared server)
12
- ↓ ↓
13
- Local SQLite index Shared SQLite index(es)
14
- ```
15
-
16
- **Why a shared server?** Each developer re-indexes the same codebase independently in local mode. A shared server indexes once and serves all team members — faster, consistent, and the natural monetization layer for team features.
17
-
18
- ---
19
-
20
- ## Step 1 — Deploy the Server
21
-
22
- ### Docker (recommended)
23
-
24
- ```bash
25
- mkdir -p ./purecontext-data
26
-
27
- docker run -d \
28
- --name purecontext \
29
- -p 3000:3000 \
30
- -v "$(pwd)/purecontext-data:/data" \
31
- -e PCTX_ADMIN_KEY="$(openssl rand -hex 32)" \
32
- --restart unless-stopped \
33
- purecontext/purecontext-mcp:latest
34
- ```
35
-
36
- Note your `PCTX_ADMIN_KEY` — you'll need it to manage keys and workspaces.
37
-
38
- ### Docker Compose
39
-
40
- ```yaml
41
- # docker-compose.yml
42
- version: '3.8'
43
- services:
44
- purecontext:
45
- image: purecontext/purecontext-mcp:latest
46
- ports:
47
- - "3000:3000"
48
- volumes:
49
- - ./data:/data
50
- environment:
51
- PCTX_ADMIN_KEY: "change-me-before-deploying"
52
- restart: unless-stopped
53
- ```
54
-
55
- ```bash
56
- docker compose up -d
57
- ```
58
-
59
- ### npm (no Docker)
60
-
61
- ```bash
62
- npm install -g purecontext-mcp
63
- PCTX_ADMIN_KEY=your-secret purecontext-mcp --server --host 0.0.0.0 --port 3000
64
- ```
65
-
66
- ### Environment Variables
67
-
68
- | Variable | Description | Default |
69
- |----------|-------------|---------|
70
- | `PCTX_ADMIN_KEY` | Admin authentication token | Required in server mode |
71
- | `PCTX_DATA_DIR` | Data directory for indexes | `~/.purecontext` |
72
- | `PCTX_PORT` | HTTP port | `3000` |
73
- | `PCTX_HOST` | Bind address | `0.0.0.0` |
74
-
75
- ### Verify the server is running
76
-
77
- ```bash
78
- curl http://localhost:3000/health
79
- # {"status":"ok","version":"1.0.0","repoCount":0,"uptime":1.2}
80
- ```
81
-
82
- ---
83
-
84
- ## Step 2 — Create a Workspace
85
-
86
- A workspace is the unit of isolation — one team = one workspace. All repos and API keys belong to a workspace.
87
-
88
- ```bash
89
- export ADMIN_KEY="your-pctx-admin-key"
90
- export SERVER="http://localhost:3000"
91
-
92
- # Create a workspace
93
- curl -s -X POST "$SERVER/admin/workspaces" \
94
- -H "Authorization: Bearer $ADMIN_KEY" \
95
- -H "Content-Type: application/json" \
96
- -d '{"name": "my-team", "plan": "team"}' | jq .
97
- ```
98
-
99
- Response:
100
- ```json
101
- {"id": "ws_abc123", "name": "my-team", "plan": "team", "created_at": 1714000000}
102
- ```
103
-
104
- Save the `id` — you'll use it when creating API keys.
105
-
106
- ---
107
-
108
- ## Step 3 — Create API Keys
109
-
110
- Each developer gets their own API key. Keys are shown once on creation and never again.
111
-
112
- ```bash
113
- # Create a key for a developer
114
- curl -s -X POST "$SERVER/admin/keys" \
115
- -H "Authorization: Bearer $ADMIN_KEY" \
116
- -H "Content-Type: application/json" \
117
- -d '{
118
- "label": "alice-macbook",
119
- "permissions": ["read", "write"],
120
- "workspace_id": "ws_abc123"
121
- }' | jq .
122
-
123
- # Response (key shown only once):
124
- # {
125
- # "key": "pctx_00000000_..._1234",
126
- # "label": "alice-macbook",
127
- # "permissions": ["read", "write"],
128
- # "key_hash_prefix": "deadbeef"
129
- # }
130
- ```
131
-
132
- **Repeat for each developer.** Each person gets a unique key.
133
-
134
- ### Permission levels
135
-
136
- | Permission | Can do |
137
- |------------|--------|
138
- | `read` | Search symbols, get outlines, get source |
139
- | `write` | + Index new repos (`index_folder`) |
140
- | `admin` | + Manage keys and workspaces |
141
-
142
- ---
143
-
144
- ## Step 4 — Index the Codebase
145
-
146
- Index the shared codebase from the server (or from any machine with `write` permission and network access to the repo path).
147
-
148
- ```bash
149
- # Initialize a session first
150
- SESSION_RESPONSE=$(curl -s -X POST "$SERVER/mcp/sse" \
151
- -H "Authorization: Bearer pctx_yourwritekey" \
152
- -H "Accept: application/json, text/event-stream" \
153
- -H "Content-Type: application/json" \
154
- -d '{
155
- "jsonrpc": "2.0",
156
- "method": "initialize",
157
- "params": {
158
- "protocolVersion": "2024-11-05",
159
- "capabilities": {},
160
- "clientInfo": {"name": "cli", "version": "1.0.0"}
161
- },
162
- "id": 1
163
- }')
164
-
165
- SESSION_ID=$(echo "$SESSION_RESPONSE" | grep -i "mcp-session-id" | awk '{print $2}' | tr -d '\r')
166
-
167
- # Index the repository
168
- curl -s -X POST "$SERVER/mcp/sse" \
169
- -H "Authorization: Bearer pctx_yourwritekey" \
170
- -H "mcp-session-id: $SESSION_ID" \
171
- -H "Accept: application/json, text/event-stream" \
172
- -H "Content-Type: application/json" \
173
- -d '{
174
- "jsonrpc": "2.0",
175
- "method": "tools/call",
176
- "params": {
177
- "name": "index_folder",
178
- "arguments": {"path": "/path/to/repo"}
179
- },
180
- "id": 2
181
- }'
182
- ```
183
-
184
- Or simply connect Claude Code (step 5) and ask it to index via chat.
185
-
186
- ---
187
-
188
- ## Step 5 — Connect Claude Code
189
-
190
- Each developer runs this once on their machine (using their personal API key):
191
-
192
- ```bash
193
- claude mcp add purecontext-remote \
194
- --transport http \
195
- --url https://purecontext.mycompany.com/mcp/sse \
196
- --header "Authorization: Bearer pctx_yourpersonalkey"
197
- ```
198
-
199
- After adding, restart Claude Code and verify the connection:
200
-
201
- ```
202
- /mcp
203
- # Should show purecontext-remote as connected
204
- ```
205
-
206
- Then in a conversation:
207
-
208
- ```
209
- List my indexed repositories using list_repos
210
- ```
211
-
212
- ---
213
-
214
- ## Step 6 — Manage Keys Over Time
215
-
216
- ```bash
217
- # List all keys
218
- curl -s "$SERVER/admin/keys" -H "Authorization: Bearer $ADMIN_KEY" | jq .
219
-
220
- # Revoke a key by hash prefix (e.g. when someone leaves the team)
221
- curl -s -X DELETE "$SERVER/admin/keys/deadbeef" \
222
- -H "Authorization: Bearer $ADMIN_KEY"
223
-
224
- # Check key usage
225
- curl -s "$SERVER/admin/keys/deadbeef/usage" \
226
- -H "Authorization: Bearer $ADMIN_KEY" | jq .
227
- ```
228
-
229
- ---
230
-
231
- ## Production Checklist
232
-
233
- - [ ] `PCTX_ADMIN_KEY` is a long random secret (≥ 32 hex chars), set via env var only
234
- - [ ] Server is behind a reverse proxy (nginx/Caddy) with TLS
235
- - [ ] `/data` volume is backed up regularly (it contains all indexes)
236
- - [ ] Admin key is NOT in any config file that could be committed to git
237
-
238
- ### nginx reverse proxy example
239
-
240
- ```nginx
241
- server {
242
- listen 443 ssl;
243
- server_name purecontext.mycompany.com;
244
-
245
- ssl_certificate /etc/letsencrypt/live/purecontext.mycompany.com/fullchain.pem;
246
- ssl_certificate_key /etc/letsencrypt/live/purecontext.mycompany.com/privkey.pem;
247
-
248
- location / {
249
- proxy_pass http://localhost:3000;
250
- proxy_http_version 1.1;
251
- proxy_set_header Upgrade $http_upgrade;
252
- proxy_set_header Connection keep-alive;
253
- proxy_set_header Host $host;
254
- # Important for SSE: disable buffering
255
- proxy_buffering off;
256
- proxy_cache off;
257
- proxy_read_timeout 3600s;
258
- }
259
- }
260
- ```
261
-
262
- ### Caddy example
263
-
264
- ```
265
- purecontext.mycompany.com {
266
- reverse_proxy localhost:3000 {
267
- flush_interval -1 # disable buffering for SSE
268
- }
269
- }
270
- ```
271
-
272
- ---
273
-
274
- ## Troubleshooting
275
-
276
- ### Connection timeouts on GET /mcp/sse
277
-
278
- The SSE connection sends a `: ping` comment every 30 seconds to keep the stream alive. If your proxy or load balancer has a shorter idle timeout, increase it. With nginx, use `proxy_read_timeout 3600s`.
279
-
280
- ### Authentication errors
281
-
282
- ```bash
283
- # Test your key
284
- curl -s -X POST "$SERVER/mcp/sse" \
285
- -H "Authorization: Bearer pctx_yourkey" \
286
- -H "Accept: application/json, text/event-stream" \
287
- -H "Content-Type: application/json" \
288
- -d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}},"id":1}'
289
- ```
290
-
291
- - `401` → key missing or wrong format
292
- - `401` → key revoked or not found in DB
293
- - `403` → key lacks required permission
294
-
295
- ### Health check
296
-
297
- ```bash
298
- curl http://localhost:3000/health
299
- ```
300
-
301
- Returns 200 even without authentication — use this to verify the server is running.
302
-
303
- ### Server logs (Docker)
304
-
305
- ```bash
306
- docker logs -f purecontext
307
- ```
308
-
309
- ### Update
310
-
311
- ```bash
312
- docker pull purecontext/purecontext-mcp:latest
313
- docker compose up -d --force-recreate
314
- ```
315
-
316
- The SQLite index is in the `/data` volume — it persists across container restarts and updates.
@@ -1,99 +0,0 @@
1
- # PureContext MCP — Telemetry
2
-
3
- PureContext MCP includes **opt-in anonymous telemetry** so the maintainers can understand which languages, adapters, and features are actually used in the wild. This data helps us prioritize work and improve the tool.
4
-
5
- ## Opt-in, not opt-out
6
-
7
- **No data is sent unless you explicitly enable telemetry.**
8
-
9
- The default is `telemetry.enabled: false`. When you run `purecontext-mcp config --init`, you will be asked whether you want to enable telemetry. You can change your answer at any time by editing `~/.purecontext/config.json`.
10
-
11
- ## What is collected
12
-
13
- When telemetry is enabled, the following is sent after each indexing operation and on server startup:
14
-
15
- ### `index_complete` event
16
-
17
- ```json
18
- {
19
- "event": "index_complete",
20
- "version": "1.0.0",
21
- "nodeVersion": "20.11.0",
22
- "platform": "linux",
23
- "languages": ["typescript", "javascript"],
24
- "adapterNames": ["vue", "nuxt"],
25
- "fileCount": 342,
26
- "symbolCount": 4821,
27
- "durationMs": 1240,
28
- "workerCount": 4,
29
- "sessionId": "a1b2c3d4-...",
30
- "timestamp": "2026-04-26T10:00:00.000Z"
31
- }
32
- ```
33
-
34
- ### `server_start` event
35
-
36
- ```json
37
- {
38
- "event": "server_start",
39
- "version": "1.0.0",
40
- "nodeVersion": "20.11.0",
41
- "platform": "linux",
42
- "sessionId": "a1b2c3d4-...",
43
- "timestamp": "2026-04-26T10:00:00.000Z"
44
- }
45
- ```
46
-
47
- **`sessionId`** is a random UUID generated fresh each time the process starts. It is **not** persisted between sessions — it cannot be used to track you across restarts.
48
-
49
- ## What is never collected
50
-
51
- - File paths, directory names, or repo names
52
- - Symbol names, function names, or any source code content
53
- - Import specifiers or file contents
54
- - IP addresses or any personally identifiable information
55
- - Anything not listed in the "What is collected" section above
56
-
57
- ## Local audit log
58
-
59
- Every event sent is also appended to `~/.purecontext/telemetry.jsonl` so you can inspect exactly what was transmitted. This file is local only and never shared automatically.
60
-
61
- ## How to enable or disable
62
-
63
- **Enable:**
64
-
65
- ```json
66
- // ~/.purecontext/config.json
67
- {
68
- "telemetry": {
69
- "enabled": true
70
- }
71
- }
72
- ```
73
-
74
- **Disable (default):**
75
-
76
- ```json
77
- {
78
- "telemetry": {
79
- "enabled": false
80
- }
81
- }
82
- ```
83
-
84
- Run `purecontext-mcp config --init` to regenerate the config file with an interactive opt-in prompt.
85
-
86
- ## Where data is sent
87
-
88
- Events are POSTed to `https://telemetry.purecontext.dev/v1/event`. You can override this endpoint in config:
89
-
90
- ```json
91
- {
92
- "telemetry": {
93
- "enabled": true,
94
- "endpoint": "https://your-own-telemetry-server.example.com/v1/event"
95
- }
96
- }
97
- ```
98
-
99
- Network errors are silently discarded — telemetry failures never affect PureContext's normal operation.