@remembrance-ai/mcp-server 0.1.39 → 0.1.44

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 CHANGED
@@ -16,9 +16,9 @@ npx @remembrance-ai/mcp-server
16
16
  ```
17
17
 
18
18
  Use this standalone MCP server when your agent cannot install a native
19
- Remembrance plugin. Claude Code, Codex, Cursor, and OpenClaw users should start
20
- with their native plugin path because those packages add skills/rules and hooks
21
- around the MCP tools.
19
+ Remembrance plugin. Claude Code, Codex, Cursor, OpenClaw, VS Code, and OpenCode
20
+ users should start with their native plugin path because those packages add
21
+ skills/rules and hooks around the MCP tools.
22
22
 
23
23
  Claude Code plugin install:
24
24
 
@@ -57,6 +57,20 @@ conversation hooks around the MCP tools. Use standalone MCP only when a native
57
57
  plugin install is unavailable. Restart OpenClaw after setup, then run
58
58
  `openclaw mcp doctor remembrance --probe`.
59
59
 
60
+ VS Code agent-mode install: run **Chat: Install Plugin From Source** from the
61
+ Command Palette and enter
62
+ `https://github.com/dreamarkinc/remembrance-skills`.
63
+
64
+ OpenCode plugin install:
65
+
66
+ ```bash
67
+ npx -y @remembrance/opencode-plugin setup
68
+ ```
69
+
70
+ Restart OpenCode after setup. The plugin adds bounded matching guidance before
71
+ eligible model turns and observes lifecycle, tool, and completion events around
72
+ the version-matched local MCP server.
73
+
60
74
  Environment:
61
75
 
62
76
  - `REMEMBRANCE_API_URL`: Remembrance API origin. Defaults to `https://remembrance.dev`.
@@ -65,8 +79,9 @@ Environment:
65
79
  `$XDG_CONFIG_HOME/remembrance/agent-key.json` or
66
80
  `~/.config/remembrance/agent-key.json`.
67
81
  - `REMEMBRANCE_PLUGIN_HOST`: set by native plugin manifests (`codex`,
68
- `claude_code`, `cursor`, or `openclaw`) so connection health can verify that
69
- host's local lifecycle. Leave unset for MCP-only installs.
82
+ `claude_code`, `cursor`, `openclaw`, `vs_code`, or `opencode`) so connection
83
+ health can verify that host's local lifecycle. Leave unset for MCP-only
84
+ installs.
70
85
  - `REMEMBRANCE_HEALTH_REPORTING=0`: disables best-effort submission of bounded
71
86
  degraded-activation issue codes. Local diagnostics remain available.
72
87
 
@@ -285,10 +300,11 @@ their host exposes enough lifecycle data. Raw MCP clients should call
285
300
  mode never exposes USD values, prices, rebates, credits, subscriptions, or
286
301
  payment instructions.
287
302
 
288
- Provider labels such as `codex`, `cursor`, `claude`, and `openclaw` describe the
289
- calling agent runtime. Independent agents should use `generic` or `other`.
303
+ Provider labels such as `codex`, `cursor`, `claude`, `openclaw`, `vscode`, and
304
+ `opencode` describe the calling agent runtime. Independent agents should use
305
+ `generic` or `other`.
290
306
 
291
307
  Do not confuse `agent.provider` with `evidence.attestation.provider`.
292
308
  `agent.provider` describes the calling runtime (`codex`, `cursor`, `claude`,
293
- `openclaw`, `generic`, `other`); attestation provider describes the signing key
294
- family (`claude_code`, `codex`, `cursor`, `other`).
309
+ `openclaw`, `vscode`, `opencode`, `generic`, `other`); attestation provider
310
+ describes the signing key family (`claude_code`, `codex`, `cursor`, `other`).
package/dist/server.js CHANGED
@@ -78,6 +78,219 @@ function attestationEvidenceHashForRemembrance(payload) {
78
78
  );
79
79
  }
80
80
 
