diff --git a/README.md b/README.md index 7c4dea8294..f799f160cd 100644 --- a/README.md +++ b/README.md @@ -355,6 +355,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 51 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/plugin/.mcp.json b/plugin/.mcp.json index 12702a2a5a..f7c3760336 100644 --- a/plugin/.mcp.json +++ b/plugin/.mcp.json @@ -2,7 +2,11 @@ "mcpServers": { "agentmemory": { "command": "npx", - "args": ["-y", "@agentmemory/mcp"] + "args": ["-y", "@agentmemory/mcp"], + "env": { + "AGENTMEMORY_URL": "${AGENTMEMORY_URL}", + "AGENTMEMORY_SECRET": "${AGENTMEMORY_SECRET}" + } } } } diff --git a/test/codex-plugin.test.ts b/test/codex-plugin.test.ts index bb38087643..e7fdf3a031 100644 --- a/test/codex-plugin.test.ts +++ b/test/codex-plugin.test.ts @@ -46,6 +46,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; + } + >; + }>(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 }>(hooksPath);