Completes Fase 9's "consolidar MCP" half: the daemon now serves its own MCP endpoint at /mcp, exposing every semantic-routes operation as an MCP tool against the daemon's authoritative graph, and the old Electron-local MCP server is retired since it's now redundant. New: src/main/frontend/worker/mcp_server.cljs The CF-Worker's own MCP endpoint (deps/db-sync/worker/entry.mjs) generates its tools from the OpenAPI document via @cloudflare/codemode's openApiMcpServer, a package that only exists inside Cloudflare Workers, plus a pile of ChatGPT-App-specific tooling (asset image resources, upload_asset, Cognito protected-resource metadata) this daemon has no use for -- none of that ports to Node. So this registers one tool per operation by hand instead, using @modelcontextprotocol/sdk directly, the same pattern electron/mcp_server.cljs already used for its own 6 tools (registerTool with an explicit title/description/inputSchema/handler) -- just generated from semantic-routes' operation table and operation-docs (now public) instead of writing 35 one-off registrations by hand, so the MCP tool surface can't drift from the HTTP routes or the OpenAPI document. Each tool's Zod input shape is assembled from path params (auto-derived from the route's :param segments) plus a per-operation-id map of the extra query/body fields; a handful of shared fragments (pagination, time filters, the recursive block-tree shape, property-value/task-status selectors) cover the repetition across list/create/update operations. Each tool's handler makes a loopback HTTP call to this same daemon's own /v1/semantic/* route, forwarding the /mcp request's own Authorization header -- reusing the already-tested HTTP-layer logic (repo-error validation, lock-owner assertion, response shaping) instead of a second request path directly against the thread-api. Session/transport plumbing (handle-post/get/delete-request, the transports-by-session-id map) is adapted from electron/mcp_server.cljs's Fastify-based version: that one gets req/res already unwrapped-to-Node-primitives via `.raw` with the body pre-parsed by Fastify; this one is called straight from the daemon's own raw http.createServer callback, so req/res already are what StreamableHTTPServerTransport wants, and the body needs parsing here instead. No separate auth check either -- the daemon's existing bearer-token check on every route (request-authorized? in db_worker_node.cljs) already gates /mcp before this is reached. Wires POST/GET/DELETE /mcp into db_worker_node.cljs's make-server cond chain, alongside the existing /v1/semantic/* branch. Dependencies: adds @modelcontextprotocol/sdk and zod (zod/v3 -- the SDK doesn't work with zod 4's default export, same constraint electron/mcp_server.cljs already worked around) to the root package.json; previously only resources/package.json (Electron's own bundle) had them. Retired: electron/mcp_server.cljs and its wiring (electron/server.cljs's initialize-mcp-routes, its 3 POST/GET/DELETE /mcp route registrations, the :mcp-enabled? config field; components/server.cljs's "copy MCP URL" popup link; components/settings.cljs's entire AI settings tab, which had nothing in it besides the MCP-server toggle). Electron already talks to the daemon (Fase 3) rather than driving itself locally, so a second, separately-configured MCP surface bolted onto Electron's own local automation API server (which otherwise stays -- /api is a distinct, still-used concern) was redundant with the daemon's new one. Removed the 4 associated i18n keys (server/mcp-url-copied, settings/ai, settings.ai/enable-mcp-server[-desc]) from all ~26 locale dicts. New: src/test/frontend/worker/mcp_server_test.cljs Connects a real @modelcontextprotocol/sdk client over HTTP to a live daemon's /mcp endpoint: lists all registered tools, round-trips createPage/getPage and a recursive captureToToday block tree, and checks a tool call against a nonexistent page surfaces as MCP error content rather than throwing. 4 tests, 11 assertions. Verification: all 5 shadow-cljs targets compile with 0 warnings. Full `bb dev:test` run: the only failures are the same 7 pre-existing, sandboxed-network-related persist_db_test.cljs failures already documented in the Fase 8 and Fase 9 (1/N) commits -- identical test names, identical ECONNREFUSED/Invalid URL errors. Every other shard, including all three daemon-HTTP worker test files sharing one test.js process (db_worker_node_test.cljs, semantic_test.cljs, mcp_server_test.cljs), passes clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
227 lines
10 KiB
JSON
227 lines
10 KiB
JSON
{
|
|
"name": "logseq",
|
|
"version": "0.0.1",
|
|
"private": true,
|
|
"packageManager": "pnpm@10.33.0",
|
|
"main": "static/electron.js",
|
|
"bin": {
|
|
"logseq": "dist/logseq.js"
|
|
},
|
|
"files": [
|
|
"dist/",
|
|
"static/logseq-cli.js",
|
|
".agents/skills/logseq-cli/SKILL.md"
|
|
],
|
|
"engines": {
|
|
"node": ">=22.20.0"
|
|
},
|
|
"devDependencies": {
|
|
"@capacitor/assets": "^3.0.5",
|
|
"@capacitor/cli": "^8.3.1",
|
|
"@jcesarmobile/ssl-skip": "^0.9.0",
|
|
"@playwright/test": "^1.58.2",
|
|
"@tailwindcss/aspect-ratio": "0.4.2",
|
|
"@tailwindcss/forms": "0.5.11",
|
|
"@tailwindcss/postcss": "4.3.0",
|
|
"@tailwindcss/typography": "0.5.19",
|
|
"autoprefixer": "^10.5.0",
|
|
"better-sqlite3": "^12.9.0",
|
|
"cross-env": "^10.1.0",
|
|
"cssnano": "^7.1.8",
|
|
"gulp": "^5.0.1",
|
|
"gulp-postcss": "^10.0.0",
|
|
"npm-run-all2": "^8.0.4",
|
|
"playwright": "^1.58.2",
|
|
"postcss": "^8.5.13",
|
|
"postcss-cli": "11.0.1",
|
|
"postcss-import": "16.1.1",
|
|
"postcss-import-ext-glob": "2.1.1",
|
|
"postcss-nested": "7.0.2",
|
|
"process": "^0.11.10",
|
|
"semver": "7.7.4",
|
|
"shadow-cljs": "^3.4.6",
|
|
"source-map-loader": "^5.0.0",
|
|
"stylelint": "^13.13.1",
|
|
"stylelint-config-standard": "^20.0.0",
|
|
"tailwindcss": "4.3.0",
|
|
"tailwindcss-animate": "^1.0.7",
|
|
"typescript": "^5.9.3",
|
|
"vite": "^8.0.10",
|
|
"webpack": "^5.106.2",
|
|
"webpack-cli": "^7.0.2",
|
|
"ws": "^8.20.0"
|
|
},
|
|
"scripts": {
|
|
"watch": "run-p gulp:watch cljs:watch webpack-app-watch",
|
|
"electron-watch": "run-p gulp:watch cljs:electron-watch webpack-app-watch",
|
|
"app-watch": "run-p gulp:watch cljs:app-watch webpack-app-watch",
|
|
"mobile-watch": "run-p gulp:mobile-watch cljs:mobile-watch webpack-mobile-watch",
|
|
"dev": "run-p gulp:watch gulp:mobile-watch cljs:dev-watch webpack-watch",
|
|
"release": "run-s gulp:build cljs:release webpack-app-build",
|
|
"release-app": "run-s gulp:build cljs:release-app webpack-app-build",
|
|
"release-mobile": "run-s gulp:buildMobile cljs:release-mobile webpack-mobile-build",
|
|
"dev-release-app": "run-s gulp:build cljs:dev-release-app webpack-app-build",
|
|
"dev-electron-app": "gulp electron",
|
|
"release-electron": "run-s gulp:build && gulp electronMaker",
|
|
"release-electron:unsigned": "run-s gulp:build && gulp electronMakerUnsigned",
|
|
"debug-electron": "cd static/ && pnpm electron:debug",
|
|
"webpack-watch": "webpack --watch",
|
|
"webpack-app-watch": "pnpm exec webpack --watch --config-name app",
|
|
"webpack-mobile-watch": "pnpm exec webpack --watch --config-name mobile",
|
|
"webpack-app-build": "pnpm exec webpack build --mode production --config-name app",
|
|
"webpack-mobile-build": "pnpm exec webpack build --mode production --config-name mobile",
|
|
"sync-android-release": "pnpm clean && pnpm release-mobile && rm -rf ./static/mobile/**/*.map && pnpm exec cap sync android",
|
|
"sync-ios-release": "pnpm clean && pnpm release-mobile && rm -rf ./static/mobile/**/*.map && pnpm exec cap sync ios && pnpm test:ios-web-fonts",
|
|
"clean": "gulp clean",
|
|
"test": "run-s cljs:test cljs:run-test",
|
|
"test:ios-web-fonts": "node ./scripts/check-ios-web-fonts.mjs",
|
|
"test:node-adapter": "pnpm --dir deps/db-sync run test:node-adapter",
|
|
"report": "run-s cljs:report",
|
|
"style:lint": "stylelint \"src/**/*.css\"",
|
|
"gulp:watch": "gulp watch",
|
|
"gulp:build": "cross-env NODE_ENV=production gulp build",
|
|
"gulp:buildMobile": "cross-env NODE_ENV=production gulp buildMobile",
|
|
"css:build": "postcss tailwind.all.css -o static/css/style.css --verbose --env production",
|
|
"css:watch": "cross-env TAILWIND_MODE=watch postcss tailwind.all.css -o static/css/style.css --verbose --watch",
|
|
"cljs:watch": "clojure -M:cljs watch app db-worker db-worker-node electron",
|
|
"gulp:mobile-watch": "gulp watchMobile",
|
|
"css:mobile-build": "postcss tailwind.mobile.css -o static/mobile/css/style.css --verbose --env production",
|
|
"css:mobile-watch": "cross-env TAILWIND_MODE=watch postcss tailwind.mobile.css -o static/mobile/css/style.css --verbose --watch",
|
|
"cljs:mobile-watch": "clojure -M:cljs watch mobile db-worker db-worker-node --config-merge \"{:output-dir \\\"./static/mobile/js\\\" :asset-path \\\"/static/mobile/js\\\" :release {:asset-path \\\"http://localhost\\\"}}\"",
|
|
"cljs:release-mobile": "clojure -M:cljs release mobile db-worker db-worker-node --config-merge \"{:output-dir \\\"./static/mobile/js\\\" :asset-path \\\"/static/mobile/js\\\" :release {:asset-path \\\"http://localhost\\\"}}\"",
|
|
"cljs:dev-watch": "clojure -M:cljs watch app db-worker db-worker-node electron mobile",
|
|
"cljs:app-watch": "clojure -J-Xmx1536m -J-XX:ActiveProcessorCount=4 -M:cljs watch app db-worker",
|
|
"cljs:electron-watch": "clojure -M:cljs watch app db-worker db-worker-node electron test --config-merge \"{:asset-path \\\"./js\\\"}\"",
|
|
"cljs:release": "clojure -M:cljs release app db-worker db-worker-node publishing electron",
|
|
"cljs:release-electron": "clojure -M:cljs release app db-worker db-worker-node electron publishing",
|
|
"cljs:release-app": "clojure -M:cljs release app db-worker db-worker-node",
|
|
"cljs:release-publishing": "clojure -M:cljs release app publishing",
|
|
"cljs:test": "clojure -M:test compile test",
|
|
"cljs:run-test": "cross-env LOGSEQ_STABLE_IDENTS=1 bb dev:run-test-namespaces -r \"^(?!logseq.db-sync.).*\" -e fix-me",
|
|
"cljs:test-no-worker": "clojure -M:test compile test-no-worker",
|
|
"cljs:run-test-no-worker": "node static/tests-no-worker.js",
|
|
"db-worker-node:compile": "clojure -M:cljs compile db-worker-node",
|
|
"db-worker-node:release": "clojure -M:cljs release db-worker-node",
|
|
"db-worker-node:bundle": "node ./scripts/build-db-worker-node-bundle.mjs",
|
|
"db-worker-node:release:bundle": "run-s db-worker-node:release db-worker-node:bundle",
|
|
"db-worker-node:compile:bundle": "run-s db-worker-node:compile db-worker-node:bundle",
|
|
"cli:release": "pnpm --dir cli bundle && node ./scripts/stage-cli-runtime.mjs",
|
|
"desktop:prepare-runtime-js": "node ./scripts/prepare-desktop-runtime-js.mjs",
|
|
"cli:e2e": "bb dev:cli-e2e",
|
|
"cli:e2e:skip-build": "bb dev:cli-e2e --skip-build",
|
|
"cljs:dev-release-app": "clojure -M:cljs release app db-worker db-worker-node --config-merge \"{:closure-defines {frontend.config/DEV-RELEASE true}}\"",
|
|
"cljs:dev-release-electron": "clojure -M:cljs release app db-worker db-worker-node electron --debug --config-merge \"{:closure-defines {frontend.config/DEV-RELEASE true}}\" && clojure -M:cljs release publishing",
|
|
"cljs:debug": "clojure -M:cljs release app db-worker db-worker-node --debug",
|
|
"cljs:report": "clojure -M:cljs run shadow.cljs.build-report app db-worker db-worker-node report.html",
|
|
"cljs:build-electron": "clojure -A:cljs compile app db-worker db-worker-node electron",
|
|
"cljs:lint": "clojure -M:clj-kondo --parallel --lint src --cache false",
|
|
"ios:dev": "cross-env PLATFORM=ios gulp cap",
|
|
"android:dev": "cross-env PLATFORM=android gulp cap"
|
|
},
|
|
"dependencies": {
|
|
"@aparajita/capacitor-secure-storage": "^8.0.0",
|
|
"@base-ui/react": "^1.5.0",
|
|
"@capacitor-community/safe-area": "8.0.1",
|
|
"@capacitor/action-sheet": "^8.1.1",
|
|
"@capacitor/android": "^8.3.1",
|
|
"@capacitor/app": "^8.1.0",
|
|
"@capacitor/camera": "^8.2.0",
|
|
"@capacitor/clipboard": "^8.0.1",
|
|
"@capacitor/core": "^8.3.1",
|
|
"@capacitor/device": "^8.0.2",
|
|
"@capacitor/dialog": "^8.0.1",
|
|
"@capacitor/filesystem": "^8.1.2",
|
|
"@capacitor/haptics": "^8.0.2",
|
|
"@capacitor/ios": "^8.3.1",
|
|
"@capacitor/keyboard": "^8.0.3",
|
|
"@capacitor/network": "^8.0.1",
|
|
"@capacitor/share": "^8.0.1",
|
|
"@capacitor/splash-screen": "^8.0.1",
|
|
"@capacitor/status-bar": "^8.0.2",
|
|
"@capgo/capacitor-navigation-bar": "^8.1.5",
|
|
"@dnd-kit/core": "^6.3.1",
|
|
"@dnd-kit/sortable": "^10.0.0",
|
|
"@emoji-mart/data": "^1.2.1",
|
|
"@glidejs/glide": "^3.7.1",
|
|
"@highlightjs/cdn-assets": "11.11.1",
|
|
"@hookform/resolvers": "^5.2.2",
|
|
"@isomorphic-git/lightning-fs": "^4.6.2",
|
|
"@js-joda/core": "3.2.0",
|
|
"@js-joda/locale_en-us": "3.1.1",
|
|
"@js-joda/timezone": "2.5.0",
|
|
"@logseq/react-tweet-embed": "1.3.1-1",
|
|
"@logseq/simple-wave-record": "^0.0.3",
|
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
"@sentry/react": "^10.51.0",
|
|
"@sqlite.org/sqlite-wasm": "3.51.2-build9",
|
|
"@tabler/icons-react": "3.44.0",
|
|
"aws-amplify": "^6.16.3",
|
|
"bignumber.js": "^9.3.1",
|
|
"buffer": "^6.0.3",
|
|
"chrono-node": "2.9.0",
|
|
"codemirror": "5.65.18",
|
|
"comlink": "^4.4.2",
|
|
"d3-force": "3.0.0",
|
|
"dompurify": "^3.4.2",
|
|
"emoji-mart": "^5.6.0",
|
|
"fs": "0.0.1-security",
|
|
"fs-extra": "^11.3.4",
|
|
"graphology": "0.20.0",
|
|
"html2canvas": "^1.4.1",
|
|
"inter-ui": "^4.1.1",
|
|
"interactjs": "^1.10.27",
|
|
"jszip": "3.10.1",
|
|
"katex": "^0.16.45",
|
|
"keytar": "^7.9.0",
|
|
"marked": "^17.0.6",
|
|
"mldoc": "^1.5.9",
|
|
"path": "0.12.7",
|
|
"path-complete-extname": "1.0.0",
|
|
"pdfjs-dist": "4.2.67",
|
|
"photoswipe": "^5.4.4",
|
|
"picocolors": "1.1.1",
|
|
"pixi.js": "^8.18.1",
|
|
"posthog-js": "1.10.0",
|
|
"prop-types": "^15.8.1",
|
|
"react": "19.2.6",
|
|
"react-day-picker": "^9.0.9",
|
|
"react-dom": "19.2.6",
|
|
"react-hook-form": "^7.71.2",
|
|
"react-intersection-observer": "^10.0.3",
|
|
"react-textarea-autosize": "8.5.9",
|
|
"react-transition-group": "4.4.5",
|
|
"react-virtuoso": "4.18.3",
|
|
"remove-accents": "0.5.0",
|
|
"sanitize-filename": "1.6.4",
|
|
"send-intent": "^7.0.0",
|
|
"string-width": "8.2.0",
|
|
"tiny-pinyin": "1.3.2",
|
|
"uniqolor": "1.1.1",
|
|
"url": "^0.11.4",
|
|
"util": "^0.12.5",
|
|
"yup": "^1.7.1",
|
|
"zod": "^4.3.6"
|
|
},
|
|
"optionalDependencies": {
|
|
"@zvec/bindings-darwin-arm64": "0.5.0",
|
|
"@zvec/bindings-linux-arm64": "0.5.0",
|
|
"@zvec/bindings-linux-x64": "0.5.0",
|
|
"@zvec/bindings-win32-x64": "0.5.0",
|
|
"@zvec/zvec": "0.5.0"
|
|
},
|
|
"pnpm": {
|
|
"ignoredBuiltDependencies": [
|
|
"canvas",
|
|
"core-js",
|
|
"protobufjs",
|
|
"sharp"
|
|
],
|
|
"onlyBuiltDependencies": [
|
|
"@zvec/zvec",
|
|
"better-sqlite3",
|
|
"electron",
|
|
"keytar"
|
|
]
|
|
}
|
|
}
|