81
+ // ../core/src/agent-hosts.ts
82
+ var AGENT_HOSTS = [
83
+ {
84
+ surface: "codex",
85
+ host_name: "Codex",
86
+ query_provider: "codex",
87
+ handoff_runtime: "codex",
88
+ package_path: "packages/codex-plugin",
89
+ distribution: "codex_marketplace",
90
+ public_mirror: true,
91
+ client_release: true,
92
+ release_smoke: true,
93
+ release_gate: "host",
94
+ plugin: true,
95
+ hooks: {
96
+ session_start: true,
97
+ prompt_hook: true,
98
+ pre_model_prompt: true,
99
+ tool_observer: true,
100
+ completion_hook: true
101
+ }
102
+ },
103
+ {
104
+ surface: "claude_code",
105
+ host_name: "Claude Code",
106
+ query_provider: "claude",
107
+ handoff_runtime: "claude_code",
108
+ package_path: "packages/claude-code-plugin",
109
+ distribution: "claude_marketplace",
110
+ public_mirror: true,
111
+ client_release: true,
112
+ release_smoke: true,
113
+ release_gate: "host",
114
+ plugin: true,
115
+ hooks: {
116
+ session_start: true,
117
+ prompt_hook: true,
118
+ pre_model_prompt: true,
119
+ tool_observer: true,
120
+ completion_hook: true
121
+ }
122
+ },
123
+ {
124
+ surface: "cursor",
125
+ host_name: "Cursor",
126
+ query_provider: "cursor",
127
+ handoff_runtime: "cursor",
128
+ package_path: "packages/cursor-plugin",
129
+ distribution: "cursor_marketplace",
130
+ public_mirror: true,
131
+ client_release: true,
132
+ release_smoke: true,
133
+ release_gate: "source_contract",
134
+ plugin: true,
135
+ hooks: {
136
+ session_start: true,
137
+ prompt_hook: true,
138
+ pre_model_prompt: false,
139
+ tool_observer: true,
140
+ completion_hook: true
141
+ }
142
+ },
143
+ {
144
+ surface: "openclaw",
145
+ host_name: "OpenClaw",
146
+ query_provider: "openclaw",
147
+ handoff_runtime: "openclaw",
148
+ package_path: "packages/openclaw-plugin",
149
+ distribution: "openclaw_clawhub",
150
+ public_mirror: true,
151
+ client_release: true,
152
+ release_smoke: true,
153
+ release_gate: "host",
154
+ plugin: true,
155
+ hooks: {
156
+ session_start: true,
157
+ prompt_hook: true,
158
+ pre_model_prompt: true,
159
+ tool_observer: true,
160
+ completion_hook: true
161
+ }
162
+ },
163
+ {
164
+ surface: "vs_code",
165
+ host_name: "VS Code",
166
+ query_provider: "vscode",
167
+ handoff_runtime: "vs_code",
168
+ package_path: "packages/vscode-plugin",
169
+ distribution: "public_mirror_source",
170
+ public_mirror: true,
171
+ client_release: true,
172
+ release_smoke: true,
173
+ release_gate: "source_contract",
174
+ plugin: true,
175
+ hooks: {
176
+ session_start: true,
177
+ prompt_hook: true,
178
+ pre_model_prompt: true,
179
+ tool_observer: true,
180
+ completion_hook: true
181
+ }
182
+ },
183
+ {
184
+ surface: "opencode",
185
+ host_name: "opencode",
186
+ query_provider: "opencode",
187
+ handoff_runtime: "opencode",
188
+ package_path: "packages/opencode-plugin",
189
+ distribution: "npm",
190
+ public_mirror: true,
191
+ client_release: true,
192
+ release_smoke: true,
193
+ release_gate: "host",
194
+ plugin: true,
195
+ hooks: {
196
+ session_start: true,
197
+ prompt_hook: true,
198
+ pre_model_prompt: true,
199
+ tool_observer: true,
200
+ completion_hook: true
201
+ }
202
+ },
203
+ {
204
+ surface: "mcp",
205
+ host_name: "MCP",
206
+ query_provider: "other",
207
+ handoff_runtime: "mcp",
208
+ package_path: "packages/mcp-server",
209
+ distribution: "npm",
210
+ public_mirror: false,
211
+ client_release: true,
212
+ release_smoke: true,
213
+ release_gate: "transport",
214
+ plugin: false,
215
+ hooks: {
216
+ session_start: false,
217
+ prompt_hook: false,
218
+ pre_model_prompt: false,
219
+ tool_observer: false,
220
+ completion_hook: false
221
+ }
222
+ },
223
+ {
224
+ surface: "rest",
225
+ host_name: "REST",
226
+ query_provider: "other",
227
+ handoff_runtime: null,
228
+ package_path: null,
229
+ distribution: "built_in",
230
+ public_mirror: false,
231
+ client_release: false,
232
+ release_smoke: true,
233
+ release_gate: "transport",
234
+ plugin: false,
235
+ hooks: {
236
+ session_start: false,
237
+ prompt_hook: false,
238
+ pre_model_prompt: false,
239
+ tool_observer: false,
240
+ completion_hook: false
241
+ }
242
+ }
243
+ ];
244
+ function nonEmptyTuple(values) {
245
+ if (values.length === 0) {
246
+ throw new Error("Agent host registry must contain at least one value.");
247
+ }
248
+ return values;
249
+ }
250
+ function uniqueValues(values) {
251
+ return [...new Set(values)];
252
+ }
253
+ var AGENT_HOST_SURFACES = nonEmptyTuple(
254
+ AGENT_HOSTS.map((host) => host.surface)
255
+ );
256
+ var AGENT_HOST_NAMES = nonEmptyTuple(
257
+ AGENT_HOSTS.map((host) => host.host_name)
258
+ );
259
+ var AGENT_QUERY_PROVIDERS = nonEmptyTuple(
260
+ uniqueValues([
261
+ ...AGENT_HOSTS.map((host) => host.query_provider),
262
+ "generic",
263
+ "other"
264
+ ])
265
+ );
266
+ var ORGANIZATION_SKILL_HANDOFF_RUNTIMES = nonEmptyTuple(
267
+ uniqueValues([
268
+ ...AGENT_HOSTS.flatMap(
269
+ (host) => host.handoff_runtime ? [host.handoff_runtime] : []
270
+ ),
271
+ "other"
272
+ ])
273
+ );
274
+ var PLUGIN_HOSTS = AGENT_HOSTS.filter((host) => host.plugin);
275
+ var PLUGIN_HOST_SURFACES = nonEmptyTuple(
276
+ PLUGIN_HOSTS.map((host) => host.surface)
277
+ );
278
+ var PUBLIC_MIRROR_PLUGIN_PATHS = PLUGIN_HOSTS.filter(
279
+ (host) => host.public_mirror && host.package_path
280
+ ).map((host) => host.package_path);
281
+ var CLIENT_RELEASE_PACKAGE_PATHS = AGENT_HOSTS.filter(
282
+ (host) => host.client_release && host.package_path
283
+ ).map((host) => host.package_path);
284
+ var CLIENT_HEALTH_HOST_BY_SURFACE = Object.fromEntries(
285
+ AGENT_HOSTS.map((host) => [host.surface, host.host_name])
286
+ );
287
+ function agentHostBySurface(surface) {
288
+ return AGENT_HOSTS.find((host) => host.surface === surface);
289
+ }
290
+ function isPluginHostSurface(value) {
291
+ return PLUGIN_HOSTS.some((host) => host.surface === value);
292
+ }
293
+
81
294
  // ../../node_modules/zod/v3/external.js
