@shinobiapps/shinobi 0.1.6 → 0.2.1

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 (64) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/LICENSE +21 -21
  3. package/README.md +50 -17
  4. package/dist/cli.js +23 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/dashboard/auth.d.ts.map +1 -1
  7. package/dist/dashboard/auth.js +6 -3
  8. package/dist/dashboard/auth.js.map +1 -1
  9. package/dist/dashboard/server.d.ts +10 -1
  10. package/dist/dashboard/server.d.ts.map +1 -1
  11. package/dist/dashboard/server.js +28 -2
  12. package/dist/dashboard/server.js.map +1 -1
  13. package/dist/lib/db.d.ts.map +1 -1
  14. package/dist/lib/db.js +6 -2
  15. package/dist/lib/db.js.map +1 -1
  16. package/dist/lib/migrations.d.ts +2 -0
  17. package/dist/lib/migrations.d.ts.map +1 -1
  18. package/dist/lib/migrations.js +49 -4
  19. package/dist/lib/migrations.js.map +1 -1
  20. package/dist/lib/paths.d.ts +26 -0
  21. package/dist/lib/paths.d.ts.map +1 -0
  22. package/dist/lib/paths.js +68 -0
  23. package/dist/lib/paths.js.map +1 -0
  24. package/dist/lib/rate-limit.d.ts +25 -0
  25. package/dist/lib/rate-limit.d.ts.map +1 -0
  26. package/dist/lib/rate-limit.js +75 -0
  27. package/dist/lib/rate-limit.js.map +1 -0
  28. package/dist/models/decision_drafts.d.ts.map +1 -1
  29. package/dist/models/decision_drafts.js +2 -1
  30. package/dist/models/decision_drafts.js.map +1 -1
  31. package/dist/models/decisions.d.ts.map +1 -1
  32. package/dist/models/decisions.js +12 -3
  33. package/dist/models/decisions.js.map +1 -1
  34. package/dist/models/notes.d.ts.map +1 -1
  35. package/dist/models/notes.js +2 -1
  36. package/dist/models/notes.js.map +1 -1
  37. package/dist/models/subtasks.d.ts.map +1 -1
  38. package/dist/models/subtasks.js +2 -1
  39. package/dist/models/subtasks.js.map +1 -1
  40. package/dist/server/http.d.ts +17 -0
  41. package/dist/server/http.d.ts.map +1 -0
  42. package/dist/server/http.js +42 -0
  43. package/dist/server/http.js.map +1 -0
  44. package/dist/server/mcp.d.ts +14 -0
  45. package/dist/server/mcp.d.ts.map +1 -1
  46. package/dist/server/mcp.js +19 -1
  47. package/dist/server/mcp.js.map +1 -1
  48. package/dist/server/tools/projects.d.ts.map +1 -1
  49. package/dist/server/tools/projects.js +16 -2
  50. package/dist/server/tools/projects.js.map +1 -1
  51. package/dist/server/tools/workflow.d.ts.map +1 -1
  52. package/dist/server/tools/workflow.js +27 -3
  53. package/dist/server/tools/workflow.js.map +1 -1
  54. package/dist/services/auth/magic-link.d.ts.map +1 -1
  55. package/dist/services/auth/magic-link.js +3 -0
  56. package/dist/services/auth/magic-link.js.map +1 -1
  57. package/docs/configuration.md +21 -0
  58. package/docs/deploy-gcp-free.md +205 -0
  59. package/docs/getting-started.md +94 -0
  60. package/docs/recovery-runbook.md +162 -0
  61. package/docs/remote-mcp.md +132 -0
  62. package/migrations/0001_initial_schema.sql +284 -284
  63. package/migrations/0002_activity_and_links.sql +26 -26
  64. package/package.json +11 -5
