# pg-raggraph

A Python library and toolkit for GraphRAG built entirely on plain PostgreSQL, combining vector search, full-text search, and knowledge-graph traversal in a single SQL query without Neo4j or a separate vector database.

pg-raggraph is a Python library for GraphRAG that runs entirely on PostgreSQL: pointed at a directory of documents, it ingests them into chunks, embeddings, extracted entities, relationships, and a full-text index, then answers queries by combining vector similarity, BM25, and graph traversal in one round trip to Postgres. It supports two retrieval workloads: classic GraphRAG over static corpora such as technical documentation and code Q&A with multi-hop entity reasoning, and evolving-knowledge retrieval for corpora where the correct answer depends on time, version, or retraction status.

Around the core library, the project also provides a CLI (`pgrg`), an optional FastAPI server with a web UI, and an MCP server for clients such as Claude Desktop, Cursor, and Zed. Ingestion can run synchronously, returning once the graph is built, or deferred with a background worker that backfills entities, relationships, and a code call graph out of band, including a command for code knowledge bases that rebuilds call, inheritance, and implementation edges without blocking initial ingest.

Website: https://github.com/yonk-labs/pg-raggraph
