# lightning-memory [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/singularityjason/lightning-memory  
**GitHub Stars:** 9  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/lightning-memory

## Description
Decentralized agent memory for the Lightning economy. Nostr identity, L402 payments.

## Tools
Capabilities this server exposes over MCP:

- **memory_store** — Store a memory (transaction, vendor, preference, error, decision)
- **memory_query** — Search by relevance (FTS5 + optional semantic search)
- **memory_list** — List memories with type/time filters
- **memory_edit** — Edit content or metadata with audit trail
- **memory_sync** — Sync with Nostr relays (push/pull)
- **memory_export** — Export as NIP-78 Nostr events

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

```json
"mcpServers": {
  "lightning-memory": {
    "command": "uvx",
    "args": ["lightning-memory"]
  }
}
```

## Documentation

## What lightning-memory does

The lightning-memory MCP server provides persistent memory for agents operating around Bitcoin, Lightning, and L402 payments. It records structured memories such as transactions, vendor observations, preferences, errors, and decisions, then makes them searchable across sessions.

The server also exposes Lightning-focused analysis and safety operations. Agents can inspect vendor reputation, summarize spending, check whether a proposed amount is unusual, set vendor budgets, and run a pre-payment check combining budget, anomaly, and trust information. Trust and compliance features include vendor trust profiles, Nostr trust attestations, KYA agent attestations, LNURL-auth session records, agent verification, and compliance report generation.

A separate gateway mode lets other agents access selected memory and Lightning operations through L402 micropayments. Gateway operations include memory queries, vendor reports, spending summaries, anomaly checks, preflight checks, trust profiles, budget information, and compliance exports.

## How it works

The lightning-memory MCP server uses a local SQLite store. Full-text search is provided through FTS5, while optional ONNX support adds semantic search. Search results can use recency weighting, deduplication, contradiction detection, noise filtering, and access tracking.

Agent identity is represented by a Nostr keypair using BIP-340 rather than an account or API key. Memories can be synchronized with Nostr relays as NIP-78 events, allowing export and relay-based sharing. The memory tools include storing, querying, listing, editing with an audit trail, synchronizing, and exporting memories.

For remote access, the optional gateway presents HTTP endpoints protected by L402 payments. A requesting agent receives an invoice, pays it over Lightning, and sends the resulting authorization token with its request. The gateway can use Phoenixd for invoice creation and payment verification.

## Setup and configuration

Install the package with Python 3.10 or later:

```bash
pip install lightning-memory
lightning-memory
```

For Claude Code, configure the command directly:

```json
{
  "mcpServers": {
    "lightning-memory": {
      "command": "lightning-memory"
    }
  }
}
```

Claude Desktop can start the module with Python:

```json
{
  "mcpServers": {
    "lightning-memory": {
      "command": "python",
      "args": ["-m", "lightning_memory.server"]
    }
  }
}
```

The MCP server is described as zero-configuration and local-first. Gateway mode is installed separately with `pip install lightning-memory[gateway]` and started with `lightning-memory-gateway`. Gateway users need Phoenixd running locally and must provide its password through the documented configuration file or the `PHOENIXD_PASSWORD` environment variable when using Docker Compose.

## Tools and capabilities

Memory operations:

- Store, search, list, edit, synchronize, and export memories.
- Filter listings by memory type and time.
- Export memories as NIP-78 Nostr events.

Lightning intelligence and safety:

- Calculate vendor reputation from transaction history.
- Summarize spending by vendor and protocol.
- Detect unusually high payment amounts.
- Set and check per-vendor transaction, daily, and monthly limits.
- Run a preflight decision before a payment.

Trust, compliance, and marketplace operations include Nostr trust attestations, agent verification, LNURL-auth records, compliance exports, remote gateway discovery, and paid queries to remote gateways.

## Limitations and notes

Semantic search is optional; the base search path uses SQLite FTS5. Relay synchronization depends on configured Nostr relays, while remote gateway access requires Lightning payments. The MCP installation is separate from gateway deployment, and gateway operation requires a Phoenixd setup with funded Lightning capacity.

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

