Skip to main content
Glama
T-NhanNguyen

GraphRAG Llama Index MCP Server

by T-NhanNguyen

GraphRAG LlamaIndex

Full-stack GraphRAG engine optimized for local indexing and lightweight cloud querying. Built on DuckDB, LlamaIndex, and the Model Context Protocol (MCP).

1. Context

This project implements a Decoupled Architecture:

  • Indexer (Image A): Heavy-duty ML environment (PyTorch, GLiNER) for local graph construction.

  • Query (Image B): Lightweight API environment (Node.js, DuckDB) for fast cloud deployment (~1GB footprint).

Related MCP server: Graforest MCP

2. Building the Images

# Build specialized images via Docker Compose
docker compose build

3. Running Indexer & Query

Load the shell aliases for the fastest workflow:

  • macOS (Zsh): source .graphrag-alias.zsh

  • WSL/Bash: source .graphrag-alias.sh

  • PowerShell: . .\.graphrag-alias.ps1

Indexing Documents

# 1. Initialize a database entry
graphrag start my_project --source /app/documents/source_files

# 2. Run the ingestion pipeline (Indexer Image)
graphrag index my_project [--reset] [--prune]

Querying

# CLI Search (Query Image)
graphrag search my_project "What are the common themes?"

# Start MCP Server for Agents
docker compose up query

4. Deployment Folder

  • deployment/fly/: Scripts for zero-latency hosting on Fly.io (optimized for free-tier fly-machines).

  • deployment/aws/: Infrastructure scripts for ECR, S3 backups, and App Runner deployments.

5. Setup & Configuration

Environment (.env)

Copy .env.example and set:

  • OPENAI_API_KEY: For LLM reasoning and extraction.

  • DOCUMENTS_HOME: Absolute path to your local data folder (mapped to /app/documents in Docker).

Engine Configuration (core/graphrag_config.py)

Tweak these parameters to refine performance:

  • SearchType: Switch between entity_connections (graph-heavy) or thematic_overview (summary-heavy).

  • ExtractionMode: Choose llm (creative) or gliner (fast/cost-effective).

6. Local Integration & Testing

Integrate this project as an MCP Server in Desktop Agents (Claude Desktop, Cursor, etc.) to give them memory of your documents.

Add to your MCP Config:

{
  "mcpServers": {
    "graphrag": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "C:/Users/<USER>/.graphrag:/root/.graphrag",
        "graphrag-query"
      ]
    }
  }
}

7. Database Cheatsheet

Core Commands

  • graphrag list: Show all registered databases.

  • graphrag status <db>: Check entity/relationship counts and health.

  • graphrag delete <db> [--files]: Unregister database entry and optionally remove physical files.

  • graphrag index <db> [--reset]: Index documents into database (use --reset to skip duplicate checks).

Managed Storage Workflow

To keep your project portable, move database files into a Managed/ folder inside your data directory.

Manual Move:

  1. Move your_db.duckdb to [DOCUMENTS_HOME]/Managed/.

  2. Re-register the path:

graphrag register my_db --db-path /app/documents/Managed/your_db.duckdb

For S3 management see S3_CHEATSHEET.md.

Available Tools

3 tools
explore_entity_graphA

Traverse the knowledge graph starting from a specific entity. Returns the entity, its direct connections (other entities), and the relationships between them. Use this to build reasoning chains or verify facts about a known entity.

