@henrychong-ai/mcp-neo4j-knowledge-graph 2.0.0 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SETUP_AUTOMATION.md +18 -257
- package/package.json +7 -2
package/SETUP_AUTOMATION.md
CHANGED
|
@@ -44,13 +44,13 @@ node --version
|
|
|
44
44
|
|
|
45
45
|
**EVALUATE:**
|
|
46
46
|
|
|
47
|
-
- **If version >=
|
|
48
|
-
- **If version <
|
|
47
|
+
- **If version >= 18.0.0**: ✅ "Great! You have Node.js v[X.X.X] installed." (v20+ recommended for best compatibility)
|
|
48
|
+
- **If version < 18.0.0**: ⚠️ "You have Node.js v[X.X.X], but we need v18.0.0 or higher (v20+ recommended)."
|
|
49
49
|
- **ACTION**: Provide upgrade instructions for their OS
|
|
50
50
|
- **If not found**: ❌ "Node.js is not installed."
|
|
51
51
|
- **ACTION**: Provide installation instructions:
|
|
52
52
|
- **macOS**: `brew install node`
|
|
53
|
-
- **Linux**: Recommend nvm: `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.
|
|
53
|
+
- **Linux**: Recommend nvm: `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash && nvm install --lts`
|
|
54
54
|
- **Windows**: Download from https://nodejs.org/
|
|
55
55
|
|
|
56
56
|
**STOP HERE** if Node.js installation is needed. Ask user to install and run this automation again.
|
|
@@ -128,7 +128,6 @@ I'm creating a docker-compose.yml file to run Neo4j...
|
|
|
128
128
|
**CREATE FILE** `docker-compose.yml` in current directory:
|
|
129
129
|
|
|
130
130
|
```yaml
|
|
131
|
-
version: '3.8'
|
|
132
131
|
services:
|
|
133
132
|
neo4j:
|
|
134
133
|
image: neo4j:5.26-community
|
|
@@ -345,14 +344,10 @@ cp ~/.claude.json ~/.claude.json.backup-$(date +%Y%m%d-%H%M%S)
|
|
|
345
344
|
"command": "npx",
|
|
346
345
|
"args": ["-y", "@henrychong-ai/mcp-neo4j-knowledge-graph"],
|
|
347
346
|
"env": {
|
|
348
|
-
"MEMORY_STORAGE_TYPE": "neo4j",
|
|
349
347
|
"NEO4J_URI": "bolt://localhost:7687",
|
|
350
348
|
"NEO4J_USERNAME": "neo4j",
|
|
351
349
|
"NEO4J_PASSWORD": "[NEO4J_PASSWORD]",
|
|
352
350
|
"NEO4J_DATABASE": "neo4j",
|
|
353
|
-
"NEO4J_VECTOR_INDEX": "entity_embeddings",
|
|
354
|
-
"NEO4J_VECTOR_DIMENSIONS": "1536",
|
|
355
|
-
"NEO4J_SIMILARITY_FUNCTION": "cosine",
|
|
356
351
|
"OPENAI_API_KEY": "[OPENAI_API_KEY]",
|
|
357
352
|
"OPENAI_EMBEDDING_MODEL": "text-embedding-3-small"
|
|
358
353
|
}
|
|
@@ -364,6 +359,8 @@ cp ~/.claude.json ~/.claude.json.backup-$(date +%Y%m%d-%H%M%S)
|
|
|
364
359
|
- `[NEO4J_PASSWORD]` with user's password
|
|
365
360
|
- `[OPENAI_API_KEY]` with user's API key (or remove line if not provided)
|
|
366
361
|
|
|
362
|
+
> **Advanced Configuration**: Vector search defaults work out of the box. To customize, add these optional env vars: `NEO4J_VECTOR_INDEX` (default: `entity_embeddings`), `NEO4J_VECTOR_DIMENSIONS` (default: `1536`), `NEO4J_SIMILARITY_FUNCTION` (default: `cosine`).
|
|
363
|
+
|
|
367
364
|
**WRITE** updated config back to `~/.claude.json`
|
|
368
365
|
|
|
369
366
|
**TELL USER:**
|
|
@@ -484,7 +481,7 @@ Would you like me to test it now by creating a sample entity?
|
|
|
484
481
|
```
|
|
485
482
|
🎉 Success! I just created a test entity in your knowledge graph!
|
|
486
483
|
|
|
487
|
-
Try searching for it: "Search the knowledge graph for '
|
|
484
|
+
Try searching for it: "Search the knowledge graph for 'setup-test'"
|
|
488
485
|
```
|
|
489
486
|
|
|
490
487
|
**IF FAILS:**
|
|
@@ -635,26 +632,15 @@ First, let me create a backup...
|
|
|
635
632
|
cp ~/.claude/CLAUDE.md ~/.claude/CLAUDE.md.backup-$(date +%Y%m%d-%H%M%S)
|
|
636
633
|
```
|
|
637
634
|
|
|
638
|
-
####
|
|
639
|
-
|
|
640
|
-
**DETERMINE OPENAI KEY STATUS:**
|
|
641
|
-
Check if user provided OpenAI API key during Section 3 setup.
|
|
642
|
-
|
|
643
|
-
**IF OPENAI KEY PROVIDED (Semantic search enabled):**
|
|
644
|
-
|
|
645
|
-
Create full instructions including semantic_search:
|
|
635
|
+
#### Add KG Instructions
|
|
646
636
|
|
|
647
|
-
**
|
|
648
|
-
|
|
649
|
-
```bash
|
|
650
|
-
cat >> ~/.claude/CLAUDE.md << 'EOF'
|
|
637
|
+
**APPEND** the following to `~/.claude/CLAUDE.md`. If the user provided an OpenAI API key during Section 3, include the full template. If they skipped it, add a note that `semantic_search` requires an OpenAI API key to be configured.
|
|
651
638
|
|
|
639
|
+
```markdown
|
|
652
640
|
---
|
|
653
641
|
|
|
654
642
|
# Knowledge Graph (KG) Usage Instructions
|
|
655
643
|
|
|
656
|
-
*Added by mcp-neo4j-knowledge-graph setup on $(date +%Y-%m-%d)*
|
|
657
|
-
|
|
658
644
|
## Abbreviation
|
|
659
645
|
- **kg**: References the Neo4j knowledge graph and MCP tools (mcp__kg__search_nodes, mcp__kg__semantic_search, etc.)
|
|
660
646
|
|
|
@@ -662,223 +648,37 @@ cat >> ~/.claude/CLAUDE.md << 'EOF'
|
|
|
662
648
|
|
|
663
649
|
### semantic_search (Recommended for Exploration)
|
|
664
650
|
|
|
665
|
-
Use `semantic_search` for concept exploration, discovery, and natural language queries
|
|
651
|
+
Use `semantic_search` for concept exploration, discovery, and natural language queries.
|
|
652
|
+
Requires OpenAI API key configured in MCP server env vars.
|
|
666
653
|
|
|
667
654
|
**When to use:**
|
|
668
655
|
- Exploring topics without knowing exact terminology
|
|
669
656
|
- Finding related concepts across different domains
|
|
670
657
|
- Natural language queries about abstract ideas
|
|
671
658
|
|
|
672
|
-
**Parameters:**
|
|
673
|
-
- `limit`: Maximum results (default: 10)
|
|
674
|
-
- `min_similarity`: Similarity threshold 0.0-1.0 (default: 0.6)
|
|
675
|
-
- `entity_types`: Optional filter by type
|
|
676
|
-
- `hybrid_search`: Combine with keyword search (default: true)
|
|
677
|
-
|
|
678
|
-
**Example queries:**
|
|
679
|
-
```
|
|
680
|
-
|
|
681
|
-
semantic_search("software architecture patterns") → Finds design patterns, architectural concepts
|
|
682
|
-
semantic_search("database optimization techniques") → Finds performance tuning, indexing strategies
|
|
683
|
-
semantic_search("project management methodologies") → Finds Agile, Scrum, workflow approaches
|
|
684
|
-
|
|
685
|
-
```
|
|
686
|
-
|
|
687
|
-
**Benefits:**
|
|
688
|
-
- Finds conceptually related entities even with different terminology
|
|
689
|
-
- Discovers unexpected connections
|
|
690
|
-
- Works well with natural language queries
|
|
659
|
+
**Parameters:** `limit` (default: 10), `min_similarity` (default: 0.6), `entity_types`, `hybrid_search` (default: true)
|
|
691
660
|
|
|
692
661
|
### search_nodes (Precision Method)
|
|
693
662
|
|
|
694
|
-
Use `search_nodes` for exact term matching
|
|
663
|
+
Use `search_nodes` for exact term matching. Fast, free, no API calls.
|
|
695
664
|
|
|
696
665
|
**When to use:**
|
|
697
666
|
- Known exact terms or technical names
|
|
698
667
|
- Quick existence checks
|
|
699
668
|
- Technical lookups with specific terminology
|
|
700
669
|
|
|
701
|
-
**Benefits:**
|
|
702
|
-
- Fast and free (no API calls)
|
|
703
|
-
- Predictable exact matches
|
|
704
|
-
- Efficient for known terms
|
|
705
|
-
|
|
706
|
-
**Example queries:**
|
|
707
|
-
```
|
|
708
|
-
|
|
709
|
-
search_nodes("Docker") → Finds entities mentioning Docker
|
|
710
|
-
search_nodes("React") → Finds React-related entities
|
|
711
|
-
search_nodes("PostgreSQL") → Finds PostgreSQL entities
|
|
712
|
-
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
**Limitations:**
|
|
716
|
-
- Literal matching only
|
|
717
|
-
- Won't find synonyms or related concepts
|
|
718
|
-
- Requires knowing exact terminology
|
|
719
|
-
|
|
720
670
|
## Best Practices
|
|
721
671
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
2. Review results and identify exact terms used
|
|
725
|
-
3. Use `search_nodes` for precision refinement
|
|
726
|
-
|
|
727
|
-
### Query Optimization:
|
|
728
|
-
- **Semantic search**: Natural language - "web development frontend frameworks modern"
|
|
729
|
-
- **Keyword search**: Specific terms - "React", "Vue", "Angular"
|
|
730
|
-
- **Escalation**: semantic_search → search_nodes → file search → web search
|
|
672
|
+
**Hybrid Approach:** Start with `semantic_search` for discovery → refine with `search_nodes` for precision.
|
|
673
|
+
**Escalation:** semantic_search → search_nodes → file search → web search
|
|
731
674
|
|
|
732
675
|
## Critical Constraints
|
|
733
676
|
|
|
734
|
-
|
|
735
|
-
-
|
|
736
|
-
- Response size: ~173,000 tokens (confirmed)
|
|
737
|
-
- **Always use `search_nodes()` or `semantic_search()` instead**
|
|
738
|
-
|
|
739
|
-
### Token Limit Awareness
|
|
740
|
-
- All MCP tool responses capped at 25,000 tokens maximum
|
|
741
|
-
- Use targeted searches rather than broad retrieval
|
|
677
|
+
- **NEVER use `read_graph()`** — always exceeds 25,000 token MCP response limit (~173k tokens)
|
|
678
|
+
- Use `search_nodes()` or `semantic_search()` instead
|
|
742
679
|
- Apply filters early to reduce response size
|
|
743
680
|
|
|
744
681
|
---
|
|
745
|
-
|
|
746
|
-
EOF
|
|
747
|
-
```
|
|
748
|
-
|
|
749
|
-
**IF OPENAI KEY NOT PROVIDED (Semantic search disabled):**
|
|
750
|
-
|
|
751
|
-
**ASK USER:**
|
|
752
|
-
|
|
753
|
-
```
|
|
754
|
-
You didn't set up an OpenAI API key, so semantic search isn't currently enabled.
|
|
755
|
-
|
|
756
|
-
Would you like to include the semantic_search instructions anyway (as commented examples for future reference)?
|
|
757
|
-
|
|
758
|
-
This way, if you add an OpenAI key later, you'll have the instructions ready.
|
|
759
|
-
|
|
760
|
-
Include semantic_search instructions as comments? (yes/no)
|
|
761
|
-
```
|
|
762
|
-
|
|
763
|
-
**IF YES (include commented):**
|
|
764
|
-
|
|
765
|
-
**RUN:**
|
|
766
|
-
|
|
767
|
-
```bash
|
|
768
|
-
cat >> ~/.claude/CLAUDE.md << 'EOF'
|
|
769
|
-
|
|
770
|
-
---
|
|
771
|
-
|
|
772
|
-
# Knowledge Graph (KG) Usage Instructions
|
|
773
|
-
|
|
774
|
-
*Added by mcp-neo4j-knowledge-graph setup on $(date +%Y-%m-%d)*
|
|
775
|
-
|
|
776
|
-
## Abbreviation
|
|
777
|
-
- **kg**: References the Neo4j knowledge graph and MCP tools
|
|
778
|
-
|
|
779
|
-
## Search Methods
|
|
780
|
-
|
|
781
|
-
### search_nodes (Currently Available)
|
|
782
|
-
|
|
783
|
-
Use `search_nodes` for exact term matching:
|
|
784
|
-
|
|
785
|
-
**When to use:**
|
|
786
|
-
- Known exact terms or technical names
|
|
787
|
-
- Quick existence checks
|
|
788
|
-
- Technical lookups with specific terminology
|
|
789
|
-
|
|
790
|
-
**Example queries:**
|
|
791
|
-
```
|
|
792
|
-
|
|
793
|
-
search_nodes("Docker") → Finds entities mentioning Docker
|
|
794
|
-
search_nodes("React") → Finds React-related entities
|
|
795
|
-
search_nodes("PostgreSQL") → Finds PostgreSQL entities
|
|
796
|
-
|
|
797
|
-
```
|
|
798
|
-
|
|
799
|
-
<!--
|
|
800
|
-
### semantic_search (Requires OpenAI API Key)
|
|
801
|
-
|
|
802
|
-
COMMENTED OUT - Add OpenAI API key to enable semantic search:
|
|
803
|
-
|
|
804
|
-
Use `semantic_search` for concept exploration and natural language queries:
|
|
805
|
-
|
|
806
|
-
**When to use:**
|
|
807
|
-
- Exploring topics without knowing exact terminology
|
|
808
|
-
- Finding related concepts across different domains
|
|
809
|
-
- Natural language queries about abstract ideas
|
|
810
|
-
|
|
811
|
-
**Parameters:**
|
|
812
|
-
- `limit`: Maximum results (default: 10)
|
|
813
|
-
- `min_similarity`: Similarity threshold 0.0-1.0 (default: 0.6)
|
|
814
|
-
|
|
815
|
-
**Example queries:**
|
|
816
|
-
```
|
|
817
|
-
|
|
818
|
-
semantic_search("software architecture patterns") → Finds design patterns, architectural concepts
|
|
819
|
-
semantic_search("database optimization techniques") → Finds performance tuning, indexing strategies
|
|
820
|
-
|
|
821
|
-
```
|
|
822
|
-
|
|
823
|
-
To enable: Add OPENAI_API_KEY to your ~/.claude.json MCP server config, then uncomment this section.
|
|
824
|
-
-->
|
|
825
|
-
|
|
826
|
-
## Critical Constraints
|
|
827
|
-
|
|
828
|
-
### NEVER use read_graph()
|
|
829
|
-
- ⚠️ The `read_graph()` tool always exceeds the 25,000 token response limit
|
|
830
|
-
- **Always use `search_nodes()` or `semantic_search()` instead**
|
|
831
|
-
|
|
832
|
-
---
|
|
833
|
-
|
|
834
|
-
EOF
|
|
835
|
-
```
|
|
836
|
-
|
|
837
|
-
**IF NO (omit semantic search):**
|
|
838
|
-
|
|
839
|
-
**RUN:**
|
|
840
|
-
|
|
841
|
-
```bash
|
|
842
|
-
cat >> ~/.claude/CLAUDE.md << 'EOF'
|
|
843
|
-
|
|
844
|
-
---
|
|
845
|
-
|
|
846
|
-
# Knowledge Graph (KG) Usage Instructions
|
|
847
|
-
|
|
848
|
-
*Added by mcp-neo4j-knowledge-graph setup on $(date +%Y-%m-%d)*
|
|
849
|
-
|
|
850
|
-
## Abbreviation
|
|
851
|
-
- **kg**: References the Neo4j knowledge graph and MCP tools
|
|
852
|
-
|
|
853
|
-
## Search Method
|
|
854
|
-
|
|
855
|
-
### search_nodes
|
|
856
|
-
|
|
857
|
-
Use `search_nodes` for exact term matching:
|
|
858
|
-
|
|
859
|
-
**When to use:**
|
|
860
|
-
- Known exact terms or technical names
|
|
861
|
-
- Quick existence checks
|
|
862
|
-
- Technical lookups with specific terminology
|
|
863
|
-
|
|
864
|
-
**Example queries:**
|
|
865
|
-
```
|
|
866
|
-
|
|
867
|
-
search_nodes("Docker") → Finds entities mentioning Docker
|
|
868
|
-
search_nodes("React") → Finds React-related entities
|
|
869
|
-
search_nodes("PostgreSQL") → Finds PostgreSQL entities
|
|
870
|
-
|
|
871
|
-
```
|
|
872
|
-
|
|
873
|
-
## Critical Constraints
|
|
874
|
-
|
|
875
|
-
### NEVER use read_graph()
|
|
876
|
-
- ⚠️ The `read_graph()` tool always exceeds the 25,000 token response limit
|
|
877
|
-
- **Always use `search_nodes()` instead**
|
|
878
|
-
|
|
879
|
-
---
|
|
880
|
-
|
|
881
|
-
EOF
|
|
882
682
|
```
|
|
883
683
|
|
|
884
684
|
#### Verify Addition
|
|
@@ -886,7 +686,7 @@ EOF
|
|
|
886
686
|
**RUN:**
|
|
887
687
|
|
|
888
688
|
```bash
|
|
889
|
-
tail -
|
|
689
|
+
tail -10 ~/.claude/CLAUDE.md
|
|
890
690
|
```
|
|
891
691
|
|
|
892
692
|
**TELL USER:**
|
|
@@ -924,45 +724,6 @@ Next steps:
|
|
|
924
724
|
Happy graphing! 🚀
|
|
925
725
|
```
|
|
926
726
|
|
|
927
|
-
### 8.5 Save Setup Summary
|
|
928
|
-
|
|
929
|
-
**CREATE FILE** `mcp-neo4j-setup-summary.txt`:
|
|
930
|
-
|
|
931
|
-
```
|
|
932
|
-
MCP Neo4j Knowledge Graph - Setup Summary
|
|
933
|
-
==========================================
|
|
934
|
-
Date: [CURRENT DATE/TIME]
|
|
935
|
-
|
|
936
|
-
Neo4j:
|
|
937
|
-
- URI: bolt://localhost:7687
|
|
938
|
-
- Username: neo4j
|
|
939
|
-
- Password: [NEO4J_PASSWORD]
|
|
940
|
-
- Browser: http://localhost:7474
|
|
941
|
-
|
|
942
|
-
Configuration:
|
|
943
|
-
- Claude Code: ~/.claude.json ✅
|
|
944
|
-
- Claude Desktop: [YES/NO]
|
|
945
|
-
|
|
946
|
-
OpenAI Semantic Search: [ENABLED/SKIPPED]
|
|
947
|
-
|
|
948
|
-
Backups:
|
|
949
|
-
- ~/.claude.json.backup-[timestamp]
|
|
950
|
-
|
|
951
|
-
To restart Neo4j (Docker):
|
|
952
|
-
docker compose restart neo4j
|
|
953
|
-
|
|
954
|
-
To stop Neo4j (Docker):
|
|
955
|
-
docker compose stop neo4j
|
|
956
|
-
|
|
957
|
-
To view logs:
|
|
958
|
-
docker compose logs -f neo4j
|
|
959
|
-
|
|
960
|
-
Documentation:
|
|
961
|
-
https://www.npmjs.com/package/@henrychong-ai/mcp-neo4j-knowledge-graph
|
|
962
|
-
```
|
|
963
|
-
|
|
964
|
-
**TELL USER:** "I've saved a setup summary to mcp-neo4j-setup-summary.txt"
|
|
965
|
-
|
|
966
727
|
---
|
|
967
728
|
|
|
968
729
|
## End of Automation Script
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henrychong-ai/mcp-neo4j-knowledge-graph",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Neo4j-based knowledge graph MCP server with temporal versioning and semantic search",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Henry Chong <henry@henrychong.ai>",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"embeddings:test": "tsx src/cli/generate-embeddings.ts -- --limit 5"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
58
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
59
59
|
"axios": "^1.13.4",
|
|
60
60
|
"dotenv": "^16.6.1",
|
|
61
61
|
"lru-cache": "^11.2.5",
|
|
@@ -95,6 +95,11 @@
|
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": ">=18.0.0"
|
|
97
97
|
},
|
|
98
|
+
"pnpm": {
|
|
99
|
+
"overrides": {
|
|
100
|
+
"@isaacs/brace-expansion": ">=5.0.1"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
98
103
|
"lint-staged": {
|
|
99
104
|
"src/**/*.ts": [
|
|
100
105
|
"eslint --fix",
|