pedigree-mcp

zzgael/pedigree-mcp

3.4

If you are the rightful owner of pedigree-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

Pedigree MCP Server is a tool for generating family pedigree tree diagrams as PNG images using standard genetic notation.

Tools
2
Resources
0
Prompts
0

Pedigree MCP Server

An MCP (Model Context Protocol) server for generating family pedigree tree diagrams as PNG images using standard genetic notation per Bennett 2008/2022 NSGC guidelines.

BRCA1 hereditary breast/ovarian cancer family history demonstrating: 3 generations, affected individuals with combined conditions, MZ identical twins, carrier status, deceased indicators, proband + consultand markers, and gene test results (BRCA1+/BRCA1-)

Installation

Add to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "pedigree": {
      "command": "npx",
      "args": ["pedigree-mcp"],
      "env": {}
    }
  }
}

Build from Source

If you prefer to build from source:

git clone https://github.com/zzgael/pedigree-mcp.git
cd pedigree-mcp
npm install
npm run build

Then use in your MCP client configuration:

{
  "mcpServers": {
    "pedigree": {
      "command": "node",
      "args": ["/absolute/path/to/pedigree-mcp/dist/index.js"],
      "env": {}
    }
  }
}

Features

Bennett 2008 Standard Compliance

This implementation follows the NSGC Standardized Human Pedigree Nomenclature:

SymbolDescriptionProperty
SquareMalesex: "M"
CircleFemalesex: "F"
DiamondUnknown sexsex: "U"
Filled shapeAffected individualconditions: [...]
Diagonal lineDeceasedstatus: 1
Arrow (lower-left)Probandproband: true
Double arrow (lower-left)Consultand (person seeking counseling)consultand: true
Brackets [ ]Adoptednoparents: true
Double lineConsanguinityAuto-detected from shared ancestors
Text on double lineConsanguinity degreeconsanguinity_degree: "1st cousins"
Horizontal barMZ (identical) twinsmztwin: "group_id"
Diagonal linesDZ (fraternal) twinsdztwin: "group_id"
Dot in centerCarrier statuscarrier: true
Outlined dotObligate carrier (inferred)obligate_carrier: true
"P" inside symbolPregnancypregnant: true
"P" + weeks labelPregnancy durationpregnant: true, terminated_age: 12
Small triangleEarly pregnancy loss (<20 weeks)terminated: true, terminated_age: 8
Large triangleStillbirth (≥20 weeks)terminated: true, terminated_age: 24
"EP" below symbolEctopic pregnancyectopic: true
Crossed lines (X)Infertilityinfertility: true
Hash marks on lineDivorced/separateddivorced: true
Line through offspringNo children by choiceno_children_by_choice: true
"A" in upper rightAshkenazi ancestryashkenazi: 1
"*" in upper leftGenetic anticipationanticipation: true
"d. XXy" labelAge at death (auto-calculated)yob: 1950, yod: 2020, status: 1
Arrow + "OUT" labelAdopted OUT (placed for adoption)adoption_type: "out"
Dashed bracketsFoster placement (temporary)adoption_type: "foster"
Roman numerals I, II, IIIBirth order in sibling groupbirth_order: 1 (displays as "I")
"E" marker (blue)ART - Egg donor conceptionart_type: "egg_donor"
"S" marker (blue)ART - Sperm donor conceptionart_type: "sperm_donor"
"Em" marker (blue)ART - Embryo donor conceptionart_type: "embryo_donor"
"GC" marker (blue)ART - Gestational carrier (surrogate)art_type: "surrogate"
"SAB" labelPregnancy outcome - Spontaneous abortionpregnancy_outcome: "miscarriage"
"TOP" labelPregnancy outcome - Termination of pregnancypregnancy_outcome: "induced_termination"
"SB" labelPregnancy outcome - Stillbirthpregnancy_outcome: "stillbirth"
"Het" label (green)Gene copy number - Heterozygousgene_copy_number: "heterozygous"
"Hom" label (green)Gene copy number - Homozygousgene_copy_number: "homozygous"
"CH" label (green)Gene copy number - Compound heterozygousgene_copy_number: "compound_heterozygous"
Dashed partnership lineUnmarried/common-law partnershiprelationship_type: "unmarried"

Conditions (Bennett Standard - FREE TEXT)

Per Bennett 2008 standard, conditions are documented using free text. Simply provide a conditions array with any disease/condition name:

{
  "conditions": [
    { "name": "Breast cancer", "age": 42 },
    { "name": "Ovarian cancer", "age": 55 }
  ]
}

Examples:

  • { "name": "Huntington's disease", "age": 45 }
  • { "name": "Type 2 diabetes" } (no age = affected status only)
  • { "name": "Cystic fibrosis" }
  • { "name": "Hereditary hemochromatosis", "age": 38 }

Colors are auto-assigned from a palette based on unique condition names. Multiple conditions show as quadrants (male) or pie slices (female).

Genetic Testing Results

Supports any gene - use pattern {gene}_gene_test:

{
  "brca1_gene_test": { "type": "T", "result": "P" },
  "htt_gene_test": { "type": "T", "result": "P" },
  "apoe_gene_test": { "type": "S", "result": "N" }
}

Gene test result codes:

  • type: T (tested), S (screening), - (unknown)
  • result: P (positive), N (negative), - (unknown/VUS)

Labels appear as: BRCA1+ (positive), HTT- (negative)

Tools

get_pedigree_documentation

Returns comprehensive documentation about the pedigree data format. Always call this first before generating a pedigree.

