# @nhatnguyen9317/memory-mcp-server [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/ngquocnhat9317/memory-mcp-server  
**GitHub Stars:** 0  
**npm Downloads (last month):** 337  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/nhatnguyen9317-memory-mcp-server

## Description
MCP server for persisting agent long-term memory and step-by-step reasoning traces in SQLite

## Tools
Capabilities this server exposes over MCP:

- **memory_search** — Recall saved memories on a topic other than your session title (reasoning_start_session already recalls the title). Any query term may match; queries with 3+ terms need at least 2. Ranked by term coverage, relevance and recency.
- **memory_get** — Retrieve a single memory by its id.
- **memory_update** — Correct a recalled memory that turned out wrong or outdated. Only the fields you pass change. `tags`/`metadata` replace the whole value; `tags_append`/`tags_remove`/`metadata_patch` change it incrementally. Pass at least one field.
- **memory_record_usage_feedback** — Record how a recalled memory turned out — usefulness is one of: used, ignored, irrelevant, stale, unsafe_to_use. For the common 'used' case, prefer used_memory_ids on reasoning_complete_session; call this tool directly for tasks without a session, or the moment a recalled memory turns out stale or wrong. Feedback is a first-party learning signal for recall quality and is always persisted locally, regardless of the MEMORY_TELEMETRY setting.
- **reasoning_start_session** — Start a new reasoning session to record a multi-step chain of thought for a task or question. Call this once at the start of a non-trivial task, then log each step with reasoning_add_step, and finish with reasoning_complete_session.

Args:
  - title (string, required): Short description of the task/question, e.g. "Diagnose flaky checkout test".
  - agent_id (string, optional): Identifier for the agent/persona running this session.
  - workspace (string, optional): Absolute path of the project directory you are working in. Pass it: the server's own working directory is often "/" or your home directory, which counts as unknown.

Returns: JSON with the new session's id (pass it to reasoning_add_step and reasoning_complete_session), plus:
  - workspace: the resolved project workspace for this session, or null when unknown (then workspace_warning explains how to fix it).
  - related_memories: up to a few saved memories relevant to the title, auto-recalled by the server — ranked by a blend of term coverage, text relevance, workspace and recency; memories from other projects appear only when they match nearly the whole title (user preferences excepted); weak matches are filtered out, so a short or empty list is normal. Review them before starting work; if one helps, report it later via used_memory_ids on reasoning_complete_session. Memories persisted from a past reasoning session carry a 'source' field ({session_id, session_title, created_at}); the source says which session produced the memory and when; read that session with reasoning_find(session_id) when the snippet is not enough.
  - open_sessions / open_sessions_warning: other in_progress sessions. Close the ones you opened and finished; leave sessions you don't recognize alone (they may belong to another agent or run).
  - auto_abandoned_sessions: count of stale in_progress sessions the server just cleaned up, if any.

Examples:
  - Use when: starting to debug a complex issue, plan a multi-step task, or work through a decision with tradeoffs.
  - Don't use when: the answer is a single simple lookup (use memory_search directly).
- **reasoning_add_step** — Append one step (thought / action / observation) — or a batch of steps — to an existing reasoning session. Steps are numbered automatically in the order added.

Args:
  - session_id (string, required): Id from reasoning_start_session.
  - thought (string, optional): The reasoning/thinking at this step.
  - action (string, optional): The action taken, if any.
  - observation (string, optional): The result observed, if any.
  - steps (array, optional): Batch mode — log up to 20 steps in one call, each {thought?, action?, observation?} with at least one field. Use INSTEAD of the top-level fields (not together), e.g. to record several steps of finished work at once.
  (Either steps, or at least one of thought/action/observation, is required.)

Returns: single mode — JSON with the new step's id and step_number; batch mode — JSON with steps: [{step_id, step_number}, ...] in insertion order.

Error Handling:
  - Returns an error if session_id does not exist (call reasoning_start_session first, or reasoning_find to look up an existing session).
  - Returns an error if the session is already 'completed' or 'abandoned'.
- **reasoning_find** — Find past work that your current context does not contain, then read it.

Call it when the user refers to earlier work, a past decision or a previous conversation you don't have ("last time…", "continue the unfinished…", "I already discussed…"), or when a recalled memory's source is not enough to know why that conclusion was reached.

Pass exactly one of:
  - query: searches past sessions' titles, conclusions and step text. Returns up to limit sessions (default 5), best match first, each with its conclusion and up to 2 matching step excerpts.
  - session_id: returns that session's full ordered trace.

Find first, then read only the session that matters.
- **reasoning_complete_session** — Mark a reasoning session as finished, recording its final conclusion. Optionally also persist the conclusion as a long-term memory so it can be recalled later without replaying the full trace.

