Skip to main content
Glama
BigContext MCP
by Rixmerz

BigContext MCP

MCP Server for handling large documents with intelligent segmentation and TF-IDF search. Designed to work with documents of any size without saturating the model context window.

Installation

No need to clone the repository! Install directly:

uvx --from git+https://github.com/Rixmerz/bigcontext_mcp.git bigcontext-mcp

Configuration for Claude Desktop

Add to your ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "bigcontext": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/Rixmerz/bigcontext_mcp.git",
        "bigcontext-mcp"
      ]
    }
  }
}

Restart Claude Desktop and the 31 BigContext tools will be available.

Related MCP server: Aleph

Overview

BigContext MCP allows Claude to work with extensive documents (books, manuals, research papers) by loading only relevant fragments per query, instead of the entire document. It uses automatic segmentation and TF-IDF keyword search to retrieve the most relevant content.

Key Features

Document Processing

  • Multi-format support: txt, md, PDF, EPUB, HTML

  • Automatic segmentation: Detects chapters, sections, and hierarchical structure

  • Efficient storage: SQLite with WAL mode for concurrent access

  • TF-IDF indexing: Fast semantic search without external embeddings

31 Domain-Agnostic Tools

Core Tools (5)

Tool

Description

ingest_document

Load, segment, and index a document

search_segment

Search for relevant segments using TF-IDF

get_metadata

Get metadata, structure, and top terms

list_documents

List all indexed documents

compare_segments

Compare two segments for themes and similarity

Epistemology Tools (4)

Tool

Description

get_source_capabilities

Analyze what a document CAN and CANNOT support

validate_claim

Check if a claim can be grounded in the source

get_epistemological_report

Complete analysis before scholarly claims

check_language_operation

Validate linguistic operations

Semantic Tools (4)

Tool

Description

detect_semantic_frames

Identify conceptual frameworks (causal, revelational, performative)

analyze_subdetermination

Distinguish indeterminacy from subdetermination

detect_performatives

Identify performative speech acts

check_anachronisms

Detect imported post-biblical concepts

Cognitive Tools (4)

Tool

Description

audit_cognitive_operations

Validate query and output compliance

detect_inference_violations

Scan for unauthorized connectors

get_permitted_operations

Get allowed operations per text type

generate_safe_fallback

Generate compliant response when violations detected

Extraction Validators (14)

Tool

Description

validate_literal_quote

Verify quoted text exists EXACTLY in source

validate_proximity

Check if segments are adjacent

get_adjacent_segments

Get segments within proximity constraint

identify_speaker

Detect who is speaking in a segment

detect_pattern_contamination

Detect pattern completion not in source

validate_extraction_schema

Validate pure data extraction

detect_narrative_voice

Distinguish voice types in text

validate_agency_execution

Distinguish EXECUTED vs REFERENCED actions

detect_text_genre

Identify genre based on structure

detect_divine_agency_without_speech

Find actions without speech verbs

detect_weak_quantifiers

Detect unsupported generalizations

validate_existential_response

Validate YES/NO question responses

build_document_vocabulary

Create closed vocabulary from document

validate_output_vocabulary

Check if output uses only source vocabulary

Domain-Agnostic Architecture

All extraction validators accept an optional DomainVocabulary parameter:

class DomainVocabulary(BaseModel):
    agents: list[str] | None = None        # ['God', 'Lord'] or ['the Court']
    addressees: list[str] | None = None    # ['Lord'] or ['Your Honor']
    oracle_formulas: list[str] | None = None    # ['thus says the Lord']
    praise_formulas: list[str] | None = None    # ['praise the Lord']
    action_verbs: list[str] | None = None       # ['led', 'brought', 'created']
    narration_verbs: list[str] | None = None    # ['said', 'spoke', 'did']
    state_verbs: list[str] | None = None        # ['is', 'was', 'has been']

Example: Biblical Text

{
  "agents": ["God", "Lord", "Moses"],
  "addressees": ["Lord", "God"],
  "action_verbs": ["led", "brought", "gave", "made", "created"],
  "narration_verbs": ["said", "spoke", "did", "made", "saw"],
  "oracle_formulas": ["thus says the Lord"],
  "praise_formulas": ["praise the Lord"]
}
{
  "agents": ["the Court", "Plaintiff", "Defendant"],
  "addressees": ["Your Honor"],
  "action_verbs": ["ruled", "ordered", "granted", "denied"],
  "narration_verbs": ["stated", "found", "held", "declared"],
  "oracle_formulas": ["the Court finds"],
  "praise_formulas": []
}

Usage Examples

1. Ingest a document

result = ingest_document(
    path="/path/to/document.pdf",
    title="My Document",
    chunk_size=2000,
    overlap=100
)
# Returns: document_id, total_segments, structure

2. Search for content

results = search_segment(
    query="agency without speech",
    document_id=1,
    limit=5
)
# Returns: matched segments with scores and snippets

3. Validate narrative voice

voice = detect_narrative_voice(
    segment_id=722,
    domain_vocabulary={
        "agents": ["God", "Lord"],
        "addressees": ["Lord", "God"],
        "action_verbs": ["led", "brought", "gave", "made"]
    }
)
# Returns: voice_type, confidence, evidence, is_retrospective

4. Validate agency execution

validation = validate_agency_execution(
    segment_id=762,
    divine_agent_patterns=["God", "Lord"]
)
# Returns: is_executed, mode, agent, action, evidence

5. Detect text genre

genre = detect_text_genre(
    segment_id=1075,
    domain_vocabulary={
        "agents": ["God", "He"],
        "oracle_formulas": ["thus says the Lord"],
        "praise_formulas": ["praise the Lord"]
    }
)
# Returns: genre, confidence, indicators

Technical Stack

  • Python 3.11+ - Modern Python with type hints

  • FastMCP 2.x - MCP server framework with decorator-based tools

  • Pydantic 2.x - Schema validation

  • SQLite - Local storage with WAL mode

  • pdfplumber - PDF text extraction

  • ebooklib - EPUB support

  • beautifulsoup4 - HTML parsing

  • NLTK - NLP tokenization

Development

Local Installation

# Clone repository
git clone https://github.com/Rixmerz/bigcontext_mcp.git
cd bigcontext_mcp

# Create virtual environment
uv venv .venv
source .venv/bin/activate

# Install in development mode
uv pip install -e .

# Run server
python -m bigcontext_mcp

Local Testing with Claude Desktop

{
  "mcpServers": {
    "bigcontext": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/bigcontext-mcp",
        "bigcontext-mcp"
      ]
    }
  }
}

Architecture Highlights

Structural Pattern Matching

  • Pure structural patterns detect grammatical structure without vocabulary

  • Dynamic pattern generation combines structure + agent-provided vocabulary

  • Fallback mechanisms work with generic patterns when no vocabulary provided

No Hardcoded Assumptions

  • Zero biblical terms hardcoded in validation logic

  • Zero legal terms hardcoded

  • Zero religious assumptions

  • Agent provides ALL domain-specific vocabulary at runtime

Separation of Concerns

  • SPEECH_VERB_WHITELIST: 38 speech verbs (said, spoke, called, etc.)

  • CAUSAL_ACTION_VERBS: 90+ action verbs (caused, drove, made, etc.)

  • STRUCTURAL_NARRATIVE_VOICE_PATTERNS: Grammar-only patterns

  • DomainVocabulary: Agent-provided dynamic vocabulary

Changelog

V16: Python Migration (2026-01-10)

Complete rewrite from TypeScript to Python:

  • Framework: FastMCP 2.x with decorator-based tool registration

  • Distribution: uvx-ready (zero-clone install from GitHub)

  • Database: SQLite with WAL mode (same schema, compatible)

  • Validation: Pydantic replacing Zod

  • Total: 31 MCP tools migrated and tested

