lensmcp 1.8.0 → 1.9.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/.claude-plugin/marketplace.json +17 -0
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +23 -0
- package/plugin/.mcp.json +13 -0
- package/plugin/README.md +49 -0
- package/plugin/scripts/dashboard-open.sh +23 -0
- package/plugin/scripts/gateway-start.sh +17 -0
- package/plugin/scripts/gateway-status.sh +15 -0
- package/plugin/scripts/gateway-stop.sh +13 -0
- package/plugin/skills/dashboard/SKILL.md +19 -0
- package/plugin/skills/start/SKILL.md +33 -0
- package/plugin/skills/status/SKILL.md +18 -0
- package/plugin/skills/stop/SKILL.md +17 -0
- package/plugin/skills/using-lensmcp/SKILL.md +42 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lensmcp-marketplace",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "David Antoon",
|
|
5
|
+
"email": "davidmantoon@gmail.com"
|
|
6
|
+
},
|
|
7
|
+
"metadata": {
|
|
8
|
+
"description": "The LensMCP observability lens, packaged as a Claude Code plugin."
|
|
9
|
+
},
|
|
10
|
+
"plugins": [
|
|
11
|
+
{
|
|
12
|
+
"name": "lensmcp",
|
|
13
|
+
"source": "./plugin",
|
|
14
|
+
"description": "Run the LensMCP dev cluster gateway + per-project dashboard + MCP server from inside Claude Code."
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lensmcp",
|
|
3
|
+
"displayName": "LensMCP",
|
|
4
|
+
"description": "The observability lens for coding agents. One command brings up the dev cluster gateway (every project.json `cluster` decl → its host on :443), the per-project lens dashboard at https://lensmcp.local/<project>/, and the MCP server your agent connects to — scoped automatically to whatever project you opened Claude Code in.",
|
|
5
|
+
"version": "1.9.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "David Antoon",
|
|
8
|
+
"email": "davidmantoon@gmail.com"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/kiwiapps-ltd/lensmcp",
|
|
11
|
+
"repository": "https://github.com/kiwiapps-ltd/lensmcp",
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mcp",
|
|
15
|
+
"lens",
|
|
16
|
+
"observability",
|
|
17
|
+
"nx",
|
|
18
|
+
"vite",
|
|
19
|
+
"nestjs",
|
|
20
|
+
"gateway"
|
|
21
|
+
],
|
|
22
|
+
"mcpServers": "./.mcp.json"
|
|
23
|
+
}
|
package/plugin/.mcp.json
ADDED
package/plugin/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# LensMCP — Claude Code plugin
|
|
2
|
+
|
|
3
|
+
Run the LensMCP observability lens for **any** project, from inside Claude Code: the dev
|
|
4
|
+
cluster **gateway**, the per-project **dashboard**, and the **MCP server** your agent
|
|
5
|
+
connects to — all scoped automatically to the project you opened Claude Code in.
|
|
6
|
+
|
|
7
|
+
## What it bundles
|
|
8
|
+
|
|
9
|
+
- **MCP server** (`.mcp.json`) — launched as `lensmcp mcp --cwd ${CLAUDE_PROJECT_DIR}`, so it
|
|
10
|
+
always reads *that project's* `.lensmcp/events.jsonl`. Open Claude Code in `tetros` → you
|
|
11
|
+
get tetros's flows; open it elsewhere → that project's flows. No cross-talk.
|
|
12
|
+
- **Commands** (skills):
|
|
13
|
+
- `/lensmcp:start` — start the gateway (every `project.json` `cluster` decl → its host on
|
|
14
|
+
:443) + the lens dashboard at `https://lensmcp.local/<key>/`.
|
|
15
|
+
- `/lensmcp:stop` — stop the gateway.
|
|
16
|
+
- `/lensmcp:status` — gateway liveness + `lensmcp doctor`.
|
|
17
|
+
- `/lensmcp:dashboard` — open the per-project dashboard in the browser.
|
|
18
|
+
- `/lensmcp:using-lensmcp` — how to drive the lens (which tool answers which question).
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
The target project must have **`lensmcp` installed** as a dev dependency
|
|
23
|
+
(`yarn add -D lensmcp`) — the plugin shells out to its project-local CLI so versions stay in
|
|
24
|
+
lock-step with the project. `lensmcp` is a **dev-only** tool; never a prod/CI dependency.
|
|
25
|
+
|
|
26
|
+
Binding **:443** needs privilege — run `nx run gateway:trust` once per machine (sets up the
|
|
27
|
+
`*.local` hosts + a TLS CA), and start the gateway with the elevation your OS requires.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
**Dev (fastest, what we use while iterating):**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
claude --plugin-dir /Users/davidantoon/git/lensmcp/plugin
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Via marketplace (once published):**
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
/plugin marketplace add kiwiapps-ltd/lensmcp
|
|
41
|
+
/plugin install lensmcp@lensmcp-marketplace
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Multi-project
|
|
45
|
+
|
|
46
|
+
Each project derives its own `key`, ports, and dashboard mount path
|
|
47
|
+
(`.lensmcp/config.json`), so the lens runs cleanly across projects — switch projects and the
|
|
48
|
+
dashboard moves to `lensmcp.local/<that-project>/` with its own ports. One gateway owns :443
|
|
49
|
+
at a time.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Open the per-project LensMCP dashboard (history-routed) in the default browser.
|
|
3
|
+
# The mount path comes from .lensmcp/config.json (e.g. /tetros), served by the gateway
|
|
4
|
+
# at https://lensmcp.local/<key>/.
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
|
|
7
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
8
|
+
CFG="$PROJECT_DIR/.lensmcp/config.json"
|
|
9
|
+
|
|
10
|
+
BASE=""
|
|
11
|
+
if [ -f "$CFG" ]; then
|
|
12
|
+
BASE="$(node -e "try{process.stdout.write(require('$CFG').dashboardBasePath||'')}catch(e){}" 2>/dev/null || echo '')"
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
URL="https://lensmcp.local${BASE}/"
|
|
16
|
+
echo "LensMCP dashboard → $URL"
|
|
17
|
+
echo "(needs the gateway running: /lensmcp:start)"
|
|
18
|
+
|
|
19
|
+
case "$(uname -s)" in
|
|
20
|
+
Darwin) open "$URL" 2>/dev/null || true ;;
|
|
21
|
+
Linux) xdg-open "$URL" 2>/dev/null || true ;;
|
|
22
|
+
*) echo "Open it manually: $URL" ;;
|
|
23
|
+
esac
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Start the LensMCP dev cluster gateway for the project Claude Code is open in.
|
|
3
|
+
# The gateway reads every project.json `cluster` decl, launches each app/service under
|
|
4
|
+
# its host on :443, and serves the per-project lens dashboard at lensmcp.local/<key>/.
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
8
|
+
BIN="$PROJECT_DIR/node_modules/lensmcp/bin.js"
|
|
9
|
+
|
|
10
|
+
if [ ! -f "$BIN" ]; then
|
|
11
|
+
echo "✗ lensmcp is not installed in $PROJECT_DIR (no node_modules/lensmcp/bin.js)." >&2
|
|
12
|
+
echo " Install it as a dev dependency: yarn add -D lensmcp" >&2
|
|
13
|
+
echo " (the gateway is a dev-only tool — never a prod/CI dependency)." >&2
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
exec node "$BIN" gateway start --cwd "$PROJECT_DIR"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Report LensMCP gateway status for the current project, then run the install doctor.
|
|
3
|
+
set -uo pipefail
|
|
4
|
+
|
|
5
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
6
|
+
BIN="$PROJECT_DIR/node_modules/lensmcp/bin.js"
|
|
7
|
+
|
|
8
|
+
if [ ! -f "$BIN" ]; then
|
|
9
|
+
echo "✗ lensmcp is not installed in $PROJECT_DIR." >&2
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
node "$BIN" gateway status --cwd "$PROJECT_DIR" || true
|
|
14
|
+
echo
|
|
15
|
+
node "$BIN" doctor --cwd "$PROJECT_DIR" || true
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Stop the LensMCP dev cluster gateway for the current project.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
6
|
+
BIN="$PROJECT_DIR/node_modules/lensmcp/bin.js"
|
|
7
|
+
|
|
8
|
+
if [ ! -f "$BIN" ]; then
|
|
9
|
+
echo "✗ lensmcp is not installed in $PROJECT_DIR." >&2
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
exec node "$BIN" gateway stop --cwd "$PROJECT_DIR"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Open the per-project LensMCP dashboard (Flows / Cluster / Logs / Resources) in the browser at https://lensmcp.local/<key>/. Use when the user asks to open the lens dashboard, see the flows/cluster UI, or watch the app live.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Open the LensMCP dashboard
|
|
6
|
+
|
|
7
|
+
Run the open script with the Bash tool:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
"${CLAUDE_PLUGIN_ROOT}/scripts/dashboard-open.sh"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It reads the project's mount path from `.lensmcp/config.json` and opens
|
|
14
|
+
`https://lensmcp.local/<key>/` — the human view of the lens (the same event stream the
|
|
15
|
+
MCP server reads): **Flows**, **Cluster**, **Logs**, **Resources**, history-routed so deep
|
|
16
|
+
links + refresh work.
|
|
17
|
+
|
|
18
|
+
The dashboard is served by the gateway, so it needs the gateway running first
|
|
19
|
+
(`/lensmcp:start`). If the page doesn't load, check `/lensmcp:status`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Start the LensMCP dev cluster gateway for the current project — brings up every app/service/site under its host on :443 and the per-project lens dashboard at https://lensmcp.local/<key>/. Use when the user asks to start the gateway/cluster, "start lensmcp", bring the dev cluster up, or start listening.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Start the LensMCP gateway
|
|
6
|
+
|
|
7
|
+
Run the startup script with the Bash tool:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
"${CLAUDE_PLUGIN_ROOT}/scripts/gateway-start.sh"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The script calls `lensmcp gateway start` for the project Claude Code is open in
|
|
14
|
+
(`${CLAUDE_PROJECT_DIR}`). That single command:
|
|
15
|
+
|
|
16
|
+
- reads every `project.json` `cluster` declaration and launches each app / service /
|
|
17
|
+
website under its own host (e.g. `app.tetros.ai.local`, `auth.tetros.ai.local`,
|
|
18
|
+
`api.tetros.ai.local/crm`), each on its own port/socket via the one HTTPS front door
|
|
19
|
+
on **:443**;
|
|
20
|
+
- serves the project-scoped lens **dashboard** at `https://lensmcp.local/<key>/`;
|
|
21
|
+
- writes a pid + log under `.lensmcp/` so it can be stopped later.
|
|
22
|
+
|
|
23
|
+
After running it:
|
|
24
|
+
|
|
25
|
+
1. Report the dashboard URL the script printed.
|
|
26
|
+
2. **Binding :443 needs privilege.** If the log shows `EACCES`/permission denied, tell
|
|
27
|
+
the user to either run the gateway target with `sudo`, or that ports <1024 require
|
|
28
|
+
elevation on macOS — and that `nx run gateway:trust` must be run once (sudo) to set up
|
|
29
|
+
the `*.local` hosts + TLS CA. Check `.lensmcp/gateway.log` for the real error.
|
|
30
|
+
3. If the user has not run `gateway:trust` yet, mention it (one-time per machine).
|
|
31
|
+
|
|
32
|
+
Do **not** run a service's `serve`/`serve-hmr` manually — the gateway owns each service's
|
|
33
|
+
lifecycle. This one command is the entry point.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Report LensMCP status for the current project — gateway liveness, the dashboard URL, and the install doctor (Node, plugin wiring, MCP bundle, per-project vite/nest wiring). Use when the user asks if lensmcp is running, to check the gateway, or to diagnose the lens setup.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# LensMCP status + doctor
|
|
6
|
+
|
|
7
|
+
Run the status script with the Bash tool:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
"${CLAUDE_PLUGIN_ROOT}/scripts/gateway-status.sh"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It runs `lensmcp gateway status` (is the gateway up? the project key + dashboard URL) and
|
|
14
|
+
then `lensmcp doctor` (Node version, plugin registration, `.mcp.json`, the MCP server
|
|
15
|
+
bundle, per-project Vite/Nest wiring, agent-dev targets, Chrome for browser capture).
|
|
16
|
+
|
|
17
|
+
Summarize the result for the user: whether the gateway is running, the dashboard URL, and
|
|
18
|
+
any `✗`/`!` items doctor flagged with their suggested fix.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Stop the LensMCP dev cluster gateway for the current project. Use when the user asks to stop the gateway/cluster, "stop lensmcp", or shut the dev cluster down.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Stop the LensMCP gateway
|
|
6
|
+
|
|
7
|
+
Run the stop script with the Bash tool:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
"${CLAUDE_PLUGIN_ROOT}/scripts/gateway-stop.sh"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It calls `lensmcp gateway stop` for `${CLAUDE_PROJECT_DIR}`, which reads the pid recorded
|
|
14
|
+
in `.lensmcp/gateway.pid` and terminates the gateway process group (the gateway plus the
|
|
15
|
+
app/service pods + the lens dashboard it spawned).
|
|
16
|
+
|
|
17
|
+
Report whether it stopped, or that it was already not running.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: How to drive the LensMCP lens to observe a running app — the start→interact→read loop, and which MCP tool answers which question (what happened on a click, why a component re-rendered, what's slow, memory leaks). Use when the user asks how to use lensmcp, what it can do, or to explain/trace something the running app just did.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Using LensMCP
|
|
6
|
+
|
|
7
|
+
LensMCP gives you (and the user) eyes on a running application. Producers (the gateway,
|
|
8
|
+
agent-dev, instrumented apps) write events to `<project>/.lensmcp/events.jsonl`; the MCP
|
|
9
|
+
server and the dashboard both read that file. **Project isolation is automatic** — the MCP
|
|
10
|
+
server is launched with `--cwd ${CLAUDE_PROJECT_DIR}`, so it always reads the flows of the
|
|
11
|
+
project Claude Code is open in. Different project → different event file → different flows.
|
|
12
|
+
|
|
13
|
+
## The loop
|
|
14
|
+
|
|
15
|
+
1. **Start** the cluster + lens: `/lensmcp:start` (gateway up, all hosts routed, dashboard
|
|
16
|
+
at `https://lensmcp.local/<key>/`). For a single app instead of the whole cluster, the
|
|
17
|
+
workspace's `nx run <project>:agent-dev` also produces events.
|
|
18
|
+
2. **Interact** with the running app (click around in the browser, or let an e2e drive it).
|
|
19
|
+
3. **Read** the lens — ask in plain language and call the right MCP tool:
|
|
20
|
+
|
|
21
|
+
| The user asks… | Tool |
|
|
22
|
+
|---|---|
|
|
23
|
+
| "what's the current state / is the lens live?" | `observe_current_status` |
|
|
24
|
+
| "show me recent flows" / "what just happened?" | `flow_list_recent`, then `flow_get` |
|
|
25
|
+
| "what happened when I clicked X?" | `graph_find_backend_work_caused_by_click`, `graph_trace_from_origin` |
|
|
26
|
+
| "why did this component re-render?" | `graph_explain_rerender` |
|
|
27
|
+
| "what's slow?" / "is there a DB call in a loop?" | `graph_find_slow_path`, `graph_find_db_in_loop` |
|
|
28
|
+
| "what state updates did this cause?" | `graph_find_state_updates_caused_by` |
|
|
29
|
+
| "did anything leak memory?" | `memory_explain_leak`, `memory_find_growth_by_flow` |
|
|
30
|
+
| "tell the story of this flow" | `story_compile`, `story_get` |
|
|
31
|
+
| visual / render checks | `visual_capture_frame`, `visual_inspect_node`, `visual_compare_frames` |
|
|
32
|
+
|
|
33
|
+
4. Watch it as a human anytime with `/lensmcp:dashboard`.
|
|
34
|
+
|
|
35
|
+
## Tips
|
|
36
|
+
|
|
37
|
+
- If a tool returns nothing, no events have been produced yet — start the gateway (or an
|
|
38
|
+
`agent-dev`) and interact with the app first.
|
|
39
|
+
- `/lensmcp:status` runs the doctor if something seems off (Node, plugin wiring, MCP bundle,
|
|
40
|
+
per-project Vite/Nest instrumentation, Chrome for browser capture).
|
|
41
|
+
- Don't run a service's `serve`/`serve-hmr` by hand — the gateway owns each service's
|
|
42
|
+
lifecycle; `/lensmcp:start` is the one entry point.
|