82
295
  var external_exports = {};
83
296
  __export(external_exports, {
@@ -4120,14 +4333,7 @@ var coerce = {
4120
4333
  var NEVER = INVALID;
4121
4334
 
4122
4335
  // ../core/src/client-health.ts
4123
- var clientHealthSurfaceSchema = external_exports.enum([
4124
- "codex",
4125
- "claude_code",
4126
- "cursor",
4127
- "openclaw",
4128
- "mcp",
4129
- "rest"
4130
- ]);
4336
+ var clientHealthSurfaceSchema = external_exports.enum(AGENT_HOST_SURFACES);
4131
4337
  var clientHealthIssueCodeSchema = external_exports.enum([
4132
4338
  "partial_activation",
4133
4339
  "native_hooks_not_observed",
@@ -4145,14 +4351,6 @@ var clientHealthIssueCodeSchema = external_exports.enum([
4145
4351
  "unsupported_hook_manifest",
4146
4352
  "unsupported_plugin_host"
4147
4353
  ]);
4148
- var CLIENT_HEALTH_HOST_BY_SURFACE = {
4149
- codex: "Codex",
4150
- claude_code: "Claude Code",
4151
- cursor: "Cursor",
4152
- openclaw: "OpenClaw",
4153
- mcp: "MCP",
4154
- rest: "REST"
4155
- };
4156
4354
  var componentStatusSchema = external_exports.enum([
4157
4355
  "active",
4158
4356
  "not_observed",
@@ -4162,14 +4360,7 @@ var componentStatusSchema = external_exports.enum([
4162
4360
  var clientHealthReportSchema = external_exports.object({
4163
4361
  surface: clientHealthSurfaceSchema,
4164
4362
  plugin_version: external_exports.string().trim().max(64).regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/),
4165
- host_name: external_exports.enum([
4166
- "Codex",
4167
- "Claude Code",
4168
- "Cursor",
4169
- "OpenClaw",
4170
- "MCP",
4171
- "REST"
4172
- ]),
4363
+ host_name: external_exports.enum(AGENT_HOST_NAMES),
4173
4364
  host_version: external_exports.string().trim().max(64).regex(/^[0-9A-Za-z._+ -]*$/).nullable().default(null),
4174
4365
  transport: external_exports.enum(["local_stdio_mcp", "hosted_http_mcp", "none"]),
4175
4366
  credential_source: external_exports.enum([
@@ -4233,7 +4424,12 @@ var secureWebhookUrlSchema = external_exports.string().trim().url().max(2048).su
4233
4424
  });
4234
4425
  var slackWebhookUrlSchema = secureWebhookUrlSchema.superRefine(
4235
4426
  (value, context) => {
4236
- const parsed = new URL(value);
4427
+ let parsed;
4428
+ try {
4429
+ parsed = new URL(value);
4430
+ } catch {
4431
+ return;
4432
+ }
4237
4433
  if (parsed.hostname.toLowerCase() !== "hooks.slack.com" || !parsed.pathname.startsWith("/services/")) {
4238
4434
  context.addIssue({
4239
4435
  code: external_exports.ZodIssueCode.custom,
@@ -4329,12 +4525,6 @@ var SECRET_PATTERN_SPECS = [
4329
4525
  var SECRET_PATTERNS = SECRET_PATTERN_SPECS.map(
4330
4526
  ([source, flags]) => new RegExp(source, flags)
4331
4527
  );
4332
- function redactString(value) {
4333
- return SECRET_PATTERNS.reduce(
4334
- (current, pattern) => current.replace(pattern, "[redacted]"),
4335
- value
4336
- );
4337
- }
4338
4528
 
4339
4529
  // ../core/src/organization-skill-handoff.ts
4340
4530
  var ORGANIZATION_SKILL_HANDOFF_KIND = "remembrance.organization_skill_import";
@@ -4365,7 +4555,7 @@ var organizationSkillHandoffSkillSchema = external_exports.object({
4365
4555
  });
4366
4556
  var organizationSkillHandoffRequestSchema = external_exports.object({
4367
4557
  skills: external_exports.array(organizationSkillHandoffSkillSchema).min(1).max(MAX_ORGANIZATION_SKILL_HANDOFF_SKILLS),
4368
- source_runtime: external_exports.enum(["codex", "claude_code", "cursor", "openclaw", "mcp", "other"]).default("other"),
4558
+ source_runtime: external_exports.enum(ORGANIZATION_SKILL_HANDOFF_RUNTIMES).default("other"),
4369
4559
  handoff_reason: external_exports.enum(["host_policy_blocked", "network_unavailable", "manual_offline"]).default("host_policy_blocked"),
4370
4560
  idempotency_key: boundedText(512).optional()
4371
4561
  }).strict();
@@ -4535,14 +4725,7 @@ function boundedJsonRecord(maxBytes = MAX_JSON_FIELD_BYTES) {
4535
4725
  }
4536
4726
  });
4537
4727
  }
4538
- var agentProviderSchema = external_exports.enum([
4539
- "codex",
4540
- "cursor",
4541
- "claude",
4542
- "openclaw",
4543
- "generic",
4544
- "other"
4545
- ]);
4728
+ var agentProviderSchema = external_exports.enum(AGENT_QUERY_PROVIDERS);
4546
4729
  var attestationProviderSchema = external_exports.enum([
4547
4730
  "claude_code",
4548
4731
  "codex",
@@ -4739,6 +4922,8 @@ var queryRuntimeSchema = external_exports.enum([
4739
4922
  "claude_code",
4740
4923
  "cursor",
4741
4924
  "openclaw",
4925
+ "vs_code",
4926
+ "opencode",
4742
4927
  "other",
4743
4928
  "unknown"
4744
4929
  ]);
@@ -8486,13 +8671,13 @@ var toolDefinitions = [
8486
8671
  ),
8487
8672
  tool(
8488
8673
  "propose_skill_idea",
8489
- "Propose a missing reusable skill when query_skills has no useful result. With an organization API key, the candidate stays inside that organization and enters its review queue; without one, it is a public candidate. Never remove or bypass an organization key to force public submission: submit privately, then use the reviewed public-propagation flow. Send repository-derived private instructions only when Remembrance is an organization-approved destination. If host policy blocks the export, queue_private_skill_import locally and do not claim submission.",
8674
+ "Propose a missing reusable skill when query_skills has no useful result. THIS TOOL'S VISIBILITY IS NOT FIXED: an active organization API key keeps the candidate inside that organization's review queue, while intentionally calling without a key creates a PUBLIC candidate. A supplied invalid/inactive key fails with 401 and a valid key without submission:create fails with 403; neither failure creates a candidate. Prefer propose_private_skill for anything repository-derived, organization-specific, or otherwise not intended for the public registry because that endpoint structurally requires organization auth. Use propose_skill_idea only when a public candidate is an acceptable outcome. Check `visibility` (organization_private or public_candidate) and `owner_scope` in the successful response, and report where the candidate landed. Never remove or bypass an organization key to force public submission: submit privately, then use the reviewed public-propagation flow. Send repository-derived private instructions only when Remembrance is an organization-approved destination. If host policy blocks the export, queue_private_skill_import locally and do not claim submission.",
8490
8675
  "/api/v1/agent/skill-ideas",
8491
8676
  skillIdeaRequestSchema
8492
8677
  ),
8493
8678
  tool(
8494
8679
  "propose_private_skill",
8495
- "Submit a proposed skill only to the authenticated organization's private review queue. This endpoint rejects anonymous use and never creates a public candidate. Use it for repository-derived instructions only when Remembrance is an organization-approved destination. If host policy blocks the export, queue_private_skill_import locally instead; never retry through another transport or claim submission without a receipt.",
8680
+ "Submit a proposed skill only to the authenticated organization's private review queue. Privacy here is STRUCTURAL, not credential-dependent: this endpoint rejects anonymous use and never creates a public candidate, so unlike propose_skill_idea it cannot silently fall through to public when a key fails to resolve \u2014 it fails closed with 401/403 instead. Prefer it whenever the content is repository-derived, organization-specific, or must not reach the public registry; that preference is about removing the credential from the privacy decision, not about propose_skill_idea being unsafe when a key is present. Use it for repository-derived instructions only when Remembrance is an organization-approved destination. The response reports `visibility` (always organization_private here) \u2014 a rejection means nothing was submitted. If host policy blocks the export, queue_private_skill_import locally instead; never retry through another transport or claim submission without a receipt.",
8496
8681
  "/api/v1/agent/private-skill-ideas",
8497
8682
  skillIdeaRequestSchema
8498
8683
  ),
@@ -8636,12 +8821,6 @@ var PLUGIN_HEALTH_COMPONENTS = [
8636
8821
  "tool_observer",
8637
8822
  "completion_hook"
8638
8823
  ];
8639
- var PLUGIN_HEALTH_SURFACES = /* @__PURE__ */ new Set([
8640
- "codex",
8641
- "claude_code",
8642
- "cursor",
8643
- "openclaw"
8644
- ]);
8645
8824
  var PLUGIN_HEALTH_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
8646
8825
  var PLUGIN_HEALTH_MAX_FUTURE_SKEW_MS = 5 * 60 * 1e3;
8647
8826
  var nodeFileSystem = {
@@ -8654,34 +8833,67 @@ function remembranceConfigPath(env = process.env, homeDirectory = homedir2()) {
8654
8833
  const configRoot = env.REMEMBRANCE_PLUGIN_HOST?.trim().toLowerCase() === "openclaw" ? join2(homeDirectory, ".config") : env.XDG_CONFIG_HOME ?? join2(homeDirectory, ".config");
8655
8834
  return join2(configRoot, "remembrance", "config.json");
8656
8835
  }
8657
- function readRemembranceConfig(env = process.env, fileSystem = nodeFileSystem) {
8836
+ function resolveApiCredential(env = process.env, fileSystem = nodeFileSystem) {
8837
+ const environmentKey = env.REMEMBRANCE_API_KEY?.trim();
8838
+ if (environmentKey) {
8839
+ return { apiKey: environmentKey, source: "environment" };
8840
+ }
8841
+ const path = remembranceConfigPath(env);
8842
+ if (!fileSystem.exists(path)) {
8843
+ return { apiKey: "", source: "none" };
8844
+ }
8658
8845
  try {
8659
- return normalizeConfig(
8660
- JSON.parse(fileSystem.read(remembranceConfigPath(env)))
8661
- );
8846
+ const parsed = JSON.parse(fileSystem.read(path));
8847
+ if (!isRecord(parsed)) {
8848
+ return { apiKey: "", source: "unusable_shared_config" };
8849
+ }
8850
+ if (Object.prototype.hasOwnProperty.call(parsed, "apiKey") && (typeof parsed.apiKey !== "string" || !parsed.apiKey.trim())) {
8851
+ return { apiKey: "", source: "unusable_shared_config" };
8852
+ }
8853
+ const apiKey = normalizeConfig(parsed).apiKey;
8854
+ return apiKey ? { apiKey, source: "shared_config" } : { apiKey: "", source: "none" };
8662
8855
  } catch {
8663
- return {};
8856
+ return { apiKey: "", source: "unusable_shared_config" };
8664
8857
  }
8665
8858
  }
8666
- function resolveApiCredential(env = process.env, fileSystem = nodeFileSystem) {
8667
- if (env.REMEMBRANCE_API_KEY) {
8668
- return { apiKey: env.REMEMBRANCE_API_KEY, source: "environment" };
8669
- }
8670
- const apiKey = readRemembranceConfig(env, fileSystem).apiKey;
8671
- return apiKey ? { apiKey, source: "shared_config" } : { apiKey: "", source: "none" };
8672
- }
8673
8859
  function resolveApiKey(env = process.env, fileSystem = nodeFileSystem) {
8674
8860
  return resolveApiCredential(env, fileSystem).apiKey;
8675
8861
  }
8676
8862
  function resolveApiConfiguration(env = process.env, fileSystem = nodeFileSystem) {
8677
- if (env.REMEMBRANCE_API_URL) {
8863
+ const environmentUrl = env.REMEMBRANCE_API_URL?.trim();
8864
+ if (environmentUrl) {
8865
+ const normalized = normalizeApiUrl(environmentUrl);
8866
+ return normalized ? { baseUrl: normalized, source: "environment" } : {
8867
+ baseUrl: "https://remembrance.dev",
8868
+ source: "unusable_environment"
8869
+ };
8870
+ }
8871
+ const path = remembranceConfigPath(env);
8872
+ if (!fileSystem.exists(path)) {
8873
+ return { baseUrl: "https://remembrance.dev", source: "default" };
8874
+ }
8875
+ try {
8876
+ const parsed = JSON.parse(fileSystem.read(path));
8877
+ if (!isRecord(parsed)) {
8878
+ return {
8879
+ baseUrl: "https://remembrance.dev",
8880
+ source: "unusable_shared_config"
8881
+ };
8882
+ }
8883
+ if (!Object.prototype.hasOwnProperty.call(parsed, "apiUrl")) {
8884
+ return { baseUrl: "https://remembrance.dev", source: "default" };
8885
+ }
8886
+ const normalized = normalizeApiUrl(parsed.apiUrl);
8887
+ return normalized ? { baseUrl: normalized, source: "shared_config" } : {
8888
+ baseUrl: "https://remembrance.dev",
8889
+ source: "unusable_shared_config"
8890
+ };
8891
+ } catch {
8678
8892
  return {
8679
- baseUrl: env.REMEMBRANCE_API_URL.replace(/\/$/, ""),
8680
- source: "environment"
8893
+ baseUrl: "https://remembrance.dev",
8894
+ source: "unusable_shared_config"
8681
8895
  };
8682
8896
  }
8683
- const apiUrl = readRemembranceConfig(env, fileSystem).apiUrl;
8684
- return apiUrl ? { baseUrl: apiUrl.replace(/\/$/, ""), source: "shared_config" } : { baseUrl: "https://remembrance.dev", source: "default" };
8685
8897
  }
8686
8898
  function sharedConfigStatus(env = process.env, fileSystem = nodeFileSystem) {
8687
8899
  const path = remembranceConfigPath(env);
@@ -8744,7 +8956,7 @@ function localConnectionStatus(result, options) {
8744
8956
  api_url: options.apiBase,
8745
8957
  api_url_source: options.apiUrlSource,
8746
8958
  shared_config: sharedConfigStatus(env, fileSystem),
8747
- credential_boundary: "This local MCP process resolves REMEMBRANCE_API_KEY first, then the shared config file. Anonymous curl or browser probes do not test this process."
8959
+ credential_boundary: credential.source === "unusable_shared_config" || options.apiUrlSource === "unusable_shared_config" ? "The shared Remembrance config exists but is unreadable or invalid. Remote tools fail locally until it is fixed or intentionally removed; no request silently falls back to anonymous scope." : options.apiUrlSource === "unusable_environment" ? "REMEMBRANCE_API_URL is invalid. Remote tools fail locally until it is set to an absolute HTTP(S) registry URL or intentionally removed." : "This local MCP process resolves REMEMBRANCE_API_KEY first, then the shared config file. Anonymous curl or browser probes do not test this process."
8748
8960
  },
8749
8961
  registry: response.body ?? (response.error ? { error: String(response.error) } : null),
8750
8962
  plugin_health: pluginHealth
@@ -8763,7 +8975,7 @@ function localPluginLifecycleHealth(options) {
8763
8975
  issues: []
8764
8976
  };
8765
8977
  }
8766
- if (!PLUGIN_HEALTH_SURFACES.has(rawSurface)) {
8978
+ if (!isPluginHostSurface(rawSurface)) {
8767
8979
  return {
8768
8980
  expected: true,
8769
8981
  status: "degraded",
@@ -8772,12 +8984,13 @@ function localPluginLifecycleHealth(options) {
8772
8984
  issues: [
8773
8985
  {
8774
8986
  code: "unsupported_plugin_host",
8775
- action: "Remove REMEMBRANCE_PLUGIN_HOST or set it to codex, claude_code, cursor, or openclaw."
8987
+ action: "Remove REMEMBRANCE_PLUGIN_HOST or set it to a supported native plugin surface."
8776
8988
  }
8777
8989
  ]
8778
8990
  };
8779
8991
  }
8780
8992
  const surface = rawSurface;
8993
+ const host = agentHostBySurface(surface);
8781
8994
  const healthDir = env.REMEMBRANCE_PLUGIN_HEALTH_DIR ? String(env.REMEMBRANCE_PLUGIN_HEALTH_DIR) : join2(tmpdir(), "remembrance-plugin-health");
8782
8995
  const paths = lifecycleMarkerPaths(surface, healthDir, fileSystem);
8783
8996
  if (paths.length === 0) {
@@ -8823,7 +9036,7 @@ function localPluginLifecycleHealth(options) {
8823
9036
  const observed = Number.isFinite(lastSeenMs2) && (component !== "prompt_hook" || !Number.isFinite(sessionStartMs) || lastSeenMs2 >= sessionStartMs);
8824
9037
  return [
8825
9038
  component,
8826
- observed ? { observed: true, last_seen_at: lastSeen } : { observed: false, last_seen_at: null }
9039
+ observed ? { observed: true, last_seen_at: lastSeen, expected: true } : { observed: false, last_seen_at: null, expected: true }
8827
9040
  ];
8828
9041
  })
8829
9042
  );
@@ -8932,11 +9145,26 @@ function lifecycleMarkerPaths(surface, healthDir, fileSystem) {
8932
9145
  }
8933
9146
  function normalizeConfig(value) {
8934
9147
  if (!isRecord(value)) return {};
9148
+ const apiKey = typeof value.apiKey === "string" ? value.apiKey.trim() : "";
9149
+ const apiUrl = typeof value.apiUrl === "string" ? value.apiUrl.trim() : "";
8935
9150
  return {
8936
- ...typeof value.apiKey === "string" && value.apiKey ? { apiKey: value.apiKey } : {},
8937
- ...typeof value.apiUrl === "string" && value.apiUrl ? { apiUrl: value.apiUrl } : {}
9151
+ ...apiKey ? { apiKey } : {},
9152
+ ...apiUrl ? { apiUrl } : {}
8938
9153
  };
8939
9154
  }
9155
+ function normalizeApiUrl(value) {
9156
+ if (typeof value !== "string" || !value.trim()) return null;
9157
+ const candidate = value.trim();
9158
+ try {
9159
+ const parsed = new URL(candidate);
9160
+ if (!["http:", "https:"].includes(parsed.protocol) || parsed.username || parsed.password || parsed.search || parsed.hash) {
9161
+ return null;
9162
+ }
9163
+ return candidate.replace(/\/+$/, "");
9164
+ } catch {
9165
+ return null;
9166
+ }
9167
+ }
8940
9168
  function validLifecycleTimestamp(value, nowMs) {
8941
9169
  if (typeof value !== "string") return Number.NaN;
8942
9170
  const parsed = Date.parse(value);
@@ -8952,7 +9180,7 @@ function isRecord(value) {
8952
9180
  // src/server.ts
8953
9181
  var apiConfiguration = resolveApiConfiguration();
8954
9182
  var apiBase = apiConfiguration.baseUrl;
8955
- var SERVER_VERSION = true ? "0.1.39" : "0.0.0-dev";
9183
+ var SERVER_VERSION = true ? "0.1.44" : "0.0.0-dev";
8956
9184
  var tools = toolDefinitions;
8957
9185
  var inputBuffer = Buffer.alloc(0);
8958
9186
  var clientFraming = "ndjson";
@@ -8960,10 +9188,10 @@ var cachedEconomicsSession = null;
8960
9188
  var cachedValueProofKeys = null;
8961
9189
  process.stdin.on("data", (chunk) => {
8962
9190
  inputBuffer = Buffer.concat([inputBuffer, chunk]);
8963
- processMessages().catch((error) => {
9191
+ processMessages().catch(() => {
8964
9192
  writeResponse(null, null, {
8965
9193
  code: -32603,
8966
- message: error instanceof Error ? redactString(error.message) : "Internal error"
9194
+ message: "Internal MCP error."
8967
9195
  });
8968
9196
  });
8969
9197
  });
@@ -9143,12 +9371,14 @@ async function dispatchJsonRpcRequest(request) {
9143
9371
  return null;
9144
9372
  }
9145
9373
  function jsonRpcErrorForToolError(error) {
9146
- const message = error instanceof Error ? redactString(error.message) : "Tool call failed";
9374
+ const validationError = isZodValidationError(error);
9147
9375
  return {
9148
- code: isZodValidationError(error) ? -32602 : -32603,
9149
- message
9376
+ code: validationError ? -32602 : -32603,
9377
+ message: validationError ? "Invalid MCP arguments." : error instanceof McpPublicError ? error.message : "MCP operation failed."
9150
9378
  };
9151
9379
  }
9380
+ var McpPublicError = class extends Error {
9381
+ };
9152
9382
  function isZodValidationError(error) {
9153
9383
  return error instanceof Error && (error.name === "ZodError" || messageLooksLikeZodError(error.message));
9154
9384
  }
@@ -9169,27 +9399,44 @@ async function callTool(definition, rawArguments) {
9169
9399
  if (definition.name === "submit_remembrance") {
9170
9400
  return submitRemembrance(payload);
9171
9401
  }
9172
- const result = await callRemembrance(definition, payload);
9402
+ const localConfigurationError = remoteConfigurationError(
9403
+ apiConfiguration.source,
9404
+ resolveApiCredential().source
9405
+ );
9406
+ const result = definition.name === "get_connection_status" && localConfigurationError ? { ok: false, status: 0, error: localConfigurationError } : await callRemembrance(definition, payload);
9173
9407
  if (definition.name === "get_connection_status") {
9174
9408
  const status = localConnectionStatus(result, {
9175
9409
  apiBase,
9176
9410
  apiUrlSource: apiConfiguration.source,
9177
9411
  pluginVersion: SERVER_VERSION
9178
9412
  });
9179
- void reportDegradedClientHealth(status).catch(() => void 0);
9413
+ if (!localConfigurationError) {
9414
+ void reportDegradedClientHealth(status).catch(() => void 0);
9415
+ }
9180
9416
  return status;
9181
9417
  }
9182
9418
  return result;
9183
9419
  }
9420
+ function remoteConfigurationError(apiUrlSource, credentialSource) {
9421
+ if (apiUrlSource === "unusable_environment") {
9422
+ return "REMEMBRANCE_API_URL is invalid. Set it to an absolute HTTP(S) registry URL or intentionally remove it before using remote Remembrance tools.";
9423
+ }
9424
+ if (apiUrlSource === "unusable_shared_config" || credentialSource === "unusable_shared_config") {
9425
+ return "The shared Remembrance config exists but is unreadable or invalid. Fix or intentionally remove ~/.config/remembrance/config.json before using remote Remembrance tools.";
9426
+ }
9427
+ return null;
9428
+ }
9184
9429
  function clientHealthReportFromConnectionStatus(status) {
9185
9430
  const health = isRecord2(status.plugin_health) ? status.plugin_health : null;
9186
9431
  if (!health || health.expected !== true || health.status !== "degraded") {
9187
9432
  return null;
9188
9433
  }
9189
9434
  const surface = String(health.surface ?? "");
9190
- if (surface !== "codex" && surface !== "claude_code" && surface !== "cursor" && surface !== "openclaw") {
9435
+ if (!isPluginHostSurface(surface)) {
9191
9436
  return null;
9192
9437
  }
9438
+ const host = agentHostBySurface(surface);
9439
+ if (!host || !host.plugin) return null;
9193
9440
  const components = isRecord2(health.components) ? health.components : {};
9194
9441
  const observed = (name) => isRecord2(components[name]) && components[name]?.observed === true ? "active" : "not_observed";
9195
9442
  const issueCodes = Array.isArray(health.issues) ? health.issues.map((issue) => isRecord2(issue) ? issue.code : null).filter((code) => typeof code === "string") : [];
@@ -9211,7 +9458,7 @@ function clientHealthReportFromConnectionStatus(status) {
9211
9458
  const candidate = {
9212
9459
  surface,
9213
9460
  plugin_version: typeof health.plugin_version === "string" && health.plugin_version ? health.plugin_version : SERVER_VERSION,
9214
- host_name: surface === "claude_code" ? "Claude Code" : surface === "openclaw" ? "OpenClaw" : surface === "cursor" ? "Cursor" : "Codex",
9461
+ host_name: host.host_name,
9215
9462
  host_version: typeof health.host_version === "string" && health.host_version ? health.host_version : null,
9216
9463
  transport: "local_stdio_mcp",
9217
9464
  credential_source: health.credential_source === "environment" || health.credential_source === "shared_config" || health.credential_source === "none" ? health.credential_source : "unknown",
@@ -9489,7 +9736,15 @@ async function callRemembrance(definition, rawArguments) {
9489
9736
  const headers = {
9490
9737
  "content-type": "application/json"
9491
9738
  };
9492
- const apiKey = resolveApiKey();
9739
+ const credential = resolveApiCredential();
9740
+ const configurationError = remoteConfigurationError(
9741
+ apiConfiguration.source,
9742
+ credential.source
9743
+ );
9744
+ if (configurationError && definition.name !== "get_connection_status") {
9745
+ throw new McpPublicError(configurationError);
9746
+ }
9747
+ const apiKey = credential.apiKey;
9493
9748
  if (apiKey) {
9494
9749
  headers["x-remembrance-api-key"] = apiKey;
9495
9750
  }
@@ -9516,13 +9771,13 @@ async function callRemembrance(definition, rawArguments) {
9516
9771
  return {
9517
9772
  ok: false,
9518
9773
  status: 0,
9519
- error: error instanceof Error ? redactString(error.message) : "API request failed"
9774
+ error: controller.signal.aborted ? "Remembrance API request timed out." : "Remembrance API request failed."
9520
9775
  };
9521
9776
  } finally {
9522
9777
  clearTimeout(timeout);
9523
9778
  }
9524
- const body = await response.json().catch(async () => ({
9525
- text: await response.text().catch(() => "")
9779
+ const body = await response.json().catch(() => ({
9780
+ error: response.ok ? "Remembrance API returned an unreadable response." : "Remembrance API request failed."
9526
9781
  }));
9527
9782
  const verifiedBody = definition.name === "get_value_proof" && response.ok ? await verifySignedValueProofWithKeyRefresh(body, fetchValueProofKeySet) : body;
9528
9783
  return {
@@ -9550,7 +9805,7 @@ async function fetchValueProofKeySet(forceRefresh) {
9550
9805
  }
9551
9806
  );
9552
9807
  if (!response.ok) {
9553
- throw new Error(
9808
+ throw new McpPublicError(
9554
9809
  `Value proof verification keys are unavailable (${response.status}).`
9555
9810
  );
9556
9811
  }
@@ -9577,7 +9832,7 @@ function apiTimeoutMs() {
9577
9832
  process.env.REMEMBRANCE_API_TIMEOUT_MS ?? "",
9578
9833
  10
9579
9834
  );
9580
- return Number.isFinite(parsed) && parsed > 0 ? parsed : 1e4;
9835
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 3e4;
9581
9836
  }
9582
9837
  function endpointFor(definition, payload) {
9583
9838
  if (!definition.endpoint) {
@@ -9611,13 +9866,20 @@ async function listSkillResources(rawCursor) {
9611
9866
  }
9612
9867
  async function readSkillResource(rawUri) {
9613
9868
  if (typeof rawUri !== "string") {
9614
- throw new Error("resources/read requires a Remembrance skill URI.");
9869
+ throw new McpPublicError(
9870
+ "resources/read requires a Remembrance skill URI."
9871
+ );
9872
+ }
9873
+ let slug;
9874
+ try {
9875
+ slug = parseRemembranceSkillResourceUri(rawUri);
9876
+ } catch {
9877
+ throw new McpPublicError("Invalid Remembrance skill resource URI.");
9615
9878
  }
9616
- const slug = parseRemembranceSkillResourceUri(rawUri);
9617
9879
  const catalog = await fetchSkillCatalog({ slug, limit: 1 });
9618
9880
  const skill = catalog.skills.find((entry) => entry.slug === slug);
9619
9881
  if (!skill) {
9620
- throw new Error("Skill resource is unavailable or inaccessible.");
9882
+ throw new McpPublicError("Skill resource is unavailable or inaccessible.");
9621
9883
  }
9622
9884
  return {
9623
9885
  contents: [
@@ -9635,7 +9897,7 @@ async function fetchSkillCatalog(input) {
9635
9897
  input
9636
9898
  );
9637
9899
  if (!response.ok) {
9638
- throw new Error(
9900
+ throw new McpPublicError(
9639
9901
  `Skill catalog is unavailable${response.status ? ` (${response.status})` : ""}.`
9640
9902
  );
9641
9903
  }
@@ -9747,6 +10009,7 @@ export {
9747
10009
  dispatchJsonRpcRequest,
9748
10010
  formatJsonRpcResponse,
9749
10011
  readJsonRpcMessages,
10012
+ remoteConfigurationError,
9750
10013
  reportDegradedClientHealth,
9751
10014
  resetValueProofKeyCacheForTests
9752
10015
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remembrance-ai/mcp-server",
3
- "version": "0.1.39",
3
+ "version": "0.1.44",
4
4
  "mcpName": "io.github.dreamarkinc/remembrance",
5
5
  "description": "MCP server for discovering Remembrance skills/resources and submitting agent feedback with optional TOFU attestations.",
6
6
  "license": "Apache-2.0",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/dreamarkinc/remembrance-skills",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.1.39",
9
+ "version": "0.1.44",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@remembrance-ai/mcp-server",
14
- "version": "0.1.39",
14
+ "version": "0.1.44",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },