6666 multi_scan.rs # Multi-server scanning
6767 ai/ # AI provider integration
6868 engine.rs # ExplainEngine
69+ prompt_templates.rs # Advanced prompt engineering (few-shot, CoT)
70+ neo4j_kb.rs # Neo4j knowledge graph (optional feature)
6971 provider/ # Provider implementations
7072 anthropic.rs # Claude API
7173 openai.rs # GPT API
@@ -168,6 +170,13 @@ OPENAI_API_KEY # For GPT models
168170OLLAMA_BASE_URL # For local Ollama (default: http://localhost:11434)
169171MCPLINT_CACHE_DIR # Cache directory
170172MCPLINT_CACHE_BACKEND # Backend: filesystem, memory, redis
173+
174+ # Neo4j Knowledge Graph (optional, requires --features neo4j)
175+ NEO4J_URI # Neo4j connection URI (e.g., neo4j+s://xxx.databases.neo4j.io)
176+ NEO4J_USERNAME # Database username
177+ NEO4J_PASSWORD # Database password
178+ NEO4J_DATABASE # Database name (default: neo4j)
179+ VOYAGE_API_KEY # Voyage AI API key for embeddings
171180```
172181
173182## Exit Codes
@@ -187,6 +196,7 @@ Key crates:
187196- serde/serde_json: Serialization
188197- reqwest: HTTP client
189198- tracing: Logging
199+ - neo4rs: Neo4j graph database (optional, ` --features neo4j ` )
190200
191201## Test Coverage
192202
@@ -304,6 +314,45 @@ let engine = ExplainEngine::new(config, cache).await?;
304314let explanation = engine . explain (& finding ). await ? ;
305315```
306316
317+ ### Advanced Prompt Engineering
318+
319+ ``` rust
320+ use mcplint :: ai :: {AdvancedPromptBuilder , VulnCategory , FewShotExample };
321+
322+ // Build prompts with chain-of-thought reasoning and few-shot examples
323+ let builder = AdvancedPromptBuilder :: new ()
324+ . with_finding (finding . clone ())
325+ . with_chain_of_thought (true )
326+ . with_confidence_scoring (true );
327+
328+ let (system_prompt , user_prompt ) = builder . build_prompts ();
329+
330+ // Categories: Injection, Authentication, Cryptographic, DataExposure,
331+ // Deserialization, Dos, ProtocolViolation, Generic
332+ ```
333+
334+ ### Neo4j Knowledge Graph (optional)
335+
336+ ``` rust
337+ #[cfg(feature = " neo4j" )]
338+ use mcplint :: ai :: {
339+ Neo4jConfig , SecurityKnowledgeGraph , VoyageEmbedder , EmbeddingProvider ,
340+ SimilarFinding , CweKnowledge ,
341+ };
342+
343+ // Connect to Neo4j with vector search for similar vulnerabilities
344+ let config = Neo4jConfig :: from_env ()? ;
345+ let embedder = Arc :: new (VoyageEmbedder :: new (api_key , " voyage-code-2" , 1536 ));
346+ let kg = SecurityKnowledgeGraph :: new (config , embedder ). await ? ;
347+
348+ // Store and search findings
349+ kg . store_finding (& finding , " my-server" ). await ? ;
350+ let similar = kg . find_similar_vulnerabilities (& finding , 5 , 0.7 ). await ? ;
351+
352+ // Retrieve CWE knowledge
353+ let cwe = kg . get_cwe_knowledge (" CWE-78" ). await ? ;
354+ ```
355+
307356### Caching
308357
309358``` rust
@@ -454,6 +503,8 @@ User Command
454503| ` scanner ` | Security vulnerability detection | ` ScanEngine ` , ` Finding ` , ` Severity ` |
455504| ` fuzzer ` | Coverage-guided fuzzing | ` FuzzSession ` , ` FuzzResults ` , ` FuzzCrash ` |
456505| ` ai ` | AI-powered explanations | ` ExplainEngine ` , ` ExplanationResponse ` |
506+ | ` ai::prompt_templates ` | Advanced prompt engineering | ` AdvancedPromptBuilder ` , ` VulnCategory ` , ` FewShotExample ` |
507+ | ` ai::neo4j_kb ` | Neo4j knowledge graph (optional) | ` SecurityKnowledgeGraph ` , ` VoyageEmbedder ` |
457508| ` cache ` | Multi-backend caching | ` CacheManager ` , ` CacheConfig ` |
458509| ` baseline ` | Diff comparison | ` Baseline ` , ` DiffEngine ` , ` DiffResult ` |
459510| ` fingerprinting ` | Schema change detection | ` FingerprintHasher ` , ` ToolFingerprint ` |
0 commit comments