Skip to content

Self-hosted MCP server + dashboard giving Claude Code, Cursor & Hermes agents shared long-term memory over a git-backed markdown vault. Agent-native, Obsidian-compatible second brain — markdown RAG, no vector DB.

1.9 KB
Raw Blame
# Engram — standalone stdio MCP server.
#
# This is the "local mode" image: it serves the brain_* tools over stdio against a folder of
# markdown, with no HTTP, no auth, no git. It's what registries (Glama, Smithery) run to
# introspect the tools, and what Claude Desktop / Cursor run over stdio.
#
# The full dashboard + HTTP MCP server for a self-hosted team is the root `Dockerfile`.
#
# By default it serves the bundled sample-vault. Mount your own and point VAULT_DIR at it:
#   docker run -i -v /path/to/vault:/vault -e VAULT_DIR=/vault <image>

FROM oven/bun:1

# Ownership proof for the official MCP registry: the registry reads this label from the
# image manifest and rejects the publish unless it matches the `name` in server.json.
LABEL io.modelcontextprotocol.server.name="io.github.rwnalds/engram"

WORKDIR /app

# git + certs: only used if you point it at a git-backed vault; harmless otherwise.
RUN apt-get update \
  && apt-get install -y --no-install-recommends git ca-certificates \
  && rm -rf /var/lib/apt/lists/*

COPY package.json bun.lock* ./
RUN bun install --frozen-lockfile

COPY . .

ENV NODE_ENV=production \
    GIT_SYNC_ENABLED=false

# stdio MCP server: JSON-RPC on stdin/stdout. Nothing here may write to stdout.
#
# ENTRYPOINT, not CMD. server.json tells clients to pass the vault as a positional argument
# (`docker run ... <image> /vault`), and with a bare CMD that argument *replaces* the command
# instead of appending to it — the base image's entrypoint then tries to exec /vault, a
# directory, and the container dies with "Permission denied" before serving a single request.
# As ENTRYPOINT the argument lands where the script expects it. Overriding the base entrypoint
# is deliberate: this image runs exactly one program.
#
# Verified: `docker run -i --rm --mount type=bind,src=<vault>,dst=/vault <image> /vault`
# answers initialize/tools/list, and a bare `docker run <image>` still serves sample-vault.
ENTRYPOINT ["bun", "scripts/mcp-stdio.ts"]