Skip to main content

An MCP Server to store and retreive project information from memory file

Project description

Project Memory MCP

An MCP server and Claude Code plugin for persistent project memory. Allows AI agents to maintain knowledge about projects between conversations via MEMORY.md files.

Features

  • Store & retrieve project knowledge in Markdown format
  • Incremental updates via SEARCH/REPLACE patches
  • Auto-read hook — automatically loads project memory on first prompt (Claude Code plugin)
  • Dream consolidation — automatic project memory cleanup and deduplication (Claude Code plugin)

Installation

Claude Code Plugin (recommended)

Installs the MCP server, auto-read hook, and dream consolidation:

/plugin marketplace add /path/to/project-mem-mcp
/plugin install project-mem@cc-plugin-project-mem

Standalone MCP Server

For Codex, Claude Desktop, Cursor, or other MCP clients:

uvx project-mem-mcp

MCP Client Configuration

{
  "mcpServers": {
    "project-mem-mcp": {
      "command": "uvx",
      "args": [
        "project-mem-mcp",
        "--allowed-dir", "/path/to/your/projects"
      ]
    }
  }
}

The --allowed-dir argument restricts which directories the server can access. Can be used multiple times. Defaults to the current working directory if omitted.

Install from Source

git clone https://github.com/pynesys/project-mem-mcp.git
cd project-mem-mcp
python -m venv venv
source venv/bin/activate
pip install -e .

Tools

get_project_memory

Retrieves MEMORY.md content. With no extra args, returns the whole file. The server raises ValueError if the file would exceed ~20K estimated tokens (below most clients' tool-result caps); use head_only or offset/limit to pull what you need.

get_project_memory(
    project_path: str,
    offset: int = 0,           # 1-indexed start line; 0 = from start
    limit: int | None = None,  # max lines to return
    head_only: bool = False,   # return only size + heading TOC
) -> str

Typical large-file pattern: call once with head_only=True to get size and a section TOC (line ranges), then fetch sections via offset/limit.

search_project_memory

Substring search inside MEMORY.md. Case-insensitive. Returns matching lines with 1-indexed line numbers; combine with get_project_memory(offset, limit) to fetch surrounding context for a hit.

search_project_memory(
    project_path: str,
    query: str,
    max_results: int = 50,
) -> str

set_project_memory

Overwrites the entire MEMORY.md. Use when creating a new project memory or when patches fail.

set_project_memory(project_path: str, project_info: str)

update_project_memory

Applies a single SEARCH/REPLACE patch to MEMORY.md:

update_project_memory(project_path: str, patch_content: str)

Patch format:

<<<<<<< SEARCH
Text to find in the project memory file
=======
Text to replace it with
>>>>>>> REPLACE

The search text must appear exactly once in the file. Use empty replacement to remove content.

Plugin Features

When installed as a Claude Code plugin, you also get:

Project-memory Skill (auto-trigger)

Guides Claude on when and how to save to project memory. Automatically triggers when insights worth persisting are discovered — architecture decisions, gotchas, non-obvious patterns, current work context. The skill is marked user-invocable: false so it does not appear in the slash command picker; the main model invokes it autonomously.

Auto-read Hook

Automatically reads MEMORY.md into context on the first prompt of each session. No manual tool call needed.

Dream Consolidation

Automatic project memory maintenance triggered after writes when:

  • File size exceeds 50KB
  • Last consolidation was more than 24 hours ago

The dream spawns a sonnet subagent that:

  • Removes content duplicated in CLAUDE.md files
  • Restructures for clarity and LLM readability

No backup is written; use git to recover the pre-dream state if needed.

Manual trigger: /dream

The last-dream timestamp is stored as last_dream: inside a YAML frontmatter block at the top of MEMORY.md. Projects previously using this plugin may still have a .claude/.last-dream-timestamp file — that file is now ignored and can be safely deleted (the first dream run after upgrade repopulates the frontmatter).

Security

  • Project paths are validated against --allowed-dir arguments
  • Project memory files should never contain sensitive information
  • Project memory files must be in English

Dependencies

  • fastmcp (>=3.2.0, <4.0.0)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

project_mem_mcp-0.4.8.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

project_mem_mcp-0.4.8-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file project_mem_mcp-0.4.8.tar.gz.

File metadata

  • Download URL: project_mem_mcp-0.4.8.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for project_mem_mcp-0.4.8.tar.gz
Algorithm Hash digest
SHA256 d253d1aedd6470222f2aab7291e71c2440bd223b0d79a9bd582e6903e5636241
MD5 ac6e9b0853dc77704e4fde2e8a5558e0
BLAKE2b-256 9551b6a10661f9f7dbec7e21d146444e6b43b2fdf2a7ba0328a57dfe49e2f988

See more details on using hashes here.

File details

Details for the file project_mem_mcp-0.4.8-py3-none-any.whl.

File metadata

File hashes

Hashes for project_mem_mcp-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d3245ced35bad5fa9b963a6b80f4472d4d2f7f8ae76b86adf1edb6ab216d1812
MD5 b8caaa1f57798a66fdd22b72aea59fd7
BLAKE2b-256 ad9f4846cad780fd395082ed35822d1ee8ef67d49cb23fe9371de922c43f406c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page