---
name: haiyushuke-report-mcp
description: 通过海宇数科智能报告 MCP 拉取企业/人员数据并生成尽调报告。包含 MCP 配置自检、工具调用顺序、以及 fetch 结果 AES-GCM 解密。
---

# 海宇数科 · 大模型智能报告（MCP）

官网一键安装与文档：https://www.haiyushuke.com/docs/report/setup · https://www.haiyushuke.com/docs/report/mcp-skills

## 前置条件

1. 在 [海宇数科控制台](https://console.haiyushuke.com) → **智能报告 → MCP Key** 创建密钥（`sk-hyr-` 开头）。
2. 账户已实名认证且余额充足（每次 `fetch_enterprise_data` 按管理端配置单价扣费）。

## Cursor MCP 配置（3 个远程 Stream）

**3 个 MCP 服务、各 1 个工具**。将 `https://console.haiyushuke.com` 换为 Platform 地址（本地 `http://127.0.0.1:8080`），三条共用同一 `sk-hyr-` Key。

```json
{
  "mcpServers": {
    "haiyushuke-list-report-products": {
      "url": "https://console.haiyushuke.com/api/v1/mcp/list-report-products/stream",
      "headers": {
        "Authorization": "Bearer sk-hyr-你的密钥"
      }
    },
    "haiyushuke-get-report-product-guide": {
      "url": "https://console.haiyushuke.com/api/v1/mcp/get-report-product-guide/stream",
      "headers": {
        "Authorization": "Bearer sk-hyr-你的密钥"
      }
    },
    "haiyushuke-fetch-enterprise-data": {
      "url": "https://console.haiyushuke.com/api/v1/mcp/fetch-enterprise-data/stream",
      "headers": {
        "Authorization": "Bearer sk-hyr-你的密钥"
      }
    }
  }
}
```

| MCP | 工具 | 主要输入 | 主要输出 |
|-----|------|----------|----------|
| list-report-products | `list_report_products` | 可选 `category`: `enterprise` / `person` | `productKey`, `name`, `summary`, `costYuan`, `typicalQuestions[]`, `requiredInputs[]`, `suggestedSections[]` |
| get-report-product-guide | `get_report_product_guide` | `productKey` | `fieldGuideMarkdown`, `reportWorkflow`, `suggestedReportOutline[]` |
| fetch-enterprise-data | `fetch_enterprise_data` | `productKey`, `params` | `ok`, `reportData` / `securePayload`, `chargeNotice`, `nextStep` |

## 第一步：验证 Key

先调用 **list_report_products**。若返回产品列表则 Key 有效；若提示 IP 不在白名单、Key 过期或失效，请在控制台「智能报告 → MCP Key」处理。

## 推荐 Agent 工作流

1. `list_report_products` — 用 **productKey** 选型（勿向用户展示任何上游内部编号）。
2. `get_report_product_guide` — 阅读 **fieldGuideMarkdown** 与 **reportWorkflow**。
3. `fetch_enterprise_data` — 传入 **productKey** 与 **params**。
4. 按 **nextStep** 与 guide：先整理结构化报表，再撰写解读说明。

## 工具：fetch_enterprise_data 加密结果

当 `encryptResult: true` 时，平台用 **MCP Key 全文** 派生 AES-256 密钥（SHA-256），以 **AES-256-GCM** 加密 `data`，响应形如：

```json
{ "ok": true, "reportData": { ... }, "chargeNotice": "...", "nextStep": "..." }
```

当 `encryptResult: true` 时使用 `securePayload` 解密，再按同样流程先报表、后解读。

### Node.js 解密

```javascript
import crypto from 'node:crypto'

export function deriveKey(apiKeySecret) {
  return crypto.createHash('sha256').update(apiKeySecret, 'utf8').digest()
}

export function decryptPayload(apiKeySecret, payloadB64) {
  const raw = Buffer.from(payloadB64, 'base64')
  const key = deriveKey(apiKeySecret)
  const nonceSize = 12
  const nonce = raw.subarray(0, nonceSize)
  const ciphertext = raw.subarray(nonceSize)
  const decipher = crypto.createDecipheriv('aes-256-gcm', key, nonce)
  const tag = ciphertext.subarray(ciphertext.length - 16)
  const data = ciphertext.subarray(0, ciphertext.length - 16)
  decipher.setAuthTag(tag)
  return JSON.parse(Buffer.concat([decipher.update(data), decipher.final()]).toString('utf8'))
}
```

### Python 解密

```python
import base64, hashlib, json
from cryptography.hazmat.primitives.ciphers.aead import AESGCM

def decrypt_payload(api_key_secret: str, payload_b64: str):
    raw = base64.b64decode(payload_b64)
    key = hashlib.sha256(api_key_secret.encode()).digest()
    nonce, ct = raw[:12], raw[12:]
    return json.loads(AESGCM(key).decrypt(nonce, ct, None))
```

## productKey 速查（Agent 入参）

勿向终端用户展示任何上游内部编号；调用 MCP 时使用下表 **productKey**：

| productKey | 名称 |
|--------|------|
| enterprise-comprehensive-risk | 企业综合风险报告 V2 |
| enterprise-full-verification | 企业全量信息核验 V2 |
| enterprise-equity-panorama | 企业股权结构全景 |
| enterprise-annual-report | 企业年报信息核验 |
| enterprise-customs-credit | 企业进出口信用核查 |
| enterprise-tax-violation | 企业税收违法核查 |
| enterprise-litigation | 企业司法诉讼 V1 |
| executive-judicial-check | 董监高司法综合信息核验 A |

## 合规提示

- 数据仅供授权尽调/风控使用，勿向未授权第三方泄露。
- 引用数据时注明来源与查询时间；关键结论需与原始字段交叉核对。
