PAI Memory MCP Server
Enables semantic and keyword search across AI work sessions, learnings, reflections, failures, research, and relationships stored in PAI's MEMORY directory.
README
PAI Memory MCP Server
Semantic and keyword search across your AI work sessions, learnings, reflections, failures, research, and relationships. Built for PAI (Personal AI Infrastructure).
What It Does
Indexes your PAI MEMORY/ directory into a searchable SQLite database with:
- Keyword search via FTS5 (full-text search) — works offline, no dependencies
- Semantic search via LM Studio embeddings — meaning-based retrieval using
nomic-embed-text-v1.5 - MCP server exposing 7 tools for cross-tool access via Model Context Protocol
Supported Memory Types
| Type | Source | Description |
|---|---|---|
work |
MEMORY/WORK/ |
Work sessions with META.yaml, tasks, and markdown notes |
learning |
MEMORY/LEARNING/ALGORITHM/, SYSTEM/ |
Algorithm execution and system learnings |
reflection |
MEMORY/LEARNING/REFLECTIONS/ |
JSONL self-assessment after each task |
rating |
MEMORY/LEARNING/SIGNALS/ |
JSONL session ratings with sentiment |
failure |
MEMORY/LEARNING/FAILURES/ |
Context dumps from low-rated sessions |
research |
MEMORY/RESEARCH/ |
Research output files |
relationship |
MEMORY/RELATIONSHIP/ |
Relationship memory notes |
Installation
cd ~/.claude/MCPs/pai-memory
bun install
CLI Usage
# Index all MEMORY/ content into SQLite
bun cli.ts index
# Search (semantic if LM Studio running, keyword fallback)
bun cli.ts search "hook performance"
# Generate embeddings via LM Studio
bun cli.ts embed
# Show database statistics
bun cli.ts stats
MCP Tools
When registered as an MCP server, exposes these tools:
| Tool | Description |
|---|---|
memory_search |
Semantic/keyword search across all memory types |
memory_recent_work |
List recent work sessions with status filter |
memory_recent_learnings |
List recent learnings with category filter |
memory_get_work |
Get full details of a specific work entry |
memory_stats |
Database statistics — entry counts, size, embedding coverage |
memory_failures |
List recent failure analyses |
memory_reflections |
List algorithm performance reflections |
MCP Registration
Add to your .mcp.json:
{
"mcpServers": {
"pai-memory": {
"command": "bun",
"args": ["run", "mcp-server.ts"],
"cwd": "/path/to/pai-memory"
}
}
}
Architecture
cli.ts CLI entry point (index, search, embed, stats)
mcp-server.ts MCP server (7 tools via StdioServerTransport)
src/
types.ts Shared types (MemoryEntry, SearchResult, MemoryStats)
db.ts SQLite layer (FTS5 + cosine similarity + embeddings)
memory-reader.ts Filesystem parser (YAML, JSON, JSONL, Markdown)
search.ts Unified search (semantic first, keyword fallback)
embedder.ts LM Studio embedding client (nomic-embed-text-v1.5)
data/
pai-memory.db SQLite database (generated, not committed)
Requirements
- Bun runtime
- PAI with populated
MEMORY/directory - Optional: LM Studio with
nomic-embed-text-v1.5for semantic search
License
MIT
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.