Skip to main content
Glama
waalwalker1

Northstar MCP Server

by waalwalker1

Regulated MCP Insurance Deployment Kit

面向欧洲保险的确定性报价架构与企业交付套件

CI License: MIT Node.js: v20+ TypeScript: Strict

一个生产形态的参考实现,展示欧洲保险公司如何通过 Model Context Protocol (MCP) 提供确定性、非约束性的房屋保险报价流程,同时保持服务器端拥有的验证、定价计算、强制 GDPR 同意门控以及防篡改的可审计性。


1. 业务问题

对话式 AI 助手显著提升了保险报价转化率,但金融法规(EU AI Act、GDPR、Solvency II 以及保险行为准则)禁止未经审查的、非确定性的价格设定或不可审计的资格决策。

传统对话式机器人在受监管金融领域存在三个致命缺陷:

  1. 定价幻觉: LLM 以非确定性的方式凭空生成或修改保费和折扣。

  2. 监管不合规: 未经明确记录同意而签发的报价违反 GDPR 第 6 条和第 7 条。

  3. 黑盒状态转换: 监管机构无法重建用户输入与精算规则的精确序列。

本部署套件演示了确定性服务器权威模式:AI 助手负责对话式自然语言提取,而编译后的服务器核心拥有所有状态转换、验证、精算公式、同意门控和加密审计日志。


Related MCP server: @getplexa/mcp

2. 架构概述

flowchart LR
    subgraph Conversational Boundary
        Client[MCP Client / User Assistant]
    end

    subgraph Northstar MCP Server
        Sanitizer[Input Sanitizer & Regex Guard]
        StateMachine[Funnel State Machine]
        Store[(Session Store: Memory / Postgres)]
    end

    subgraph Deterministic Core
        Rules[Actuarial Pricing Engine (v1/v2)]
        Eligibility[Underwriting Eligibility Evaluator]
        ConsentGuard[GDPR Consent Gate]
        Audit[Append-Only SHA-256 Audit Store]
    end

    Client -->|MCP Tool Calls| Sanitizer
    Sanitizer --> StateMachine
    StateMachine <--> Store
    StateMachine --> Eligibility
    StateMachine --> ConsentGuard
    ConsentGuard --> Rules
    StateMachine --> Audit

核心不变量

  • 服务器定价权威: 保费通过编译后的 TypeScript 中的纯函数计算(packages/rules/src/pricing.ts)。客户端负载无法修改价格。

  • 强制同意门控: 在记录明确的数据处理同意之前([CONSENT_REQUIRED]),报价签发被硬性阻止。

  • 加密审计追踪: 每个生命周期事件都会追加一个 SHA-256 哈希,链接回会话起点(packages/audit/src/audit-store.ts)。

  • 零凭据本地路径: 无需付费的第三方 API 凭据即可在本地完全测试和运行。


3. 关键能力

  • 多国欧洲地址: 针对法国(FR)、西班牙(ES)、葡萄牙(PT)、德国(DE)和意大利(IT)的正则表达式验证邮政编码格式。

  • 承保资格与转介: 评估风险组合(例如理赔次数 $>3$、大型高价值别墅),并输出明确的机器可读原因代码。

  • 状态修正与失效循环: 修改先前确认的风险参数会自动使有效报价失效并重置同意状态。

  • 动态报价调整: 无需重新启动漏斗即可修改有效报价的保障层级(essential、comfort、premium)和免赔额(€150 至 €1000)。

  • 托管 SaaS 与客户 VPC 蓝图: 完整的部署清单、Docker Compose 本地栈以及多标准决策矩阵。

  • 企业交付与采购套件: 32 个全面的交付物,包括 35 题安全问卷、STRIDE 威胁模型、RTM、RACI 和 UAT 计划。


4. 快速开始

前置条件

  • Node.js v20.x 或更高版本

  • npm v10.x 或更高版本(容器化 PostgreSQL 可选使用 Docker)

单命令验证

# 1. Install dependencies (idempotent, local)
make setup

# 2. Run the full interactive demonstration
make demo

# 3. Run all unit and integration tests (32 tests)
make test

# 4. Run the 24-scenario automated evaluation benchmark
make eval

# 5. Execute all release audit quality gates
make release-check

5. 60 秒报价对话记录

[User]      "Hi, I need home insurance for my apartment in Paris (75008)."
[Assistant] submit_property_basics({ country: 'FR', postcode: '75008', propertyType: 'apartment', occupancyType: 'owner_occupied' })
[Server]    -> Status: PROPERTY_RECORDED. State advanced to COLLECTING_RISK.

[User]      "It was built in 2010, 75 sqm, primary residence, 0 claims in past 5 years."
[Assistant] submit_risk_factors({ constructionYearBand: '2000_2015', floorAreaBand: '50_100_sqm', isPrimaryResidence: true, claimsCount5Years: 0 })
[Server]    -> Status: RISK_FACTORS_RECORDED.

[Assistant] evaluate_eligibility()
[Server]    -> Outcome: ELIGIBLE (Reason: RISK_CRITERIA_MET). Rule version: northstar-home-eu-v1.

