knowledgegraph
MCP server for enabling persistent knowledge storage for Claude through a knowledge graph with multiple storage backends and fuzzy search
claude mcp add --transport stdio n-r-w-knowledgegraph-mcp npx -y knowledgegraph-mcp
How to use
The KnowledgeGraph MCP Server provides a persistent memory layer for LLMs by exposing a knowledge graph that can store entities, relations, and metadata across conversations. It supports multiple storage backends (SQLite by default for local use, PostgreSQL for production-grade workloads) and can automatically isolate data per project. With this server, Claude, VS Code, or other clients can remember people, projects, and preferences, and perform rich search queries over the stored graph using fuzzy matching and paginated results. Tools and prompts are organized to help you manage entities, relations, and queries (e.g., create a person entity, link a project to a person, or search for all projects led by a specific individual).
To use it, run the MCP server via NPX (no installation required) or via Docker if you prefer containerized deployment. Then configure your client (Claude Desktop or VS Code) to point at the Knowledge Graph MCP, using the provided JSON in their settings. Once connected, you can issue natural-language prompts like: remember a preference, add a relation between a person and a project, or find all entities related to a given project. The LLM can leverage the graph for targeted recall, improved consistency across sessions, and more context-aware reasoning.
How to install
Prerequisites:
- Node.js and npm installed (for NPX usage) or Docker if you prefer containerized deployment
- Optional: PostgreSQL installed if you plan to use PostgreSQL storage
Install and run using NPX (no download required):
- Ensure you have Node.js installed and npm available in your PATH
- Run the MCP server directly: npx knowledgegraph-mcp --help
If you want to run via Docker:
- Clone the repository (or use the published image when available): git clone https://github.com/n-r-w/knowledgegraph-mcp.git cd knowledgegraph-mcp
- Build and run the container: docker build -t knowledgegraph-mcp . docker run -i --rm knowledgegraph-mcp
Database options:
- SQLite (default): No setup needed. Database file is created automatically in your home folder under .knowledge-graph/ (knowledgegraph.db).
- PostgreSQL: Install PostgreSQL, create a database (e.g., knowledgegraph), and supply a connection string via environment variables (see configuration examples below).
Client configuration is described in the README: choose NPX + SQLite (default) or Docker + SQLite, or configure PostgreSQL via environment variables when using NPX or Docker.
Additional notes
Environment variables to customize storage:
- KNOWLEDGEGRAPH_STORAGE_TYPE: sqlite (default) or postgresql
- KNOWLEDGEGRAPH_CONNECTION_STRING: the PostgreSQL connection string, e.g. postgresql://user:pass@host:5432/knowledgegraph
- KNOWLEDGEGRAPH_SQLITE_PATH: optional path for the SQLite database, e.g. /path/to/your/knowledgegraph.db
Common issues:
- For Docker + PostgreSQL, ensure the database exists and the connection string is correct; if problems arise, try the alternative configuration shown in the README.
- If you see connection errors in VS Code, verify the network settings and environment variable propagation in your container or host.
Prompts and usage:
- Use prompts like: remember that I prefer morning meetings, or find all people who work at a given company to test search and relations.
- You can define entity types and relation types to tailor the graph to your domain (e.g., person, project, organization, role, etc.).
Related MCP Servers
claude-talk-to-figma
A Model Context Protocol (MCP) that allows Claude Desktop and other AI tools (Claude Code, Cursor, Antigravity, etc.) to read, analyze, and modify Figma designs
mcp -azure-devops
An MCP server for Azure DevOps
mcp -templates
A flexible platform that provides Docker & Kubernetes backends, a lightweight CLI (mcpt), and client utilities for seamless MCP integration. Spin up servers from templates, route requests through a single endpoint with load balancing, and support both deployed (HTTP) and local (stdio) transports — all with sensible defaults and YAML-based configs.
memory
A MCP (Model Context Protocol) server providing long-term memory for LLMs
zip
An MCP tool that provides AI with the ability to compress and decompress local files.
claude-code-agentic-semantic-memory-system
This guide provides complete instructions for implementing an **Agentic Semantic Memory System** that enables Claude agents to: