context_drop 0.1.2 → 0.1.4
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.
- checksums.yaml +4 -4
- data/README.md +101 -9
- data/app/assets/javascripts/context_drop/context_drop.js +1219 -575
- data/app/controllers/context_drop/dashboard/feedbacks_controller.rb +62 -2
- data/app/helpers/context_drop/dashboard_helper.rb +52 -0
- data/app/javascript/context_drop/__tests__/widget.test.ts +225 -3
- data/app/javascript/context_drop/element-picker.ts +958 -484
- data/app/javascript/context_drop/icons.ts +2 -0
- data/app/javascript/context_drop/screenshot.ts +7 -1
- data/app/javascript/context_drop/styles.ts +88 -39
- data/app/javascript/context_drop/widget.ts +195 -69
- data/app/models/context_drop/feedback.rb +11 -5
- data/app/views/context_drop/dashboard/feedbacks/index.html.erb +161 -60
- data/app/views/context_drop/dashboard/feedbacks/show.html.erb +168 -47
- data/app/views/layouts/context_drop/application.html.erb +415 -70
- data/lib/context_drop/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f47ccd912edd4803adfe23aac2346e3ff6e34ad115c109f0982fe2e715af3d9
|
|
4
|
+
data.tar.gz: 0be0fbda77adbc5f6e655be40d940aa4ba1dd967299a4ffbca323fd5abbade93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7c52b647c0b16dba94ecffe2546db1bb944b91280d41099bd55e097d63b02081e7910678c77e2a0cae5a4e9f3471cf3d61bdafb183f27b64456982d2a1b3524
|
|
7
|
+
data.tar.gz: f76d7bffc1455cedfe99391be70923907b2eec123ea714a4ce7816aed3502854b7ba696c81846bbd5f9e673878a8e6071714cac4e60d152ad01ada436447e78b
|
data/README.md
CHANGED
|
@@ -223,14 +223,109 @@ ContextDrop ships with a built-in **Model Context Protocol (MCP)** server (`Cont
|
|
|
223
223
|
|
|
224
224
|
---
|
|
225
225
|
|
|
226
|
-
###
|
|
226
|
+
### Recommended Setup (Local + Remote)
|
|
227
|
+
|
|
228
|
+
For day-to-day development, register **both** a local `stdio` server and a remote Streamable HTTP server side-by-side in your MCP configuration (`mcp_config.json` in **Antigravity**, `~/.cursor/mcp.json` in **Cursor**, **Claude Desktop** / `.mcp.json` in **Claude Code**, **Windsurf**, or **VS Code**):
|
|
229
|
+
|
|
230
|
+
- **`context-drop-local` (`stdio`):** Runs `./bin/rails context_drop:mcp` directly against your local development database and Active Storage (no running `bin/rails server` required). Wrapped with `/bin/zsh -c`, `cd`, `exec`, and an explicit `PATH` so it boots reliably inside strict agent sandboxes and GUI-launched IDEs.
|
|
231
|
+
- **`context-drop-remote` (`Streamable HTTP`):** Connects to your deployed staging or production Rails app (`POST <mount_path>/mcp` with `CONTEXT_DROP_MCP_ENABLED=true` and `CONTEXT_DROP_MCP_API_KEY=<your-secret-token>` configured on the server) so your agent can pull real bug reports, pinned selectors, and screenshots submitted by QA or users, fix the code locally, and mark the remote feedback resolved.
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"mcpServers": {
|
|
236
|
+
"context-drop-local": {
|
|
237
|
+
"command": "/bin/zsh",
|
|
238
|
+
"args": [
|
|
239
|
+
"-c",
|
|
240
|
+
"cd /absolute/path/to/your-rails-app && exec /Users/<you>/.rbenv/shims/bundle exec ./bin/rails context_drop:mcp"
|
|
241
|
+
],
|
|
242
|
+
"env": {
|
|
243
|
+
"PATH": "/Users/<you>/.rbenv/shims:/Users/<you>/.rbenv/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"context-drop-remote": {
|
|
247
|
+
"url": "https://staging.example.com/context_drop/mcp",
|
|
248
|
+
"headers": {
|
|
249
|
+
"Authorization": "Bearer <your-secret-token>"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
> [!NOTE]
|
|
257
|
+
> **Custom route prefixes:** Match the `context-drop-remote` URL to wherever `ContextDrop::Engine` is mounted in `config/routes.rb` plus `/mcp` (for example, `https://staging.example.com/rails/context_drop/mcp` when mounted under `/rails/context_drop`).
|
|
258
|
+
|
|
259
|
+
Naming the servers `context-drop-local` and `context-drop-remote` lets you target either environment explicitly in your IDE prompts without toggling config files:
|
|
260
|
+
- *"Check `context-drop-remote` for new feedbacks, inspect the pinned element selector and screenshot, diagnose the root cause in our local Rails views/CSS, and mark the feedback resolved."*
|
|
261
|
+
- *"Inspect the latest feedback I just pinned on `context-drop-local` and verify the layout fix."*
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### Multi-Environment & Multiple Remote Servers (`local` + `staging` + `production`)
|
|
266
|
+
|
|
267
|
+
MCP clients support registering any number of ContextDrop servers simultaneously. If your team triages feedback across **Staging / QA** and **Production** (or across multiple Rails services), register each remote endpoint under an explicit environment-scoped key:
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"mcpServers": {
|
|
272
|
+
"context-drop-local": {
|
|
273
|
+
"command": "/bin/zsh",
|
|
274
|
+
"args": [
|
|
275
|
+
"-c",
|
|
276
|
+
"cd /absolute/path/to/your-rails-app && exec /Users/<you>/.rbenv/shims/bundle exec ./bin/rails context_drop:mcp"
|
|
277
|
+
],
|
|
278
|
+
"env": {
|
|
279
|
+
"PATH": "/Users/<you>/.rbenv/shims:/Users/<you>/.rbenv/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"context-drop-staging": {
|
|
283
|
+
"url": "https://staging.example.com/context_drop/mcp",
|
|
284
|
+
"headers": {
|
|
285
|
+
"Authorization": "Bearer <staging-mcp-secret-token>"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"context-drop-production": {
|
|
289
|
+
"url": "https://app.example.com/context_drop/mcp",
|
|
290
|
+
"headers": {
|
|
291
|
+
"Authorization": "Bearer <production-mcp-secret-token>"
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### Recommended Environment Matrix
|
|
299
|
+
|
|
300
|
+
| Environment | MCP Transport | `CONTEXT_DROP_ENABLED` (Widget & Dashboard) | `CONTEXT_DROP_MCP_ENABLED` (HTTP `/mcp`) | Token & Access Strategy |
|
|
301
|
+
|---|---|---|---|---|
|
|
302
|
+
| **Local (`development`)** | `stdio` (`context_drop:mcp`) | `true` | `false` *(not needed for `stdio`)* | Direct local DB & Active Storage access; zero network exposure. |
|
|
303
|
+
| **Staging / QA** | Streamable HTTP | `true` | `true` | Dedicated `staging` token (`bin/rails secret`); open to QA & preview testers. |
|
|
304
|
+
| **Production** | Streamable HTTP | `true` *(or scoped via `authorize_submission`)* | `true` | Separate `production` token (rotated independently) + optional gateway headers / `authorize_mcp`. |
|
|
305
|
+
|
|
306
|
+
#### Multi-Environment Best Practices
|
|
307
|
+
|
|
308
|
+
- **Namespace server keys clearly (especially across multiple Rails apps):** In global IDE configs (`mcp_config.json` in Antigravity or `~/.cursor/mcp.json`), prefix keys by service and environment—such as `checkout-local`, `checkout-staging`, `checkout-prod`, and `admin-prod`—so your agent never confuses tools from different repositories or databases.
|
|
309
|
+
- **Isolate secrets per environment:** Generate a distinct high-entropy `CONTEXT_DROP_MCP_API_KEY` (`bin/rails secret` or `openssl rand -hex 32`) in each environment's Rails encrypted credentials or secret manager. Never share a single Bearer token between staging and production.
|
|
310
|
+
- **Keep live tokens out of version control:** Place configs containing live `Authorization` headers in user-level MCP files (e.g., Antigravity `mcp_config.json`, `~/.cursor/mcp.json`) or gitignore workspace `.mcp.json` overrides.
|
|
311
|
+
- **Independent Widget vs. MCP switches:** `config.enabled` and `config.mcp_enabled` are decoupled—`ContextDrop::McpController` remains reachable whenever `CONTEXT_DROP_MCP_ENABLED=true`, even if you temporarily set `CONTEXT_DROP_ENABLED=false` in production to pause new widget submissions while finishing triage.
|
|
312
|
+
- **Stamp environment & release SHA into widget metadata:** Pass `metadata: { env: Rails.env, release: ENV["GIT_COMMIT_SHA"] }` to `<%= context_drop_widget(...) %>` so every feedback record pulled by your agent explicitly carries the environment and commit SHA it came from.
|
|
313
|
+
- **Layer zero-trust proxy headers when needed:** If your remote MCP endpoints sit behind Cloudflare Access, Google IAP, or an internal MCP gateway, pass additional proxy headers inside `"headers"` alongside `Authorization` (or validate custom JWT/header claims in `config.authorize_mcp`).
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
### Individual Transport Options & Environment Reference
|
|
318
|
+
|
|
319
|
+
If you only need a single transport or use a different Ruby version manager (`mise`, `asdf`, `rvm`, Homebrew) or Docker setup, see the reference configurations below.
|
|
320
|
+
|
|
321
|
+
#### Option 1: Project-Scoped Local `stdio` (Inherited Shell Environment)
|
|
227
322
|
|
|
228
323
|
When using a workspace-scoped MCP file (e.g., `.mcp.json` in Claude Code or `.cursor/mcp.json` launched from a terminal) where your IDE already runs inside the Rails root and inherits your Ruby shell `PATH`:
|
|
229
324
|
|
|
230
325
|
```json
|
|
231
326
|
{
|
|
232
327
|
"mcpServers": {
|
|
233
|
-
"context-drop": {
|
|
328
|
+
"context-drop-local": {
|
|
234
329
|
"command": "bundle",
|
|
235
330
|
"args": ["exec", "./bin/rails", "context_drop:mcp"]
|
|
236
331
|
}
|
|
@@ -238,7 +333,7 @@ When using a workspace-scoped MCP file (e.g., `.mcp.json` in Claude Code or `.cu
|
|
|
238
333
|
}
|
|
239
334
|
```
|
|
240
335
|
|
|
241
|
-
|
|
336
|
+
#### Option 2: Strict Sandboxes, Global IDE Configs & Ruby Version Managers (`rbenv`, `mise`, `asdf`, `rvm`)
|
|
242
337
|
|
|
243
338
|
Strict sandboxed coding agents and GUI-launched desktop IDEs (such as **Antigravity** `mcp_config.json`, **Claude Desktop**, global `~/.cursor/mcp.json`, **Windsurf**, or VS Code launched from macOS Finder / Linux desktop) typically spawn MCP subprocesses with:
|
|
244
339
|
1. **A non-project working directory** (often `/` or `$HOME`, causing relative `./bin/rails` or `Gemfile` lookup to fail), and
|
|
@@ -249,7 +344,7 @@ To make `stdio` work reliably in strict sandboxes, wrap the launch command with
|
|
|
249
344
|
```json
|
|
250
345
|
{
|
|
251
346
|
"mcpServers": {
|
|
252
|
-
"context-drop": {
|
|
347
|
+
"context-drop-local": {
|
|
253
348
|
"command": "/bin/zsh",
|
|
254
349
|
"args": [
|
|
255
350
|
"-c",
|
|
@@ -277,14 +372,14 @@ To make `stdio` work reliably in strict sandboxes, wrap the launch command with
|
|
|
277
372
|
| **`rvm`** (macOS / Linux) | `/Users/<you>/.rvm/wrappers/default/bundle` | `/Users/<you>/.rvm/gems/default/bin:/Users/<you>/.rvm/bin` |
|
|
278
373
|
| **Homebrew / Linux `/usr/local`** | `/opt/homebrew/opt/ruby/bin/bundle` or `/usr/local/bin/bundle` | `/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/usr/local/bin` |
|
|
279
374
|
|
|
280
|
-
|
|
375
|
+
#### Option 3: Streamable HTTP Transport (Docker, Isolated Sandboxes, Staging & Production)
|
|
281
376
|
|
|
282
377
|
If your Rails app runs inside **Docker / Devcontainers**, if your agent sandbox blocks host binary execution outside the workspace, or if you want to triage feedback directly from **staging or production**, enable the HTTP endpoint with a bearer token (`CONTEXT_DROP_MCP_ENABLED=true` and `CONTEXT_DROP_MCP_API_KEY=<your-secret-token>`) and point your MCP client to `POST /context_drop/mcp`:
|
|
283
378
|
|
|
284
379
|
```json
|
|
285
380
|
{
|
|
286
381
|
"mcpServers": {
|
|
287
|
-
"context-drop-
|
|
382
|
+
"context-drop-remote": {
|
|
288
383
|
"url": "https://staging.example.com/context_drop/mcp",
|
|
289
384
|
"headers": {
|
|
290
385
|
"Authorization": "Bearer <your-secret-token>"
|
|
@@ -296,9 +391,6 @@ If your Rails app runs inside **Docker / Devcontainers**, if your agent sandbox
|
|
|
296
391
|
|
|
297
392
|
*(For local Docker or strict-sandbox setups, use `"url": "http://localhost:3000/context_drop/mcp"` against your running `bin/rails server`.)*
|
|
298
393
|
|
|
299
|
-
Once connected, prompt your coding agent directly in your IDE:
|
|
300
|
-
> *"Check the `context-drop` MCP server for new feedbacks, inspect the pinned element selector and screenshot, diagnose the root cause in our Rails views/CSS, and mark the feedback resolved."*
|
|
301
|
-
|
|
302
394
|
---
|
|
303
395
|
|
|
304
396
|
## Zero-Trust Privacy & Redaction
|