GraphRAG: What It Is, How It Works, and How to Use It (API, MCP, n8n)
Posted , updated .
GraphRAG offers a highly efficient way to improve the performance of your LLMs by using knowledge graphs to generate context-aware responses. LLM's own knowledge may be too general or limited and traditional RAG methods may not work well for general queries and won't capture complex relations. GraphRAG uses a knowledge graph to improve the original user queries and capture complex relations in data.
Get Started with GraphRAG
Create an Account
Sign up for a free InfraNodus account to get access to the knowledge graph tools and your API key.
Create a Free AccountGet InfraNodus MCP
https://mcp.infranodus.com
Add this URL as a connector via Settings > Connectors in Claude Web / Desktop and authenticate with your InfraNodus API key via OAuth.
https://mcp.infranodus.com
Open the ChatGPT Apps page > Advanced Settings > enable Developer Mode > Create App, paste this URL (leave the OAuth fields empty), click Connect, and authenticate with your InfraNodus API key. Full guide: ChatGPT setup.
claude mcp add infranodus -s user --transport http https://mcp.infranodus.com/mcp
Then open Claude Code in terminal, run /mcp and pick
"Authenticate" — it opens the browser OAuth flow where you will need to
put in your InfraNodus API key to connect to
the MCP server.
{
"mcpServers": {
"infranodus": {
"url": "https://mcp.infranodus.com"
}
}
}
Add this to ~/.cursor/mcp.json (all projects) or
.cursor/mcp.json (one project) — or use
Cursor Settings > MCP > New MCP Server. Then
click "Login" next to the server to authenticate with your
InfraNodus API key.
codex mcp add infranodus --url https://mcp.infranodus.com
codex mcp login infranodus
Run these commands in your terminal — the login command opens the
browser OAuth flow where you enter your
InfraNodus API key. (You can also add the
server to ~/.codex/config.toml manually.)
{
"mcpServers": {
"infranodus": {
"command": "npx",
"args": ["-y", "infranodus-mcp-server"],
"env": {
"INFRANODUS_API_KEY": "your-api-key"
}
}
}
}
Add this to your LLM client's MCP configuration file (it runs the
infranodus-mcp-server npm package via npx), replacing
your-api-key with your
InfraNodus API key. See our
deployment guides for client-specific
instructions (n8n, Make.com, local setup, and more).
Or Use GraphRAG in n8n
No-code option: use the official InfraNodus n8n node or one of our workflow templates to add GraphRAG context, content gaps, and expert knowledge to your AI agents. Developers can call the GraphRAG API directly.
Official n8n Node n8n Workflow Templates n8n TutorialTry It: Your First Prompt
Paste this into Claude Code, Claude Desktop, Cursor or any client where the MCP server is installed. Replace the parts in square brackets with your own:
Using the InfraNodus MCP server, build a knowledge graph of the documents in this folder, then answer the question below with retrieve_from_knowledge_base and the graph summary turned on. Tell me which clusters the retrieval reached and which it did not.
There are multiple different types of GraphRAG systems available and they all function in different ways as there's not a single standard for how they should work. The advantage of the InfraNodus GraphRAG API is that it provides a visual interface that can be used for contextual overview and targeted queries. It also has an easy-to-use API that can be used for prompt augmentation, get relational context for your RAG queries, generate content gaps, and AI responses that bridge those gaps.
What GraphRAG Is and How It Works
GraphRAG (graph retrieval-augmented generation) is RAG where the retrieval step runs over a knowledge graph of your content instead of over a list of embedded text chunks. The graph has concepts as nodes, co-occurrence or extracted relations as edges, and communities of nodes as topics. Retrieval means locating the concepts in the question and following their relations outward, so what comes back is decided by how your material is connected, not by how similar its wording is to the question.
A GraphRAG query runs in five steps:
- Locate the query concepts as nodes in the graph.
- Traverse one or two hops along their relations, crossing from one topical cluster into another through the concepts that connect them.
- Pull the statements behind every node reached, with their sources. Some share no words with the question; that is the point.
- Add a structural summary: the main clusters, their weight, and the gateway concepts between them, so the model knows the shape of the whole knowledge base.
- Report the gaps: clusters the walk could not enter, which tells the model and you what the knowledge base does not cover on this question.
GraphRAG vs RAG at a Glance
| Vector RAG | GraphRAG | |
|---|---|---|
| Index | Embedded text chunks | Knowledge graph of concepts and relations, plus the statements behind them |
| Retrieval | Nearest chunks by cosine similarity | Traversal from the query concepts, plus cluster summary |
| Good at | Lookup: "what did we say about X" | Relational and overview questions: "how does X relate to Y", "what is this corpus about", "what is missing" |
| Fails at | General questions, multi-hop relations, knowing what is absent | Exact quote lookup if the graph is too coarse; needs a graph to exist first |
| Explainability | Similarity scores | You can see the path the retrieval took on the graph |
| Setup | Chunk, embed, store | Build the graph (InfraNodus does this from text in one step; Neo4j or Microsoft GraphRAG need an LLM extraction pass) |
GraphRAG vs Traditional RAG: Advantages
Traditional RAG (retrieval-augmented generation) is used to provide additional context to a general-purpose LLM. The user asks a question, it is converted into a vector representation and is then matched to the most similar documents in the knowledge base (that are also represented by multidimensional vectors). The retrieved document chunks are then added to the model's context and are used to provide an answer. There are multiple problems with this approach.
First, when the user query is too general (e.g. "What is it about?"), standard vector similarity search will not understand user's intent to get an overview of the document. Instead, it will find the chunks that are most similar to the terms "what", "it" and "about" (which can be anything) and provide the most irrelevant context to the model.
Another problem is that traditional RAG does not capture relations in text, so when you make complex queries like "What are the approaches I should be using with this framework?", RAG will look for "framework" and "approaches", not what they are connected to.
Using a knowledge graph helps solve these problems. It encodes the complex relationships and can be used to retrieve relations between the entities. As there is a model of the whole text structure, it can also be used to retrieve an overview, identify topical clusters, and add this as additional context to the model. These insights can be used both to augment users' prompts or to provide additional context to the model to improve its responses.
For example, when you ask a model about the main topics in a document, it will use its underlying representation of the whole dataset and retrieve the main topical clusters, which can be used to provide better results. When you ask about a specific relations, it will retrieve a relevant part of the graph and traverse it several hops away to retrieve all related statements that may not be semantically similar. It will then provide those text chunks to the context and increase model's awareness of the context in a way that is specific to the particular dataset you're analyzing.
Typical Graph RAG Applications
There are different types of Graph RAG applications that can be used for different purposes. Often, they are combined for better results.
1. User Prompt Augmentation
One of the most typical use cases for GraphRAG is user prompt augmentation. In this scenario, GraphRAG is added to an LLM pipeline in order to add contextual information to the user's prompt, which can then be used with the standard RAG pipeline to generate better answers.
For example, if the user asks "What is it about?", before sending it to a knowledge retrieval function, we can retrieve the general information about the text — the main topical clusters, concepts, and relations — and ask an LLM to improve user's propmt with that contextual information. So it becomes "What are the most important ideas in this document related to text analysis, API, and data visualization?". When this augmented prompt is then sent to a standard RAG pipeline, vector search will retrieve much more relevant results as we're providing more context in our query. This context will then be used to generate a better response for the user.
Further reading: prompt augmentation for LLM RAG with Dify and InfraNodus.
2. Adding Relations to Context
Another common use case for GraphRAG is to provide relational context to LLMs. In this scenario, GraphRAG will retrieve the most relevant parts of the knowledge graph related to the user's query. These parts may be encoded as ontological relations (e.g. "Text Analysis" [used in] "Data Science"), as it is done in the Neo4J, LlamaIndex, and InfraNodus GraphRAG systems. They may also contain the actual statements, which will be added to the model's context — as it is done in InfraNodus. This additional relational data will help the model generate more focused results with a particular emphasis on ontological relations present in a particular dataset.
Further reading: Portable GraphRAG.
3. Topical Overview and Summarization
GraphRAG can also be used to store a topical overview of a document or a dataset. In this scenario, GraphRAG identifies the main clusters of entities present in text and then organizes them into topics, which can then be summarized and used for providing additional context to the model. This approach is used in Microsoft and InfraNodus GraphRAG.
Further reading: using GraphRAG to generate topical clusters and summaries.
4. Knowledge Base Optimization
Knowledge base optimization is another interesting use case for GraphRAG. Knowledge base is used to retrieve contextual data for LLM responses. Usually it's a collection of documents or support articles to be used for response generation. GraphRAG can be used to evaluate the quality of this knowledge base and to see whether something is missing. This can be done using the InfraNodus GraphRAG, which will visualize the main topical clusters in a graph and show the relations between them. This representation can be used to assess the completedness of the knowledge base and identify the content gaps that need to be filled in order to improve the quality of retrieval.
Further reading: knowledge base optimization.
5. Content Gap Detection
Knowledge graphs can be used to detect content gaps in a dataset. These can be identified based on the structural holes in the knowledge graph: the topical clusters that could be better connected but are not. Bridging these gaps can help generate interesting but relevant insights because they connect the ideas that already exist in a text in a completely new way. InfraNodus knowledge graphs can be used for this purpose and there is a dedicated endpoint in InfraNodus API that provides this insight based on the text's knowledge graph structure. Content gap detection can be integrated into your automation workflows as additional tools that can help remove model's bias and point its attention to what's missing in a particular text.
Further reading: content gap detection for agentic workflows with Crew AI.
GraphRAG Comparison: Neo4J vs Microsoft vs InfraNodus
There are several GraphRAG frameworks available in the market today and they work slightly differently. They also differ in terms of complexity and ease of use. Choosing the right framework depends on your objectives. Below we overview the most popular ones and compare them to one another.
Neo4J GraphRAG
Neo4J is a popular graph database that that be used for knowledge graph storage and retrieval. It is relatively easy to set up on the cloud and it has multiple tutorials.
The problems start when you want to generate a graph. You can use their LLM graph builder, but it takes a long time to process the data and might use a lot of your tokens as it has to process the whole document, feed it to an LLM of your choice (that you will provide your own API key for), and then generate Cypher queries (Neo4J database language) to create the graph. This is a very long and tedious process. As a result, you will have a graph of entities and ontological relations and can then use the Neo4J's GraphRAG library (directly in Python or in your favorite framework, such as LangChain or LlamaIndex) to extract those relations and augment your prompts with them. However, as you can see, you still need a bunch of external frameworks to use it, it's hard to update the knowledge base with new data, and it can be costly, especially if you don't host everything yourself.
Pros:
• One of the market leaders
• Has a basic graphical interface
• Has cloud hosting options to try it out
• Can build large graphs and encode complex ontologies
• Integrates with popular LLM frameworks
Cons:
• Difficult to generate graphs
• Graphs can be expensive to encode
• Difficult to update
• Lack of analysis / editing features in the graph
interface
• Requires extensive coding knowledge to use in an API
Microsoft GraphRAG
Microsoft GraphRAG is one of the most popular solutions, but it is not as flexible as the other options. It's based on generating a knowledge graph for your data, identifying community clusters, and then generating summaries for those clusters to provide better context to your responses.
However, Microsoft GraphRAG is very difficult to set up. You could theoretically host it yourself, but it's too buggy, so you need to set up a new Azure instance and deal with permissions and API keys. Once you set it all up, it will take you hours to launch the Microsoft GraphRAG instance due to multiple Python incompatibilities and dependencies. It may be a good solution for enterprise users who have a team to dedicate to setting it up along with a paid Azure support plan, but it's not a good solution for mere mortals.
Pros:
• Conceptually interesting
• Can be hosted on Azure
• Suitable for enterprise users
Cons:
• Requires complex set up
• Needs coding knowledge
• No graph interface
• Lack of observability
• Can be expensive to run on Azure
LangChain Graph RAG Retrieval
LangChain is a popular framework for building LLM applications. It provides a Graph RAG retrieval component that can be used to emulate graph retrieval based on metadata properties of your text chunks.
Technically, LangChain Graph RAG is not really a knowledge graph because it doesn't have a holistic view of the content. Rather, it is an ad-hoc solution where you can have graph-like retrieval by specifying certain metadata properties as the graph edges (e.g. link the text chunks, which have the same "location" property) and improve RAG retrieval using those edges to improve the precision. However, as it does not have a coded ontology or general representation of the content, it can only be used to add some relational data to prompts based on the properties, but it cannot be used for knowledge base optimization, prompt augmentation, or content gap detection.
Pros:
• Relatively simple to set up
• Uses existing metadata in your documents
• Integrated in a popular framework
• Open-source
Cons:
• Is not a proper knowledge graph
• Does not have a holistic view of the content
• No graph interface
• Lack of relation descriptions
InfraNodus GraphRAG
InfraNodus GraphRAG is a simple and easy to use solution that allows you to generate a knowledge graph for your data, identify community clusters, and then generate summaries for those clusters to provide better context to your responses. It can also retrieve relational data based on the users' query and identify structural gaps in your knowledge, which can be used to generate insights and recommendations.
InfraNodus provides an easy-to-use knowledge graph API for LLM RAG that can be integrated into any LLM pipeline, framework, or applications (such as Dify for building chatbots, for instance). It also has an interactive graph that can be used to explore and clean the knowledge base and to emulate user queries in order to understand which parts of the graph are used to provide responses.
Pros:
• Easy to use
• No need to code
• Interactive graph
• Easy to update
Cons:
• Requires subscription
• May have limitations on the total knowledge base size
• Does not support local Ollama GraphRAG (yet)
GraphRAG: Frequently Asked Questions
What is GraphRAG?
GraphRAG is retrieval-augmented generation where the LLM retrieves context from a knowledge graph of your content rather than from embedded text chunks. The graph makes relations, topics and gaps explicit, so the model can answer relational and overview questions that vector search misses, and it can tell you what the knowledge base does not cover.
What is the difference between GraphRAG and RAG?
Standard RAG ranks chunks by similarity to the question. GraphRAG locates the question's concepts in a graph and follows their relations, returning statements that may share no vocabulary with the question plus a summary of the graph's structure. RAG is better for exact lookup; GraphRAG is better for "how does this connect", "what is this about" and "what is missing". Many systems run both. See MCP vs RAG vs AI agents and LLM wiki vs RAG vs knowledge graph.
How is InfraNodus GraphRAG different from Microsoft GraphRAG and Neo4j?
Microsoft GraphRAG and Neo4j's LLM Graph Builder extract entities and relations by running an LLM over every document, then store the result in a graph database you query with code. InfraNodus builds the graph from text with network analysis (no extraction pass, no tokens spent), shows it to you as an interactive visualization, and exposes retrieval, cluster summaries and gap detection through a REST API and an MCP server. It is faster to set up and easier to update; Neo4j wins when you need a full graph database under your own ontology.
What are fast-graphrag, nano-graphrag and the GraphRAG toolkit?
They are open-source Python libraries that reimplement the Microsoft GraphRAG approach with fewer moving parts: fast-graphrag (circlemind) focuses on speed and incremental updates, nano-graphrag is a compact reimplementation for experimentation, and the AWS GraphRAG Toolkit targets Amazon Neptune and Bedrock. All three need you to write and host code. InfraNodus is the no-code route to the same kind of retrieval, reachable from Claude or Cursor through MCP.
Can I use GraphRAG with Obsidian?
Yes. The InfraNodus Obsidian plugin builds the graph from a note, folder, tag or the whole vault, and the same graph is available to Claude Code over the MCP server, so the model retrieves from your vault by traversal. The LLM wiki page shows the setup where Claude maintains the wiki and InfraNodus provides the graph layer. The Obsidian MCP guide compares this route with the file-access servers.
Is there a GraphRAG API?
Yes. The InfraNodus REST API exposes graph generation, retrieve_from_knowledge_base-style retrieval with an optional graph summary, topical clusters and content gaps as endpoints. See the API documentation for the request format and the API reference for the full parameter list.
Can I use GraphRAG in n8n or Dify?
In n8n, yes, with the official InfraNodus node and the workflow templates: the node adds relational context, a topical summary or content gaps to any AI agent step. In Dify and similar builders there is no dedicated plugin; call the REST API from an HTTP request node or a custom tool and pass the returned context into the prompt.
How do I use GraphRAG from Claude Code or Cursor?
Add the InfraNodus MCP server and ask the model to use the knowledge base. It calls generate_contextual_hint for a lightweight overview before a longer task and retrieve_from_knowledge_base with the graph summary for a full traversal. The LLM Wiki skill wires both into its query phase, and the same graphs double as persistent memory for the agent.
Try It Yourself
You can try the InfraNodus GraphRAG API after you sign up for an account and get an API key:
Log In Sign Up