Semantic Mesh Memory (SEM) MCP Server
Provides a coherent memory layer for LLM agents that models beliefs as nodes in a constraint network to detect and surface semantic contradictions. It uses local embeddings and a hybrid geometric-logical energy model to identify conflicting information that requires review.
README
@sem/mcp-server
Coherent Memory for LLM Agents
A memory layer that detects contradictions and surfaces them for review. Unlike append-only logs or RAG retrieval, this system models beliefs as nodes in a constraint network where semantic similarity implies expected agreement.
What it does
When you store beliefs, the system:
- Embeds them locally (Xenova/all-MiniLM-L6-v2, no API calls)
- Auto-links to similar existing beliefs
- Computes strain using hybrid geometric-logical energy
- Surfaces contradictions when beliefs conflict
Installation
# Install globally
npm install -g @sem/mcp-server
# Or run via npx
npx @sem/mcp-server
Claude Code / MCP Configuration
Add to your mcp_servers.json:
{
"mcpServers": {
"sem-memory": {
"command": "npx",
"args": ["@sem/mcp-server"],
"env": {
"SEM_DATA_DIR": "/path/to/your/memory"
}
}
}
}
Tools
memory_add
Add a belief to memory.
memory_add({
belief: "The user prefers dark mode",
source: "settings conversation",
confidence: 0.9
})
// Returns: { id, autoLinked, contradictions }
memory_query
Search for relevant beliefs.
memory_query({ topic: "user preferences", limit: 5 })
// Returns: { beliefs: [...], contradictions: [...] }
Each belief includes:
relevance: How relevant to the querystrain: Coherence tension (higher = needs attention)status: 'stable' | 'needs_review' | 'high_tension'
memory_contradictions
Get all current contradictions.
memory_contradictions()
// Returns pairs of conflicting beliefs
memory_link
Explicitly define a relationship between beliefs.
memory_link({
sourceId: "sem_123",
targetId: "sem_456",
relation: "contradicts" // or: supersedes, elaborates, related, caused, caused_by
})
memory_forget
Remove a belief.
memory_forget({ id: "sem_123" })
memory_stats
Get memory health metrics.
memory_stats()
// Returns: { totalBeliefs, totalEdges, stable, needsReview, highTension, energy... }
How Strain Works
The system uses a hybrid energy model:
Logical Energy (E_logic)
- Positive constraints: Penalize disagreement between related beliefs
- Negative constraints: Penalize co-acceptance of contradicting beliefs
Geometric Energy (E_geom)
- Spring energy based on embedding distance vs. rest length
- Beliefs that drift apart semantically create tension
Total Energy: E_total = E_logic + λ * E_geom
High-strain beliefs are flagged as needs_review or high_tension.
Data Storage
By default, beliefs are stored in .sem-data/memory-index.jsonl. Set SEM_DATA_DIR env var to customize.
Theory
Based on Thagard & Verbeurgt's "Coherence as Constraint Satisfaction" - coherence is modeled as maximizing satisfaction of positive/negative constraints between elements.
See: Semantic Mesh Memory (paper)
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.