- Home
- MCP servers
- Knowledge Graph
Knowledge Graph
- javascript
16
GitHub Stars
javascript
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"n-r-w-knowledgegraph-mcp": {
"command": "npx",
"args": [
"-y",
"knowledgegraph-mcp"
],
"env": {
"KNOWLEDGEGRAPH_SQLITE_PATH": "/path/to/db.sqlite",
"KNOWLEDGEGRAPH_STORAGE_TYPE": "sqlite",
"KNOWLEDGEGRAPH_CONNECTION_STRING": "postgresql://user:pass@host:5432/dbname"
}
}
}
}You can give your LLMs persistent memory across conversations by running a Knowledge Graph MCP Server. It stores entities, relations, observations, and tags in a database so your AI can remember people, projects, technologies, and preferences, and then query that information efficiently across sessions and projects.
How to use
To use the Knowledge Graph MCP Server with a client, you run the MCP as a local or remote service and connect your LLM client to it. You can choose a lightweight NPX-based setup for quick testing, or run via Docker for isolation and persistence. The server supports multiple backends (SQLite for local use or PostgreSQL for production). After starting the MCP, you can create entities, define relations, add observations, and tag entities to enable fast, fuzzy searches and project-scoped data access.
Typical usage patterns include creating a person entity with a role, linking a project, and then querying who is available or who leads a particular project. Use the search features to locate entities by text or by exact tags, and use pagination to navigate large datasets. All operations are performed through the MCP client prompts and tool integrations in your Claude Desktop or VS Code setup.
How to install
Prerequisites: you need Node.js (for NPX usage) and Docker if you plan to run the containerized setup. Ensure you have a PostgreSQL server if you choose the PostgreSQL backend.
# NPX installation (easiest test)
npx knowledgegraph-mcp --help
Option A and Option B below show two common installation paths. Choose one and follow the exact commands.
# Option B: Docker (clone not required for the build example)
# Build the image from the source for your environment
git clone https://github.com/n-r-w/knowledgegraph-mcp.git
cd knowledgegraph-mcp
docker build -t knowledgegraph-mcp .
Additional setup and configuration
Choose your storage backend and then configure the MCP client to connect. SQLite is the default and requires no separate database installation. PostgreSQL is recommended for production and multiple users.
{
"mcpServers": {
"Knowledge Graph": {
"command": "npx",
"args": ["-y", "knowledgegraph-mcp"]
}
}
}
If you prefer Docker, run with a volume to persist data between runs.
{
"mcpServers": {
"Knowledge Graph": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "[you home folder]/.knowledge-graph:/app/.knowledge-graph",
"knowledgegraph-mcp"
]
}
}
}
To use PostgreSQL, set the storage type and connection string in the environment for the runtime.
{
"mcpServers": {
"Knowledge Graph": {
"command": "npx",
"args": ["-y", "knowledgegraph-mcp"],
"env": {
"KNOWLEDGEGRAPH_STORAGE_TYPE": "postgresql",
"KNOWLEDGEGRAPH_CONNECTION_STRING": "postgresql://postgres:yourpassword@localhost:5432/knowledgegraph"
}
}
}
}
Security and best practices
Keep your PostgreSQL password secure and avoid exposing it in public configurations. Use a dedicated database per project to maintain isolation and set strong access controls. Rotate credentials regularly and monitor access logs for unusual activity.
Troubleshooting and notes
If you run into issues during setup or usage, verify that the storage backend is reachable, the database exists (knowledgegraph for PostgreSQL), and that the MCP client is correctly pointing to the MCP server. Check for input validation errors when creating entities, relations, or observations, and use the provided troubleshooting guidance to diagnose problems.
Available tools
create_entities
CREATE new entities with at least one observation; entities with existing names are ignored — use add_observations to update
create_relations
CONNECT entities to enable discovery queries; include from, to, and relationType in active voice
add_observations
ADD factual observations to existing entities; target entity must exist and each update must include at least one observation
add_tags
ADD status or category tags for instant filtering; tags are exact-match and case-sensitive
read_graph
RETRIEVE the complete knowledge graph for a project to understand current state and connections
search_knowledge
SEARCH entities by text or tags with exact and fuzzy modes and pagination
open_nodes
RETRIEVE specific entities by exact names along with interconnections
delete_entities
PERMANENTLY DELETE entities and all their relationships
delete_observations
REMOVE specific observations from entities while preserving the rest
delete_relations
UPDATE relationship structure when connections change to maintain accuracy
remove_tags
REMOVE outdated tags from entities to keep search results meaningful