V15: Domain-Agnostic Extraction Validators

  • Expanded DomainVocabulary interface with 7 dynamic properties

  • Refactored all validators to accept optional vocabulary parameter

  • Zero hardcoded domain-specific terms

V14: Speech vs Action Verb Separation

  • Created SPEECH_VERB_WHITELIST (38 speech verbs)

  • Created CAUSAL_ACTION_VERBS (90+ action verbs)

V1-V13: Core Infrastructure

  • Multi-format document ingestion (txt, md, PDF, EPUB, HTML)

  • Automatic segmentation by chapters and sections

  • TF-IDF search implementation

  • SQLite storage with WAL mode

  • 27 extraction validation tools

License

MIT

Contributing

We welcome contributions! Areas of interest:

  • Additional domain vocabularies (legal, academic, literary)

  • New extraction validators

  • Performance optimizations

  • Documentation improvements

Support

Available Tools

31 tools
analyze_subdeterminationC

Analyze whether textual ambiguity is total indeterminacy or directed subdetermination.

Returns what the text CLOSES (excludes) vs. what it LEAVES OPEN, and detects asymmetric relations.

Args: segment_id: ID of the segment to analyze.

Returns: Subdetermination analysis result.

Inputs: segment_id (required). Returns: object

audit_cognitive_operationsA

CRITICAL: Run before ANY response. Validates cognitive constraint compliance.

Detects unauthorized operations (synthesis, explanation, causality inference). Returns compliance status and safe fallback if needed.

Args: document_id: ID of the document being queried. query: The user query to analyze. planned_output: The planned response text to validate.

Returns: Cognitive audit result.

Inputs: document_id (required), query (required), planned_output (required). Returns: object

build_document_vocabularyB

Build closed vocabulary from document.

Creates lexicon of all tokens. Required before using validate_output_vocabulary.

Args: document_id: ID of the document to build vocabulary from.

Returns: Vocabulary build result.

Inputs: document_id (required). Returns: object

check_anachronismsA

Check if a research question imports post-biblical conceptual categories.

Detects Aristotelian causes, Neoplatonic emanation, Trinitarian doctrine.

Args: query: The research question or claim to check.

Returns: Anachronism check result.

Inputs: query (required). Returns: object

check_language_operationB

Check if a specific linguistic operation is allowed.

Use before performing morphological, etymological, or text-critical analysis.

Args: document_id: ID of the document. operation: The operation to check (e.g., "root analysis"). language: The language involved (hebrew, greek, aramaic).

Returns: Language operation permission result.

Inputs: document_id (required), operation (required), language (required). Returns: object

compare_segmentsB

Compare two segments to find shared themes, unique terms, and similarity.

Useful for understanding relationships between chapters.

Args: segment_id_a: ID of the first segment to compare. segment_id_b: ID of the second segment to compare. find_bridges: Find intermediate segments that connect the two. max_bridges: Maximum number of bridge segments to return.

Returns: Comparison result with similarity and themes.

Inputs: segment_id_a (required), segment_id_b (required), find_bridges, max_bridges. Returns: object

detect_divine_agency_without_speechB

CRITICAL: Detect when an agent acts WITHOUT speaking.

DOMAIN-AGNOSTIC: Agent provides agentPatterns dynamically. Separates SPEECH verbs (said, spoke) from ACTION verbs (caused, made, remembered).

Examples:

  • Biblical ["God", "Lord"] finds "God remembered Noah"

  • Legal ["the Court"] finds "the Court ruled"

Args: segment_id: ID of the segment to analyze. agent_patterns: Agent names to search for. domain_vocabulary: Optional DomainVocabulary for genre detection.

Returns: Divine agency without speech detection result.

Inputs: segment_id (required), agent_patterns, domain_vocabulary. Returns: object

detect_inference_violationsA

Scan text for inferential connectors and prohibited abstract nouns.

Detects: therefore, thus, implies, means that, ontology, mechanism, structure. These signal unauthorized cognitive operations.

