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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。