SM

shuruheel/mcp-engram

部署与 DevOps

本页由 AI 翻译,技术细节请以原文为准。 查看原文

24 stars 5 forks 质量 79 趋势 18MIT

一个复杂的知识图谱记忆系统,存储具有丰富语义结构的相互关联信息。

概览

一个模型上下文协议(MCP)服务器,用于构建和探索受认知神经科学启发的知识图谱。基于人类思维结构,建模思维、情感、推理和情节记忆。支持SQLite——零基础设施,磁盘单文件,离线运行。 服务器默认将数据库存储在 ~/.mcp-engram/knowledge.db。无需外部服务。 MCP服务器展示了8个工具,使LLM能够构建、搜索和遍历知识图谱: 每个工具都会声明一个输入模式(已验证)、一个输出模式和行为注释(只读与写),并返回机器可读的结构化内容以及一个JSON文本块。写入:重新创建现有节点或边会更新你提供的字段,并保留未提供的字段。 服务器还会暴露MCP提示——一个包含整体工具使用工作流程的系统提示,以及每个工具名称下的每个工具使用指南。

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,用于构建和探索受认知神经科学启发的知识图谱。基于人类思维结构,建模思维、情感、推理和情节记忆。支持SQLite——零基础设施,磁盘单文件,离线运行。

快速启动

或者全局安装:

服务器默认将数据库存储在~/.mcp-engram/knowledge.db。无需外部服务。

建筑

工作原理

MCP服务器展示了8个工具,使LLM能够构建、搜索和遍历知识图谱:

工具 目的
search_nodes 跨所有节点的全文搜索(FTS5)
explore_context 加权图绕给定节点遍历
create_nodes 创建或合并更新任意类型的节点
create_relations 创建带有上下文、权重和信心的边
add_sources 记录来源(源节点 + DERIVED_FROM链接)
get_temporal_sequence 按时间顺序排列(下一步、之前、原因)
create_reasoning_chain 构建结构化多步推理
get_reasoning_chain 按名称或主题检索推理链

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Engram — Cognitive Knowledge Graph

A Model Context Protocol (MCP) server for building and exploring a cognitive neuroscience-inspired knowledge graph. Models thought, emotion, reasoning, and episodic memory after the structure of the human mind. Backed by SQLite — zero infrastructure, single file on disk, works offline.

Quick Start

npx mcp-engram

Or install globally:

npm install -g mcp-engram
mcp-engram

The server stores its database at ~/.mcp-engram/knowledge.db by default. No external services required.

Architecture

How It Works

The MCP server exposes 8 tools that let an LLM build, search, and traverse a knowledge graph:

Tool Purpose
search_nodes Full-text search across all nodes (FTS5)
explore_context Weighted graph traversal around given nodes
create_nodes Create or merge-update nodes of any type
create_relations Create edges with context, weight, and confidence
add_sources Record provenance (Source nodes + DERIVED_FROM links)
get_temporal_sequence Follow chronological chains (NEXT, BEFORE, CAUSES)
create_reasoning_chain Build structured multi-step reasoning
get_reasoning_chain Retrieve reasoning chains by name or topic

Every tool declares an input schema (validated), an output schema, and behavior annotations (read-only vs. write), and returns machine-readable structuredContent alongside a JSON text block. Writes merge: re-creating an existing node or edge updates the fields you provide and preserves the ones you don’t.

The server also exposes MCP prompts — a system prompt with the overall tool-usage workflow, plus per-tool usage guidance under each tool’s name.

Node Types (15)

Entity, Event, Concept, Attribute, Proposition, Emotion, Agent, ScientificInsight, Law, Location, Thought, ReasoningChain, ReasoningStep, Source, EmotionalEvent

Storage

  • SQLite with WAL mode for concurrent reads
  • FTS5 virtual table for full-text search with BM25 ranking
  • Recursive CTEs for graph traversal
  • Single nodes table for all types, edges table with UNIQUE constraint, plus aliases and observations tables
  • Complex objects stored as JSON in a properties column

Installation

Prerequisites

  • Node.js v18+
  • A C/C++ toolchain for compiling the better-sqlite3 native module:
    • Mac: Xcode Command Line Tools (xcode-select --install)
    • Linux: build-essential (apt install build-essential)
    • Windows: Visual Studio Build Tools

From npm

npx mcp-engram

From source

npm install
npx nx build mcp-engram
node dist/servers/mcp-engram/main.js

Environment Variables

Variable Required Default Description
MCP_ENGRAM_DB_PATH No ~/.mcp-engram/knowledge.db Path to the SQLite database file

Integrating with Claude Desktop

在 GitHub 查看完整 README

安装

npx mcp-engram
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mcp-engram": { "command": "npx", "args": ["mcp-engram"] } } }