मुख्य सामग्री पर जाएँ
Skillpedia
● मुफ़्त और ओपन सोर्स💻 लोकल🔓 API कुंजी नहीं चाहिएप्रोग्रामिंग

Code-Graph-RAG

आपका AI एजेंट कई भाषाओं वाले codebase को knowledge graph में index कर सकता है, फिर उसे सादी अंग्रेज़ी में पूछ और बदल सकता है।

5.3k GitHub स्टारद्वारा vitali87लाइसेंस MITअपडेट 18 दिन पहले

कैसे इंस्टॉल करें

यह MCP लोकल है: आपके कंप्यूटर पर चलता है।

यह PC पर लगे ऐप्स में काम करता है (Claude Desktop, Claude Code, Cursor, VS Code…)। अपना ऐप चुनें:

टर्मिनल में पेस्ट करें:

claude mcp add code-graph-rag -- uvx code-graph-rag mcp-server

क्या भरना है

नामयह क्या हैज़रूरी
ORCHESTRATOR_PROVIDERLLM provider for the orchestrator agent (openai, anthropic, google, azure, cohere, ollama)नहीं
ORCHESTRATOR_MODELModel name for the orchestrator agentनहीं
ORCHESTRATOR_API_KEYAPI key for the orchestrator LLM provider (not needed for the default local ollama provider)नहीं
CYPHER_PROVIDERLLM provider for Cypher query generation (openai, anthropic, google, azure, cohere, ollama)नहीं
CYPHER_MODELModel name for Cypher query generationनहीं
CYPHER_API_KEYAPI key for the Cypher LLM provider (not needed for the default local ollama provider)नहीं
MEMGRAPH_HOSTHostname of the Memgraph databaseनहीं
MEMGRAPH_PORTPort of the Memgraph databaseनहीं
TARGET_REPO_PATHPath to the repository to analyze (auto-detected from working directory if not set)नहीं

तैयार! अब टेस्ट करें

ऐप दोबारा खोलें और इनमें से कोई एक अनुरोध चैट में पेस्ट करें:

यह repository index करो, फिर बताओ login flow कैसे काम करता है।
इस प्रोजेक्ट में dead code ढूंढो।

यह क्या है

Code-Graph-RAG किसी repository की हर source फाइल को Tree-sitter से पढ़ता है और functions, classes, methods और उनके संबंधों का graph बनाता है। फिर आप सवाल पूछ सकते हैं, किसी भी function का source ला सकते हैं, diff preview के साथ code बदल सकते हैं और बेकार (dead) code ढूंढ सकते हैं। यह Claude Code और दूसरे clients के लिए MCP server के रूप में चलता है, और डिफ़ॉल्ट रूप से graph एक लोकल SQLite फाइल में रहता है।

यह क्या कर सकता है

  • cgr start --update-graph से repository को graph में index करें
  • प्राकृतिक भाषा में सवाल पूछें, जवाब graph से मिलता है
  • किसी function, class या method का source लाएं
  • AST-आधारित patching और diff preview के साथ code बदलें
  • entry points से dead code खोजें
  • ast-grep से AST pattern के आधार पर खोजें और दोबारा लिखें
  • cgr trace से runtime calls को graph पर ओवरले करें

कब इस्तेमाल करें

  • ›जब आप बड़े monorepo में काम करते हैं और जवाब असली code की संरचना पर आधारित चाहिए।
  • ›जब आप ऐसे functions खोजना चाहते हैं जिन्हें कोई नहीं बुलाता।
  • ›जब आप codebase में कोई बदलाव करना चाहते हैं और पहले diff देखना चाहते हैं।

आपको क्या चाहिए

Python 3.12+ और ripgrep। uv tool install या pipx से इंस्टॉल करें। डिफ़ॉल्ट रूप से न database server चाहिए, न Docker। model और environment सेटअप के लिए installation guide देखें।

साथ में जमने वाली skills

⭐ Skillpedia MCP · मुफ़्तआपका एजेंट सही skill अपने आप ढूँढ लेता हैहमारा MCP इंस्टॉल करें और ज़रूरत पड़ने पर आपका एजेंट 15,000+ skills में खोजेगा।मुफ़्त इंस्टॉल करें →

अक्सर पूछे जाने वाले सवाल

क्या यह मुफ्त और open source है?

हां, यह MIT license के तहत है। readme कहता है कि इसे मुफ्त इस्तेमाल कर सकते हैं, और संगठनों के लिए पेड cloud और on-premise सेवाएं हैं।

कौन सी भाषाएं सपोर्ट होती हैं?

पूरी तरह समर्थित: Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart और Julia। बाकी में संरचना का सपोर्ट है।

क्या मुझे graph database चाहिए?

नहीं। डिफ़ॉल्ट रूप से graph एक embedded SQLite फाइल में रहता है। Memgraph और Neo4j वैकल्पिक backend हैं।

graph कहां स्टोर होता है?

डिफ़ॉल्ट रूप से ~/.cgr/graph.sqlite में। जगह बदलने के लिए SQLITE_GRAPH_PATH सेट करें।

क्या --clean सिर्फ इस प्रोजेक्ट को मिटाएगा?

नहीं। readme के अनुसार --clean shared graph के हर प्रोजेक्ट को मिटा देता है, और जब दूसरे प्रोजेक्ट भी खो सकते हों तो पुष्टि मांगता है।

PyPI से कौन सा वर्शन मिलता है?

सबसे नया release, जो git के नवीनतम tag से पीछे हो सकता है। नया code पाने के लिए git से इंस्टॉल करें।

अगर काम न करे

  • ›पक्का करें कि Python 3.12 या नया है। पुराने system Python के लिए interpreter pin करना पड़ता है, जैसा installation guide में लिखा है।
  • ›ripgrep इंस्टॉल करें, यह ज़रूरी है।
  • ›सवाल पूछने से पहले cgr start --update-graph चलाएं, ताकि graph बन जाए।

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।