Skip to content

feat: add --host flag and AGENTMEMORY_HOST for configurable bind address#193

Closed
Edison-A-N wants to merge 1 commit intorohitg00:mainfrom
Edison-A-N:feat/configurable-host
Closed

feat: add --host flag and AGENTMEMORY_HOST for configurable bind address#193
Edison-A-N wants to merge 1 commit intorohitg00:mainfrom
Edison-A-N:feat/configurable-host

Conversation

@Edison-A-N
Copy link
Copy Markdown
Contributor

Summary

Adds opt-in support for binding agentmemory services to non-localhost addresses (e.g. 0.0.0.0 for LAN access). The default remains 127.0.0.1 per security advisory GHSA #3.

Motivation

Users deploying agentmemory on remote dev servers or shared machines need to access the Viewer (port 3113), REST API (3111), and WebSocket streams (3112) from other hosts on the network. Currently this is impossible without patching source or running a reverse proxy, since all three services hardcode 127.0.0.1.

Changes

  • CLI: New --host <addr> flag (sets AGENTMEMORY_HOST env var)
  • Config: New host field in AgentMemoryConfig (default 127.0.0.1)
  • Viewer server: startViewerServer() accepts host param, binds accordingly
  • iii-engine: CLI patches iii-config.yaml at startup when host is overridden, creating a temp config with the new bind address and wildcard CORS
  • CORS: Viewer dynamically allows origins on configured ports when bound to 0.0.0.0
  • CSP: connect-src relaxed to * when externally bound
  • Security: Warns at startup if --host is non-localhost without AGENTMEMORY_SECRET set

Usage

# CLI flag
npx @agentmemory/agentmemory --host 0.0.0.0

# Or via env in ~/.agentmemory/.env
AGENTMEMORY_HOST=0.0.0.0

Security Considerations

  • Default behavior is unchanged (127.0.0.1)
  • Explicit opt-in required via --host flag or AGENTMEMORY_HOST env
  • Startup warning when binding externally without AGENTMEMORY_SECRET
  • CSP and CORS only relaxed when AGENTMEMORY_HOST=0.0.0.0

…address

Add opt-in support for binding agentmemory services to non-localhost
addresses (e.g. 0.0.0.0 for LAN access). Default remains 127.0.0.1
per security advisory GHSA rohitg00#3.

Changes:
- CLI: --host <addr> flag sets AGENTMEMORY_HOST env
- Config: new host field in AgentMemoryConfig (default 127.0.0.1)
- Viewer: startViewerServer accepts host param, binds accordingly
- iii-engine: CLI patches iii-config.yaml at startup when host is
  overridden, creating a temp config with the new bind address
- CORS: viewer dynamically allows origins on configured ports when
  bound to 0.0.0.0, avoiding need to pre-configure every hostname
- CSP: connect-src relaxed to wildcard when externally bound
- Security: warns if --host is non-localhost without AGENTMEMORY_SECRET

Usage:
  npx @agentmemory/agentmemory --host 0.0.0.0
  # or via env: AGENTMEMORY_HOST=0.0.0.0 in ~/.agentmemory/.env
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

Someone is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

Important

Review skipped

Too many files!

This PR contains 231 files, which is 81 over the limit of 150.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 37d9df9a-2557-486e-bb5b-a7a5dc7f8162

📥 Commits

Reviewing files that changed from the base of the PR and between 196cbd6 and a6e9667.

