Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/exegia/corpora-py/llms.txt

Use this file to discover all available pages before exploring further.

Context Fabric (corpora-py) is a Python library and FastMCP server that gives AI assistants and developers structured, queryable access to annotated religious text corpora. Every word, verse, chapter, and book is represented as a typed node in a graph, carrying features such as lemma, morphology, and gloss — enabling precise linguistic and structural queries that plain text search cannot match. The package ships 11 ready-to-use tools and supports multiple transports so you can embed it in Claude Desktop, connect a remote client over SSE, or call it directly from Python.

What is Context Fabric?

Context Fabric is built on top of Text-Fabric (TF), a library for processing large annotated text databases represented as feature files. The context-fabric package (cfabric) wraps Text-Fabric to provide a higher-level corpus API. In a Text-Fabric dataset, a corpus is a collection of numbered nodes. Each node has a type — word, verse, chapter, book, and so on — and a set of named features that store annotation values for that node. For example:
  • A word node in the Hebrew Bible might carry lex (lexeme), pos (part of speech), gloss (English gloss), sp (morphological species), and vt (verbal tense).
  • A verse node carries book, chapter, and verse reference features.
  • Containment (a verse contains words) and adjacency are first-class relationships queryable via a template language.
CorpusManager — the singleton at the heart of the MCP server — wraps a cfabric.Fabric instance and its loaded API object. All 11 tools call corpus_manager.get_api() to reach api.S (search), api.F (feature access), api.T (text and section traversal), and so on.

Supported Corpora

Context Fabric can load any dataset that is a valid Text-Fabric directory — one containing both otext.tf and otype.tf. Several well-known open corpora are directly compatible:
CorpusDescription
BHSAHebrew Bible (Biblia Hebraica Stuttgartensia Amstelodamensis) — rich morphological annotation
GNTGreek New Testament — word-level parsing and lemmatization
QuranArabic Quran with morphological tagging
TanakhHebrew scriptures in TF format
CommentariesRabbinic or patristic commentary texts
Lexicons & dictionariesStrong’s, BDB, and other reference works
Custom booksAny EPUB or HTML converted to TF via exegia.utils
The BookCategory enum in exegia.models classifies corpora by type: bible, quran, tanakh, commentary, lexicon, dictionary, devotional, theology, history, philosophy, fiction, and other.

Two Surfaces

Context Fabric exposes corpus data through two surfaces that share the same underlying CorpusManager: MCP server (FastMCP) — The cf-mcp CLI starts a server that speaks the Model Context Protocol. AI assistants such as Claude can discover and call all 11 tools without any custom integration code. The server supports stdio (for Claude Desktop), SSE, and streamable HTTP transports. Python library — Every tool is also a plain Python function. Import exegia.mcp, load a corpus via corpus_manager.load(), and call tools directly in scripts, notebooks, or your own application.

Package Modules

The exegia namespace is organized into focused modules:
ModulePurpose
exegia.mcpFastMCP server — 11 corpus tools for AI clients
exegia.corpusFetch TF datasets from git repositories
exegia.utilsEPUB / HTML → Text-Fabric converters
exegia.modelsShared enums and data model definitions
exegia.schemasPydantic request/response schemas
exegia.authAuthentication utilities

Where to Go Next

Quickstart

Install corpora-py, download a corpus, and run your first query in under 5 minutes.

MCP Server

Learn how to start the server, choose a transport, and connect AI clients.

Corpus Datasets

Browse supported corpora and learn how to fetch them from git.

API Reference

Explore all 11 tool signatures, parameters, and return formats.

Build docs developers (and LLMs) love