Lightning Memory logo

Lightning Memory

Persistent local-first memory for Lightning agents with Nostr sync, payment checks, and vendor intelligence over MCP.

Install Lightning Memory

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "lightning-memory": {
      "command": "uvx",
      "args": [
        "lightning-memory"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Claude Code command
claude mcp add --transport stdio lightning-memory -- uvx lightning-memory

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

uvx lightning-memory

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The lightning-memory MCP server gives agents persistent memory for Lightning and L402 activity, storing transactions, vendors, preferences, errors, and decisions locally. It uses SQLite with FTS5 search and optional ONNX semantic search, and can synchronize memories with Nostr relays as NIP-78 events. Additional tools evaluate vendor reputation, spending, payment anomalies, budgets, trust, and compliance. Reach for it when an MCP-compatible agent needs local memory and payment-aware safeguards rather than session-only context.

Use cases

  • Store and retrieve an agent's Lightning transaction history
  • Check vendor reputation before paying an L402 invoice
  • Detect unusual payment amounts against historical spending
  • Enforce per-vendor spending limits
  • Synchronize agent memories through Nostr relays

Key features

  • SQLite memory storage with FTS5 search
  • Optional semantic search through ONNX
  • Nostr relay synchronization and NIP-78 export
  • Lightning vendor, budget, and anomaly analysis
  • Payment preflight checks
  • L402 gateway access for remote queries

Tools6

What Lightning Memory lets your agent do. Expand a tool for its parameters.

Self-reported~82 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

15/15 checks healthy over the last 88d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 2d ago via OSV.dev · lightning-memory (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars9Stargazers on the source repository.
Last commit8mo agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.
Tools exposed6Callable tools this server registers over MCP.

How Lightning Memory works

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:

Terminal
pip install lightning-memory
lightning-memory

For Claude Code, configure the command directly:

config.json
{
  "mcpServers": {
    "lightning-memory": {
      "command": "lightning-memory"
    }
  }
}

Claude Desktop can start the module with Python:

config.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.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Lightning Memory

lightning-memory is an MCP server that connects AI agents to local SQLite memory and optional Nostr relay synchronization. Its main tools store, query, list, edit, sync, and export memories, while Lightning tools analyze vendors, spending, anomalies, budgets, trust, and payment preflight decisions for L402-related activity.

Install it with `pip install lightning-memory`, then run `lightning-memory` to start the MCP server. Claude Code can invoke that command directly, while Claude Desktop can start `python -m lightning_memory.server` through its MCP configuration.

Yes, the local-first memory store works offline because it uses SQLite locally. Nostr synchronization and remote gateway operations require network access, but local memory storage and search do not depend on those features.

Yes, `ln_preflight` checks a proposed payment using budget, anomaly, and trust information before payment. Related tools set vendor limits, report spending against those limits, inspect vendor reputation, and identify unusually high amounts.

Install the gateway extra with `pip install lightning-memory[gateway]`, run Phoenixd locally, configure its password, and start `lightning-memory-gateway`. The gateway accepts Lightning micropayments for selected memory, vendor, spending, anomaly, trust, budget, and compliance operations.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewLightning Memory AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/lightning-memory?style=directory)](https://allmcps.com/mcp/lightning-memory)
HTML Embed
<a href="https://allmcps.com/mcp/lightning-memory"><img src="https://allmcps.com/api/badge/lightning-memory?style=directory" alt="Lightning Memory on AllMCPs" /></a>