Command Palette

Search for a command to run...

UnylyUnyly
Весь каталог

Horizon Predictive Model

БесплатноНе проверен

Exposes a professional services pipeline prediction model with tools to score opportunities, validate inputs, and retrieve model metadata such as win probabilit

GitHubEmbed

Описание

Exposes a professional services pipeline prediction model with tools to score opportunities, validate inputs, and retrieve model metadata such as win probability, fees, and margin.

README

Extends the horizon-mcp-demo with a second MCP server wrapping the Horizon Data Predictive Model, demonstrating the Claudeception pattern — a single Claude agent connecting to two governed data systems simultaneously.

Built as research and reference material for the Horizon Data Partners white paper: The Governed Data Layer: Why AI Agents Fail Without One, and How to Build It.


What this demonstrates

The core pattern: Two governed data systems, one agent, reasoning across both simultaneously.

System Transport What it exposes Tools
Insurance Data (from horizon-mcp-demo) MCP via stdio P&C insurance semantic layer — loss ratio, claim frequency, earned premium by segment list_models, get_model_details, get_metric_definitions, query_data
Predictive Model (this repo) Direct Python calls Professional services pipeline prediction model — win probability, fees, margin, milestone timing describe_inputs, describe_outputs, validate_payload, score_opportunity

The agent connects to both servers simultaneously, discovers what each one exposes, and reasons about how to bridge them — including explicitly surfacing the schema mismatch between the two systems and the governance risks of any mapping it proposes.


The schema mapping problem (Option C)

The two systems use completely different schemas:

Insurance data: product_type (auto/homeowners), state (TX/CA/FL/NY)

Predictive model: ServiceLine (Audit/Tax/Advisory), ClientType (Business/Individual), Industry (Healthcare/Financial Services/Technology/Manufacturing), NewVsExisting (Existing/New), LeadSource (Referral/Competitive)

These fields do not map cleanly to each other. The demo provides a pre-specified mapping for some questions, but Question 3 deliberately asks the agent to reason about the mapping problem before applying it — surfacing the governance risks of cross-system field mapping in a way that documents rather than hides the assumption.

This is the real-world use case: someone has a predictive model and a data source with different schemas, and needs an agent to connect them intelligently.


Project structure

horizon-mcp-demo-extended/
├── data/
│   └── seed_predictive_model.py    # Generates predictive_model.duckdb from scratch
├── mcp_server/
│   └── predictive_model_mcp_server.py  # Model-side MCP server (4 tools)
├── scripts/
│   └── run_two_server_agent.py     # Claudeception demo — two servers, one agent
├── logs/                           # Created at runtime — token logs per run
├── docs/                           # Additional documentation
├── requirements.txt
├── .gitignore
└── README.md

Prerequisites

  • Python 3.12
  • horizon-mcp-demo cloned at the same directory level as this repo
    • The two-server agent looks for the insurance MCP server at ../horizon-mcp-demo/mcp_server/horizon_mcp_server.py
  • horizon-mcp-demo fully built (dbt seed && dbt run completed)

Setup (Windows)

1. Clone this repo

git clone https://github.com/christianashworth/horizon-mcp-demo-extended.git
cd horizon-mcp-demo-extended

2. Create and activate virtual environment

py -3.12 -m venv .venv
.venv\Scripts\activate

3. Install dependencies

python -m pip install --upgrade pip
pip install -r requirements.txt

4. Generate the predictive model database

python data/seed_predictive_model.py

This generates data/predictive_model.duckdb — a DuckDB replica of the SQL Server model's trained segment estimates. Takes about 30 seconds.

5. Run the two-server demo

$env:ANTHROPIC_API_KEY = "your-api-key-here"
python scripts/run_two_server_agent.py

Demo questions

# Question type Servers used
1 Model understanding — what does the predictive model need? Predictive Model only
2 Governed data query — insurance loss ratios by segment Insurance Data only
3 Schema mapping surfaced — reason about mapping insurance fields to model inputs before scoring Both
4 Cross-server analysis — score all homeowners segments and combine with loss ratio data Both
5 Governance reflection — what decisions need to be made before using this mapping in production? Both

Predictive model input contract

Field Type Allowed values Notes
ServiceLine string Audit, Tax, Advisory Required. Highest priority — dropped last.
ClientType string Business, Individual Required
Industry string Healthcare, Financial Services, Technology, Manufacturing Optional (nullable for Individuals)
NewVsExisting string Existing, New Required
LeadSource string Referral, Competitive Required. Lowest priority — dropped first.

Predictive model outputs

Output Description
WinPct Probability of winning (0.0–1.0)
NetFees Estimated net fees in USD if won
MarginPct Estimated margin percentage
DaysSellToStart Estimated days from contract signing to work start
DaysStartTo50Pct Estimated days from work start to 50% completion
DaysStartTo100Pct Estimated days from work start to 100% completion

Notes

  • The predictive model database (data/predictive_model.duckdb) is excluded from version control — generated locally by the seed script.
  • The predictive model tools run as direct Python function calls — this avoids a Windows asyncio/anyio compatibility issue with nested stdio MCP clients while preserving the same agent behavior.
  • Token usage is logged per question per server in logs/two_server_run_<timestamp>.json.
  • The Claudeception pattern works with any MCP-compatible agent, not just Claude — the two servers are independent and do not communicate with each other directly.

from github.com/christianashworth/horizon-mcp-demo-extended

Установка Horizon Predictive Model

У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.

▸ github.com/christianashworth/horizon-mcp-demo-extended

FAQ

Horizon Predictive Model MCP бесплатный?

Да, Horizon Predictive Model MCP бесплатный — установка в пару кликов через Unyly без оплаты.

Нужен ли API-ключ для Horizon Predictive Model?

Нет, Horizon Predictive Model работает без API-ключей и переменных окружения.

Horizon Predictive Model — hosted или self-hosted?

Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.

Как установить Horizon Predictive Model в Claude Desktop, Claude Code или Cursor?

Открой Horizon Predictive Model на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.

Похожие MCP

Compare Horizon Predictive Model with

Не уверен что выбрать?

Найди свой стек за 60 секунд

Автор?

Embed-бейдж для README

Похожее

Все в категории development