⛔ Files ignored due to path filters (69)
  • assets/banner.png is excluded by !**/*.png
  • assets/demo.gif is excluded by !**/*.gif
  • assets/demo.mp4 is excluded by !**/*.mp4
  • assets/icon.svg is excluded by !**/*.svg
  • assets/iii-console/dashboard.png is excluded by !**/*.png
  • assets/iii-console/states.png is excluded by !**/*.png
  • assets/iii-console/traces-waterfall.png is excluded by !**/*.png
  • assets/logo.svg is excluded by !**/*.svg
  • assets/tags/divider.svg is excluded by !**/*.svg
  • assets/tags/light/divider.svg is excluded by !**/*.svg
  • assets/tags/light/new-v082.svg is excluded by !**/*.svg
  • assets/tags/light/pill-beta.svg is excluded by !**/*.svg
  • assets/tags/light/pill-hook.svg is excluded by !**/*.svg
  • assets/tags/light/pill-mcp.svg is excluded by !**/*.svg
  • assets/tags/light/pill-new.svg is excluded by !**/*.svg
  • assets/tags/light/pill-plugin.svg is excluded by !**/*.svg
  • assets/tags/light/pill-secure.svg is excluded by !**/*.svg
  • assets/tags/light/pill-skill.svg is excluded by !**/*.svg
  • assets/tags/light/pill-stable.svg is excluded by !**/*.svg
  • assets/tags/light/section-agents.svg is excluded by !**/*.svg
  • assets/tags/light/section-api.svg is excluded by !**/*.svg
  • assets/tags/light/section-architecture.svg is excluded by !**/*.svg
  • assets/tags/light/section-benchmarks.svg is excluded by !**/*.svg
  • assets/tags/light/section-competitors.svg is excluded by !**/*.svg
  • assets/tags/light/section-config.svg is excluded by !**/*.svg
  • assets/tags/light/section-development.svg is excluded by !**/*.svg
  • assets/tags/light/section-how.svg is excluded by !**/*.svg
  • assets/tags/light/section-license.svg is excluded by !**/*.svg
  • assets/tags/light/section-mcp.svg is excluded by !**/*.svg
  • assets/tags/light/section-quickstart.svg is excluded by !**/*.svg
  • assets/tags/light/section-search.svg is excluded by !**/*.svg
  • assets/tags/light/section-viewer.svg is excluded by !**/*.svg
  • assets/tags/light/section-why.svg is excluded by !**/*.svg
  • assets/tags/light/stat-deps.svg is excluded by !**/*.svg
  • assets/tags/light/stat-hooks.svg is excluded by !**/*.svg
  • assets/tags/light/stat-recall.svg is excluded by !**/*.svg
  • assets/tags/light/stat-tests.svg is excluded by !**/*.svg
  • assets/tags/light/stat-tokens.svg is excluded by !**/*.svg
  • assets/tags/light/stat-tools.svg is excluded by !**/*.svg
  • assets/tags/new-v082.svg is excluded by !**/*.svg
  • assets/tags/pill-beta.svg is excluded by !**/*.svg
  • assets/tags/pill-hook.svg is excluded by !**/*.svg
  • assets/tags/pill-mcp.svg is excluded by !**/*.svg
  • assets/tags/pill-new.svg is excluded by !**/*.svg
  • assets/tags/pill-plugin.svg is excluded by !**/*.svg
  • assets/tags/pill-secure.svg is excluded by !**/*.svg
  • assets/tags/pill-skill.svg is excluded by !**/*.svg
  • assets/tags/pill-stable.svg is excluded by !**/*.svg
  • assets/tags/section-agents.svg is excluded by !**/*.svg
  • assets/tags/section-api.svg is excluded by !**/*.svg
  • assets/tags/section-architecture.svg is excluded by !**/*.svg
  • assets/tags/section-benchmarks.svg is excluded by !**/*.svg
  • assets/tags/section-competitors.svg is excluded by !**/*.svg
  • assets/tags/section-config.svg is excluded by !**/*.svg
  • assets/tags/section-development.svg is excluded by !**/*.svg
  • assets/tags/section-how.svg is excluded by !**/*.svg
  • assets/tags/section-license.svg is excluded by !**/*.svg
  • assets/tags/section-mcp.svg is excluded by !**/*.svg
  • assets/tags/section-quickstart.svg is excluded by !**/*.svg
  • assets/tags/section-search.svg is excluded by !**/*.svg
  • assets/tags/section-viewer.svg is excluded by !**/*.svg
  • assets/tags/section-why.svg is excluded by !**/*.svg
  • assets/tags/stat-deps.svg is excluded by !**/*.svg
  • assets/tags/stat-hooks.svg is excluded by !**/*.svg
  • assets/tags/stat-recall.svg is excluded by !**/*.svg
  • assets/tags/stat-tests.svg is excluded by !**/*.svg
  • assets/tags/stat-tokens.svg is excluded by !**/*.svg
  • assets/tags/stat-tools.svg is excluded by !**/*.svg
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (231)
  • .claude-plugin/marketplace.json
  • .github/security-advisories/01-viewer-xss.md
  • .github/security-advisories/02-curl-sh-rce.md
  • .github/security-advisories/04-mesh-unauth.md
  • .github/security-advisories/05-obsidian-export-traversal.md
  • .github/security-advisories/06-privacy-redaction-incomplete.md
  • .github/workflows/ci.yml
  • .github/workflows/publish.yml
  • .gitignore
  • AGENTS.md
  • CHANGELOG.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • DESIGN.md
  • GOVERNANCE.md
  • LICENSE
  • MAINTAINERS.md
  • ROADMAP.md
  • SECURITY.md
  • benchmark/COMPARISON.md
  • benchmark/LONGMEMEVAL.md
  • benchmark/QUALITY.md
  • benchmark/REAL-EMBEDDINGS.md
  • benchmark/SCALE.md
  • benchmark/data/.gitignore
  • benchmark/data/longmemeval_results_bm25.json
  • benchmark/data/longmemeval_results_hybrid.json
  • benchmark/dataset.ts
  • benchmark/longmemeval-bench.ts
  • benchmark/quality-eval.ts
  • benchmark/real-embeddings-eval.ts
  • benchmark/scale-eval.ts
  • docker-compose.yml
  • iii-config.docker.yaml
  • integrations/filesystem-watcher/README.md
  • integrations/filesystem-watcher/bin.mjs
  • integrations/filesystem-watcher/package.json
  • integrations/filesystem-watcher/watcher.mjs
  • integrations/hermes/README.md
  • integrations/hermes/__init__.py
  • integrations/hermes/plugin.yaml
  • integrations/openclaw/README.md
  • integrations/openclaw/plugin.mjs
  • integrations/openclaw/plugin.yaml
  • package.json
  • packages/mcp/LICENSE
  • packages/mcp/README.md
  • packages/mcp/bin.mjs
  • packages/mcp/package.json
  • plugin/.claude-plugin/plugin.json
  • plugin/.mcp.json
  • plugin/hooks/hooks.json
  • plugin/scripts/diagnostics.mjs
  • plugin/scripts/notification.mjs
  • plugin/scripts/post-tool-failure.mjs
  • plugin/scripts/post-tool-use.mjs
  • plugin/scripts/pre-compact.mjs
  • plugin/scripts/pre-tool-use.mjs
  • plugin/scripts/prompt-submit.mjs
  • plugin/scripts/session-end.mjs
  • plugin/scripts/session-start.mjs
  • plugin/scripts/stop.mjs
  • plugin/scripts/subagent-start.mjs
  • plugin/scripts/subagent-stop.mjs
  • plugin/scripts/task-completed.mjs
  • plugin/skills/forget/SKILL.md
  • plugin/skills/recall/SKILL.md
  • plugin/skills/remember/SKILL.md
  • plugin/skills/session-history/SKILL.md
  • src/auth.ts
  • src/cli.ts
  • src/config.ts
  • src/eval/metrics-store.ts
  • src/eval/quality.ts
  • src/eval/schemas.ts
  • src/eval/self-correct.ts
  • src/eval/validator.ts
  • src/functions/access-tracker.ts
  • src/functions/actions.ts
  • src/functions/audit.ts
  • src/functions/auto-forget.ts
  • src/functions/branch-aware.ts
  • src/functions/cascade.ts
  • src/functions/checkpoints.ts
  • src/functions/claude-bridge.ts
  • src/functions/compress-file.ts
  • src/functions/compress-synthetic.ts
  • src/functions/compress.ts
  • src/functions/consolidate.ts
  • src/functions/consolidation-pipeline.ts
  • src/functions/context.ts
  • src/functions/crystallize.ts
  • src/functions/dedup.ts
  • src/functions/diagnostics.ts
  • src/functions/disk-size-manager.ts
  • src/functions/enrich.ts
  • src/functions/evict.ts
  • src/functions/export-import.ts
  • src/functions/facets.ts
  • src/functions/file-index.ts
  • src/functions/flow-compress.ts
  • src/functions/frontier.ts
  • src/functions/governance.ts
  • src/functions/graph-retrieval.ts
  • src/functions/graph.ts
  • src/functions/image-quota-cleanup.ts
  • src/functions/image-refs.ts
  • src/functions/leases.ts
  • src/functions/lessons.ts
  • src/functions/mesh.ts
  • src/functions/migrate.ts
  • src/functions/observe.ts
  • src/functions/obsidian-export.ts
  • src/functions/patterns.ts
  • src/functions/privacy.ts
  • src/functions/profile.ts
  • src/functions/query-expansion.ts
  • src/functions/reflect.ts
  • src/functions/relations.ts
  • src/functions/remember.ts
  • src/functions/replay.ts
  • src/functions/retention.ts
  • src/functions/routines.ts
  • src/functions/search.ts
  • src/functions/sentinels.ts
  • src/functions/signals.ts
  • src/functions/sketches.ts
  • src/functions/skill-extract.ts
  • src/functions/sliding-window.ts
  • src/functions/slots.ts
  • src/functions/smart-search.ts
  • src/functions/snapshot.ts
  • src/functions/summarize.ts
  • src/functions/team.ts
  • src/functions/temporal-graph.ts
  • src/functions/timeline.ts
  • src/functions/verify.ts
  • src/functions/vision-search.ts
  • src/functions/working-memory.ts
  • src/health/monitor.ts
  • src/health/thresholds.ts
  • src/hooks/notification.ts
  • src/hooks/post-tool-failure.ts
  • src/hooks/post-tool-use.ts
  • src/hooks/pre-compact.ts
  • src/hooks/pre-tool-use.ts
  • src/hooks/prompt-submit.ts
  • src/hooks/session-end.ts
  • src/hooks/session-start.ts
  • src/hooks/stop.ts
  • src/hooks/subagent-start.ts
  • src/hooks/subagent-stop.ts
  • src/hooks/task-completed.ts
  • src/index.ts
  • src/logger.ts
  • src/mcp/in-memory-kv.ts
  • src/mcp/rest-proxy.ts
  • src/mcp/standalone.ts
  • src/mcp/tools-registry.ts
  • src/mcp/transport.ts
  • src/prompts/compression.ts
  • src/prompts/consolidation.ts
  • src/prompts/graph-extraction.ts
  • src/prompts/reflect.ts
  • src/prompts/summary.ts
  • src/prompts/vision.ts
  • src/prompts/xml.ts
  • src/providers/agent-sdk.ts
  • src/providers/anthropic.ts
  • src/providers/circuit-breaker.ts
  • src/providers/embedding/clip.ts
  • src/providers/embedding/cohere.ts
  • src/providers/embedding/gemini.ts
  • src/providers/embedding/index.ts
  • src/providers/embedding/local.ts
  • src/providers/embedding/openai.ts
  • src/providers/embedding/openrouter.ts
  • src/providers/embedding/voyage.ts
  • src/providers/fallback-chain.ts
  • src/providers/index.ts
  • src/providers/minimax.ts
  • src/providers/openrouter.ts
  • src/providers/resilient.ts
  • src/replay/jsonl-parser.ts
  • src/replay/timeline.ts
  • src/state/hybrid-search.ts
  • src/state/index-persistence.ts
  • src/state/keyed-mutex.ts
  • src/state/kv.ts
  • src/state/reranker.ts
  • src/state/schema.ts
  • src/state/search-index.ts
  • src/state/stemmer.ts
  • src/state/synonyms.ts
  • src/state/vector-index.ts
  • src/telemetry/setup.ts
  • src/triggers/api.ts
  • src/triggers/events.ts
  • src/types.ts
  • src/utils/image-store.ts
  • src/version.ts
  • src/viewer/index.html
  • src/viewer/server.ts
  • src/xenova.d.ts
  • test/access-tracker.test.ts
  • test/actions.test.ts
  • test/audit.test.ts
  • test/auto-compress.test.ts
  • test/auto-forget.test.ts
  • test/cascade.test.ts
  • test/checkpoints.test.ts
  • test/circuit-breaker.test.ts
  • test/claude-bridge.test.ts
  • test/compress-file.test.ts
  • test/confidence.test.ts
  • test/consistency.test.ts
  • test/consolidation-pipeline.test.ts
  • test/context-injection.test.ts
  • test/crystallize.test.ts
  • test/diagnostics.test.ts
  • test/embedding-provider.test.ts
  • test/enrich.test.ts
  • test/eval.test.ts
  • test/export-import.test.ts
  • test/facets.test.ts
  • test/fallback-chain.test.ts
  • test/fixtures/jsonl/basic.jsonl
  • test/fixtures/jsonl/errors.jsonl
  • test/fixtures/jsonl/tool-use.jsonl
  • test/frontier.test.ts
  • test/fs-watcher.test.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Edison-A-N
Copy link
Copy Markdown
Contributor Author

Closing — branch had unintended file deletions from partial clone. Will re-submit with clean branch.

@Edison-A-N Edison-A-N closed this Apr 23, 2026
@Edison-A-N Edison-A-N deleted the feat/configurable-host branch April 23, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant