Litegraph
Lightweight graph database with relational, vector, and MCP support, designed to power knowledge and artificial intelligence persistence and retrieval.
Install / Use
/learn @litegraphdb/LitegraphREADME
LiteGraph
LiteGraph is a property graph database with support for graph relationships, tags, labels, metadata, data, and vectors. LiteGraph is intended to be a unified database for providing persistence and retrieval for knowledge and artificial intelligence applications.
LiteGraph can be run in-process (using LiteGraphClient) or as a standalone RESTful server (using LiteGraph.Server). For comprehensive documentation, visit litegraph.readme.io.
Repository Structure
This monorepo contains the LiteGraph database core, server, dashboard, and client SDKs:
| Directory | Description |
|-----------|-------------|
| src/ | Core LiteGraph library and server projects (.NET) |
| dashboard/ | Web-based dashboard UI (Next.js/React) |
| sdk/csharp/ | C# SDK for REST API (NuGet) |
| sdk/python/ | Python SDK for REST API (PyPI) |
| sdk/js/ | JavaScript/Node.js SDK for REST API (npm) |
| docker-litegraph/ | Docker deployment for LiteGraph Server |
| docker-mcp/ | Docker deployment for MCP Server |
New in v5.0.x
- Breaking changes: migrated all APIs to full async/await
- New MCP (Model Context Protocol) server for AI/LLM integration
AI Agent Integration
LiteGraph can be controlled by Claude and other AI agents using natural language through the Model Context Protocol (MCP). Instead of writing code, you can simply tell an AI assistant what you need — create graphs, add nodes and edges, run traversals, perform vector similarity searches, manage backups — and it executes the operations for you.
Why use AI agents with LiteGraph?
- Natural language control — describe your graph operations in plain English
- 145+ MCP tools — full database control without learning the API
- Multi-client support — works with Claude Code, Claude Desktop, Cursor, and other MCP-compatible clients
- Conversational exploration — interactively query and visualize your graph data
- Zero SDK knowledge required — the agent handles the API calls
Get started in minutes: Using Claude with LiteGraph
Bugs, Feedback, or Enhancement Requests
Please feel free to start an issue or a discussion! For detailed documentation and guides, visit litegraph.readme.io.
Simple Example, Embedded
Embedding LiteGraph into your application is simple and requires no configuration of users or credentials. Refer to the Test project for a full example, or visit the documentation for more comprehensive examples and guides.
using LiteGraph;
LiteGraphClient client = new LiteGraphClient(new SqliteRepository("litegraph.db"));
client.InitializeRepository();
// Create a tenant
TenantMetadata tenant = await client.Tenant.Create(new TenantMetadata { Name = "My tenant" });
// Create a graph
Graph graph = await client.Graph.Create(new Graph { TenantGUID = tenant.GUID, Name = "This is my graph!" });
// Create nodes
Node node1 = await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "node1" });
Node node2 = await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "node2" });
Node node3 = await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "node3" });
// Create edges
Edge edge1 = await client.Edge.Create(new Edge { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, From = node1.GUID, To = node2.GUID, Name = "Node 1 to node 2" });
Edge edge2 = await client.Edge.Create(new Edge { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, From = node2.GUID, To = node3.GUID, Name = "Node 2 to node 3" });
// Find routes
await foreach (RouteDetail route in client.Node.ReadRoutes(
SearchTypeEnum.DepthFirstSearch,
tenant.GUID,
graph.GUID,
node1.GUID,
node2.GUID))
{
Console.WriteLine(...);
}
// Export to GEXF file
await client.ExportGraphToGexfFile(tenant.GUID, graph.GUID, "mygraph.gexf", false, false);
Simple Example, In-Memory
LiteGraph can be configured to run in-memory, with a specified database filename. If the database exists, it will be fully loaded into memory, and then must later be Flush()ed out to disk when done. If the database does not exist, it will be created.
using LiteGraph;
LiteGraphClient client = new LiteGraphClient(new SqliteRepository("litegraph.db", true)); // true to run in-memory
client.InitializeRepository();
// Create a tenant
TenantMetadata tenant = await client.Tenant.Create(new TenantMetadata { Name = "My tenant" });
// Create a graph
Graph graph = await client.Graph.Create(new Graph { TenantGUID = tenant.GUID, Name = "This is my graph!" });
// Create nodes
Node node1 = await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "node1" });
Node node2 = await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "node2" });
Node node3 = await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "node3" });
// Create edges
Edge edge1 = await client.Edge.Create(new Edge { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, From = node1.GUID, To = node2.GUID, Name = "Node 1 to node 2" });
Edge edge2 = await client.Edge.Create(new Edge { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, From = node2.GUID, To = node3.GUID, Name = "Node 2 to node 3" });
// Flush to disk
client.Flush();
Working with Object Labels, Tags, and Data
The Labels property is a List<string> allowing you to attach labels to any Graph, Node, or Edge, i.e. [ "mylabel" ].
The Tags property is a NameValueCollection allowing you to attach key-value pairs to any Graph, Node, or Edge, i.e. { "foo": "bar" }.
The Data property is an object and can be attached to any Graph, Node, or Edge. Data supports any object serializable to JSON. This value is retrieved when reading or searching objects, and filters can be created to retrieve only objects that have matches based on elements in the object stored in Data. Refer to ExpressionTree for information on how to craft expressions.
The Vectors property can be attached to any Graph, Node, or Edge object, and is a List<VectorMetadata>. The embeddings within can be used for a variety of different vector searches (such as CosineSimilarity).
All of these properties can be used in conjunction with one another when filtering for retrieval.
Storing and Searching Labels
List<string> labels = new List<string>
{
"test",
"label1"
};
await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "Joel", Labels = labels });
await foreach (Node node in client.Node.ReadMany(tenant.GUID, graph.GUID, labels: labels))
{
Console.WriteLine(...);
}
Storing and Searching Tags
NameValueCollection nvc = new NameValueCollection();
nvc.Add("key", "value");
await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "Joel", Tags = nvc });
await foreach (Node node in client.Node.ReadMany(tenant.GUID, graph.GUID, tags: nvc))
{
Console.WriteLine(...);
}
Storing and Searching Data
using ExpressionTree;
class Person
{
public string Name { get; set; } = null;
public int Age { get; set; } = 0;
public string City { get; set; } = "San Jose";
}
Person person1 = new Person { Name = "Joel", Age = 47, City = "San Jose" };
await client.Node.Create(new Node { TenantGUID = tenant.GUID, GraphGUID = graph.GUID, Name = "Joel", Data = person1 });
Expr expr = new Expr
{
"Left": "City",
"Operator": "Equals",
"Right": "San Jose"
};
await foreach (Node node in client.Node.ReadMany(tenant.GUID, graph.GUID, nodeFilter: expr))
{
Console.WriteLine(...);
}
Storing and Searching Vectors
It is important to note that vectors have a dimensionality (number of array elements) and vector searches are only performed against graphs, nodes, and edges where the attached vector objects have a dimensionality consistent with the input.
Further, it is strongly recommended that you make extensive use of labels, tags, and expressions (data filters) when performing a vector search to reduce the number of records against which score, distance, or inner product calculations are performed.
VectorSearchResult objects have three properties used to weigh the similarity or distance of the result to the supplied query:
Score- a higher score indicates a greater degree of similarity to the queryDistance- a lower distance indicates a greater proximity to the queryInnerProduct- a higher inner product indicates a greater degree of similarity to the query
When searching vectors, you can supply one of three requirements thresholds that must be met:
MinimumScore- only return results with this score or higherMaximumDistance- only return results with distance less than the supplied valueMinimumInnerProduct- only ret
Related Skills
Hook Development
83.9kThis skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.
MCP Integration
83.9kThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP, WebSocket). Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.
Plugin Structure
83.9kThis skill should be used when the user asks to "create a plugin", "scaffold a plugin", "understand plugin structure", "organize plugin components", "set up plugin.json", "use ${CLAUDE_PLUGIN_ROOT}", "add commands/agents/skills/hooks", "configure auto-discovery", or needs guidance on plugin directory layout, manifest configuration, component organization, file naming conventions, or Claude Code plugin architecture best practices.
Skill Development
83.9kThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.
