Skip to content

#1 Persistent memory for AI coding agents based on real-world benchmarks

fix: pass plugin mcp env overrides (#386)

CauchYoung5649e9c647bb
diff --git a/README.md b/README.md
index 803366fe..63f78056 100644
--- a/README.md
+++ b/README.md
@@ -415,6 +415,8 @@ Implementation details live in `src/cli.ts` (see `runUpgrade` around the `src/cl
Install agentmemory: run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server. Then run `/plugin marketplace add rohitg00/agentmemory` and `/plugin install agentmemory` — the plugin registers all 12 hooks, 4 skills, AND auto-wires the `@agentmemory/mcp` stdio server via its `.mcp.json`, so you get 53 MCP tools (memory_smart_search, memory_save, memory_sessions, memory_governance_delete, etc.) without any extra config step. Verify with `curl http://localhost:3111/agentmemory/health`. The real-time viewer is at http://localhost:3113.
```
+For remote or protected deployments, launch Claude Code with `AGENTMEMORY_URL` and `AGENTMEMORY_SECRET` set. The plugin passes both values through to its bundled MCP server; when `AGENTMEMORY_URL` is empty, the MCP shim uses `http://localhost:3111`.
+
### Codex CLI (Codex plugin platform)
```bash
diff --git a/test/codex-plugin.test.ts b/test/codex-plugin.test.ts
index bbbd88db..63aa1803 100644
--- a/test/codex-plugin.test.ts
+++ b/test/codex-plugin.test.ts
@@ -69,6 +69,24 @@ describe("Codex plugin manifest (developers.openai.com/codex/plugins)", () => {
expect(existsSync(join(pluginRoot, manifest.hooks))).toBe(true);
});
+ it("plugin MCP server inherits remote agentmemory environment overrides", () => {
+ const mcp = readJson<{
+ mcpServers: Record<
+ string,
+ {
+ command: string;
+ args: string[];
+ env?: Record<string, string>;
+ }
+ >;
+ }>(join(pluginRoot, ".mcp.json"));
+
+ expect(mcp.mcpServers.agentmemory?.env).toMatchObject({
+ AGENTMEMORY_URL: "${AGENTMEMORY_URL}",
+ AGENTMEMORY_SECRET: "${AGENTMEMORY_SECRET}",
+ });
+ });
+
it("hooks.codex.json contains only events Codex supports (no Subagent / SessionEnd / Notification / TaskCompleted / PostToolUseFailure)", () => {
const hooksPath = join(pluginRoot, "hooks/hooks.codex.json");
const hooks = readJson<{ hooks: Record<string, unknown> }>(hooksPath);