memory-journal-mcp 6.1.2 → 6.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.
- package/README.md +44 -28
- package/dist/{chunk-X4SWFATC.js → chunk-BI4ZNSKA.js} +38 -24
- package/dist/{chunk-HCEWINSB.js → chunk-N6EBIDN7.js} +99 -102
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/dist/tools-WPRY5MJ6.js +2 -0
- package/package.json +10 -1
- package/skills/github-commander/SKILL.md +151 -0
- package/skills/github-commander/config/project-config.example.md +125 -0
- package/skills/github-commander/workflows/code-quality-audit.md +80 -0
- package/skills/github-commander/workflows/full-audit.md +134 -0
- package/skills/github-commander/workflows/issue-triage.md +239 -0
- package/skills/github-commander/workflows/milestone-sprint.md +81 -0
- package/skills/github-commander/workflows/perf-audit.md +142 -0
- package/skills/github-commander/workflows/pr-review.md +123 -0
- package/skills/github-commander/workflows/security-audit.md +170 -0
- package/skills/github-commander/workflows/update-deps.md +109 -0
- package/.dockerignore +0 -139
- package/.gitattributes +0 -20
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -95
- package/.github/ISSUE_TEMPLATE/config.yml +0 -11
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -110
- package/.github/ISSUE_TEMPLATE/question.md +0 -78
- package/.github/aw/actions-lock.json +0 -14
- package/.github/copilot-instructions.md +0 -122
- package/.github/dependabot.yml +0 -93
- package/.github/pull_request_template.md +0 -135
- package/.github/workflows/README.md +0 -133
- package/.github/workflows/agentics-maintenance.yml +0 -141
- package/.github/workflows/auto-release.yml +0 -68
- package/.github/workflows/ci-health-monitor.lock.yml +0 -1121
- package/.github/workflows/ci-health-monitor.md +0 -87
- package/.github/workflows/codeql.yml +0 -41
- package/.github/workflows/dependabot-auto-merge.yml +0 -42
- package/.github/workflows/dependency-maintenance.lock.yml +0 -1182
- package/.github/workflows/dependency-maintenance.md +0 -147
- package/.github/workflows/docker-publish.yml +0 -254
- package/.github/workflows/docs-drift-detector.lock.yml +0 -1142
- package/.github/workflows/docs-drift-detector.md +0 -115
- package/.github/workflows/lint-and-test.yml +0 -60
- package/.github/workflows/publish-npm.yml +0 -85
- package/.github/workflows/secrets-scanning.yml +0 -32
- package/.github/workflows/security-update.yml +0 -127
- package/.gitleaks.toml +0 -9
- package/.prettierignore +0 -21
- package/.prettierrc +0 -33
- package/.scout-ignore +0 -12
- package/.trivyignore +0 -21
- package/CHANGELOG.md +0 -1814
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -263
- package/DOCKER_README.md +0 -331
- package/Dockerfile +0 -128
- package/SECURITY.md +0 -227
- package/UNRELEASED.md +0 -1
- package/dist/tools-T4U5A3X4.js +0 -2
- package/docker-compose.yml +0 -71
- package/docs/README.md +0 -18
- package/docs/agentic-journal-synergy.md +0 -175
- package/docs/copilot-setup.md +0 -72
- package/eslint.config.js +0 -110
- package/mcp-config-example.json +0 -21
- package/playwright.config.ts +0 -35
- package/releases/v2.1.0.md +0 -220
- package/releases/v2.2.0.md +0 -168
- package/releases/v3.0.0.md +0 -237
- package/releases/v3.1.0.md +0 -104
- package/releases/v3.1.1.md +0 -42
- package/releases/v3.1.2.md +0 -40
- package/releases/v3.1.3.md +0 -64
- package/releases/v3.1.4.md +0 -32
- package/releases/v3.1.5.md +0 -44
- package/releases/v4.0.0.md +0 -71
- package/releases/v4.1.0.md +0 -88
- package/releases/v4.2.0.md +0 -90
- package/releases/v4.3.0.md +0 -92
- package/releases/v4.3.1.md +0 -69
- package/releases/v4.4.0.md +0 -120
- package/releases/v4.4.1.md +0 -33
- package/releases/v4.4.2.md +0 -31
- package/releases/v4.5.0.md +0 -116
- package/releases/v5.0.0.md +0 -105
- package/releases/v5.0.1.md +0 -25
- package/releases/v5.1.0.md +0 -83
- package/releases/v5.1.1.md +0 -10
- package/releases/v6.0.0.md +0 -48
- package/releases/v6.0.1.md +0 -36
- package/releases/v6.1.0.md +0 -68
- package/releases/v6.1.1.md +0 -30
- package/releases/v6.1.2.md +0 -23
- package/scripts/generate-server-instructions.ts +0 -306
- package/scripts/server-instructions-function-body.ts +0 -107
- package/scripts/server-instructions-gotchas.ts +0 -45
- package/server.json +0 -42
- package/social-preview.png +0 -0
- package/src/auth/auth-context.ts +0 -78
- package/src/auth/authorization-server-discovery.ts +0 -263
- package/src/auth/errors.ts +0 -215
- package/src/auth/index.ts +0 -58
- package/src/auth/middleware.ts +0 -392
- package/src/auth/oauth-resource-server.ts +0 -170
- package/src/auth/scope-map.ts +0 -46
- package/src/auth/scopes.ts +0 -256
- package/src/auth/token-validator.ts +0 -293
- package/src/auth/transport-agnostic.ts +0 -164
- package/src/auth/types.ts +0 -372
- package/src/cli.ts +0 -279
- package/src/codemode/api-constants.ts +0 -263
- package/src/codemode/api.ts +0 -302
- package/src/codemode/auto-return.ts +0 -65
- package/src/codemode/index.ts +0 -47
- package/src/codemode/sandbox-factory.ts +0 -144
- package/src/codemode/sandbox.ts +0 -220
- package/src/codemode/security.ts +0 -155
- package/src/codemode/types.ts +0 -228
- package/src/codemode/worker-sandbox.ts +0 -277
- package/src/codemode/worker-script.ts +0 -239
- package/src/constants/icons.ts +0 -183
- package/src/constants/server-instructions.md +0 -166
- package/src/constants/server-instructions.ts +0 -514
- package/src/database/adapter-factory.ts +0 -16
- package/src/database/core/entry-columns.ts +0 -10
- package/src/database/core/interfaces.ts +0 -188
- package/src/database/core/schema.ts +0 -152
- package/src/database/sqlite-adapter/backup.ts +0 -167
- package/src/database/sqlite-adapter/entries/crud.ts +0 -233
- package/src/database/sqlite-adapter/entries/importance.ts +0 -76
- package/src/database/sqlite-adapter/entries/index.ts +0 -142
- package/src/database/sqlite-adapter/entries/search.ts +0 -294
- package/src/database/sqlite-adapter/entries/shared.ts +0 -102
- package/src/database/sqlite-adapter/entries/statistics.ts +0 -162
- package/src/database/sqlite-adapter/index.ts +0 -265
- package/src/database/sqlite-adapter/native-connection.ts +0 -301
- package/src/database/sqlite-adapter/relationships.ts +0 -70
- package/src/database/sqlite-adapter/tags.ts +0 -182
- package/src/filtering/tool-filter.ts +0 -312
- package/src/github/github-integration/client.ts +0 -114
- package/src/github/github-integration/index.ts +0 -297
- package/src/github/github-integration/insights.ts +0 -155
- package/src/github/github-integration/issues.ts +0 -213
- package/src/github/github-integration/milestones.ts +0 -262
- package/src/github/github-integration/projects.ts +0 -414
- package/src/github/github-integration/pull-requests.ts +0 -235
- package/src/github/github-integration/repository.ts +0 -110
- package/src/github/github-integration/types.ts +0 -43
- package/src/handlers/prompts/github.ts +0 -210
- package/src/handlers/prompts/index.ts +0 -97
- package/src/handlers/prompts/workflow.ts +0 -361
- package/src/handlers/resources/core/briefing/context-section.ts +0 -182
- package/src/handlers/resources/core/briefing/github-section.ts +0 -354
- package/src/handlers/resources/core/briefing/index.ts +0 -106
- package/src/handlers/resources/core/briefing/user-message.ts +0 -114
- package/src/handlers/resources/core/health.ts +0 -75
- package/src/handlers/resources/core/index.ts +0 -31
- package/src/handlers/resources/core/instructions.ts +0 -45
- package/src/handlers/resources/core/utilities.ts +0 -310
- package/src/handlers/resources/github.ts +0 -340
- package/src/handlers/resources/graph.ts +0 -218
- package/src/handlers/resources/help.ts +0 -410
- package/src/handlers/resources/index.ts +0 -143
- package/src/handlers/resources/shared.ts +0 -219
- package/src/handlers/resources/team.ts +0 -134
- package/src/handlers/resources/templates.ts +0 -334
- package/src/handlers/tools/admin.ts +0 -351
- package/src/handlers/tools/analytics.ts +0 -346
- package/src/handlers/tools/backup.ts +0 -272
- package/src/handlers/tools/codemode.ts +0 -188
- package/src/handlers/tools/core.ts +0 -359
- package/src/handlers/tools/error-fields-mixin.ts +0 -10
- package/src/handlers/tools/export.ts +0 -150
- package/src/handlers/tools/github/copilot-tools.ts +0 -72
- package/src/handlers/tools/github/helpers.ts +0 -125
- package/src/handlers/tools/github/insights-tools.ts +0 -112
- package/src/handlers/tools/github/issue-tools.ts +0 -442
- package/src/handlers/tools/github/kanban-tools.ts +0 -153
- package/src/handlers/tools/github/milestone-tools.ts +0 -371
- package/src/handlers/tools/github/mutation-tools.ts +0 -17
- package/src/handlers/tools/github/read-tools.ts +0 -302
- package/src/handlers/tools/github/schemas.ts +0 -435
- package/src/handlers/tools/github.ts +0 -39
- package/src/handlers/tools/index.ts +0 -255
- package/src/handlers/tools/relationships.ts +0 -390
- package/src/handlers/tools/schemas.ts +0 -165
- package/src/handlers/tools/search.ts +0 -448
- package/src/handlers/tools/team/admin-tools.ts +0 -164
- package/src/handlers/tools/team/analytics-tools.ts +0 -233
- package/src/handlers/tools/team/backup-tools.ts +0 -83
- package/src/handlers/tools/team/core-tools.ts +0 -197
- package/src/handlers/tools/team/export-tools.ts +0 -130
- package/src/handlers/tools/team/helpers.ts +0 -66
- package/src/handlers/tools/team/index.ts +0 -45
- package/src/handlers/tools/team/relationship-tools.ts +0 -219
- package/src/handlers/tools/team/schemas.ts +0 -558
- package/src/handlers/tools/team/search-tools.ts +0 -145
- package/src/handlers/tools/team/vector-tools.ts +0 -261
- package/src/index.ts +0 -57
- package/src/server/mcp-server.ts +0 -446
- package/src/server/registration.ts +0 -141
- package/src/server/scheduler.ts +0 -283
- package/src/transports/http/handlers.ts +0 -78
- package/src/transports/http/index.ts +0 -8
- package/src/transports/http/security.ts +0 -147
- package/src/transports/http/server/index.ts +0 -397
- package/src/transports/http/server/legacy-sse.ts +0 -87
- package/src/transports/http/server/stateful.ts +0 -222
- package/src/transports/http/server/stateless.ts +0 -42
- package/src/transports/http/types.ts +0 -132
- package/src/types/entities.ts +0 -145
- package/src/types/error-types.ts +0 -92
- package/src/types/errors.ts +0 -200
- package/src/types/filtering.ts +0 -55
- package/src/types/github.ts +0 -216
- package/src/types/index.ts +0 -348
- package/src/utils/error-helpers.ts +0 -78
- package/src/utils/errors/error-response-fields.ts +0 -29
- package/src/utils/errors/suggestions.ts +0 -94
- package/src/utils/github-helpers.ts +0 -33
- package/src/utils/logger.ts +0 -107
- package/src/utils/mcp-logger.ts +0 -155
- package/src/utils/progress-utils.ts +0 -100
- package/src/utils/query-helpers.ts +0 -78
- package/src/utils/resource-annotations.ts +0 -75
- package/src/utils/security-utils.ts +0 -198
- package/src/utils/vector-index-helpers.ts +0 -24
- package/src/vector/vector-search-manager.ts +0 -409
- package/src/version.ts +0 -15
- package/test-server/README.md +0 -193
- package/test-server/code-map.md +0 -399
- package/test-server/test-agent-experience.md +0 -213
- package/test-server/test-filter-instructions.mjs +0 -295
- package/test-server/test-instruction-levels.mjs +0 -102
- package/test-server/test-preflight.md +0 -55
- package/test-server/test-prompts.mjs +0 -185
- package/test-server/test-scheduler.mjs +0 -174
- package/test-server/test-tool-annotations.mjs +0 -115
- package/test-server/test-tools-codemode.md +0 -632
- package/test-server/test-tools-codemode2.md +0 -1218
- package/test-server/test-tools-team.md +0 -215
- package/test-server/test-tools.md +0 -429
- package/test-server/test-tools2.md +0 -361
- package/test-server/test-tools3.md +0 -396
- package/test-server/tool-reference.md +0 -231
- package/tests/README.md +0 -54
- package/tests/auth/auth-context.test.ts +0 -162
- package/tests/auth/authorization-server-discovery.test.ts +0 -265
- package/tests/auth/errors.test.ts +0 -170
- package/tests/auth/middleware.test.ts +0 -585
- package/tests/auth/oauth-resource-server.test.ts +0 -173
- package/tests/auth/scope-map.test.ts +0 -66
- package/tests/auth/scopes.test.ts +0 -347
- package/tests/auth/token-validator.test.ts +0 -271
- package/tests/codemode/api.test.ts +0 -396
- package/tests/codemode/auto-return.test.ts +0 -167
- package/tests/codemode/codemode-tool-handlers.test.ts +0 -197
- package/tests/codemode/sandbox-factory.test.ts +0 -152
- package/tests/codemode/sandbox.test.ts +0 -190
- package/tests/codemode/security.test.ts +0 -242
- package/tests/codemode/worker-sandbox.test.ts +0 -106
- package/tests/constants/icons.test.ts +0 -101
- package/tests/constants/server-instructions.test.ts +0 -514
- package/tests/database/crud-workflow-branches.test.ts +0 -418
- package/tests/database/database-branches.test.ts +0 -132
- package/tests/database/entries-auth-branches.test.ts +0 -390
- package/tests/database/native-connection.test.ts +0 -249
- package/tests/database/shared-helpers.test.ts +0 -103
- package/tests/database/sqlite-adapter.bench.ts +0 -63
- package/tests/database/sqlite-adapter.test.ts +0 -690
- package/tests/database/tags.test.ts +0 -134
- package/tests/e2e/README.md +0 -39
- package/tests/e2e/auth.spec.ts +0 -106
- package/tests/e2e/codemode-abuse.spec.ts +0 -75
- package/tests/e2e/health.spec.ts +0 -63
- package/tests/e2e/helpers.ts +0 -139
- package/tests/e2e/oauth-discovery.spec.ts +0 -102
- package/tests/e2e/oauth-scopes.spec.ts +0 -222
- package/tests/e2e/payloads-admin.spec.ts +0 -76
- package/tests/e2e/payloads-analytics.spec.ts +0 -37
- package/tests/e2e/payloads-backup-restore.spec.ts +0 -102
- package/tests/e2e/payloads-backup.spec.ts +0 -44
- package/tests/e2e/payloads-codemode-api.spec.ts +0 -131
- package/tests/e2e/payloads-codemode-readonly.spec.ts +0 -116
- package/tests/e2e/payloads-codemode.spec.ts +0 -116
- package/tests/e2e/payloads-core.spec.ts +0 -82
- package/tests/e2e/payloads-error-contracts.spec.ts +0 -159
- package/tests/e2e/payloads-export.spec.ts +0 -46
- package/tests/e2e/payloads-github-degradation.spec.ts +0 -73
- package/tests/e2e/payloads-github.spec.ts +0 -176
- package/tests/e2e/payloads-relationships.spec.ts +0 -56
- package/tests/e2e/payloads-search.spec.ts +0 -64
- package/tests/e2e/payloads-team-happy.spec.ts +0 -231
- package/tests/e2e/payloads-team.spec.ts +0 -174
- package/tests/e2e/prompts-expanded.spec.ts +0 -137
- package/tests/e2e/prompts.spec.ts +0 -62
- package/tests/e2e/protocols.spec.ts +0 -134
- package/tests/e2e/rate-limiting.spec.ts +0 -291
- package/tests/e2e/resources-briefing-env.spec.ts +0 -106
- package/tests/e2e/resources-complete.spec.ts +0 -180
- package/tests/e2e/resources-expanded.spec.ts +0 -83
- package/tests/e2e/resources-instructions-levels.spec.ts +0 -145
- package/tests/e2e/resources-templates.spec.ts +0 -123
- package/tests/e2e/resources.spec.ts +0 -103
- package/tests/e2e/scheduler.spec.ts +0 -79
- package/tests/e2e/security.spec.ts +0 -112
- package/tests/e2e/session-advanced.spec.ts +0 -152
- package/tests/e2e/sessions.spec.ts +0 -95
- package/tests/e2e/stateless.spec.ts +0 -79
- package/tests/e2e/streaming.spec.ts +0 -176
- package/tests/e2e/tool-filtering-presets.spec.ts +0 -192
- package/tests/e2e/tool-filtering.spec.ts +0 -77
- package/tests/e2e/tools.spec.ts +0 -111
- package/tests/filtering/tool-filter.test.ts +0 -314
- package/tests/github/client-issues-errors.test.ts +0 -433
- package/tests/github/github-integration-branches.test.ts +0 -490
- package/tests/github/github-integration.test.ts +0 -1015
- package/tests/github/github-managers-branches.test.ts +0 -907
- package/tests/github/pull-requests.test.ts +0 -334
- package/tests/handlers/analytics-branches.test.ts +0 -222
- package/tests/handlers/backup-branches.test.ts +0 -270
- package/tests/handlers/briefing-context-section.test.ts +0 -388
- package/tests/handlers/briefing-github-section.test.ts +0 -392
- package/tests/handlers/briefing-user-message.test.ts +0 -405
- package/tests/handlers/codemode-tools.test.ts +0 -85
- package/tests/handlers/copilot-tools.test.ts +0 -126
- package/tests/handlers/error-path-coverage.test.ts +0 -324
- package/tests/handlers/export-tools.test.ts +0 -203
- package/tests/handlers/github-resource-handlers.test.ts +0 -929
- package/tests/handlers/github-tool-handlers.test.ts +0 -1452
- package/tests/handlers/handler-error-branches.test.ts +0 -346
- package/tests/handlers/help-resource.test.ts +0 -92
- package/tests/handlers/prompt-handler-coverage.test.ts +0 -108
- package/tests/handlers/prompt-handlers.test.ts +0 -131
- package/tests/handlers/resource-handler-coverage.test.ts +0 -281
- package/tests/handlers/resource-handlers.test.ts +0 -357
- package/tests/handlers/resource-prompt-branches.test.ts +0 -495
- package/tests/handlers/search-tool-handlers.test.ts +0 -379
- package/tests/handlers/targeted-gap-closure.test.ts +0 -387
- package/tests/handlers/team-admin.test.ts +0 -291
- package/tests/handlers/team-analytics.test.ts +0 -220
- package/tests/handlers/team-core.test.ts +0 -148
- package/tests/handlers/team-data.test.ts +0 -198
- package/tests/handlers/team-relationships.test.ts +0 -271
- package/tests/handlers/team-resource-handlers.test.ts +0 -161
- package/tests/handlers/team-search.test.ts +0 -134
- package/tests/handlers/team-tool-handlers.test.ts +0 -301
- package/tests/handlers/team-vector.test.ts +0 -213
- package/tests/handlers/template-github-branches.test.ts +0 -676
- package/tests/handlers/tool-annotations.test.ts +0 -90
- package/tests/handlers/tool-handler-coverage.test.ts +0 -514
- package/tests/handlers/tool-handlers.test.ts +0 -510
- package/tests/handlers/tool-output-schemas.test.ts +0 -116
- package/tests/handlers/vector-tool-handlers.test.ts +0 -238
- package/tests/security/sql-injection.test.ts +0 -284
- package/tests/server/mcp-server.bench.ts +0 -55
- package/tests/server/mcp-server.test.ts +0 -1326
- package/tests/server/scheduler.test.ts +0 -400
- package/tests/transports/http-legacy-sse.test.ts +0 -275
- package/tests/transports/http-security.test.ts +0 -322
- package/tests/transports/http-stateful.test.ts +0 -487
- package/tests/transports/http-transport-server.test.ts +0 -301
- package/tests/transports/http-transport.test.ts +0 -771
- package/tests/utils/github-helpers.test.ts +0 -58
- package/tests/utils/logger.test.ts +0 -180
- package/tests/utils/mcp-logger.test.ts +0 -211
- package/tests/utils/progress-utils.test.ts +0 -156
- package/tests/utils/query-helpers.test.ts +0 -80
- package/tests/utils/security-utils.test.ts +0 -82
- package/tests/vector/vector-search-branches.test.ts +0 -111
- package/tests/vector/vector-search-manager.test.ts +0 -375
- package/tests/vector/vector-search.bench.ts +0 -48
- package/tsconfig.json +0 -42
- package/tsup.config.ts +0 -19
- package/vitest.config.ts +0 -25
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* memory-journal-mcp - Worker Script (Worker Thread Entry Point)
|
|
3
|
-
*
|
|
4
|
-
* Runs inside `node:worker_threads`. Receives serialized API bindings,
|
|
5
|
-
* builds an async Proxy API object (`mj.*`), and executes user code
|
|
6
|
-
* within a secondary `vm.createContext` boundary.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { parentPort, workerData } from 'node:worker_threads'
|
|
10
|
-
import * as vm from 'node:vm'
|
|
11
|
-
import type { MessagePort } from 'node:worker_threads'
|
|
12
|
-
import type { RpcRequest, RpcResponse, SandboxResult, ExecutionMetrics } from './types.js'
|
|
13
|
-
import { transformAutoReturn } from './auto-return.js'
|
|
14
|
-
|
|
15
|
-
// =============================================================================
|
|
16
|
-
// Worker Data
|
|
17
|
-
// =============================================================================
|
|
18
|
-
|
|
19
|
-
interface WorkerInit {
|
|
20
|
-
code: string
|
|
21
|
-
methodList: Record<string, string[]>
|
|
22
|
-
timeoutMs: number
|
|
23
|
-
rpcPort: MessagePort
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const { code, methodList, timeoutMs, rpcPort: workerRpcPort } = workerData as WorkerInit
|
|
27
|
-
|
|
28
|
-
// =============================================================================
|
|
29
|
-
// RPC Client (Worker Side)
|
|
30
|
-
// =============================================================================
|
|
31
|
-
|
|
32
|
-
let rpcPort: MessagePort | null = null
|
|
33
|
-
let rpcIdCounter = 0
|
|
34
|
-
const pendingRpcRequests = new Map<
|
|
35
|
-
number,
|
|
36
|
-
{ resolve: (value: unknown) => void; reject: (reason: Error) => void }
|
|
37
|
-
>()
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Send an RPC request to the main thread and await the response.
|
|
41
|
-
*/
|
|
42
|
-
function rpcCall(group: string, method: string, args: unknown[]): Promise<unknown> {
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
if (!rpcPort) {
|
|
45
|
-
reject(new Error('RPC port not initialized'))
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const id = ++rpcIdCounter
|
|
50
|
-
pendingRpcRequests.set(id, { resolve, reject })
|
|
51
|
-
|
|
52
|
-
const request: RpcRequest = { id, group, method, args }
|
|
53
|
-
rpcPort.postMessage(request)
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// =============================================================================
|
|
58
|
-
// API Proxy Builder
|
|
59
|
-
// =============================================================================
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Build the `mj` API proxy object from the method list.
|
|
63
|
-
* Each group becomes a namespace with async methods that call
|
|
64
|
-
* back to the main thread via RPC.
|
|
65
|
-
*/
|
|
66
|
-
function buildApiProxy(methods: Record<string, string[]>): Record<string, unknown> {
|
|
67
|
-
const api: Record<string, unknown> = {}
|
|
68
|
-
|
|
69
|
-
for (const [group, methodNames] of Object.entries(methods)) {
|
|
70
|
-
// _topLevel methods go directly on the api object (mj.createEntry, etc.)
|
|
71
|
-
if (group === '_topLevel') {
|
|
72
|
-
for (const methodName of methodNames) {
|
|
73
|
-
api[methodName] = (...args: unknown[]) => rpcCall('_topLevel', methodName, args)
|
|
74
|
-
}
|
|
75
|
-
continue
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const groupProxy: Record<string, (...args: unknown[]) => Promise<unknown>> = {}
|
|
79
|
-
|
|
80
|
-
for (const methodName of methodNames) {
|
|
81
|
-
groupProxy[methodName] = (...args: unknown[]) => rpcCall(group, methodName, args)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Per-group help()
|
|
85
|
-
groupProxy['help'] = () =>
|
|
86
|
-
Promise.resolve({
|
|
87
|
-
group,
|
|
88
|
-
methods: methodNames,
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
// Wrap in a Proxy so that calling an undefined method (e.g. a mutation
|
|
92
|
-
// that was stripped in readonly mode) throws a rejected Promise instead of
|
|
93
|
-
// silently returning { success: false } — this halts control flow in the
|
|
94
|
-
// sandbox and surfaces a proper error to the caller.
|
|
95
|
-
const groupProxyWrapped = new Proxy(groupProxy, {
|
|
96
|
-
get(target, prop) {
|
|
97
|
-
// Symbols (Symbol.toPrimitive, Symbol.iterator, etc.) — pass through
|
|
98
|
-
if (typeof prop === 'symbol') return undefined
|
|
99
|
-
const key = prop
|
|
100
|
-
if (key in target) return target[key]
|
|
101
|
-
// `then` must return undefined so the Proxy is never treated as a
|
|
102
|
-
// thenable. Without this, `return mj.core` would trigger Promise
|
|
103
|
-
// resolution → `.then()` → immediate reject with a misleading error.
|
|
104
|
-
if (key === 'then') return undefined
|
|
105
|
-
// Unknown/stripped method — reject so the sandbox try/catch catches it
|
|
106
|
-
const available = methodNames.join(', ') || 'none'
|
|
107
|
-
const reason =
|
|
108
|
-
methodNames.length === 0
|
|
109
|
-
? `Operation '${key}' is not available — this group has no methods (read-only mode?). Available: ${available}.`
|
|
110
|
-
: `Operation '${key}' is not found in group. Available: ${available}.`
|
|
111
|
-
return (..._args: unknown[]) => Promise.reject(new Error(reason))
|
|
112
|
-
},
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
api[group] = groupProxyWrapped
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Top-level help()
|
|
119
|
-
api['help'] = () => {
|
|
120
|
-
const groups = Object.keys(methods).filter((g) => g !== '_topLevel')
|
|
121
|
-
let totalMethods = 0
|
|
122
|
-
for (const group of groups) {
|
|
123
|
-
totalMethods += methods[group]?.length ?? 0
|
|
124
|
-
}
|
|
125
|
-
return Promise.resolve({
|
|
126
|
-
groups,
|
|
127
|
-
totalMethods,
|
|
128
|
-
usage: 'Use mj.<group>.help() for group details. Example: mj.core.help()',
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return api
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// =============================================================================
|
|
136
|
-
// Execution
|
|
137
|
-
// =============================================================================
|
|
138
|
-
|
|
139
|
-
async function executeCode(): Promise<SandboxResult> {
|
|
140
|
-
const startCpu = process.cpuUsage()
|
|
141
|
-
const startTime = performance.now()
|
|
142
|
-
|
|
143
|
-
try {
|
|
144
|
-
const mjApi = buildApiProxy(methodList)
|
|
145
|
-
|
|
146
|
-
// Build sandbox context with nulled dangerous globals
|
|
147
|
-
// Built-ins (JSON, Math, Promise, etc.) inherit from the worker's global scope
|
|
148
|
-
const sandbox: Record<string, unknown> = {
|
|
149
|
-
mj: mjApi,
|
|
150
|
-
console: {
|
|
151
|
-
log: (...args: unknown[]) => args,
|
|
152
|
-
warn: (...args: unknown[]) => args,
|
|
153
|
-
error: (...args: unknown[]) => args,
|
|
154
|
-
info: (...args: unknown[]) => args,
|
|
155
|
-
debug: (...args: unknown[]) => args,
|
|
156
|
-
},
|
|
157
|
-
// Nulled globals
|
|
158
|
-
setTimeout: undefined,
|
|
159
|
-
setInterval: undefined,
|
|
160
|
-
setImmediate: undefined,
|
|
161
|
-
process: undefined,
|
|
162
|
-
require: undefined,
|
|
163
|
-
__dirname: undefined,
|
|
164
|
-
__filename: undefined,
|
|
165
|
-
global: undefined,
|
|
166
|
-
globalThis: undefined,
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const context = vm.createContext(sandbox, {
|
|
170
|
-
name: 'codemode-worker-sandbox',
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
const wrappedCode = `(async () => { ${transformAutoReturn(code)} })()`
|
|
174
|
-
const script = new vm.Script(wrappedCode, {
|
|
175
|
-
filename: 'codemode-execution.js',
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
const resultPromise = script.runInContext(context, {
|
|
179
|
-
timeout: timeoutMs,
|
|
180
|
-
}) as Promise<unknown>
|
|
181
|
-
|
|
182
|
-
const result = await resultPromise
|
|
183
|
-
|
|
184
|
-
const endTime = performance.now()
|
|
185
|
-
const endCpu = process.cpuUsage(startCpu)
|
|
186
|
-
const metrics: ExecutionMetrics = {
|
|
187
|
-
wallTimeMs: Math.round(endTime - startTime),
|
|
188
|
-
cpuTimeMs: Math.round((endCpu.user + endCpu.system) / 1000),
|
|
189
|
-
memoryUsedMb: 0, // Measured on host side via RSS delta
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return { success: true, result, metrics }
|
|
193
|
-
} catch (err) {
|
|
194
|
-
const endTime = performance.now()
|
|
195
|
-
const endCpu = process.cpuUsage(startCpu)
|
|
196
|
-
const error = err instanceof Error ? err : new Error(String(err))
|
|
197
|
-
const metrics: ExecutionMetrics = {
|
|
198
|
-
wallTimeMs: Math.round(endTime - startTime),
|
|
199
|
-
cpuTimeMs: Math.round((endCpu.user + endCpu.system) / 1000),
|
|
200
|
-
memoryUsedMb: 0,
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return {
|
|
204
|
-
success: false,
|
|
205
|
-
error: error.message,
|
|
206
|
-
stack: error.stack,
|
|
207
|
-
metrics,
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// =============================================================================
|
|
213
|
-
// Startup — Port from workerData, execute immediately
|
|
214
|
-
// =============================================================================
|
|
215
|
-
|
|
216
|
-
// Initialize RPC port from workerData (transferred via constructor)
|
|
217
|
-
rpcPort = workerRpcPort
|
|
218
|
-
rpcPort.ref() // Keep event loop alive while RPC is active
|
|
219
|
-
|
|
220
|
-
// Listen for RPC responses from the main thread
|
|
221
|
-
rpcPort.on('message', (response: RpcResponse) => {
|
|
222
|
-
const pending = pendingRpcRequests.get(response.id)
|
|
223
|
-
if (pending) {
|
|
224
|
-
pendingRpcRequests.delete(response.id)
|
|
225
|
-
if (response.error) {
|
|
226
|
-
pending.reject(new Error(response.error))
|
|
227
|
-
} else {
|
|
228
|
-
pending.resolve(response.result)
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
// Execute code and send result back to the host via parentPort
|
|
234
|
-
void executeCode().then((result) => {
|
|
235
|
-
// Close the RPC port before sending result (allows worker to exit)
|
|
236
|
-
rpcPort?.unref()
|
|
237
|
-
rpcPort?.close()
|
|
238
|
-
parentPort?.postMessage(result)
|
|
239
|
-
})
|
package/src/constants/icons.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory Journal MCP Server - Icon Constants
|
|
3
|
-
*
|
|
4
|
-
* Centralized icon definitions using data URIs for self-contained distribution.
|
|
5
|
-
* Icons follow MCP 2025-11-25 specification.
|
|
6
|
-
*
|
|
7
|
-
* Using simple Lucide-style SVG icons encoded as data URIs.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { McpIcon } from '../types/index.js'
|
|
11
|
-
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// Tool Group Icons
|
|
14
|
-
// ============================================================================
|
|
15
|
-
|
|
16
|
-
/** Journal/notebook icon for core operations */
|
|
17
|
-
export const ICON_CORE: McpIcon = {
|
|
18
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M4 19.5A2.5 2.5 0 016.5 17H20"/%3E%3Cpath d="M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z"/%3E%3C/svg%3E',
|
|
19
|
-
mimeType: 'image/svg+xml',
|
|
20
|
-
sizes: ['24x24'],
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** Magnifying glass for search operations */
|
|
24
|
-
export const ICON_SEARCH: McpIcon = {
|
|
25
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Ccircle cx="11" cy="11" r="8"/%3E%3Cline x1="21" y1="21" x2="16.65" y2="16.65"/%3E%3C/svg%3E',
|
|
26
|
-
mimeType: 'image/svg+xml',
|
|
27
|
-
sizes: ['24x24'],
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** Chart/bar for analytics */
|
|
31
|
-
export const ICON_ANALYTICS: McpIcon = {
|
|
32
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cline x1="18" y1="20" x2="18" y2="10"/%3E%3Cline x1="12" y1="20" x2="12" y2="4"/%3E%3Cline x1="6" y1="20" x2="6" y2="14"/%3E%3C/svg%3E',
|
|
33
|
-
mimeType: 'image/svg+xml',
|
|
34
|
-
sizes: ['24x24'],
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Link for relationships */
|
|
38
|
-
export const ICON_RELATIONSHIPS: McpIcon = {
|
|
39
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/%3E%3Cpath d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/%3E%3C/svg%3E',
|
|
40
|
-
mimeType: 'image/svg+xml',
|
|
41
|
-
sizes: ['24x24'],
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Download/export icon */
|
|
45
|
-
export const ICON_EXPORT: McpIcon = {
|
|
46
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/%3E%3Cpolyline points="7 10 12 15 17 10"/%3E%3Cline x1="12" y1="15" x2="12" y2="3"/%3E%3C/svg%3E',
|
|
47
|
-
mimeType: 'image/svg+xml',
|
|
48
|
-
sizes: ['24x24'],
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Settings/cog for admin */
|
|
52
|
-
export const ICON_ADMIN: McpIcon = {
|
|
53
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Ccircle cx="12" cy="12" r="3"/%3E%3Cpath d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/%3E%3C/svg%3E',
|
|
54
|
-
mimeType: 'image/svg+xml',
|
|
55
|
-
sizes: ['24x24'],
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** GitHub logo for github tools */
|
|
59
|
-
export const ICON_GITHUB: McpIcon = {
|
|
60
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"%3E%3Cpath d="M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"/%3E%3C/svg%3E',
|
|
61
|
-
mimeType: 'image/svg+xml',
|
|
62
|
-
sizes: ['24x24'],
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** Archive/box for backup */
|
|
66
|
-
export const ICON_BACKUP: McpIcon = {
|
|
67
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpolyline points="21 8 21 21 3 21 3 8"/%3E%3Crect x="1" y="3" width="22" height="5"/%3E%3Cline x1="10" y1="12" x2="14" y2="12"/%3E%3C/svg%3E',
|
|
68
|
-
mimeType: 'image/svg+xml',
|
|
69
|
-
sizes: ['24x24'],
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Users group for team collaboration */
|
|
73
|
-
export const ICON_TEAM: McpIcon = {
|
|
74
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/%3E%3Ccircle cx="9" cy="7" r="4"/%3E%3Cpath d="M23 21v-2a4 4 0 00-3-3.87"/%3E%3Cpath d="M16 3.13a4 4 0 010 7.75"/%3E%3C/svg%3E',
|
|
75
|
-
mimeType: 'image/svg+xml',
|
|
76
|
-
sizes: ['24x24'],
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// ============================================================================
|
|
80
|
-
// Resource Icons
|
|
81
|
-
// ============================================================================
|
|
82
|
-
|
|
83
|
-
/** Document for briefing/instructions */
|
|
84
|
-
export const ICON_BRIEFING: McpIcon = {
|
|
85
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/%3E%3Cpolyline points="14 2 14 8 20 8"/%3E%3Cline x1="16" y1="13" x2="8" y2="13"/%3E%3Cline x1="16" y1="17" x2="8" y2="17"/%3E%3Cpolyline points="10 9 9 9 8 9"/%3E%3C/svg%3E',
|
|
86
|
-
mimeType: 'image/svg+xml',
|
|
87
|
-
sizes: ['24x24'],
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/** Network/share for graph resources */
|
|
91
|
-
export const ICON_GRAPH: McpIcon = {
|
|
92
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Ccircle cx="18" cy="5" r="3"/%3E%3Ccircle cx="6" cy="12" r="3"/%3E%3Ccircle cx="18" cy="19" r="3"/%3E%3Cline x1="8.59" y1="13.51" x2="15.42" y2="17.49"/%3E%3Cline x1="15.41" y1="6.51" x2="8.59" y2="10.49"/%3E%3C/svg%3E',
|
|
93
|
-
mimeType: 'image/svg+xml',
|
|
94
|
-
sizes: ['24x24'],
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/** Clock for recent/timeline resources */
|
|
98
|
-
export const ICON_CLOCK: McpIcon = {
|
|
99
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Ccircle cx="12" cy="12" r="10"/%3E%3Cpolyline points="12 6 12 12 16 14"/%3E%3C/svg%3E',
|
|
100
|
-
mimeType: 'image/svg+xml',
|
|
101
|
-
sizes: ['24x24'],
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** Heartbeat for health status */
|
|
105
|
-
export const ICON_HEALTH: McpIcon = {
|
|
106
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M22 12h-4l-3 9L9 3l-3 9H2"/%3E%3C/svg%3E',
|
|
107
|
-
mimeType: 'image/svg+xml',
|
|
108
|
-
sizes: ['24x24'],
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** Kanban board columns */
|
|
112
|
-
export const ICON_KANBAN: McpIcon = {
|
|
113
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Crect x="3" y="3" width="18" height="18" rx="2" ry="2"/%3E%3Cline x1="9" y1="3" x2="9" y2="21"/%3E%3Cline x1="15" y1="3" x2="15" y2="21"/%3E%3C/svg%3E',
|
|
114
|
-
mimeType: 'image/svg+xml',
|
|
115
|
-
sizes: ['24x24'],
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** Star for significant items */
|
|
119
|
-
export const ICON_STAR: McpIcon = {
|
|
120
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpolygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/%3E%3C/svg%3E',
|
|
121
|
-
mimeType: 'image/svg+xml',
|
|
122
|
-
sizes: ['24x24'],
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** Tag for tags resource */
|
|
126
|
-
export const ICON_TAG: McpIcon = {
|
|
127
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"/%3E%3Cline x1="7" y1="7" x2="7.01" y2="7"/%3E%3C/svg%3E',
|
|
128
|
-
mimeType: 'image/svg+xml',
|
|
129
|
-
sizes: ['24x24'],
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** Issue icon for GitHub issues */
|
|
133
|
-
export const ICON_ISSUE: McpIcon = {
|
|
134
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Ccircle cx="12" cy="12" r="10"/%3E%3Cline x1="12" y1="8" x2="12" y2="12"/%3E%3Cline x1="12" y1="16" x2="12.01" y2="16"/%3E%3C/svg%3E',
|
|
135
|
-
mimeType: 'image/svg+xml',
|
|
136
|
-
sizes: ['24x24'],
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/** Git merge for PR resources */
|
|
140
|
-
export const ICON_PR: McpIcon = {
|
|
141
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Ccircle cx="18" cy="18" r="3"/%3E%3Ccircle cx="6" cy="6" r="3"/%3E%3Cpath d="M6 21V9a9 9 0 009 9"/%3E%3C/svg%3E',
|
|
142
|
-
mimeType: 'image/svg+xml',
|
|
143
|
-
sizes: ['24x24'],
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** Flag for milestone tracking */
|
|
147
|
-
export const ICON_MILESTONE: McpIcon = {
|
|
148
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/%3E%3Cline x1="4" y1="22" x2="4" y2="15"/%3E%3C/svg%3E',
|
|
149
|
-
mimeType: 'image/svg+xml',
|
|
150
|
-
sizes: ['24x24'],
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** Message bubble for prompts */
|
|
154
|
-
export const ICON_PROMPT: McpIcon = {
|
|
155
|
-
src: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpath d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/%3E%3C/svg%3E',
|
|
156
|
-
mimeType: 'image/svg+xml',
|
|
157
|
-
sizes: ['24x24'],
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// ============================================================================
|
|
161
|
-
// Tool Group Icon Mapping
|
|
162
|
-
// ============================================================================
|
|
163
|
-
|
|
164
|
-
/** Map tool group name to icon */
|
|
165
|
-
export const TOOL_GROUP_ICONS: Record<string, McpIcon> = {
|
|
166
|
-
core: ICON_CORE,
|
|
167
|
-
search: ICON_SEARCH,
|
|
168
|
-
analytics: ICON_ANALYTICS,
|
|
169
|
-
relationships: ICON_RELATIONSHIPS,
|
|
170
|
-
export: ICON_EXPORT,
|
|
171
|
-
admin: ICON_ADMIN,
|
|
172
|
-
github: ICON_GITHUB,
|
|
173
|
-
backup: ICON_BACKUP,
|
|
174
|
-
team: ICON_TEAM,
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Get icons array for a tool based on its group
|
|
179
|
-
*/
|
|
180
|
-
export function getToolIcon(group: string): McpIcon[] | undefined {
|
|
181
|
-
const icon = TOOL_GROUP_ICONS[group]
|
|
182
|
-
return icon ? [icon] : undefined
|
|
183
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
<!-- SECTION:CORE -->
|
|
2
|
-
|
|
3
|
-
# memory-journal-mcp
|
|
4
|
-
|
|
5
|
-
## Session Start
|
|
6
|
-
|
|
7
|
-
**REQUIRED**: Before processing any user request, read `memory://briefing` and **present the `userMessage` to the user as a formatted bullet list of key facts:**
|
|
8
|
-
|
|
9
|
-
- Entry counts (journal + team)
|
|
10
|
-
- GitHub: repo, branch, CI status, open issues/PRs
|
|
11
|
-
- Milestone progress (if any)
|
|
12
|
-
- Template resources count
|
|
13
|
-
- Optional metadata present (rulesFile, skillsDir, workflowSummary, copilotReviews, Team DB)
|
|
14
|
-
|
|
15
|
-
**Server name for resource calls**: Derive from tool prefixes — strip the tool name suffix to get the server name.
|
|
16
|
-
|
|
17
|
-
- **AntiGravity**: Tools are `mcp_{name}_{tool}` → server name = `memory-journal-mcp`
|
|
18
|
-
- **Cursor**: Tools are `user-{name}-{tool}` → server name = `user-memory-journal-mcp`
|
|
19
|
-
- **Other clients**: Use configured name exactly. Use tool-prefix discovery if unsure.
|
|
20
|
-
|
|
21
|
-
## Behaviors
|
|
22
|
-
|
|
23
|
-
- **Create entries for**: implementations, decisions, bug fixes, milestones, user requests to "remember"
|
|
24
|
-
- **Search before**: major decisions, referencing prior work, understanding project context
|
|
25
|
-
- **Link entries**: implementation→spec, bugfix→issue, followup→prior work
|
|
26
|
-
|
|
27
|
-
## Rule & Skill Suggestions
|
|
28
|
-
|
|
29
|
-
When you notice the user consistently applies patterns, preferences, or workflows that could be codified:
|
|
30
|
-
|
|
31
|
-
**Suggest adding a rule** when you observe:
|
|
32
|
-
|
|
33
|
-
- Naming conventions, formatting preferences, or coding standards
|
|
34
|
-
- Testing patterns or verification steps the user always follows
|
|
35
|
-
- Project-specific commands, workflows, or deployment steps
|
|
36
|
-
- Error handling patterns or logging conventions
|
|
37
|
-
|
|
38
|
-
**Suggest adding a skill** when you build:
|
|
39
|
-
|
|
40
|
-
- Reusable multi-step processes (e.g., deployment, release, audit workflows)
|
|
41
|
-
- Project-specific templates or scaffolds
|
|
42
|
-
- Complex integrations or tool chains the user may repeat
|
|
43
|
-
|
|
44
|
-
**Suggest refining existing rules/skills** when you notice:
|
|
45
|
-
|
|
46
|
-
- A rule conflict or ambiguity causing inconsistent behavior
|
|
47
|
-
- An outdated pattern that no longer matches the codebase
|
|
48
|
-
- Missing edge cases or exceptions to an existing rule
|
|
49
|
-
- A skill that could be extended with new steps
|
|
50
|
-
|
|
51
|
-
**How to act:**
|
|
52
|
-
|
|
53
|
-
- The briefing shows **Rules** and **Skills** paths — use these to locate the files
|
|
54
|
-
- **Always ask the user first** — never create or modify rules/skills silently
|
|
55
|
-
- Frame suggestions as: "I noticed you always [pattern]. Would you like me to add/update a rule for this?"
|
|
56
|
-
- For skills, explain the workflow it would automate and what triggers it
|
|
57
|
-
|
|
58
|
-
<!-- SECTION:COPILOT -->
|
|
59
|
-
|
|
60
|
-
## Copilot Review Patterns
|
|
61
|
-
|
|
62
|
-
When the user has GitHub Copilot code review enabled:
|
|
63
|
-
|
|
64
|
-
**Learn from reviews** — After a PR is merged or reviewed, use `get_copilot_reviews(pr_number)` to read Copilot's findings. If patterns emerge (e.g., repeated null check warnings, missing error handling), suggest adding a rule or updating existing rules. Create journal entries tagged `copilot-finding` and link to the PR via `pr_number`.
|
|
65
|
-
|
|
66
|
-
**Pre-emptive checking** — Before creating or modifying code, search journal entries with tag `copilot-finding` for patterns relevant to the current work. Apply those patterns proactively to reduce review cycles.
|
|
67
|
-
|
|
68
|
-
**How to act:**
|
|
69
|
-
|
|
70
|
-
- The briefing shows **Rules** and **Skills** paths — use these to locate the files
|
|
71
|
-
- **Always ask the user first** — never create or modify rules/skills silently
|
|
72
|
-
- Frame suggestions as: "I noticed you always [pattern]. Would you like me to add/update a rule for this?"
|
|
73
|
-
- For skills, explain the workflow it would automate and what triggers it
|
|
74
|
-
|
|
75
|
-
<!-- SECTION:CODE_MODE -->
|
|
76
|
-
|
|
77
|
-
## Code Mode (Token-Efficient Multi-Step Operations)
|
|
78
|
-
|
|
79
|
-
For multi-step workflows (3+ operations), prefer `mj_execute_code` over individual tool calls.
|
|
80
|
-
This executes JavaScript in a sandboxed environment with all tools available as `mj.*` API:
|
|
81
|
-
|
|
82
|
-
| Group | Namespace | Example |
|
|
83
|
-
| ------------- | -------------------- | -------------------------------------------------- |
|
|
84
|
-
| Core | `mj.core.*` | `mj.core.createEntry("Implemented feature X")` |
|
|
85
|
-
| Search | `mj.search.*` | `mj.search.searchEntries("performance")` |
|
|
86
|
-
| Analytics | `mj.analytics.*` | `mj.analytics.getStatistics()` |
|
|
87
|
-
| Relationships | `mj.relationships.*` | `mj.relationships.linkEntries(1, 2, "implements")` |
|
|
88
|
-
| Export | `mj.export.*` | `mj.export.exportEntries("json")` |
|
|
89
|
-
| Admin | `mj.admin.*` | `mj.admin.rebuildVectorIndex()` |
|
|
90
|
-
| GitHub | `mj.github.*` | `mj.github.getGithubIssues({ state: "open" })` |
|
|
91
|
-
| Backup | `mj.backup.*` | `mj.backup.backupJournal()` |
|
|
92
|
-
| Team | `mj.team.*` | `mj.team.teamCreateEntry("Team update")` |
|
|
93
|
-
|
|
94
|
-
**Features**: Positional args (`createEntry("note")`), aliases (`mj.core.create`), `mj.help()` for discovery.
|
|
95
|
-
**Readonly mode**: `readonly: true` restricts to read-only tools only. Calling a mutation method (e.g., `mj.core.create(...)`) in readonly mode throws an error that halts execution — the sandbox returns `{ success: false, error: "Operation '...' is not found in group" }`. If a group has no methods at all (fully stripped), the error says `"no methods (read-only mode?)"`.
|
|
96
|
-
**Returns**: Last expression value. Errors return `{ success: false, error: "..." }`.
|
|
97
|
-
|
|
98
|
-
**Important — all `mj.*` methods return Promises. Always `await` them:**
|
|
99
|
-
|
|
100
|
-
```js
|
|
101
|
-
// ✅ Correct
|
|
102
|
-
const result = await mj.core.recent({ limit: 5 })
|
|
103
|
-
return result.entries.map((e) => e.id)
|
|
104
|
-
|
|
105
|
-
// ❌ Wrong — returns a Promise object, not the entries
|
|
106
|
-
const result = mj.core.recent({ limit: 5 })
|
|
107
|
-
|
|
108
|
-
// ✅ Discovery
|
|
109
|
-
const help = await mj.help() // { groups, totalMethods, usage }
|
|
110
|
-
const groupHelp = await mj.core.help() // { group, methods }
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**`mj.core.recent()` return shape**: Returns `{ entries: JournalEntry[], count: number }` — not a plain array. Access `.entries` to iterate:
|
|
114
|
-
|
|
115
|
-
```js
|
|
116
|
-
const { entries, count } = await mj.core.recent({ limit: 10 })
|
|
117
|
-
return entries.map((e) => ({ id: e.id, content: e.content.slice(0, 50) }))
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
<!-- SECTION:GITHUB -->
|
|
121
|
-
|
|
122
|
-
## GitHub Integration
|
|
123
|
-
|
|
124
|
-
- Include `issue_number`/`pr_number` in `create_entry` to auto-link
|
|
125
|
-
- After closing issue/merging PR → create summary entry with learnings
|
|
126
|
-
- CI failures → `actions-failure-digest` prompt or `memory://actions/recent`
|
|
127
|
-
- Kanban: `get_kanban_board(project_number)` → `move_kanban_item` → document completion
|
|
128
|
-
- Milestones: `get_github_milestones` → track project progress, `memory://github/milestones`
|
|
129
|
-
- GitHub tools auto-detect owner/repo from git context; specify explicitly if null
|
|
130
|
-
|
|
131
|
-
<!-- SECTION:HELP_POINTERS -->
|
|
132
|
-
|
|
133
|
-
## Help Resources
|
|
134
|
-
|
|
135
|
-
Read `memory://help` for tool group index and available help resources.
|
|
136
|
-
Read `memory://help/{group}` for per-group tool reference (parameters, annotations, examples).
|
|
137
|
-
Read `memory://help/gotchas` for critical field notes and usage patterns.
|
|
138
|
-
Only help resources for your enabled tool groups are registered.
|
|
139
|
-
|
|
140
|
-
<!-- SECTION:SERVER_ACCESS -->
|
|
141
|
-
|
|
142
|
-
## How to Access This Server
|
|
143
|
-
|
|
144
|
-
### Server Name Discovery
|
|
145
|
-
|
|
146
|
-
The server name used for resource and tool calls depends on your MCP client:
|
|
147
|
-
|
|
148
|
-
- **AntiGravity**: Prefixes tools with `mcp_` and uses underscores. If the server is named `memory-journal-mcp` in config, tools appear as `mcp_memory-journal-mcp_create_entry`. Use `memory-journal-mcp` as the server name for resource calls.
|
|
149
|
-
- **Cursor**: Prepends `user-` to the configured name. If the server is named `memory-journal-mcp` in config, use `user-memory-journal-mcp` for `ListMcpResources` and `FetchMcpResource` calls.
|
|
150
|
-
- **Other clients** (Claude Desktop, etc.): Likely use the configured name exactly. Only Cursor and AntiGravity have been verified — use the tool-prefix discovery method if unsure.
|
|
151
|
-
|
|
152
|
-
To identify your server name: look at the tool name prefix. Strip the tool name suffix to get the server name. Examples: `mcp_memory-journal-mcp_create_entry` → `memory-journal-mcp`; `user-memory-journal-mcp-create_entry` → `user-memory-journal-mcp`.
|
|
153
|
-
|
|
154
|
-
### Calling Tools
|
|
155
|
-
|
|
156
|
-
Use the tool functions directly — they are already available in your context by their full prefixed name.
|
|
157
|
-
|
|
158
|
-
### Reading Resources
|
|
159
|
-
|
|
160
|
-
Use the resource-reading mechanism provided by your MCP client with the discovered server name and `memory://` URIs.
|
|
161
|
-
|
|
162
|
-
Do NOT try to browse filesystem paths for MCP tool/resource definitions — use the MCP protocol directly.
|
|
163
|
-
|
|
164
|
-
## Quick Health Check
|
|
165
|
-
|
|
166
|
-
Fetch `memory://health` to verify server status, database stats, and tool availability.
|