neo4j-kg-mcp
Allows configuring and testing a Neo4j connection, validating document-extracted entities and relationships against an ontology, writing them into Neo4j with idempotent MERGE operations, and running read-only Cypher queries to inspect the resulting knowledge graph.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
neo4j-kg-mcp
Neo4j Knowledge Graph MCP Server for AI Agents — zero-LLM-config tool server that turns PDFs, Word, Excel and plain text into a Neo4j knowledge graph.
Why this exists
Most MCP knowledge-graph servers embed private LLM calls and ask you to configure yet another API key. neo4j-kg-mcp flips that: the host platform's LLM — Claude, GPT, Gemini, DeepSeek inside your agent — performs entity-relationship extraction in a conversational chunk loop, while the server handles the graph-write layer: document parsing, ontology validation, parameterized Cypher generation, and auditable Neo4j writes.
It is the missing graph construction block for the MCP ecosystem:
Zero LLM configuration — the server ships with no LLM dependency. Configure one Neo4j connection and you're done.
Schema-driven & interactive — define your ontology in YAML, validate it conversationally with the agent, iterate until it passes.
Long-task friendly — work proceeds chunk-by-chunk in the conversation, survives server restarts, and never duplicates nodes.
Related MCP server: Neo4j MCP Knowledge Graph Server
Features
Feature | Description |
🔌 MCP native | 8 clean tools; works over stdio (Claude Code, Cursor) or Streamable HTTP (WorkBuddy, Dify, n8n, custom agents) |
🤖 Agent = engine | No embedded LLM, no API keys — extraction quality follows your platform's model |
📚 Multi-format documents | PDF, DOCX/DOC, XLSX/XLS, TXT — single file, folder batch, or inline text |
📝 Ontology (Schema) management | Preset templates + YAML; |
🧱 Enforced constraints | Entity types, relation types and endpoints are validated against your ontology before writing |
🛡️ Secure by design | Parameterized Cypher (injection-safe), sanitized identifiers, read-only query whitelist |
⏸️ Resumable | Progress persists to disk per job; resume after a crash or server restart |
♻️ Idempotent writes |
|
Quick demo
User: Ingest docs/product-report.pdf using this schema
1. Agent drafts a Schema → validate_schema → fixes per error list → passes
2. start_extraction(document={path|text}, schema=final)
← {job_id, total_chunks, chunk_text, instructions}
3. Agent reads the chunk, produces triples → submit_triples
← {accepted, rejected:[{triple, reason}], next_chunk}
4. …loop until done…
5. get_job_status → summary; query_graph → verify in Neo4jYou can interrupt at any block and redirect the agent ("normalize company names"), effective from the next chunk.
Install & configure
Prerequisites
Python 3.10+
A running Neo4j 5.x instance
1. Install
pip install -e neo4j-kg-mcp
# or
pip install -r requirements.txt2. Claude Code / Cursor (stdio)
Add this to your .mcp.json:
{
"mcpServers": {
"neo4j-kg-mcp": {
"command": "python",
"args": ["-m", "kg_mcp.server"],
"env": {
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USER": "neo4j",
"NEO4J_PASSWORD": "your_password"
}
}
}
}No NEO4J_* env vars? Still fine — call configure_neo4j in the conversation and pass credentials there.
3. WorkBuddy / Dify / n8n (Streamable HTTP)
python -m kg_mcp.server --http --host 0.0.0.0 --port 8765Point your platform at: http://<host>:8765/mcp
Environment variables
Variable | Default | Description |
|
| Neo4j Bolt address |
|
| Username |
| — | Password (optional if calling |
Job progress lives in .data/jobs/<job_id>/; delete the folder to reset.
Tools (8)
Tool | Purpose |
| Set & test the Neo4j connection |
| List built-in ontology templates (full YAML) |
| Validate ontology YAML; return structured errors for agent iteration |
| Parse the document, chunk it, return chunk 0 + instructions |
| Validate & write a chunk's triples; return the next chunk |
| Query job progress |
| Resume a job from its first unfinished chunk |
| Read-only Cypher query (whitelist: MATCH/RETURN/WITH/ORDER BY/LIMIT) |
Sample schema (ontology) YAML
entities:
- name: Person
properties: [name, role]
- name: Company
properties: [name, industry]
relationships:
- {head: Person, relation: worksAt, tail: Company}
- {head: Person, relation: develops, tail: Product}Architecture
┌─────────────────────────────┐
│ Claude Code / WorkBuddy │
│ (platform LLM = engine) │
│ read chunk → triples │◄── MCP tool calls
└──────────┬──────────────────┘
▼
┌─────────────────────────────┐
│ neo4j-kg-mcp (no LLM) │
│ doc_loader · schema_mgr │
│ triple validation · cypher │
│ graph_store · job_store │
└──────────┬──────────────────┘
▼
┌──────┐
│Neo4j │
└──────┘Design decisions
Decision | Rationale |
No embedded LLM | Install-and-run (configure Neo4j only); quality follows your platform's model; cost stays on your existing subscription |
Chunked conversational loop | No context overflow on big docs; ~2000-char chunks keep extraction precise; per-chunk persistence enables resume |
Reject + explain, not silent filter | Rejected triples return their reason to the agent so it can fix and resubmit — no invisible data loss |
| Idempotent: resume / re-submit never duplicates nodes or edges |
Development
pytest tests/ -v # unit + simulated end-to-endUnit tests cover schema validation, triple validation (rejection reasons), injection-safe Cypher, job persistence and resume. An end-to-end script exercises the full MCP flow against a real Neo4j.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Universal Document Intelligence: 70+ formats & 75+ languages to LPG/RDF entities & tables (13 tools)
Read-only MCP over your Excel or Airtable plus the PDFs beside it, joined as one relational dataset.
An agent-first office suite Claude & ChatGPT read and write over one MCP URL.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables document ingestion and typed knowledge graph queries through Claude MCP tools, allowing agents to extract, store, and retrieve typed entities and relations from documents.2MIT
- FlicenseNot gradedqualityDmaintenanceA containerized FastAPI + MCP server that lets LLM agents inject structured entities and relationships into a Neo4j graph database with safe Cypher execution.-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to query Neo4j graph databases and Box document storage using natural language through a single MCP endpoint.-
- AlicenseNot gradedqualityBmaintenanceEnables persona-grounded retrieval-augmented generation over your own documents by building a Neo4j knowledge graph and exposing tools for search, context, persona briefs, and graph queries via MCP.MIT