Args: text: The text to scan for inference violations.

Returns: Inference violation detection result.

Inputs: text (required). Returns: object

detect_narrative_voiceA

CRITICAL: Detect the narrative voice type of a text segment.

Distinguishes:

  • primary_narration ("The Lord did X") = action executed in-scene

  • human_to_divine ("You led them...") = human prayer/praise, RETROSPECTIVE

  • divine_direct_speech ("I am the Lord") = God speaking

  • human_about_divine ("The Lord is my shepherd") = descriptive

Use BEFORE extracting "divine actions" to avoid confusing retrospective prayer with primary divine agency.

Args: segment_id: ID of the segment to analyze. domain_vocabulary: Optional DomainVocabulary for enhanced detection.

Returns: Narrative voice detection result.

Inputs: segment_id (required), domain_vocabulary. Returns: object

detect_pattern_contaminationB

Detect when output may be completing a known pattern not in source.

Domain-agnostic: works for any genre (religious, fairy tales, legal, etc.). Agent provides patterns dynamically based on document genre.

Args: claimed_output: What the agent claims is in the text. segment_id: ID of the segment to check against. patterns: Optional: Pattern definitions with trigger/expectedCompletion.

Returns: Pattern contamination detection result.

Inputs: claimed_output (required), segment_id (required), patterns. Returns: object

detect_performativesB

Detect performative speech acts where divine speech IS the creative act.

Identifies "And God said... and it was so" patterns that resist causal analysis.

Args: segment_id: ID of the segment to analyze.

Returns: Performative detection result.

Inputs: segment_id (required). Returns: object

detect_semantic_framesC

Detect conceptual frameworks in a text segment.

Identifies causal, revelational, performative, and invocative frames. Prevents reductive analysis by identifying non-causal categories.

Args: segment_id: ID of the segment to analyze. query: The research question being investigated.

Returns: Semantic frame detection result.

Inputs: segment_id (required), query (required). Returns: object

detect_text_genreB

Detect text genre to apply correct extraction rules.

Genres: historical_narrative, narrative_poetry, prayer_praise, recapitulation, prophetic.

DOMAIN-AGNOSTIC: Uses structural patterns by default. Provide domainVocabulary for domain-specific enhanced detection.

Args: segment_id: ID of the segment to analyze. domain_vocabulary: Optional DomainVocabulary for enhanced detection.

Returns: Text genre detection result.

Inputs: segment_id (required), domain_vocabulary. Returns: object

detect_weak_quantifiersA

Detects weak quantifiers that require statistical evidence.

Quantifiers like "frequently", "typically", "always", "never" imply statistical claims that should not be made without counting evidence.

Returns recommendation: "allow", "require_count", or "block". Use on agent output BEFORE returning to user.

Args: text: Text to analyze (typically agent output).

Returns: Weak quantifier detection result.

Inputs: text (required). Returns: object

generate_safe_fallbackA

Generate a safe, compliant response when query requires unauthorized operations.

Use when audit_cognitive_operations returns violations.

Args: question_type: Type of unauthorized operation (synthesis, explanation, etc.). document_title: Title of the document for the fallback message.

Returns: Safe fallback response.

Inputs: question_type (required), document_title (required). Returns: object

get_adjacent_segmentsB

Get list of segment IDs within proximity constraint.

Use for extraction queries that require adjacency.

Args: base_segment_id: The anchor segment ID. max_distance: Maximum distance from base (default: 1).

Returns: Adjacent segment IDs.

Inputs: base_segment_id (required), max_distance. Returns: object

get_epistemological_reportA

Generate complete epistemological analysis before making scholarly claims.

Returns: language hard stops, canonical frame detection, auto-critique, confidence decay calculation, and recommendations. Use BEFORE any complex textual analysis.

Args: document_id: ID of the document to analyze. query: The research question or claim being investigated.

Returns: Epistemological report.

Inputs: document_id (required), query (required). Returns: object

get_metadataB

Get metadata, structure, and statistics for a document or segment.

