Tree Analyzer MCP Server

Tree Analyzer MCP Server

Analyzes genealogy trees to detect errors, duplicates, and timeline inconsistencies while identifying missing source citations. It generates detailed audit reports and prioritized research leads to help users maintain accurate and well-documented family histories.

Category
访问服务器

README

Tree Analyzer MCP Server

Family tree analysis and error detection for Claude Code via MCP

Analyze genealogy trees for errors, duplicates, timeline issues, and missing sources through Claude's Model Context Protocol.

License: MIT

Features

  • 🔍 Name Disambiguation - Detect duplicate persons using fuzzy matching and phonetic algorithms (Soundex, NYSIIS, Metaphone)
  • ⏱️ Timeline Validation - Find impossible dates, age issues, and chronological errors
  • 🔗 Relationship Checker - Detect circular ancestry and structural tree problems
  • 📊 Source Coverage - Identify persons and events missing source citations
  • 📝 Report Generation - Create detailed Markdown reports with FamilySearch links
  • 🧬 Spanish Name Support - Optimized for Spanish/Latin American naming patterns

Installation

Via Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "tree-analyzer": {
      "command": "python",
      "args": ["-m", "tree_analyzer_mcp.server"],
      "cwd": "/path/to/tree-analyzer-mcp-standalone"
    }
  }
}

Via Docker

docker run -v /path/to/data:/app/data tree-analyzer-mcp

From Source

git clone https://github.com/ibarrajo/tree-analyzer-mcp
cd tree-analyzer-mcp
pip install -e .

Tools Available

Tool Description
detect_name_duplicates Find potential duplicate persons using fuzzy name matching
validate_timeline Check for impossible dates, age issues, parent-child age gaps
check_relationships Detect circular ancestry and structural tree problems
analyze_source_coverage Find persons and events missing source citations
generate_person_profile Create detailed Markdown profile for a person
generate_audit_report Comprehensive tree audit with all issues and statistics
generate_research_leads Prioritized next-steps for genealogy research
compare_persons Deep comparison of two persons to identify duplicates

Usage Examples

Detect Duplicate Names

Ask Claude Code:

Find potential duplicate persons in my family tree

Claude will use:

detect_name_duplicates(
    surname_filter="Smith",  # Optional: focus on specific surname
    similarity_threshold=0.8
)

Validate Timeline

Ask Claude Code:

Check my family tree for timeline errors and impossible dates

Claude will use:

validate_timeline(
    person_id=None,  # None = check entire tree
    max_parent_age=60,
    min_parent_age=14
)

Generate Audit Report

Ask Claude Code:

Create a comprehensive audit report for my 8-generation tree starting with person GK1Y-97Y

Claude will use:

generate_audit_report(
    root_person_id="GK1Y-97Y",
    generations=8,
    sections=["all"]
)

Find Missing Sources

Ask Claude Code:

Which ancestors are missing source citations?

Claude will use:

analyze_source_coverage(
    root_person_id="GK1Y-97Y",
    min_sources_per_person=1
)

Development

# Clone repository
git clone https://github.com/ibarrajo/tree-analyzer-mcp
cd tree-analyzer-mcp

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=src --cov-report=html

# Lint code
ruff check src
black --check src
mypy src

# Format code
black src
ruff check --fix src

Architecture

  • Python 3.11+ - Modern Python with type hints
  • FastMCP - Official Model Context Protocol framework for Python
  • SQLite - Local database access (reads from familysearch-mcp cache)
  • Fuzzy Matching - RapidFuzz for name similarity
  • Phonetic Coding - Soundex, NYSIIS, Metaphone for name variants
  • Jinja2 - Report templating

Data Flow

Claude Code
    ↓
MCP Protocol (stdio)
    ↓
tree-analyzer-mcp (Python)
    ↓
┌──────────────────┬──────────────────┐
│ familysearch-mcp │ research-sources │
│   cache.sqlite   │   -cache.sqlite  │
└──────────────────┴──────────────────┘
    ↓
Analysis & Reports

Name Disambiguation Algorithm

Optimized for Spanish/Latin American naming conventions:

  1. Normalize: Remove accents, lowercase, strip particles (de, del, y)
  2. Expand: Ma. → Maria, Fco. → Francisco, Jph → Joseph
  3. Index: Compute Soundex, NYSIIS, Metaphone codes
  4. Block: Match candidates via phonetic codes (avoids O(n²))
  5. Score: Multi-factor similarity (0-1):
    • Surname exact: 0.25
    • Given name fuzzy: 0.20
    • Birth year proximity: 0.15
    • Birth place: 0.10
    • Death year proximity: 0.10
    • Parent names: 0.10
    • Spouse names: 0.05
    • Source overlap: 0.05
  6. Cluster: Union-Find algorithm for grouping
  7. Output: Disambiguation tables with timeline overlap

Tool Reference

detect_name_duplicates

Find potential duplicate persons using fuzzy matching.

Parameters:

  • surname_filter (optional): Focus on specific surname
  • similarity_threshold (optional): Minimum similarity score (0.0-1.0, default 0.75)

Returns: Markdown report with name clusters and similarity scores

validate_timeline

Check for impossible dates and age issues.

Parameters:

  • person_id (optional): Check specific person (None = entire tree)
  • max_parent_age (optional): Maximum age for having children (default 60)
  • min_parent_age (optional): Minimum age for having children (default 14)
  • max_lifespan (optional): Maximum human lifespan (default 120)

Returns: Markdown report with timeline errors and recommendations

check_relationships

Detect structural tree problems.

Parameters:

  • person_id (optional): Starting person (None = check all)
  • check_types (optional): Types of checks ["circular", "orphans", "marriages"]

Returns: Markdown report with relationship issues

analyze_source_coverage

Find persons and events missing sources.

Parameters:

  • root_person_id (required): Starting person for analysis
  • generations (optional): Number of generations to analyze (default 8)
  • min_sources_per_person (optional): Minimum sources required (default 1)

Returns: Markdown report prioritized by generation proximity

generate_person_profile

Create detailed profile for one person.

Parameters:

  • person_id (required): FamilySearch person ID

Returns: Markdown profile with all facts, relationships, sources

generate_audit_report

Comprehensive tree audit report.

Parameters:

  • root_person_id (required): Starting person
  • generations (optional): Depth to analyze (default 8)
  • sections (optional): Sections to include (default ["all"])

Returns: Full Markdown audit with statistics, issues, recommendations

generate_research_leads

Prioritized research suggestions.

Parameters:

  • root_person_id (required): Starting person
  • focus_area (optional): "missing_sources", "timeline_errors", "duplicates"

Returns: Markdown report with actionable next steps

compare_persons

Deep comparison of two persons.

Parameters:

  • person_id_a (required): First person ID
  • person_id_b (required): Second person ID

Returns: Markdown comparison table with similarity score

Report Output

All reports are Markdown format with:

  • Executive summary with issue counts by severity
  • FamilySearch links for all persons (https://www.familysearch.org/tree/person/details/{PID})
  • Actionable recommendations with specific next steps
  • Statistics (person counts, source coverage, etc.)
  • Tables for easy scanning of issues

Example report sections:

  • Critical issues (circular ancestry, impossible dates)
  • Name duplicate clusters with similarity scores
  • Missing sources by generation
  • Timeline validation results
  • Research leads with collection suggestions

Contributing

See CONTRIBUTING.md for development guidelines.

License

MIT License - see LICENSE file for details.

Credits

Built as part of the FamilySearch genealogy research system. Part of a suite of MCP servers:

Links

Support

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选