ParametersJSON Schema
NameRequiredDescriptionDefault
entityNameYesExact name of the entity to explore (e.g., 'Microsoft', 'Vistra')
hopsNoHow many relationship hops to traverse (default: 1, max: 3)

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the return structure (entity, direct connections, relationships) and mentions traversal behavior with hops, but doesn't cover important aspects like rate limits, authentication requirements, error conditions, or what happens when the entity isn't found. The description adds value but leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise with two sentences that each earn their place. The first sentence states the core functionality, the second provides usage guidance. No wasted words, well-structured, and front-loaded with the main purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a graph traversal tool with no annotations and no output schema, the description provides adequate basic information about what the tool does and when to use it. However, it lacks details about the return format structure, error handling, performance characteristics, and limitations that would be important for an agent to use this tool effectively in complex scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the schema already documents both parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema descriptions. It mentions traversal with hops but doesn't provide additional context about parameter usage or interactions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('traverse', 'returns') and resources ('knowledge graph', 'entity', 'direct connections', 'relationships'). It distinguishes from siblings by focusing on graph traversal from a specific entity rather than corpus statistics or general search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('to build reasoning chains or verify facts about a known entity'), which implicitly suggests it's for exploring known entities rather than discovering new ones. However, it doesn't explicitly state when NOT to use it or name specific alternatives among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_corpus_statsA

Get statistics about the indexed knowledge base. Returns counts of documents, chunks, entities, and relationships. Use for corpus health checks or to understand the scale of available data.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what the tool returns (counts of documents, chunks, entities, relationships) but doesn't mention performance characteristics, potential limitations, or error conditions. The behavioral information is adequate but minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise with two well-structured sentences. The first sentence states the purpose and return values, the second provides usage guidance. Every word earns its place with zero redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no output schema, no annotations), the description provides adequate coverage of purpose and usage. However, without an output schema, it could benefit from more detail about the structure of returned statistics. The description is complete enough for basic understanding but leaves some implementation details unspecified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, focusing instead on the tool's purpose and output.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Get statistics') and resources ('indexed knowledge base'), and it distinguishes from siblings by focusing on corpus-level metrics rather than entity exploration or search functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage contexts ('corpus health checks' and 'understand the scale of available data'), giving clear guidance on when to use this tool. However, it doesn't explicitly mention when NOT to use it or name specific alternatives among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv1.0.0
    • First observedexplore_entity_graph
    • First observedget_corpus_stats
    • First observedsearch

TDQS

A4.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no ambiguity: explore_entity_graph is for graph traversal from a specific entity, get_corpus_stats is for corpus-level statistics, and search is for querying the knowledge base with three distinct modes (keyword_lookup, entity_connections, thematic_overview). The tools do not overlap in functionality.

Naming Consistency4/5

The tool names follow a consistent snake_case pattern (explore_entity_graph, get_corpus_stats, search), but 'search' is a generic verb compared to the more descriptive 'explore' and 'get', which is a minor deviation. Overall, the naming is predictable and readable.

Tool Count3/5

With only 3 tools, the server feels thin for a GraphRAG system, as it might lack operations like updating or managing the knowledge base. However, the tools cover core query and exploration functions, making it borderline appropriate for basic usage.

Completeness4/5

The tool surface covers key operations for querying and exploring a GraphRAG knowledge base, including graph traversal, corpus statistics, and multi-mode search. Minor gaps exist, such as no tools for adding or modifying data, but agents can work around this for read-only analysis.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    Not graded
    maintenance
    A local-first knowledge base server that enables AI clients to store, retrieve, and manage documents using semantic search. Provides privacy-focused, offline-capable memory for AI assistants with tools for ingesting, querying, updating, and deleting knowledge.
    7
    12 npm
    -
  • F
    license
    A
    quality
    C
    maintenance
    Enables AI agents to build, populate, and search knowledge graphs by providing tools for entity extraction, relationship mapping, and graph traversal. It manages the underlying database infrastructure so users can create searchable knowledge bases from text through natural language commands.
    13
    1
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    A local OKF-compatible knowledge engine for AI agents. Enables capturing agent conversations, hybrid semantic+keyword search, MCP serving to agents, interactive graph visualization, and OKF bundle export.
    Apache 2.0
  • A
    license
    A
    quality
    C
    maintenance
    Enables semantic search and question answering over a knowledge base using hybrid retrieval and grounded answers, all running offline with no API keys.
    4
    MIT