Skip to main content
Glama
NoveltyDreams

textual-criticism-mcp

README.md
# textual-criticism-mcp

Biblical text analysis with textual criticism support. An MCP server for morphological analysis, manuscript variants, and concordance searches across Hebrew and Greek biblical texts.

## Features

- **Text-Fabric Integration**: Full morphological and syntactic analysis of Hebrew (BHSA) and Greek (N1904) texts
- **Textual Criticism**: Variant readings, manuscript data, apparatus analysis
- **Concordance**: Search by lemma, morphology, or syntax patterns
- **Lexicons**: BDB (Hebrew), Thayer's (Greek), Strong's numbers
- **Multiple Translations**: Public domain texts (KJV, WEB, ASV, YLT, Darby, BBE)

## Installation

```bash
# Basic installation
pip install textual-criticism-mcp

# With MCP server support
pip install textual-criticism-mcp[mcp]

# With CLI
pip install textual-criticism-mcp[cli]

# Everything
pip install textual-criticism-mcp[all]
```

## Quick Start

### Python Library

```python
from textual_criticism_mcp.lib import parse_verse, search

# Parse a verse with full morphology
verse = parse_verse("John 3:16")
for word in verse.words:
    print(f"{word.text} ({word.lemma}) - {word.pos}")

# Search for a lemma
results = search("word lex=ἀγάπη", corpus="greek")
```

### MCP Server

Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "textual-criticism": {
      "command": "python",
      "args": ["-m", "textual_criticism_mcp.mcp.server"]
    }
  }
}
```

Or with uvx:

```json
{
  "mcpServers": {
    "textual-criticism": {
      "command": "uvx",
      "args": ["textual-criticism-mcp"]
    }
  }
}
```

## MCP Tools

### `parse_verse`

Parse a verse with complete morphological analysis.

```
parse_verse("Gen 1:1", detail_level="syntax")
```

Returns word-by-word breakdown with:
- Original text + transliteration
- Lemma and Strong's number
- Full morphological parsing (POS, person, gender, number, tense, voice, mood, case, state, stem)
- Syntactic information (phrase function, clause type)

### `search_lemma`

Find all occurrences of a word.

```
search_lemma("ἀγάπη", corpus="nt", limit=100)
```

### `search_morphology`

Search by grammatical criteria.

```
search_morphology(language="hebrew", pos="verb", stem="qal", mood="imperative")
```

### `get_variants`

Get textual variants for a passage.

```
get_variants("Mark 16:9-20", include_manuscripts=True)
```

Returns:
- All variant readings
- Manuscript support (P46, א, B, etc.)
- Edition support (NA28, SBLGNT, TR)
- Variant classification and transcriptional analysis

### `get_passage`

Retrieve passage text in multiple translations.

```
get_passage("Rom 8:1-4", translations=["KJV", "WEB", "ASV"], include_original=True)
```

## Data Sources

- **Hebrew Bible**: BHSA (Biblia Hebraica Stuttgartensia Amstelodamensis) via Text-Fabric
- **Greek NT**: Nestle 1904 via Text-Fabric
- **Apparatus**: STEPBible TAGNT/TAHOT (CC BY 4.0)
- **Lexicons**: OpenScriptures BDB, Strong's, Thayer's
- **Translations**: [wldeh/bible-api](https://github.com/wldeh/bible-api) (public domain texts)

## First Run

Text-Fabric corpora are downloaded automatically on first use (~300MB total).

```python
from textual_criticism_mcp.lib.corpus import get_corpus_manager

# This will download BHSA and N1904 on first run
cm = get_corpus_manager()
cm.hebrew  # Downloads Hebrew corpus
cm.greek   # Downloads Greek corpus
```

## Development

```bash
# Clone and install in dev mode
git clone https://github.com/yourusername/textual-criticism-mcp
cd textual-criticism-mcp
pip install -e ".[all]"

# Run tests
pytest

# Type check
mypy src/textual_criticism_mcp

# Lint
ruff check src/textual_criticism_mcp
```

## License

MIT

## Acknowledgments

- [Text-Fabric](https://github.com/annotation/text-fabric) - Corpus infrastructure
- [ETCBC](https://github.com/ETCBC) - BHSA Hebrew Bible data
- [STEPBible](https://github.com/STEPBible/STEPBible-Data) - Apparatus and tagged texts
- [OpenScriptures](https://github.com/openscriptures) - Lexicons and morphology