Includes top terms by TF-IDF.

Args: document_id: ID of the document to get metadata for. segment_id: ID of the segment to get metadata for. include_structure: Include document structure in response. top_terms: Number of top terms to return (default: 10).

Returns: Metadata including structure and top terms.

Inputs: document_id, segment_id, include_structure, top_terms. Returns: object

get_permitted_operationsC

Get permitted cognitive operations based on text genre.

Different genres allow different operations (narrative, poetry, wisdom, etc.).

Args: segment_id: ID of the segment to check.

Returns: Permitted operations result.

Inputs: segment_id (required). Returns: object

get_source_capabilitiesA

CRITICAL: Analyze what a document CAN and CANNOT support.

Returns detected languages, whether original Hebrew/Greek/Aramaic is present, textual variant availability, and epistemological limitations. MUST be called before making claims about morphology, etymology, or textual criticism.

Args: document_id: ID of the document to analyze.

Returns: Source capabilities analysis.

Inputs: document_id (required). Returns: object

identify_speakerB

Identify who is speaking in a text segment.

Returns speaker name, confidence level, and evidence. Domain-agnostic: works for any document type.

Args: segment_id: ID of the segment to analyze. priority_patterns: Optional: Speaker names to prioritize. exclude_patterns: Optional: Speaker patterns to flag as ambiguous. expected_speaker: Optional: verify this specific speaker.

Returns: Speaker identification result.

Inputs: segment_id (required), priority_patterns, exclude_patterns, expected_speaker. Returns: object

ingest_documentA

Load, segment, and index a document for search.

Supports txt, md, pdf, epub, and html formats. Automatically detects chapters and sections.

Args: path: Absolute path to the document file. title: Optional title for the document (defaults to filename). chunk_size: Target size in words for each chunk (default: 2000). overlap: Number of words to overlap between chunks (default: 100). force: Force re-indexing even if document already exists.

Returns: Ingestion result with document ID and structure.

Inputs: path (required), title, chunk_size, overlap, +1 more. Returns: object

list_documentsB

List all indexed documents with their metadata.

Args: limit: Maximum number of documents to return (default: 20). offset: Number of documents to skip (for pagination).

Returns: List of documents with metadata.

Inputs: limit, offset. Returns: object

search_segmentB

Search for relevant segments using TF-IDF.

Returns snippets with matched terms highlighted.

Args: query: Search query (keywords or phrases). document_id: Optional: limit search to a specific document. segment_id: Optional: search within a specific segment only. limit: Maximum number of results to return (default: 5). context_words: Number of words around matches in snippets (default: 50).

Returns: Search results with scores and snippets.

Inputs: query (required), document_id, segment_id, limit, +1 more. Returns: object

validate_agency_executionA

Validates whether a divine action is EXECUTED in-scene vs merely REFERENCED.

Key distinction:

  • EXECUTED = "Fire came up from the rock" (Judges 6:21)

  • REFERENCED = "You led them with a pillar" (Nehemiah 9:12) - retrospective

The second describes same action but as human memory, NOT primary execution.

Args: segment_id: ID of the segment to analyze. divine_agent_patterns: Optional: Patterns to identify divine agent.

Returns: Agency execution validation result.

Inputs: segment_id (required), divine_agent_patterns. Returns: object

validate_claimB

Check if a specific claim can be grounded in the source document.

Returns whether the claim requires capabilities the document lacks. Use this BEFORE making scholarly assertions.

Args: document_id: ID of the document to validate against. claim: The claim or assertion to validate.

Returns: Claim validation result.

Inputs: document_id (required), claim (required). Returns: object

validate_existential_responseA

CRITICAL: Validates response to existential question ("Does X exist in text?").

VALID: "YES" + textual evidence, OR "NO" + explicit denial. INVALID: meta-discourse, hedging, questions, introducing categories not asked.

Use AFTER generating response to existential questions to catch evasion.

Args: response: The agent response to validate.

Returns: Existential response validation result.