Args:
  - session_id (string, required): The session id.
  - conclusion (string, required): The final answer/decision reached.
  - status ('completed'|'abandoned', default 'completed'): Use 'abandoned' if the task was dropped without a real conclusion.
  - save_as_memory (boolean, default false): If true, also create a memory with this conclusion.
  - memory_mode ('auto'|'always'|'never', optional): 'auto' (default) does NOT save a memory on its own — a memory is only created when save_as_memory=true or memory_mode='always'; 'never' skips saving and requires not_saved_reason.
  - memory_type (optional): Memory type to use when a completion is persisted.
  - memory_importance (optional): Importance to use when a completion is persisted.
  - memory_tags (string[], default []): Tags for the created memory.
  - not_saved_reason (optional): Required when memory_mode='never'.
  - used_memory_ids (string[], default []): Ids of memories that actually helped during this session (e.g. from related_memories returned by reasoning_start_session). The server records a 'used' usage-feedback event for each.

Returns: JSON with the updated session, created memory id if any, usage-feedback count, and skip warnings when memory is not saved.

Error Handling:
  - Returns "Error: Session '<id>' not found" if the id does not exist.
  - Returns an error if the session was already completed/abandoned (finalize only once).
- **get_usage_guide** — Return the versioned GUIDELINES.md file that defines how an agent should use this MCP.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "memory-mcp-server": {
    "command": "npx",
    "args": ["-y","@nhatnguyen9317/memory-mcp-server"],
    "env": {
      "MEMORY_DB_PATH": "",
      "MEMORY_SESSION_TTL_HOURS": "",
      "MEMORY_AUTO_RECALL_LIMIT": "",
      "MEMORY_WORKSPACE": "",
      "MEMORY_TELEMETRY": ""
    }
  }
}
```

**Requires environment variables:** `MEMORY_DB_PATH`, `MEMORY_SESSION_TTL_HOURS`, `MEMORY_AUTO_RECALL_LIMIT`, `MEMORY_WORKSPACE`, `MEMORY_TELEMETRY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What @nhatnguyen9317/memory-mcp-server does

@nhatnguyen9317/memory-mcp-server gives an agent durable local memory and task-level reasoning records through MCP. It stores data in SQLite with full-text search, allowing an agent to retrieve saved memories, inspect individual records, update stale information, and review earlier reasoning sessions.

The server is designed around a reasoning-session workflow. At the start of a non-trivial task, the agent opens a session and receives related memories based on the task title. During the task, it records thoughts, actions, and observations. At completion, it saves a conclusion and can optionally turn that conclusion into a reusable memory.

## How it works

The server runs locally over stdio and does not provide a network service. A SQLite database holds memories, sessions, reasoning steps, and usage feedback. Full-text search ranks recall using factors including term coverage, relevance, workspace, and recency.

`reasoning_start_session` can accept the project workspace and returns related memories, open sessions, and any stale sessions automatically abandoned during cleanup. A session can contain individual reasoning steps or batches of up to 20 steps. `reasoning_find` searches earlier session titles, conclusions, and step text, or reads a complete session by ID.

When a session is completed, the agent supplies a conclusion and may save it as a long-term memory. It can also identify which recalled memories were useful through `used_memory_ids`. That usage feedback is stored locally regardless of the telemetry setting.

## Setup and configuration

Node.js 22.5.0 or newer is required because the server uses the built-in `node:sqlite` API. Start it with `npx -y @nhatnguyen9317/memory-mcp-server` in an MCP client's stdio configuration.

The database defaults to `~/.memory-mcp-server/memory.db`. Set `MEMORY_DB_PATH` to use another location, including a project-local file for hard isolation. `MEMORY_SESSION_TTL_HOURS` controls stale-session cleanup, while `MEMORY_AUTO_RECALL_LIMIT` sets the number of memories returned at session start. `MEMORY_WORKSPACE` supplies a default workspace identity; an explicit workspace passed to `reasoning_start_session` takes precedence. Set `MEMORY_TELEMETRY=on` to record local diagnostic events for SQL inspection.

## Tools and capabilities

- Search memories by topic with `memory_search`, or retrieve one record with `memory_get`.
- Correct selected memory fields with `memory_update`, including incremental tag and metadata changes.
- Record whether a recalled memory was used, ignored, irrelevant, stale, or unsafe with `memory_record_usage_feedback`.
- Start, extend, find, and complete reasoning sessions with the `reasoning_*` tools.
- Save a completed session's conclusion as a memory when appropriate.
- Read the versioned agent usage instructions with `get_usage_guide`.

## Limitations and notes

The server is local-only and communicates over stdio. Node may print an experimental-warning message because `node:sqlite` is experimental in Node 22. A session should be used for multi-step work; simple lookups can use `memory_search` directly. Agents should pass the actual project path as the session workspace because the server's home directory or `/` is treated as an unknown project. Shared databases prefer memories from the active workspace, while a database placed inside a project provides hard isolation.

_Full upstream README: https://allmcps.com/mcp/nhatnguyen9317-memory-mcp-server/readme_