package/CHANGELOG.md CHANGED
@@ -5,6 +5,98 @@ All notable changes to Shinobi will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.1] — 2026-06-12
9
+
10
+ Hardening + cross-device fixes found by dogfooding the remote brain from a
11
+ cloud session, plus pre-launch safety nets.
12
+
13
+ ### Added
14
+
15
+ - **Rate limiting** on the public surface: `/mcp` (default 240 req/min per
16
+ client, `SHINOBI_MCP_RATE_LIMIT`) and `/api/auth/magic-link` + `/api/auth/verify`
17
+ (default 10 req/min, `SHINOBI_AUTH_RATE_LIMIT`). Keyed by
18
+ `CF-Connecting-IP` / `X-Forwarded-For`, applied before auth so token
19
+ guessing is cut early. (#12)
20
+ - **Pre-migration database backup.** Pending migrations now snapshot the DB
21
+ file to `<db>.pre-migrate-<timestamp>` first (3 kept), so a failed
22
+ forward-only migration is recoverable. Failure messages include the backup
23
+ path. (#12)
24
+ - **`list_projects brief=true`** — token-light listing (truncated
25
+ descriptions, no summary blobs) for agents scanning many projects. (#12)
26
+ - **Host-side auto-deploy** for the VM: `scripts/vm-autodeploy.sh`, a cron
27
+ check-and-deploy with env carry-over, health check, and automatic rollback
28
+ to the previous image. (#11)
29
+ - **Recovery runbook** (`docs/recovery-runbook.md`): tested restore paths for
30
+ container/VM/database/Cloudflare failures, phone-only preflight checklist,
31
+ and a drill. (#9)
32
+ - First **vitest unit suites** (`paths`, `rate-limit`), wired into `npm test`. (#9, #12)
33
+
34
+ ### Fixed
35
+
36
+ - **Cross-device `files_touched` lookups.** Paths are normalized to
37
+ repo-relative at write time and matched with a suffix fallback, so
38
+ decisions logged on one machine (e.g. `c:\laragon\www\...`) are found from
39
+ any other (`/home/user/...`). Legacy absolute rows keep working without a
40
+ backfill. (#9)
41
+ - **Stale project summaries.** `session_closeout` now persists the
42
+ agent-authored summary as `recent_summary_md` (`agent:closeout`) when no
43
+ server-side LLM is configured — an external LLM key is no longer required
44
+ to keep the brain fresh. `agent_bootstrap` flags stale summaries
45
+ (`summary_stale`) and closeout reports `summary_skip_reason`. (#10)
46
+ - **Magic-link token accumulation** — consumed/expired tokens are purged on
47
+ each issuance. (#12)
48
+
49
+ ## [0.2.0] — 2026-06-12
50
+
51
+ Remote MCP foundation — Shinobi becomes a cloud brain reachable from every
52
+ device, and repositions from "memory server" to **task spine + actively-searched
53
+ dead ends + approvals + one brain across laptop, cloud, and mobile**.
54
+
55
+ ### Added
56
+
57
+ - **Remote HTTP `/mcp` endpoint.** Streamable HTTP transport, **stateless**
58
+ (every POST is self-contained, so it runs behind a load balancer / tunnel
59
+ with no sticky sessions), mounted on the existing Hono dashboard server
60
+ behind the same bearer-token auth. `shinobi serve` now exposes dashboard +
61
+ MCP in one process. (#1)
62
+ - **Docker container + GCP Always Free deploy guide.** `docs/deploy-gcp-free.md`
63
+ walks an e2-micro (us-central1) from zero to a running container, including
64
+ the 2 GB swapfile the build needs on 1 GB RAM. DB persistence fixed for
65
+ containers via config-dir override so the SQLite store survives
66
+ `docker rm` / rebuild. (#2)
67
+ - **Env-driven `.mcp.json` pattern for cloud sessions.** Repo `.mcp.json` now
68
+ uses `${SHINOBI_MCP_URL}` / `${SHINOBI_MCP_TOKEN}` placeholders expanded from
69
+ the environment, so claude.ai/code cloud sessions get zero-config remote MCP
70
+ and **tokens never live in the repo**. (#6)
71
+ - **Cloudflare Tunnel setup.** Documented outbound-only exposure (zero open
72
+ ports, free TLS, no static IP) publishing `shinobi.shinobi-apps.com` →
73
+ local `/mcp` + dashboard.
74
+ - **`git` in the Docker image** so `shinobi sync push` (nightly backup to the
75
+ private `shinobi-sync` repo) works inside the container. (#4)
76
+ - **Troubleshooting docs.** curl exit-55 on `sync push` (set
77
+ `http.version HTTP/1.1` + `http.postBuffer`), and a getting-started guide
78
+ with both local and remote onboarding paths. (#5, #8)
79
+
80
+ ### Fixed
81
+
82
+ - **Dashboard re-login after token rotation.** A stale `shinobi_token` cookie
83
+ shadowed a fresh `?token=` query param, so rotating the token locked you out
84
+ until you cleared cookies. The query param now takes precedence. (#3)
85
+
86
+ ### Changed
87
+
88
+ - **Repositioning.** Shinobi is no longer pitched as a local-first "memory
89
+ layer." The wedge is the task spine, decisions that survive across devices,
90
+ and dead ends that are **semantically searched before an agent implements a
91
+ similar approach** — a differentiator no competitor ships. README,
92
+ `package.json`, and roadmap updated to match.
93
+ - **Cloudflare zone min TLS pinned to 1.2.** The Anthropic egress gateway does
94
+ not negotiate TLS 1.3; raising the zone minimum to 1.3 breaks **all** MCP
95
+ calls from cloud sessions (`TLSV1_ALERT_PROTOCOL_VERSION` + 503). Documented
96
+ as a hard runbook rule. (#7)
97
+
98
+ [0.2.0]: https://github.com/numbererikson/shinobi/releases/tag/v0.2.0
99
+
8
100
  ## [0.1.6] — 2026-06-04
9
101
 
10
102
  Dashboard UX: kanban/list naming + clickable subtask cards.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Tomislav Krizan
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tomislav Krizan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -5,30 +5,41 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
  [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)
7
7
 
8
- Your AI coding agent forgets every session. Shinobi is the fix — local SQLite + MCP, decisions stick, dead-ends stay logged, approvals come to your phone.
8
+ The task spine for AI coding agents. Shinobi holds the decisions that survive across sessions, **actively searches your past dead ends — semantically — before the agent writes code**, and routes approvals to your phone. One brain, every device: laptop, cloud session, and mobile all wired to the same store.
9
9
 
10
10
  Works with Claude Code, Cursor, Cline, Continue.dev, Zed — any MCP-compatible client.
11
11
 
12
- > **Status:** v0.1 — feature-complete first release. MCP server with 37 tools, web dashboard, plugin system, cross-machine sync, optional semantic recall.
12
+ > **Status:** v0.2 — remote MCP foundation. Run it as a hosted HTTP `/mcp` brain (the default deploy) or self-host a local instance. 37 MCP tools, web dashboard, mobile approvals, plugin system, optional semantic recall.
13
13
 
14
14
  ## What it does
15
15
 
16
- Shinobi gives your AI coding agent persistent project memory across sessions:
16
+ Most tools try to be a memory bolt-on. Shinobi is the **task spine** your agent
17
+ works *along* — the durable backbone of work, decisions, and known-bad paths
18
+ that outlives any single session and follows you across every device.
17
19
 
18
- - **Projects + subtasks** — track multi-session work as the agent claims, completes, or pivots
19
- - **Decisions** — record architectural choices with rationale so future sessions don't re-litigate them
20
- - **Dead ends** — log approaches that failed; the agent checks here before retrying
21
- - **Notes** — free-form annotations and voice notes (audio_path field)
20
+ - **Task spine** — projects + subtasks the agent claims, completes, or pivots; the persistent skeleton of multi-session work
21
+ - **Decisions that survive** — record architectural choices with rationale so the next session (on any device) doesn't re-litigate them
22
+ - **Dead ends, searched before you build** — every failed approach is logged and **semantically matched the moment an agent plans a similar one**, so it never burns a second session on the same wall. No other tool does this.
23
+ - **Approvals on your phone** — `request_approval` pushes the decision to your pocket; the agent blocks until you tap yes/no, wherever you are
24
+ - **One brain, every device** — laptop editor, Claude Code cloud session, and mobile chat all hit the same store over remote MCP; no sync step, no per-device drift
22
25
  - **Plans** — versioned plan snapshots, retrievable mid-task
23
26
  - **Context** — per-project conventions, "don't touch" rules, test patterns, deploy notes, file annotations
24
27
  - **Recall** — fulltext (FTS5) by default, semantic (embedding-backed) when an embedding provider is configured
28
+ - **Notes** — free-form annotations and voice notes (audio_path field)
25
29
  - **Activity timeline** — every write path lands in the timeline so you can replay what happened
26
30
  - **Git linking** — `link_commit` ties commits to subtasks via `[SHI-N]` tags or via `target_path` attribution
27
- - **Web dashboard** — Hono-served Kanban + decisions + dead ends + notes + plans + context + timeline + analytics on `localhost:8765`
28
- - **Cross-machine sync** — git-based snapshot push/pull, zero cloud infrastructure
31
+ - **Web dashboard** — Hono-served Kanban + decisions + dead ends + notes + plans + context + timeline + analytics
29
32
  - **Plugin system** — drop a `.js` file in `~/.shinobi/plugins/` or install a `@shinobi/plugin-*` npm package and register custom `plugin_*` tools
30
33
 
31
- All local. SQLite. No cloud account required (BYO embedding provider only if you want semantic recall).
34
+ **Hosted or self-hosted, your call.** The default deploy is one remote brain
35
+ behind an HTTP `/mcp` endpoint (we run ours at `shinobi.shinobi-apps.com`); the
36
+ same binary still runs as a fully local single-machine instance when you'd
37
+ rather keep everything on your own box. BYO embedding provider only if you want
38
+ semantic recall.
39
+
40
+ > 🚀 New here? Follow [Getting started](docs/getting-started.md) — zero to a
41
+ > working brain in ten minutes. Going multi-device? [Remote mode](docs/remote-mcp.md)
42
+ > + [$0/month cloud deploy](docs/deploy-gcp-free.md).
32
43
 
33
44
  ## Install
34
45
 
@@ -205,6 +216,24 @@ Avoid the bare `shinobi` command in MCP config — many clients spawn
205
216
  servers with `shell: false`, which skips the OS PATH resolution that
206
217
  makes `shinobi` work in a terminal.
207
218
 
219
+ ### Remote mode (the default deploy)
220
+
221
+ Host one Shinobi brain on a server and connect every device to it — your
222
+ desktop editor, Claude Code web/mobile sessions, any remote-MCP-capable
223
+ client. `shinobi serve` exposes the MCP endpoint at `/mcp` (streamable HTTP,
224
+ **stateless**, bearer-token auth) alongside the dashboard:
225
+
226
+ ```bash
227
+ claude mcp add --transport http shinobi https://your-host/mcp \
228
+ --header "Authorization: Bearer YOUR_TOKEN"
229
+ ```
230
+
231
+ This is the recommended way to run Shinobi — one brain, reachable from every
232
+ device. The same binary still runs as a local single-machine instance if you'd
233
+ rather self-host everything on your own box. Full deployment guide (Docker,
234
+ Cloudflare Tunnel, GCP Always Free, client config):
235
+ [docs/remote-mcp.md](docs/remote-mcp.md).
236
+
208
237
  ## CLI
209
238
 
210
239
  ```
@@ -215,6 +244,7 @@ Commands:
215
244
  mcp Run the MCP server over stdio (invoked by the MCP client)
216
245
  migrate Apply pending SQL migrations
217
246
  dashboard Start the web dashboard on localhost (default port 8765)
247
+ serve [--host H] [--port P] Dashboard + MCP HTTP endpoint (/mcp) in one process — see docs/remote-mcp.md
218
248
  sync init <path> [branch] Configure a local git repo as the cross-machine sync target
219
249
  sync push Snapshot the DB and commit it to the sync repo
220
250
  sync pull Restore the DB from the sync repo's snapshot
@@ -341,13 +371,16 @@ Restart the MCP client and `mcp__shinobi__plugin_count_open` is available. See [
341
371
 
342
372
  ## Roadmap
343
373
 
344
- - **v0.1 (current)** — local MCP + dashboard + plugin system + git sync + relay
345
- + optional embeddings + voice + mobile push + VS Code/Cursor extensions.
346
- - **v0.2** — multi-user team mode (auth + members + mentions UI), vite/dev-deps
347
- upgrade, plugin marketplace UI polish, deeper integrations (Linear /
348
- GitHub Issues sync candidates).
349
- - **v0.3** — hosted SaaS GA + Stripe billing.
350
- - **v1.0** — stability, audit, performance pass.
374
+ - **v0.2 (current)** — remote MCP foundation: stateless HTTP `/mcp` endpoint,
375
+ Docker + GCP Always Free deploy, Cloudflare Tunnel, env-driven `.mcp.json`
376
+ for cloud sessions. One brain across laptop, cloud, and mobile.
377
+ - **v0.3** — push notifications (task-completed / agent-blocked) → dispatch loop
378
+ (headless agent pulls `next_task` and works while you sleep) → Shinobi Swarm
379
+ (N parallel agents, worktree isolation, shared dead ends).
380
+ - **v0.4** — audit→remediation templates (finding list → subtask graph → swarm),
381
+ unit-test coverage pass on `tools/*`.
382
+ - **v1.0** — stability, security audit, performance pass; optional team mode /
383
+ hosted SaaS only on demand signal.
351
384
 
352
385
  ## Changelog
353
386
 
package/dist/cli.js CHANGED
@@ -26,7 +26,7 @@ import { syncInit, syncPull, syncPush, syncStatus } from './commands/sync.js';
26
26
  import { startDashboard } from './dashboard/server.js';
27
27
  import { applyPendingMigrations } from './lib/migrations.js';
28
28
  import { startMcpServer } from './server/mcp.js';
29
- const COMMANDS = ['init', 'mcp', 'dashboard', 'migrate', 'sync', 'cost', 'digest'];
29
+ const COMMANDS = ['init', 'mcp', 'dashboard', 'serve', 'migrate', 'sync', 'cost', 'digest'];
30
30
  function readVersion() {
31
31
  try {
32
32
  const pkgPath = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
@@ -53,6 +53,8 @@ Commands:
53
53
  sync pull Restore the DB from the sync repo's snapshot
54
54
  sync status Show last push/pull timestamps and git status
55
55
  dashboard Start the web dashboard on localhost (default port 8765)
56
+ serve [--host H] [--port P] Start the dashboard + MCP streamable HTTP endpoint (/mcp) in one process
57
+ Non-loopback hosts get token auth automatically (see docs/remote-mcp.md)
56
58
  cost ingest [--since H] Parse Claude Code transcripts under ~/.claude/projects/ and upsert per-session AI token cost (USD)
57
59
  cost ingest --source <dir> Override transcript root (e.g. another machine's mirrored directory)
58
60
  digest [--workspace W] [--telegram] Render weekly Markdown summary → ~/.shinobi/digests/YYYY-WW.md
@@ -142,6 +144,23 @@ async function dispatchDigest(rest) {
142
144
  applyPendingMigrations();
143
145
  await runDigest(options);
144
146
  }
147
+ async function dispatchServe(rest) {
148
+ const options = { mcp: true };
149
+ for (let i = 0; i < rest.length; i++) {
150
+ const v = rest[i];
151
+ if (v === '--host' && rest[i + 1])
152
+ options.host = rest[++i];
153
+ else if (v === '--port' && rest[i + 1])
154
+ options.port = Number(rest[++i]);
155
+ else {
156
+ stderr.write(`serve: unknown option "${v}"\n`);
157
+ exit(1);
158
+ return;
159
+ }
160
+ }
161
+ applyPendingMigrations();
162
+ await startDashboard(options);
163
+ }
145
164
  async function dispatchSync(rest) {
146
165
  const sub = rest[0];
147
166
  if (!sub) {
@@ -207,6 +226,9 @@ async function main() {
207
226
  applyPendingMigrations();
208
227
  await startDashboard();
209
228
  return;
229
+ case 'serve':
230
+ await dispatchServe(rest);
231
+ return;
210
232
  case 'cost':
211
233
  await dispatchCost(rest);
212
234
  return;
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,0EAA0E;AAC1E,wBAAwB;AACxB,IAAI,CAAC;IACH,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,M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kB,CAsB1D;AAiCD,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,qBAAqB,GAAG,iBAAiB,CAqCnF"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/dashboard/auth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAW,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAQvD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,qBAAqB,IAAI,kBAAkB,CAsB1D;AAoCD,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,qBAAqB,GAAG,iBAAiB,CAqCnF"}
@@ -47,13 +47,16 @@ function tokenFromRequest(c) {
47
47
  const headerToken = c.req.header('x-shinobi-token');
48
48
  if (headerToken && headerToken.length > 0)
49
49
  return headerToken;
50
- const cookie = getCookie(c, COOKIE_NAME);
51
- if (cookie && cookie.length > 0)
52
- return cookie;
50
+ // ?token= must win over the cookie: it is an explicit (re-)login attempt.
51
+ // After a token rotation the browser still carries the stale cookie — if
52
+ // the cookie took precedence, the user could never log back in.
53
53
  const url = new URL(c.req.url);
54
54
  const q = url.searchParams.get('token');
55
55
  if (q && q.length > 0)
56
56
  return q;
57
+ const cookie = getCookie(c, COOKIE_NAME);
58
+ if (cookie && cookie.length > 0)
59
+ return cookie;
57
60
  return null;
58
61
  }
59
62
  function safeEqual(a, b) {
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/dashboard/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;AAClE,MAAM,WAAW,GAAG,eAAe,CAAC;AACpC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAExC,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAC9C,CAAC;AAUD,MAAM,UAAU,qBAAqB;IACnC,MAAM,IAAI,GAAG,kBAAkB,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,GAAG,CAAC,yBAAyB,CAAC,CAAC;IAC/C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,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AAC,KAAK,EAAE;gBACpC,IAAI,EAAE,GAAG;gBACT,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,KAAK;gBACf,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;aAC1B,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
@@ -9,8 +9,17 @@ export interface StartDashboardOptions {
9
9
  * and disabled for 127.0.0.1 / localhost / ::1.
10
10
  */
11
11
  auth?: AuthMiddlewareOptions;
12
+ /**
13
+ * Expose the MCP streamable HTTP endpoint at /mcp alongside the dashboard.
14
+ * Defaults to SHINOBI_MCP_HTTP=on|true|1 (off otherwise). The endpoint
15
+ * shares the dashboard auth middleware — remote binds get token auth
16
+ * automatically.
17
+ */
18
+ mcp?: boolean;
12
19
  }
13
- declare function buildApp(auth?: AuthMiddlewareOptions): Hono;
20
+ declare function buildApp(auth?: AuthMiddlewareOptions, opts?: {
21
+ mcp?: boolean;
22
+ }): Hono;
14
23
  export declare function startDashboard(options?: StartDashboardOptions): Promise<ServerType>;
15
24
  export { buildApp };
16
25
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/dashboard/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAM5B,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,WAAW,CAAC;AAiGnB,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B;AAmCD,iBAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAg7BpD;AAED,wBAAsB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,CA0D7F;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/dashboard/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAM5B,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,WAAW,CAAC;AAoGnB,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAmCD,iBAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,qBAAqB,EAAE,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CA67B9E;AAED,wBAAsB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,CAuE7F;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -44,6 +44,9 @@ import { deleteSubscription, listSubscriptions, upsertSubscription, } from '../m
44
44
  import { cancelApproval, getApproval, listApprovals, respondToApproval, } from '../models/approvals.js';
45
45
  import { ensureVapidConfigured, sendPushToAll } from '../services/push/web-push.js';
46
46
  import { broadcastSyncAvailable, getRelayClient } from '../services/relay/client.js';
47
+ import { registerMcpRoutes } from '../server/http.js';
48
+ import { initToolRuntime } from '../server/mcp.js';
49
+ import { authRateLimiter, mcpRateLimiter } from '../lib/rate-limit.js';
47
50
  const STATUS_VALUES = ['todo', 'in_progress', 'done'];
48
51
  const PRIORITY_VALUES = ['low', 'medium', 'high', 'urgent'];
49
52
  const DECISION_STATUS_VALUES = ['open', 'fix_now', 'fix_later', 'wontfix', 'fixed', 'false_positive'];
@@ -76,11 +79,22 @@ function loadSpaIndex() {
76
79
  cachedSpaIndex = readFileSync(SPA_INDEX_PATH, 'utf-8');
77
80
  return cachedSpaIndex;
78
81
  }
79
- function buildApp(auth) {
82
+ function buildApp(auth, opts) {
80
83
  const app = new Hono();
84
+ // Rate limits sit in front of auth: failed token guesses and magic-link
85
+ // spam are cut before any timing-safe comparison or DB write happens.
86
+ const authLimiter = authRateLimiter();
87
+ app.use('/api/auth/magic-link', authLimiter.middleware);
88
+ app.use('/api/auth/verify', authLimiter.middleware);
89
+ if (opts?.mcp) {
90
+ app.use('/mcp', mcpRateLimiter().middleware);
91
+ }
81
92
  if (auth?.enabled) {
82
93
  app.use('*', createAuthMiddleware(auth));
83
94
  }
95
+ if (opts?.mcp) {
96
+ registerMcpRoutes(app);
97
+ }
84
98
  // Track dashboard hits (opt-in, no-op when SHINOBI_TELEMETRY=off).
85
99
  app.use('*', async (c, next) => {
86
100
  await next();
@@ -1018,9 +1032,21 @@ export async function startDashboard(options = {}) {
1018
1032
  const resolved = resolveDashboardToken();
1019
1033
  auth = { enabled: true, token: resolved.token, tokenPath: resolved.path };
1020
1034
  }
1021
- const app = buildApp(auth);
1035
+ const mcpEnv = (process.env['SHINOBI_MCP_HTTP'] ?? '').toLowerCase();
1036
+ const mcp = options.mcp ?? (mcpEnv === 'on' || mcpEnv === 'true' || mcpEnv === '1');
1037
+ if (mcp) {
1038
+ // Tools need migrations + registry + plugins before the first /mcp call.
1039
+ await initToolRuntime();
1040
+ }
1041
+ const app = buildApp(auth, { mcp });
1022
1042
  const server = serve({ fetch: app.fetch, port, hostname: host });
1023
1043
  stdout.write(`shinobi dashboard: listening on http://${host}:${port}\n`);
1044
+ if (mcp) {
1045
+ stdout.write(`shinobi mcp: streamable HTTP endpoint at http://${host}:${port}/mcp\n`);
1046
+ if (!auth.enabled) {
1047
+ stdout.write(`shinobi mcp: auth OFF — do not expose this bind beyond localhost\n`);
1048
+ }
1049
+ }
1024
1050
  if (auth.enabled && auth.token) {
1025
1051
  const reason = isLoopbackHost(host) ? 'forced via env' : 'non-loopback bind';
1026
1052
  stdout.write(`shinobi dashboard: auth ON (${reason})\n`);