@shinobiapps/shinobi 0.1.6 → 0.2.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/CHANGELOG.md +51 -0
- package/LICENSE +21 -21
- package/README.md +50 -17
- package/dist/cli.js +23 -1
- package/dist/cli.js.map +1 -1
- package/dist/dashboard/auth.d.ts.map +1 -1
- package/dist/dashboard/auth.js +6 -3
- package/dist/dashboard/auth.js.map +1 -1
- package/dist/dashboard/server.d.ts +10 -1
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +19 -2
- package/dist/dashboard/server.js.map +1 -1
- package/dist/lib/db.d.ts.map +1 -1
- package/dist/lib/db.js +6 -2
- package/dist/lib/db.js.map +1 -1
- package/dist/server/http.d.ts +17 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +42 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/mcp.d.ts +14 -0
- package/dist/server/mcp.d.ts.map +1 -1
- package/dist/server/mcp.js +19 -1
- package/dist/server/mcp.js.map +1 -1
- package/docs/deploy-gcp-free.md +183 -0
- package/docs/getting-started.md +94 -0
- package/docs/remote-mcp.md +132 -0
- package/migrations/0001_initial_schema.sql +284 -284
- package/migrations/0002_activity_and_links.sql +26 -26
- package/package.json +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,57 @@ 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.0] — 2026-06-12
|
|
9
|
+
|
|
10
|
+
Remote MCP foundation — Shinobi becomes a cloud brain reachable from every
|
|
11
|
+
device, and repositions from "memory server" to **task spine + actively-searched
|
|
12
|
+
dead ends + approvals + one brain across laptop, cloud, and mobile**.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Remote HTTP `/mcp` endpoint.** Streamable HTTP transport, **stateless**
|
|
17
|
+
(every POST is self-contained, so it runs behind a load balancer / tunnel
|
|
18
|
+
with no sticky sessions), mounted on the existing Hono dashboard server
|
|
19
|
+
behind the same bearer-token auth. `shinobi serve` now exposes dashboard +
|
|
20
|
+
MCP in one process. (#1)
|
|
21
|
+
- **Docker container + GCP Always Free deploy guide.** `docs/deploy-gcp-free.md`
|
|
22
|
+
walks an e2-micro (us-central1) from zero to a running container, including
|
|
23
|
+
the 2 GB swapfile the build needs on 1 GB RAM. DB persistence fixed for
|
|
24
|
+
containers via config-dir override so the SQLite store survives
|
|
25
|
+
`docker rm` / rebuild. (#2)
|
|
26
|
+
- **Env-driven `.mcp.json` pattern for cloud sessions.** Repo `.mcp.json` now
|
|
27
|
+
uses `${SHINOBI_MCP_URL}` / `${SHINOBI_MCP_TOKEN}` placeholders expanded from
|
|
28
|
+
the environment, so claude.ai/code cloud sessions get zero-config remote MCP
|
|
29
|
+
and **tokens never live in the repo**. (#6)
|
|
30
|
+
- **Cloudflare Tunnel setup.** Documented outbound-only exposure (zero open
|
|
31
|
+
ports, free TLS, no static IP) publishing `shinobi.shinobi-apps.com` →
|
|
32
|
+
local `/mcp` + dashboard.
|
|
33
|
+
- **`git` in the Docker image** so `shinobi sync push` (nightly backup to the
|
|
34
|
+
private `shinobi-sync` repo) works inside the container. (#4)
|
|
35
|
+
- **Troubleshooting docs.** curl exit-55 on `sync push` (set
|
|
36
|
+
`http.version HTTP/1.1` + `http.postBuffer`), and a getting-started guide
|
|
37
|
+
with both local and remote onboarding paths. (#5, #8)
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- **Dashboard re-login after token rotation.** A stale `shinobi_token` cookie
|
|
42
|
+
shadowed a fresh `?token=` query param, so rotating the token locked you out
|
|
43
|
+
until you cleared cookies. The query param now takes precedence. (#3)
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **Repositioning.** Shinobi is no longer pitched as a local-first "memory
|
|
48
|
+
layer." The wedge is the task spine, decisions that survive across devices,
|
|
49
|
+
and dead ends that are **semantically searched before an agent implements a
|
|
50
|
+
similar approach** — a differentiator no competitor ships. README,
|
|
51
|
+
`package.json`, and roadmap updated to match.
|
|
52
|
+
- **Cloudflare zone min TLS pinned to 1.2.** The Anthropic egress gateway does
|
|
53
|
+
not negotiate TLS 1.3; raising the zone minimum to 1.3 breaks **all** MCP
|
|
54
|
+
calls from cloud sessions (`TLSV1_ALERT_PROTOCOL_VERSION` + 503). Documented
|
|
55
|
+
as a hard runbook rule. (#7)
|
|
56
|
+
|
|
57
|
+
[0.2.0]: https://github.com/numbererikson/shinobi/releases/tag/v0.2.0
|
|
58
|
+
|
|
8
59
|
## [0.1.6] — 2026-06-04
|
|
9
60
|
|
|
10
61
|
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
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
[](https://nodejs.org)
|
|
7
7
|
|
|
8
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
- **
|
|
19
|
-
- **Decisions** — record architectural choices with rationale so
|
|
20
|
-
- **Dead ends** —
|
|
21
|
-
- **
|
|
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
|
|
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
|
-
|
|
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.
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
- **
|
|
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,GAA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
|
+
{"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"}
|
package/dist/dashboard/auth.js
CHANGED
|
@@ -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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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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AAQ,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
|
|
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;
|
|
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;AAmGnB,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,CAo7B9E;AAED,wBAAsB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,CAuE7F;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/dashboard/server.js
CHANGED
|
@@ -44,6 +44,8 @@ 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';
|
|
47
49
|
const STATUS_VALUES = ['todo', 'in_progress', 'done'];
|
|
48
50
|
const PRIORITY_VALUES = ['low', 'medium', 'high', 'urgent'];
|
|
49
51
|
const DECISION_STATUS_VALUES = ['open', 'fix_now', 'fix_later', 'wontfix', 'fixed', 'false_positive'];
|
|
@@ -76,11 +78,14 @@ function loadSpaIndex() {
|
|
|
76
78
|
cachedSpaIndex = readFileSync(SPA_INDEX_PATH, 'utf-8');
|
|
77
79
|
return cachedSpaIndex;
|
|
78
80
|
}
|
|
79
|
-
function buildApp(auth) {
|
|
81
|
+
function buildApp(auth, opts) {
|
|
80
82
|
const app = new Hono();
|
|
81
83
|
if (auth?.enabled) {
|
|
82
84
|
app.use('*', createAuthMiddleware(auth));
|
|
83
85
|
}
|
|
86
|
+
if (opts?.mcp) {
|
|
87
|
+
registerMcpRoutes(app);
|
|
88
|
+
}
|
|
84
89
|
// Track dashboard hits (opt-in, no-op when SHINOBI_TELEMETRY=off).
|
|
85
90
|
app.use('*', async (c, next) => {
|
|
86
91
|
await next();
|
|
@@ -1018,9 +1023,21 @@ export async function startDashboard(options = {}) {
|
|
|
1018
1023
|
const resolved = resolveDashboardToken();
|
|
1019
1024
|
auth = { enabled: true, token: resolved.token, tokenPath: resolved.path };
|
|
1020
1025
|
}
|
|
1021
|
-
const
|
|
1026
|
+
const mcpEnv = (process.env['SHINOBI_MCP_HTTP'] ?? '').toLowerCase();
|
|
1027
|
+
const mcp = options.mcp ?? (mcpEnv === 'on' || mcpEnv === 'true' || mcpEnv === '1');
|
|
1028
|
+
if (mcp) {
|
|
1029
|
+
// Tools need migrations + registry + plugins before the first /mcp call.
|
|
1030
|
+
await initToolRuntime();
|
|
1031
|
+
}
|
|
1032
|
+
const app = buildApp(auth, { mcp });
|
|
1022
1033
|
const server = serve({ fetch: app.fetch, port, hostname: host });
|
|
1023
1034
|
stdout.write(`shinobi dashboard: listening on http://${host}:${port}\n`);
|
|
1035
|
+
if (mcp) {
|
|
1036
|
+
stdout.write(`shinobi mcp: streamable HTTP endpoint at http://${host}:${port}/mcp\n`);
|
|
1037
|
+
if (!auth.enabled) {
|
|
1038
|
+
stdout.write(`shinobi mcp: auth OFF — do not expose this bind beyond localhost\n`);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1024
1041
|
if (auth.enabled && auth.token) {
|
|
1025
1042
|
const reason = isLoopbackHost(host) ? 'forced via env' : 'non-loopback bind';
|
|
1026
1043
|
stdout.write(`shinobi dashboard: auth ON (${reason})\n`);
|