# megg [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/toruai/megg  
**GitHub Stars:** 5  
**npm Downloads (last month):** 10157  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/megg

## Description
Git-native memory for AI agents — markdown knowledge in .megg/ folders that travels with your repo. MCP server + CLI for Claude Code.

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

```json
"mcpServers": {
  "megg": {
    "command": "npx",
    "args": ["-y","megg"]
  }
}
```

## Documentation

## What the megg MCP server does

The megg MCP server gives AI assistants repository-local memory through Markdown files stored in `.megg/` folders. Knowledge stays beside the code it describes, so teams can version it with Git, review changes in pull requests, and edit it without a separate database.

The megg MCP server supports hierarchical context. A company or repository root can define broad rules, while product, client, or feature directories add more specific information. When context is requested for a target path, parent knowledge is loaded together with the target's information.

Knowledge entries can represent rules, facts, decisions, or processes. This makes the Knowledge & Memory category a good fit for technical conventions, architectural choices, client requirements, and repeatable procedures.

## How it works

A project typically contains `.megg/info.md` for identity and rules, `knowledge.md` for durable learnings, and `state.md` for temporary session handoff. The CLI and MCP interface read and write these files rather than storing memory in a machine-local service.

The `context` operation loads the relevant hierarchy and can filter entries by topic, such as `auth`, `api`, or `security`. Loading is size-aware: smaller knowledge sets are returned in full, medium-sized sets use a summary and topic index, and sets above the documented limit are blocked until maintenance is run.

Session state is separate from permanent knowledge. It is intended for passing unfinished work between sessions, has a two-thousand-token hard limit, and automatically expires after 48 hours. The `/megg-state` skill provides capture, display, and clear actions in Claude Code.

## Setup and configuration

Install the package globally with `npm install -g megg`, then run `megg setup` for Claude Code. The setup command registers the MCP server, installs the `/megg-state` skill, and configures a SessionStart hook for automatic context loading.

Run `megg init` from a project directory to create its initial `.megg/` files. Use `megg context` to inspect the resulting context. Manual Claude Desktop configuration can register the server with `npx -y megg@latest`; automatic loading can also be configured through a Claude hook that invokes `megg context --json`.

## Tools and capabilities

The megg MCP server exposes five core tools:

- `context(path?, topic?)` loads inherited context, knowledge, and session state.
- `learn(title, type, topics, content)` adds a structured knowledge entry.
- `init()` creates the local `.megg/` structure.
- `maintain()` checks and cleans up oversized knowledge.
- `state(content?, status?)` reads, writes, or clears ephemeral session state.

The same functions are available through CLI commands, including topic-filtered context loading, adding decisions or rules, checking knowledge health, and clearing session state. The implementation uses standard MCP communication and can be used with Claude Code, Claude Desktop, and other MCP-compatible assistants.

## Limitations and notes

Memory is stored in repository files, so users must decide which `.megg/` content belongs in version control and should be shared. The approach does not provide a hosted synchronization service or an external vector or graph store.

Knowledge larger than 16,000 tokens is blocked until `maintain()` is used, while knowledge between 8,000 and 16,000 tokens is summarized with a topic index. Session state is temporary and should not replace durable entries in `knowledge.md`.

The documented setup is centered on Node.js package installation, the CLI, and MCP clients. The README specifically describes Claude Code and Claude Desktop workflows; other client behavior depends on their MCP support and configuration model.

_Full upstream README: https://allmcps.com/mcp/megg/readme_