[User]      "I'd like the Comfort tier with a €300 deductible."
[Assistant] select_coverage({ coverageTier: 'comfort', deductible: 300 })
[Assistant] confirm_quote_parameters({ confirmed: true })
[Server]    -> Status: PARAMETERS_CONFIRMED. State advanced to AWAITING_CONSENT.

[Invariant] calculate_quote() -> Throws [CONSENT_REQUIRED] "Cannot calculate quote without verified consent."

[User]      "I agree to the data processing terms."
[Assistant] submit_consent({ consentVersion: 'consent_v1_2026' })
[Assistant] calculate_quote()
[Server]    -> QUOTE ISSUED (ID: 90484678-f868...)
               Base Annual: €180.00 | Property Multiplier: x0.9 | Deductible Discount: -€25.00
               Net Annual:  €137.00 | Tax (18%): +€24.66
               TOTAL:       €161.66 / year (€13.47 / month)
               Fingerprint: 36d5b534f844c6e43243398f3fb42436c251712183d3e0036f239a7bc168d56a (SHA-256)
               Status:      Active (Non-binding indicative)

6. 仓库结构

├── apps/
│   ├── mcp-server/              # Model Context Protocol server (Stdio/HTTP)
│   └── pricing-service/         # Fastify microservice (/health, /ready, /metrics, /calculate)
├── packages/
│   ├── domain/                  # Zod validation schemas, error taxonomy, state machine
│   ├── rules/                   # Actuarial pricing engine, versioned rules (v1, v2), eligibility
│   ├── persistence/             # SessionStore interface (In-Memory with TTL & PostgreSQL)
│   ├── audit/                   # Append-only audit store with SHA-256 hash chaining & redactor
│   └── security/                # Input sanitization, prompt injection detection, data catalog
├── docs/
│   ├── fde/                     # 16-document Enterprise FDE Delivery Pack (RTM, RACI, UAT, etc.)
│   ├── procurement/             # 16-document Procurement & Security Library (35-question FAQ, DPIA)
│   ├── architecture/            # Threat model (STRIDE), Hosted vs VPC blueprints, SDK notes
│   ├── portfolio/               # Role requirement map, interview walkthrough, STAR stories
│   └── DEMO_SCRIPT.md           # 5-minute video recording script
├── tests/                       # Unit, property, integration, and adversarial security tests
├── scripts/
│   ├── demo-flow.ts             # Interactive demonstration runner
│   ├── run-eval.ts              # 24-scenario automated evaluation benchmark
│   └── anonymize-session.ts     # GDPR Article 17 right-to-erasure utility
├── Makefile                     # Canonical developer command interface
├── docker-compose.yml           # Local multi-container deployment stack
└── .github/workflows/ci.yml     # Automated CI verification pipeline

7. 实测证据与评估结果

本仓库中的所有声明均由通过的代码和自动化评估基准支撑:

评估维度

测量工具

场景/测试

实测结果

类型安全

TypeScript 编译器(tsc --noEmit)

Monorepo 严格模式

0 个类型错误

单元与集成测试套件

Vitest 测试运行器(npm run test)

11 个测试套件,32 个测试

32 个通过(100%)

评估基准

自动化评估运行器(npm run eval)

24 个多国场景

24 个通过(100%,10ms 执行)

安全审计

npm 依赖审计(npm run security)

193 个依赖

0 个高危/严重漏洞

审计链完整性

SHA-256 加密验证

生命周期事件日志

100% 未断裂的哈希链

原始基准结果导出至 artifacts/evals/flow-evaluation.json。


8. 企业交付与采购套件


9. 已知限制

  1. 仅为指示性报价: Northstar Home Insurance EU 是一个合成参考模型。签发的报价不具有约束力,不构成法律承保合同,也不收取任何款项。

  2. 示例性精算因子: packages/rules/src/v1.ts 中的定价系数是简化的演示乘数,不反映专有的精算表。

  3. 无外部云部署声明: 本仓库通过零凭据运行器和 Docker Compose 在本地验证;未配置任何第三方云基础设施。


10. 非关联声明与许可证

本仓库是一个独立的技术工作量证明演示,使用开源 MIT 许可的包(@waniwani/sdk、@modelcontextprotocol/sdk)构建。它与 Waniwani AI、Anthropic 或任何商业保险公司均无关联、未经其认可,也未获得其赞助。

根据 MIT 许可证 授权。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides a privacy-preserving security framework for AI agents using the Model Context Protocol, enabling transparent anonymization of sensitive data and blockchain-like audit trails for regulated domains.
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    A Model Context Protocol server that gives any MCP client two economic-safety tools: realizable quote and pretrade check, paid per call in USDC with no accounts.
    2
    54 npm
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables governed, audit-traced AI access to a curated knowledge base through the Model Context Protocol, with OAuth 2.1 authentication and policy enforcement for secure, compliant queries.
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    A Model Context Protocol server that exposes a versioned brand package (tokens, rules, recipes, media rights, and audit gates) as resources, tools, and prompts for AI agents. It enables agents to plan and audit on-brand UI, image, motion, and video outputs while remaining read-only and credential-free.
    MIT