You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/LIBRARY-API.md
+215Lines changed: 215 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -561,8 +561,223 @@ Min/max bounds for filtering animals by trait value in search criteria.
561
561
562
562
---
563
563
564
+
## mcp Module
565
+
566
+
The `mcp` module provides a complete Model Context Protocol server implementation with tools, resources, prompts, and analytics for livestock breeding intelligence.
567
+
568
+
### NsipServer
569
+
570
+
MCP server implementation that exposes 13 tools, 5 static resources, 4 resource templates, and 7 guided breeding prompts.
571
+
572
+
```rust
573
+
usensip::mcp::NsipServer;
574
+
575
+
letserver=NsipServer::new();
576
+
```
577
+
578
+
#### `NsipServer::new() -> Self`
579
+
580
+
Create a new MCP server instance with default NSIP API client.
581
+
582
+
```rust
583
+
usensip::mcp::NsipServer;
584
+
585
+
letserver=NsipServer::new();
586
+
```
587
+
588
+
#### `serve_stdio() -> Result<()>`
589
+
590
+
Start the MCP server on stdio transport (used by Claude Desktop, Claude Code, Cursor, etc.).
591
+
592
+
```rust
593
+
usensip::mcp::serve_stdio;
594
+
595
+
#[tokio::main]
596
+
asyncfnmain() ->nsip::Result<()> {
597
+
serve_stdio().await
598
+
}
599
+
```
600
+
601
+
---
602
+
603
+
### analytics Submodule
604
+
605
+
Pure computation functions for breeding analytics with no external dependencies.
606
+
607
+
#### Types
608
+
609
+
**`CoiRating`** — Traffic-light rating for inbreeding coefficient:
610
+
-`Green` — COI < 6.25% (acceptable)
611
+
-`Yellow` — 6.25% ≤ COI < 12.5% (elevated, proceed with caution)
612
+
-`Red` — COI ≥ 12.5% (high inbreeding, generally avoid)
613
+
614
+
**`SharedAncestor`** — Common ancestor found in both sire and dam pedigrees.
615
+
616
+
| Field | Type | Description |
617
+
|-------|------|-------------|
618
+
|`lpn_id`|`String`| LPN ID of the common ancestor |
619
+
|`sire_depth`|`usize`| Generations from sire to this ancestor |
620
+
|`dam_depth`|`usize`| Generations from dam to this ancestor |
621
+
622
+
**`CoiResult`** — Result of coefficient of inbreeding calculation.
623
+
624
+
| Field | Type | Description |
625
+
|-------|------|-------------|
626
+
|`coefficient`|`f64`| Wright's coefficient of inbreeding (0.0–1.0) |
627
+
|`rating`|`CoiRating`| Traffic-light rating |
628
+
|`shared_ancestors`|`Vec<SharedAncestor>`| Common ancestors contributing to inbreeding |
629
+
630
+
**`RankedAnimal`** — Animal with weighted composite score for trait-based ranking.
0 commit comments