@henrychong-ai/mcp-neo4j-knowledge-graph 1.7.0 → 1.7.1
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 +305 -2
- package/package.json +1 -1
package/SETUP_AUTOMATION.md
CHANGED
|
@@ -527,7 +527,310 @@ Hmm, the tools aren't showing up yet. Let's troubleshoot:
|
|
|
527
527
|
Would you like me to verify your configuration?
|
|
528
528
|
```
|
|
529
529
|
|
|
530
|
-
### 8.3
|
|
530
|
+
### 8.3 Optional: Add KG Usage Instructions to Claude User Preferences
|
|
531
|
+
|
|
532
|
+
**AFTER SUCCESSFUL MCP TOOL TEST:**
|
|
533
|
+
|
|
534
|
+
Now that your MCP server is working, you can optionally add Knowledge Graph usage instructions to your Claude user preferences file (~/.claude/CLAUDE.md). This helps Claude Code understand how to best use your knowledge graph.
|
|
535
|
+
|
|
536
|
+
**ASK USER:**
|
|
537
|
+
```
|
|
538
|
+
Would you like to add Knowledge Graph (KG) usage instructions to your Claude user preferences?
|
|
539
|
+
|
|
540
|
+
This will add helpful guidelines for:
|
|
541
|
+
- When to use semantic_search vs search_nodes
|
|
542
|
+
- Best practices for querying your knowledge graph
|
|
543
|
+
- Token limit warnings and optimization tips
|
|
544
|
+
|
|
545
|
+
Add instructions? (yes/no)
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
**IF NO:**
|
|
549
|
+
```
|
|
550
|
+
No problem! You can always add these instructions later by asking a future Claude Code session to:
|
|
551
|
+
|
|
552
|
+
"Read and execute the setup guide at henrychong.com/mcp-neo4j-kg/setup and add KG usage instructions to my CLAUDE.md file"
|
|
553
|
+
|
|
554
|
+
The setup guide contains the full instructions ready to add whenever you need them.
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
**CONTINUE TO SECTION 8.4**
|
|
558
|
+
|
|
559
|
+
**IF YES:**
|
|
560
|
+
|
|
561
|
+
#### Check if CLAUDE.md Exists
|
|
562
|
+
|
|
563
|
+
**RUN:**
|
|
564
|
+
```bash
|
|
565
|
+
[ -f ~/.claude/CLAUDE.md ] && echo "exists" || echo "not found"
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
**IF NOT FOUND:**
|
|
569
|
+
```
|
|
570
|
+
I'll create a new ~/.claude/CLAUDE.md file with the KG instructions.
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**IF EXISTS:**
|
|
574
|
+
```
|
|
575
|
+
I'll add the KG instructions to your existing ~/.claude/CLAUDE.md file.
|
|
576
|
+
First, let me create a backup...
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**RUN:**
|
|
580
|
+
```bash
|
|
581
|
+
cp ~/.claude/CLAUDE.md ~/.claude/CLAUDE.md.backup-$(date +%Y%m%d-%H%M%S)
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
#### Prepare KG Instructions Content
|
|
585
|
+
|
|
586
|
+
**DETERMINE OPENAI KEY STATUS:**
|
|
587
|
+
Check if user provided OpenAI API key during Section 3 setup.
|
|
588
|
+
|
|
589
|
+
**IF OPENAI KEY PROVIDED (Semantic search enabled):**
|
|
590
|
+
|
|
591
|
+
Create full instructions including semantic_search:
|
|
592
|
+
|
|
593
|
+
**RUN:**
|
|
594
|
+
```bash
|
|
595
|
+
cat >> ~/.claude/CLAUDE.md << 'EOF'
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
# Knowledge Graph (KG) Usage Instructions
|
|
600
|
+
|
|
601
|
+
*Added by mcp-neo4j-knowledge-graph setup on $(date +%Y-%m-%d)*
|
|
602
|
+
|
|
603
|
+
## Abbreviation
|
|
604
|
+
- **kg**: References the Neo4j knowledge graph and MCP tools (mcp__kg__search_nodes, mcp__kg__semantic_search, etc.)
|
|
605
|
+
|
|
606
|
+
## Search Methods
|
|
607
|
+
|
|
608
|
+
### semantic_search (Recommended for Exploration)
|
|
609
|
+
|
|
610
|
+
Use `semantic_search` for concept exploration, discovery, and natural language queries:
|
|
611
|
+
|
|
612
|
+
**When to use:**
|
|
613
|
+
- Exploring topics without knowing exact terminology
|
|
614
|
+
- Finding related concepts across different domains
|
|
615
|
+
- Natural language queries about abstract ideas
|
|
616
|
+
|
|
617
|
+
**Parameters:**
|
|
618
|
+
- `limit`: Maximum results (default: 10)
|
|
619
|
+
- `min_similarity`: Similarity threshold 0.0-1.0 (default: 0.6)
|
|
620
|
+
- `entity_types`: Optional filter by type
|
|
621
|
+
- `hybrid_search`: Combine with keyword search (default: true)
|
|
622
|
+
|
|
623
|
+
**Example queries:**
|
|
624
|
+
```
|
|
625
|
+
semantic_search("software architecture patterns") → Finds design patterns, architectural concepts
|
|
626
|
+
semantic_search("database optimization techniques") → Finds performance tuning, indexing strategies
|
|
627
|
+
semantic_search("project management methodologies") → Finds Agile, Scrum, workflow approaches
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
**Benefits:**
|
|
631
|
+
- Finds conceptually related entities even with different terminology
|
|
632
|
+
- Discovers unexpected connections
|
|
633
|
+
- Works well with natural language queries
|
|
634
|
+
|
|
635
|
+
### search_nodes (Precision Method)
|
|
636
|
+
|
|
637
|
+
Use `search_nodes` for exact term matching:
|
|
638
|
+
|
|
639
|
+
**When to use:**
|
|
640
|
+
- Known exact terms or technical names
|
|
641
|
+
- Quick existence checks
|
|
642
|
+
- Technical lookups with specific terminology
|
|
643
|
+
|
|
644
|
+
**Benefits:**
|
|
645
|
+
- Fast and free (no API calls)
|
|
646
|
+
- Predictable exact matches
|
|
647
|
+
- Efficient for known terms
|
|
648
|
+
|
|
649
|
+
**Example queries:**
|
|
650
|
+
```
|
|
651
|
+
search_nodes("Docker") → Finds entities mentioning Docker
|
|
652
|
+
search_nodes("React") → Finds React-related entities
|
|
653
|
+
search_nodes("PostgreSQL") → Finds PostgreSQL entities
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
**Limitations:**
|
|
657
|
+
- Literal matching only
|
|
658
|
+
- Won't find synonyms or related concepts
|
|
659
|
+
- Requires knowing exact terminology
|
|
660
|
+
|
|
661
|
+
## Best Practices
|
|
662
|
+
|
|
663
|
+
### Hybrid Approach (Recommended):
|
|
664
|
+
1. Start with `semantic_search` for discovery
|
|
665
|
+
2. Review results and identify exact terms used
|
|
666
|
+
3. Use `search_nodes` for precision refinement
|
|
667
|
+
|
|
668
|
+
### Query Optimization:
|
|
669
|
+
- **Semantic search**: Natural language - "web development frontend frameworks modern"
|
|
670
|
+
- **Keyword search**: Specific terms - "React", "Vue", "Angular"
|
|
671
|
+
- **Escalation**: semantic_search → search_nodes → file search → web search
|
|
672
|
+
|
|
673
|
+
## Critical Constraints
|
|
674
|
+
|
|
675
|
+
### NEVER use read_graph()
|
|
676
|
+
- ⚠️ The `read_graph()` tool always exceeds the 25,000 token response limit
|
|
677
|
+
- Response size: ~173,000 tokens (confirmed)
|
|
678
|
+
- **Always use `search_nodes()` or `semantic_search()` instead**
|
|
679
|
+
|
|
680
|
+
### Token Limit Awareness
|
|
681
|
+
- All MCP tool responses capped at 25,000 tokens maximum
|
|
682
|
+
- Use targeted searches rather than broad retrieval
|
|
683
|
+
- Apply filters early to reduce response size
|
|
684
|
+
|
|
685
|
+
---
|
|
686
|
+
|
|
687
|
+
EOF
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
**IF OPENAI KEY NOT PROVIDED (Semantic search disabled):**
|
|
691
|
+
|
|
692
|
+
**ASK USER:**
|
|
693
|
+
```
|
|
694
|
+
You didn't set up an OpenAI API key, so semantic search isn't currently enabled.
|
|
695
|
+
|
|
696
|
+
Would you like to include the semantic_search instructions anyway (as commented examples for future reference)?
|
|
697
|
+
|
|
698
|
+
This way, if you add an OpenAI key later, you'll have the instructions ready.
|
|
699
|
+
|
|
700
|
+
Include semantic_search instructions as comments? (yes/no)
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
**IF YES (include commented):**
|
|
704
|
+
|
|
705
|
+
**RUN:**
|
|
706
|
+
```bash
|
|
707
|
+
cat >> ~/.claude/CLAUDE.md << 'EOF'
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
# Knowledge Graph (KG) Usage Instructions
|
|
712
|
+
|
|
713
|
+
*Added by mcp-neo4j-knowledge-graph setup on $(date +%Y-%m-%d)*
|
|
714
|
+
|
|
715
|
+
## Abbreviation
|
|
716
|
+
- **kg**: References the Neo4j knowledge graph and MCP tools
|
|
717
|
+
|
|
718
|
+
## Search Methods
|
|
719
|
+
|
|
720
|
+
### search_nodes (Currently Available)
|
|
721
|
+
|
|
722
|
+
Use `search_nodes` for exact term matching:
|
|
723
|
+
|
|
724
|
+
**When to use:**
|
|
725
|
+
- Known exact terms or technical names
|
|
726
|
+
- Quick existence checks
|
|
727
|
+
- Technical lookups with specific terminology
|
|
728
|
+
|
|
729
|
+
**Example queries:**
|
|
730
|
+
```
|
|
731
|
+
search_nodes("Docker") → Finds entities mentioning Docker
|
|
732
|
+
search_nodes("React") → Finds React-related entities
|
|
733
|
+
search_nodes("PostgreSQL") → Finds PostgreSQL entities
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
<!--
|
|
737
|
+
### semantic_search (Requires OpenAI API Key)
|
|
738
|
+
|
|
739
|
+
COMMENTED OUT - Add OpenAI API key to enable semantic search:
|
|
740
|
+
|
|
741
|
+
Use `semantic_search` for concept exploration and natural language queries:
|
|
742
|
+
|
|
743
|
+
**When to use:**
|
|
744
|
+
- Exploring topics without knowing exact terminology
|
|
745
|
+
- Finding related concepts across different domains
|
|
746
|
+
- Natural language queries about abstract ideas
|
|
747
|
+
|
|
748
|
+
**Parameters:**
|
|
749
|
+
- `limit`: Maximum results (default: 10)
|
|
750
|
+
- `min_similarity`: Similarity threshold 0.0-1.0 (default: 0.6)
|
|
751
|
+
|
|
752
|
+
**Example queries:**
|
|
753
|
+
```
|
|
754
|
+
semantic_search("software architecture patterns") → Finds design patterns, architectural concepts
|
|
755
|
+
semantic_search("database optimization techniques") → Finds performance tuning, indexing strategies
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
To enable: Add OPENAI_API_KEY to your ~/.claude.json MCP server config, then uncomment this section.
|
|
759
|
+
-->
|
|
760
|
+
|
|
761
|
+
## Critical Constraints
|
|
762
|
+
|
|
763
|
+
### NEVER use read_graph()
|
|
764
|
+
- ⚠️ The `read_graph()` tool always exceeds the 25,000 token response limit
|
|
765
|
+
- **Always use `search_nodes()` or `semantic_search()` instead**
|
|
766
|
+
|
|
767
|
+
---
|
|
768
|
+
|
|
769
|
+
EOF
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
**IF NO (omit semantic search):**
|
|
773
|
+
|
|
774
|
+
**RUN:**
|
|
775
|
+
```bash
|
|
776
|
+
cat >> ~/.claude/CLAUDE.md << 'EOF'
|
|
777
|
+
|
|
778
|
+
---
|
|
779
|
+
|
|
780
|
+
# Knowledge Graph (KG) Usage Instructions
|
|
781
|
+
|
|
782
|
+
*Added by mcp-neo4j-knowledge-graph setup on $(date +%Y-%m-%d)*
|
|
783
|
+
|
|
784
|
+
## Abbreviation
|
|
785
|
+
- **kg**: References the Neo4j knowledge graph and MCP tools
|
|
786
|
+
|
|
787
|
+
## Search Method
|
|
788
|
+
|
|
789
|
+
### search_nodes
|
|
790
|
+
|
|
791
|
+
Use `search_nodes` for exact term matching:
|
|
792
|
+
|
|
793
|
+
**When to use:**
|
|
794
|
+
- Known exact terms or technical names
|
|
795
|
+
- Quick existence checks
|
|
796
|
+
- Technical lookups with specific terminology
|
|
797
|
+
|
|
798
|
+
**Example queries:**
|
|
799
|
+
```
|
|
800
|
+
search_nodes("Docker") → Finds entities mentioning Docker
|
|
801
|
+
search_nodes("React") → Finds React-related entities
|
|
802
|
+
search_nodes("PostgreSQL") → Finds PostgreSQL entities
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
## Critical Constraints
|
|
806
|
+
|
|
807
|
+
### NEVER use read_graph()
|
|
808
|
+
- ⚠️ The `read_graph()` tool always exceeds the 25,000 token response limit
|
|
809
|
+
- **Always use `search_nodes()` instead**
|
|
810
|
+
|
|
811
|
+
---
|
|
812
|
+
|
|
813
|
+
EOF
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
#### Verify Addition
|
|
817
|
+
|
|
818
|
+
**RUN:**
|
|
819
|
+
```bash
|
|
820
|
+
tail -20 ~/.claude/CLAUDE.md
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
**TELL USER:**
|
|
824
|
+
```
|
|
825
|
+
✅ Knowledge Graph usage instructions added to ~/.claude/CLAUDE.md!
|
|
826
|
+
|
|
827
|
+
A backup of your previous file was saved to:
|
|
828
|
+
~/.claude/CLAUDE.md.backup-[timestamp]
|
|
829
|
+
|
|
830
|
+
These instructions will help Claude Code use your knowledge graph more effectively in future sessions.
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### 8.4 Final Success Celebration
|
|
531
834
|
|
|
532
835
|
**AFTER SUCCESSFUL MCP TOOL TEST:**
|
|
533
836
|
|
|
@@ -550,7 +853,7 @@ Next steps:
|
|
|
550
853
|
Happy graphing! 🚀
|
|
551
854
|
```
|
|
552
855
|
|
|
553
|
-
### 8.
|
|
856
|
+
### 8.5 Save Setup Summary
|
|
554
857
|
|
|
555
858
|
**CREATE FILE** `mcp-neo4j-setup-summary.txt`:
|
|
556
859
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henrychong-ai/mcp-neo4j-knowledge-graph",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
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>",
|