generate_pedigree

Generates a family pedigree tree in PNG or SVG format.

Parameters:

ParameterTypeDefaultDescription
datasetIndividual[]requiredArray of family members
widthnumber800Image width in pixels
heightnumber600Image height in pixels
symbol_sizenumber35Node diameter in pixels
backgroundstring#ffffffBackground color
labelsstring[]['age']Attributes to display
format'png' | 'svg''png'Output format: png (base64 image) or svg (XML text)

Data Format

Individual Object

interface Individual {
  // Required
  name: string;           // Unique ID (max 7 chars)
  sex: "M" | "F" | "U";   // Male, Female, Unknown

  // Identity
  display_name?: string;  // Human-readable name for display (max 13 chars)
  top_level?: boolean;    // Founding individual (no parents)
  proband?: boolean;      // Index case

  // Relationships
  mother?: string;        // Mother's name (must exist in dataset)
  father?: string;        // Father's name (must exist in dataset)

  // Demographics
  age?: number;           // Current age
  yob?: number;           // Year of birth
  status?: number;        // 0 = alive, 1 = deceased

  // Twins (Bennett standard)
  mztwin?: string;        // MZ twin group ID (identical)
  dztwin?: string;        // DZ twin group ID (fraternal)

  // Special indicators (Bennett standard)
  carrier?: boolean;      // Carrier status (dot in center)
  pregnant?: boolean;     // Current pregnancy (P inside symbol)
  terminated?: boolean;   // Stillbirth/SAB (small triangle)
  divorced?: boolean;     // Divorced from partner (hash marks)
  noparents?: boolean;    // Adopted (brackets around symbol)

  // Conditions (Bennett standard - FREE TEXT)
  conditions?: Array<{
    name: string;         // Any condition: "Breast cancer", "Huntington's disease", etc.
    age?: number;         // Age at diagnosis/onset
  }>;

  // Genetic tests (pattern: {gene}_gene_test)
  brca1_gene_test?: { type: "-"|"S"|"T", result: "-"|"P"|"N" };
  brca2_gene_test?: { type: "-"|"S"|"T", result: "-"|"P"|"N" };
  // ... any gene test
}

Examples

📸

See the full gallery of standardized pedigree scenarios demonstrating Bennett 2008/2022 compliance, including gender diversity, twins, consanguinity, ART indicators, and complex multi-generation families.

Basic Three-Generation Pedigree

[
  {"name": "MGF", "sex": "M", "top_level": true},
  {"name": "MGM", "sex": "F", "top_level": true, "conditions": [{"name": "Breast cancer", "age": 55}]},
  {"name": "Mother", "sex": "F", "mother": "MGM", "father": "MGF", "conditions": [{"name": "Breast cancer", "age": 42}]},
  {"name": "Father", "sex": "M", "top_level": true},
  {"name": "Proband", "display_name": "Sarah", "sex": "F", "mother": "Mother", "father": "Father", "proband": true, "age": 25, "brca1_gene_test": {"type": "T", "result": "P"}}
]

Neurological Condition Pedigree

[
  {"name": "GF", "sex": "M", "top_level": true, "status": 1, "conditions": [{"name": "Huntington's disease", "age": 52}]},
  {"name": "GM", "sex": "F", "top_level": true},
  {"name": "Father", "sex": "M", "mother": "GM", "father": "GF", "conditions": [{"name": "Huntington's disease", "age": 48}]},
  {"name": "Mother", "sex": "F", "top_level": true},
  {"name": "Proband", "sex": "M", "mother": "Mother", "father": "Father", "proband": true, "age": 25, "carrier": true}
]

Twins Example

[
  {"name": "Dad", "sex": "M", "top_level": true},
  {"name": "Mom", "sex": "F", "top_level": true},
  {"name": "Twin1", "sex": "M", "mother": "Mom", "father": "Dad", "mztwin": "mz1"},
  {"name": "Twin2", "sex": "M", "mother": "Mom", "father": "Dad", "mztwin": "mz1"},
  {"name": "DZTwin1", "sex": "M", "mother": "Mom", "father": "Dad", "dztwin": "dz1"},
  {"name": "DZTwin2", "sex": "F", "mother": "Mom", "father": "Dad", "dztwin": "dz1"}
]

Complex Family with Bennett Features

[
  {"name": "GF", "sex": "M", "top_level": true, "status": 1},
  {"name": "GM", "sex": "F", "top_level": true, "carrier": true},
  {"name": "Father", "sex": "M", "mother": "GM", "father": "GF", "divorced": true},
  {"name": "Mother", "sex": "F", "top_level": true},
  {"name": "Child1", "sex": "F", "mother": "Mother", "father": "Father", "proband": true, "noparents": true},
  {"name": "Loss", "sex": "U", "mother": "Mother", "father": "Father", "terminated": true}
]

Development

# Install dependencies
npm install

# Run in development mode (watch)
npm run dev

# Run all tests
npm test

# Build for production
npm run build

# Type check
npx tsc --noEmit

Testing

  • 159 tests total covering:
    • Validation (parent references, gender constraints)
    • SVG rendering (all symbol types, indicators)
    • Condition markers and multi-condition pie charts
    • Gene test formatting
    • Twin rendering (MZ with bar, DZ without)
    • Consanguinity detection
    • Bennett 2008 compliance (carrier, pregnancy, termination, divorced)
    • Edge cases (deep pedigrees, wide generations, half-siblings)

References

License

MIT License - see