Get the FREE Ultimate OpenClaw Setup Guide →

graphrag-toolkit

Python toolkit for building graph-enhanced GenAI applications

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio awslabs-graphrag-toolkit python -m graphrag_toolkit

How to use

The GraphRAG Toolkit is a collection of Python tools designed to simplify building graph-enhanced generative AI applications. It includes components for constructing and querying a hierarchical lexical graph (Lexical Graph) and modules related to knowledge graph question answering (BYOKG-RAG). Once installed, you run the toolkit as a Python module, which exposes CLI-like capabilities and programmatic interfaces for integrating graph-based retrieval and reasoning into your AI workflows. Use the Lexical Graph component to automatically build and query a hierarchical lexical graph from unstructured data, and pair it with graph-aware QA strategies to improve accuracy over standard vector-based retrieval. The BYOKG-RAG portion lets you bring your own knowledge graph and perform complex QA over it, enabling more precise answers grounded in your existing data.

How to install

Prerequisites:

  • Python 3.8 or newer
  • pip (usually included with Python)
  • Optional: virtual environment tool (e.g., venv, virtualenv)

Installation steps:

  1. Create and activate a virtual environment (recommended)

    • macOS/Linux: python3 -m venv venv source venv/bin/activate
    • Windows: python -m venv venv .\venv\Scripts\activate
  2. Upgrade pip

    • python -m pip install --upgrade pip
  3. Install the graphrag-toolkit package

    • pip install graphrag-toolkit Note: If the package name differs in your environment, install the package that provides graphrag_toolkit as a module.
  4. Verify installation

    • python -m graphrag_toolkit --version
  5. Run the toolkit module (example)

    • python -m graphrag_toolkit If you need a specific submodule (e.g., lexical-graph tooling), invoke the corresponding entry point as documented in the project docs.

Optional: If you prefer not to install system-wide, use a virtual environment or container to isolate dependencies.

For advanced usage, refer to the project documentation for any CLI flags, configuration files, or environment variables that control graph construction, QA strategies, and data sources.

Additional notes

Tips and considerations:

  • Environment variables: Some deployments may require configuring API keys, database connections, or service endpoints. Prepare a dotenv or environment variable file if your deployment environment requires it.
  • Data sources: The Lexical Graph component builds graphs from unstructured data; ensure your input data is accessible to the module (e.g., local files, cloud storage, or feed endpoints).
  • Performance: Large lexical graphs can be memory-intensive. Consider running in a container with sufficient RAM or using streaming/partial graph construction when dealing with very large datasets.
  • Compatibility: Ensure your Python version and dependencies match the tool’s requirements. Use a virtual environment to avoid conflicts with other packages.
  • Troubleshooting: If the module cannot be found, verify the installation path and PYTHONPATH, and ensure you are invoking the correct module name (graphrag_toolkit vs graphrag_toolkit) as provided by the package.
  • Documentation: Refer to the official GraphRAG Toolkit docs for CLI options, module APIs, and examples for Lexical Graph and BYOKG-RAG workflows.

Related MCP Servers

Sponsor this space

Reach thousands of developers