claude-legal-persistent-memory-pl
Persistent memory server for AI assistants that stores notes with categories and tags, and enables full-text recall across sessions.
README
claude-legal-persistent-memory-pl
MCP server providing persistent memory for AI legal assistants — remember facts between sessions, recall them with full-text search. Built for Polish law practice, works with any Claude deployment.
Part of the KTZR AI ecosystem.
⚠️ Security — protect your endpoint
Never expose this server without authentication. The /mcp endpoint gives any caller full read/write access to your memory database (client data, negotiation positions, case facts).
Recommended guards — pick one or combine:
| Method | How |
|---|---|
| Secret token in URL | Deploy behind a reverse proxy that requires /mcp/<secret> and strips it before forwarding |
| IP allowlist | Cloud Run → --ingress=internal-and-cloud-load-balancing + Cloud Armor policy |
| VPC + IAP | Route through Identity-Aware Proxy; requires Google account auth |
| Cloud Run auth | Remove --allow-unauthenticated; use Authorization: Bearer $(gcloud auth print-identity-token) in the MCP connector |
This repo ships with no auth by default (URL obscurity only) — suitable for local/testing use. Add a guard before any production deployment.
Tools
| Tool | Description |
|---|---|
remember(content, category, case_ref?, tags?) |
Store a note in long-term memory |
recall(query, category?, case_ref?, limit?) |
Full-text AND search across stored notes |
list_categories() |
Summary of stored notes by category |
Categories: klient · negocjacje · klauzule · ryzyka · precedensy · misc
Quick start (local, SQLite)
pip install .
legal-memory # starts stdio transport — no server, no auth needed
Add to Claude Code (~/.claude/mcp.json):
{
"legal-memory": {
"type": "stdio",
"command": "legal-memory"
}
}
Local stdio mode never exposes a network port — no auth required.
Cloud Run deployment
# Build and deploy
gcloud run deploy claude-legal-memory \
--source . \
--region europe-west4 \
--set-env-vars DATABASE_URL="postgresql+asyncpg://user:pass@/db?host=/cloudsql/project:region:instance" \
--allow-unauthenticated # ← add a guard here in production
# Connect Claude Code
# .claude/mcp.json:
# {
# "legal-memory": {
# "type": "http",
# "url": "https://<your-cloud-run-url>/mcp"
# }
# }
Configuration
| Env var | Default | Description |
|---|---|---|
DATABASE_URL |
sqlite+aiosqlite:///legal_memory.db |
Database connection string |
PORT |
8080 |
HTTP port (Cloud Run sets this automatically) |
The server auto-detects the transport:
K_SERVICEorPORTset →streamable-http(Cloud Run / remote)- Neither set →
stdio(local — recommended for single-user setups)
Database
Works with SQLite (local, zero config) and PostgreSQL (production).
| Backend | URL format |
|---|---|
| SQLite | sqlite+aiosqlite:///legal_memory.db |
| PostgreSQL | postgresql+asyncpg://user:pass@host/dbname |
| Cloud SQL | postgresql+asyncpg://user:pass@/dbname?host=/cloudsql/project:region:instance |
Related
- commercial-legal-pl — Polish commercial law skill for Claude (uses this server for persistent memory)
- legal-cite-pl — MCP server for verifying Polish & EU legal citations
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.