Inputs: response (required). Returns: object

validate_extraction_schemaA

Validate that extraction output follows a strict schema.

Detects parenthetical comments, notes sections, evaluative language. Use when user requests pure data extraction.

Args: output: The extraction output to validate. fields: Expected field names in output. allow_commentary: Whether commentary is allowed (default: False).

Returns: Extraction schema validation result.

Inputs: output (required), fields (required), allow_commentary. Returns: object

validate_literal_quoteA

Verify that a quoted string exists EXACTLY in a segment or document.

Use BEFORE claiming any text appears in the source. Returns confidence: "textual" (exact match), "partial" (similar), "not_found". Prevents pattern completion hallucination.

Args: quote: The exact quote to validate. document_id: Optional: document to search. segment_id: Optional: specific segment to check. fuzzy_threshold: Similarity threshold for partial matches (0-1).

Returns: Literal quote validation result.

Inputs: quote (required), document_id, segment_id, fuzzy_threshold. Returns: object

validate_output_vocabularyB

Check if output uses only vocabulary present in the source document.

Detects terms imported from outside the text.

Args: document_id: ID of the document. output: The output text to validate against document vocabulary.

Returns: Vocabulary validation result.

Inputs: document_id (required), output (required). Returns: object

validate_proximityA

Check if two segments are adjacent (within allowed distance).

Use to enforce "same verse or verse+1" constraints. Prevents narrative jump violations.

Args: base_segment_id: The anchor segment ID. target_segment_id: The segment ID being referenced. max_distance: Maximum allowed segment distance (0 = same, 1 = adjacent).

Returns: Proximity validation result.

Inputs: base_segment_id (required), target_segment_id (required), max_distance. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 31 tools

    Disambiguation2/5

    Multiple tools have overlapping purposes that could cause confusion. For example, 'audit_cognitive_operations', 'detect_inference_violations', and 'get_epistemological_report' all involve detecting or preventing unauthorized cognitive operations, making it hard for an agent to choose the right one. Similarly, 'validate_claim', 'validate_literal_quote', and 'validate_output_vocabulary' all validate different aspects of textual claims, but their boundaries are not clearly distinct, leading to potential misselection.

    Naming Consistency4/5

    The naming is mostly consistent with a verb_noun pattern (e.g., 'analyze_subdetermination', 'detect_pattern_contamination', 'validate_agency_execution'), which aids readability. However, there are minor deviations like 'get_metadata' and 'list_documents' using simpler verbs, and 'ingest_document' using 'ingest' instead of a more common verb like 'load', but these do not significantly hinder understanding.

    Tool Count2/5

    With 31 tools, the count is too high for a coherent set, making the server feel heavy and overwhelming. The tools cover a wide range of functions from document ingestion to complex epistemological analysis, but many could be consolidated or omitted without losing core functionality, indicating poor scoping and an excessive number that complicates agent usage.

    Completeness5/5

    The tool set provides comprehensive coverage for textual analysis and validation in a scholarly or theological domain. It includes ingestion, search, metadata retrieval, various detection and validation tools, and safe fallback mechanisms, ensuring no obvious gaps. The tools support a full lifecycle from document loading to rigorous claim validation, making the surface complete for its intended purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables processing and analysis of large PDF files through text extraction, search functionality, and intelligent chunking strategies. Provides comprehensive PDF operations including metadata retrieval, page-range text extraction, and content search with contextual results.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to analyze documents larger than their context window by loading files into RAM and querying them via search, navigation, and Python execution tools. Supports recursive reasoning to process massive datasets in chunks using sub-agents.
      220
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to efficiently process large local and online PDFs through selective extraction of text, images, and metadata. It provides tools for content search and document outline navigation to optimize context window usage.
      7
      16
      ISC
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides AI agents with comprehensive document parsing capabilities including PDF text extraction, OCR, HTML-to-markdown conversion, table extraction, and summarization, optimized for agent workflows.
      75 npm
      MIT