Retrieved article excerpt
Open article · Retrieved 2026-11-19T17:22:46.567694+00:00
# Cypher MCP
[Release](https://github.com/vmikhailov/cypher-mcp/releases)
[Homebrew](https://github.com/vmikhailov/homebrew-tap)
[CI](https://github.com/vmikhailov/cypher-mcp/actions/workflows/ci.yml)
[License: MIT](https://github.com/vmikhailov/cypher-mcp/blob/main/LICENSE)
A **Zero-CGO Model Context Protocol (MCP)** server and **standalone CLI tool** that gives AI agents and developers an embedded SQLite knowledge graph queried via **Cypher** — no separate database server required.
Powered by [`cypher-sql-go`](https://github.com/vmikhailov/cypher-sql-go) and pure-Go SQLite (`modernc.org/sqlite`).
---
## Why Cypher MCP?
Common approaches to AI agent memory each have practical tradeoffs:
- **Vector RAG:** Struggles with deterministic multi-hop queries (*"Who is the landlord of the apartment where my son studies?"*).
- **Dedicated Graph Databases (Neo4j, Memgraph):** Require a separate server/Docker daemon, 1–2 GB of RAM, network roundtrips, and ongoing ops.
- **Flat Markdown / Raw SQL:** Markdown files accumulate contradicting notes once multiple agents write to them, and LLMs frequently make mistakes on complex recursive SQL CTEs.
**What Cypher MCP does instead:**
1. **Single Static Binary (~15 MB):** Zero-CGO executable with no runtime dependencies — no Docker, Python, or C++ toolchain.
2. **One Local SQLite File:** Standard ACID SQLite `.db` file using B-Tree indexes, JSON1, and FTS5, easily shared across different agents and tools.
3. **In-Process Cypher-to-SQL:** Transpiles Cypher queries (`MATCH (p:Person)-[:OWES]->(o) RETURN o`) to SQLite SQL in-process (< 0.5 ms typical engine latency).
4. **Optional Evolving Schema:** Agents can define and extend allowed node/edge types without turning the graph into an unstructured dump.
### Scaling Beyond Local Storage
If you need a shared multi-tenant graph across a team, [`cypher-sql-go`](https://github.com/vmikhailov/cypher-sql-go) can target a centralized backend (such as PostgreSQL with `pgvector`).
---
## Quick Start
### 1. Install
#### Via Homebrew (macOS & Linux — Recommended)
```
brew install vmikhailov/tap/cypher-mcp
```
#### Download Prebuilt Binary
Grab the latest static binary for your OS and architecture from [Releases](https://github.com/vmikhailov/cypher-mcp/releases):
- Linux (`x86_64`, `arm64`)
- macOS (`Apple Silicon arm64`, `Intel amd64`)
- Windows (`x86_64`)
> **Note for macOS direct downloads**: If downloaded directly without Homebrew, macOS Gatekeeper may quarantine the binary. Run `xattr -d com.apple.quarantine cypher-mcp-darwin-*` and `chmod +x cypher-mcp-darwin-*`.
### 2. Configure Your AI Agent
#### Claude Desktop
Add to your `claude_desktop_config.json`:
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
```
{
"mcpServers": {
"knowledge_graph": {
"command": "/usr/local/bin/cypher-mcp",
"args": ["--db", "/path/to/my_knowledge_graph.db"]
}
}
}
```
#### Antigravity IDE / Cursor / VS Code
Add to `mcp_config.json` (or `.cursor/mcp.json`):
```
{
"mcpServers": {
"cypher_graph": {
"command": "C:/Tools/cypher-mcp.exe",
"args": ["--db", "C:/Data/knowledge_graph.db"]
}
}
}
```
#### Hermes Agent
Add to `config.yaml`:
```
mcp_servers:
cypher_graph:
command: "cypher-mcp"
args: ["--db", "knowledge_graph.db"]
```
---
## MCP Tools
`cypher-mcp` exposes 10 standard MCP tools via JSON-RPC 2.0 (stdio):
| Tool | Mode | Description |
| --- | --- | --- |
| `graph_query` | Read-only | Transpiles and executes OpenCypher against SQLite. Returns JSON records with compile and execution timing metrics. |
| `graph_resolve_entity` | Read-only | Vector semantic entity resolution (Entity Linking). Resolves colloquial, inflected, misspelled, or multilingual entity mentions (e.g. "k8s", "Beemer", "Al") to canonical graph node IDs. |
| `graph_upsert_alias` | Mutation | Associates an alias or alternative name with a graph node and indexes its embedding vector into SQLite. |
| `graph_search` | Read-only | Full-text search (SQLite FTS5) across node IDs and JSON property values. Finds entry-point nodes before path traversals. |
| `graph_batch_upsert` | Mutation | Atomically upserts multiple nodes and/or edges in a single ACID transaction with schema validation. |
| `graph_schema` | Read-only | Summarizes graph topology: counts of nodes and edges by kind, total graph volume, and active schema rules. |
| `graph_schema_define` | DDL / Governance | Defines or removes allowed node kinds and directed relationships in the taxonomy schema. |
| `graph_set_node` | Mutation | Upserts a node by unique `id`, `kind`, and dynamic JSON `properties`. Validates against schema if active. |
| `graph_set_edge` | Mutation | Upserts a directed relationship between `from_id` and `to_id` with `kind` and `properties`. Validates against schema if active. |
| `graph_delete_node` | Mutation | Deletes a node and cascade-cleans all its incoming and outgoing relationships. |
### Variable-Length Path Traversal
`graph_query` supports recursive variable-length pattern matching:
- **Syntax:** `-[*1..3]->` (outgoing 1 to 3 hops), `<-[*2..5]-` (incoming 2 to 5 hops), or `-[*]->` (arbitrary depth).
- **10-Hop Default Cap:** Unbounded patterns like `-[*]->` and `-[*1..]->` automatically default to a maximum depth of 10 hops (`min=1, max=10`) to prevent runaway queries.
- **Safety Guardrails:** All queries time out after 15 seconds. Always anchor at least one endpoint (e.g. `(p:Person {name: 'Alice'})-[*1..3]->(target)`); fully unanchored traversals (`MATCH (x)-[*1..2]->(y)`) strictly require an explicit `LIMIT` (and depth `<= 3`) to prevent full-graph combinatorial explosion.
---
## Benchmarks
### Architecture Comparison
| Aspect | Cypher MCP (Embedded) | Text-to-SQL (Relational) | Vector RAG (Top-K Chunks) | Neo4j (Docker JVM) |
| --- | --- | --- | --- | --- |
| **Multi-Hop Queries** | Deterministic Cypher-to-SQL | Manual recursive CTEs | Top-K chunk retrieval | Deterministic Cypher |
| **Query Latency** | < 0.5 ms (in-process) | < 1 ms (in-process) | ~100–300 ms (embed + search) | 15–45 ms (Bolt TCP) |
| **Memory Footprint** | ~15 MB RAM | ~15 MB RAM | 200 MB – 1 GB | 1.2 – 2.5 GB RAM |
| **Infrastructure** | Single static binary + `.db` file | App-managed SQL schema | Embedding model + vector store | Docker daemon + JVM |
### Empirical Agent Benchmarks
Evaluations run with **Gemini 3.8 Flash** across multi-hop datasets:
| Benchmark / Dataset | Task Topology | GraphRAG Recall | Plain RAG Recall | GraphRAG Tokens | Plain RAG Tokens | Token Savings | Latency (Graph vs Plain) |
| --- | --- | --- | --- | --- | --- | --- | --- |
| [**Active Directory Security**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/CYBERSECURITY_AD_BENCHMARK.md) (BloodHound: 953 nodes, 4.7k ACLs) | Privilege escalation, credential dumping, blast radius | **66.7%** | 33.3% | **14.0k** | 366.7k | **26.2x fewer** | **13.1s** vs 24.6s |
| [**MetaQA Colloquial & Typos**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/METAQA_COLLOQUIAL_BENCHMARK.md) (134,741 facts, 43k nodes) | 1-3 Hops with typos, nicknames, informal titles | **100.0%** (F1: 100%) | 100.0% (F1: 90.9%) | **4.2k** | 5.8k | **1.4x fewer** | **6.3s** vs 20.3s (3.2x faster) |
| [**MetaQA Standard Multi-Hop**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/METAQA_BENCHMARK_REPORT.md) (134,741 facts, 43k nodes) | 1-hop, 2-hop, 3-hop relationship chaining | **100.0%** | 91.7% | **1.4k** | 1.1k | Direct graph traversals | **3.1s** vs 7.6s (2.4x faster) |
| [**GraphRAG vs Plain Vector RAG**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/VECTOR_GRAPH_VS_PLAIN_RAG.md) (Synthetic corporate topology) | Conversational entity linking and 2-hop dependencies | **75.0%** | 87.5% | **21.6k** | 18.3k | Entity linking precision | **18.7s** vs 17.9s |
| [**Enterprise Audit**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/ENTERPRISE_250_DOCS_AUDIT.md) (250 corporate docs, 230 services) | Transitive blast radius, unpatched DBs, orphaned services | **93.8%** | 0.0% (timeouts) | **26.9k** | 39.8k | **1.5x fewer** | **19.8s** vs 29.2s (timeout) |
| [**2WikiMultihopQA**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/2WIKI_MULTIHOP_BENCHMARK.md) (Academic benchmark w/ distractors) | Multi-hop reasoning across distractor documents | **100.0%** | 100.0% | **4.2k** | 1.5k | Structural fact linking | **6.1s** vs 3.2s |
| [**Zero-Shortcut Depth Scaling**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/DEPTH_SCALING_BENCHMARK.md) (Branching tree, 1 to 4 hops) | Scaling search depth where intermediate nodes lack shortcuts | **100.0%** | 75.0% (0% at 4-hop) | **6.6k** | 4.6k | Exhaustive traversal | **12.6s** vs 15.5s (1.6x faster at 4-hop) |
| [**Architecture Agent Evals**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/AGENT_EVALS.md) (Distributed microservice graph) | Diagnostic multi-hop failure analysis and cascade impact | **100.0%** | 100.0% | **4.2k** | 2.7k | Single query paths | **3.8s** vs 12.5s (3.3x faster) |
| [**Engine Micro-Benchmarks**](https://github.com/vmikhailov/cypher-mcp/blob/main/benchmarks/reports/BENCHMARKS.md) (Go / SQLite in-process B-Tree) | Point lookups, 2-hop joins, recursive traversal, FTS5 | **100.0%** | 75.0% | **~110 / q** | ~1,800 / q | **16.4x fewer** | **<0.5 ms** vs ~250 ms |
---
## Command-Line Interface (CLI)
`cypher-mcp` is a dual-mode executable. When invoked without arguments (or with `--db`/`--log` on a pipe), it operates as a standard JSON-RPC 2.0 MCP server over stdio. When invoked with any CLI subcommand, it acts as a terminal CLI tool for developers, scripts, and shell pipelines.
### Subcommands Overview
| Command | Alias | Description | Example |
| --- | --- | --- | --- |
| `query` | `q` | Run OpenCypher queries against the SQLite graph | `cypher-mcp query "MATCH (n) RETURN n LIMIT 5"` |
| `search` | `s` | Full-text FTS5 search across nodes and properties | `cypher-mcp search "database"` |
| `resolve` | `r` | Semantic vector entity resolution / linking | `cypher-mcp resolve "alice"` |
| `node` | - | Inspect, create, update, or delete nodes | `cypher-mcp node get alice` |
| `edge` | - | Create or update directed relationships | `cypher-mcp edge set alice proj1 CONTRIBUTES` |
| `schema` | - | View topology volume and enforce schema rules | `cypher-mcp schema show` |
| `alias` | - | Register semantic aliases for entity linking | `cypher-mcp alias upsert alice "Al"` |
| `batch` | - | Import batches of nodes and edges atomically | `cypher-mcp batch import graph.json` |
| `serve` | - | Explicitly run as an MCP server | `cypher-mcp serve --db graph.db` |
| `version` | - | Print version and architecture info | `cypher-mcp version` |
### Querying the Graph
By default, queries render formatted ASCII tables on interactive terminals and JSON when piped into another program or when `--format json` is passed:
```
# Pretty-printed table output
cypher-mcp query "MATCH (p:Person)-[:WORKS_ON]->(prj) RETURN p.name, prj.name"
# Parameterized query with JSON output
cypher-mcp query --params '{"minAge": 21}' --format json \
"MATCH (p:Person) WHERE p.age >= $minAge RETURN p.name, p.age"
# Pipe Cypher queries via stdin
echo "MATCH (n) RETURN count(n) AS total_nodes" | cypher-mcp query -
```
### Full-Text Search & Entity Resolution
```
# Full-text search across IDs and all JSON property attributes
cypher-mcp search "kubernetes" --limit 10
# Semantic vector entity linking (uses GEMINI_API_KEY when configured)
cypher-mcp resolve "k8s cluster" --top-k 3
```
### Direct Node and Edge Manipulation
```
# Create or update a node (kind, properties)
cypher-mcp node set alice Person '{"name":"Alice","role":"Architect"}'
# Read node
cypher-mcp node get alice
# Create a dire