counterparty-credit
Counterparty Credit
一个开放、透明的 MCP 服务器,根据公开数据为上市能源公司的信用健康状况打分。向智能体询问某家公用事业公司、发电商、中游运营商或电力/天然气营销商的稳健程度;Counterparty Credit 会给出 0–100 的评分、逐因子分解,以及每个数字背后的公开来源。
它是决策支持工具,而非信用评级——每项输出都有来源、可解释,并供人工审阅。关键在于给出一个可以质疑的分数,而不是一个黑箱。
由 ComtechAI 构建。方法论版本:ccr-ref-1.3。
状态:v1,刻意保持稳定
本仓库是一个范围冻结的参考实现。它保持发布并持续可用;欢迎提交 bug 修复和上游破坏补丁,但新功能不在本仓库范围内。有关设置、测试和贡献规则,请参阅 DEVELOPMENT.md。
Related MCP server: Pulse MCP Server
工作原理
一个 MCP 工具 counterparty.health,接受公司名称或股票代码。它解析 SEC 申报人,拉取公开财务数据和市场数据,对四个因子进行评分,并将它们融合为一个带有描述性等级(强 / 稳定 / 观察 / 承压 / 困境)的综合评分。
因子 | 读取内容 | 来源 |
F1 — 资产负债表强度 | 杠杆率、利息覆盖率、流动比率 | SEC EDGAR (XBRL) |
F3 — 市场隐含风险 | 违约距离(朴素 Merton)+ 股票波动率 | Tiingo 日价格 + EDGAR |
F4 — 业务组合 / 大宗商品敞口 | 按业务类型划分的现金流结构性隔离程度 | 分类范围(27 个名称) |
F5 — 事件 / 新闻 | 评级行动、契约/流动性事件、计划外停机 | Google News RSS |
综合评分是对本次运行中实际计算出的各因子的重新归一化加权混合。参考权重为 F1 0.20 · F3 0.15 · F4 0.25 · F5 0.15。当某个因子的输入缺失时——F3 没有市场数据源,F4 遇到未分类的名称——该因子被剔除,其权重重新分配到其余因子中。不做任何插补;一个因子要么根据真实数据计算,要么缺席。
每项结果都带有 methodology_version 和 as_of 日期,每个因子都会指明其背后的申报文件或数据源。当某个数字是代理指标时(见局限性),来源行会明确说明。
安装
需要 Python 3.10–3.14。
python3 -m venv venv && source venv/bin/activate # Windows: venv\Scripts\activate
pip install -e .使用方法
从命令行
export SEC_USER_AGENT="Your Name you@example.com" # SEC requires a contact User-Agent
export TIINGO_TOKEN="your_tiingo_key" # optional; F3 is skipped without it
python3 -m counterparty_credit.cli "NextEra Energy"
python3 -m counterparty_credit.cli DUK如果没有描述性的 User-Agent,SEC 会返回 HTTP 403。免费的 Tiingo 令牌可启用 F3;省略它时,工具将基于 F1/F4/F5 评分并明确说明。申报文件和股票代码映射会缓存在 ~/.cache/counterparty-credit 下,保留 24 小时。
从 Claude Desktop 使用
将 claude_desktop_config.example.json 复制到你的 Claude Desktop 配置中,将 command 设置为本仓库 venv 的 Python(绝对路径),并在 env 中设置你的密钥,然后重启 Claude 并询问 "作为交易对手,NextEra 的财务稳健程度如何?" Claude 会调用该工具并读回评分、分解和来源。
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
如果无法解析该公司或无法获取其数据,工具会返回错误而不是数字。只有在实际计算出分数时才会返回分数。
方法论
评分从 Methodology 配置对象读取,而非硬编码常量。Methodology.default() 是开放参考,锁定在 ccr-ref-1.3。已提交的记录:
src/counterparty_credit/methodology.py— 所有曲线、权重、阈值的权威来源docs/methodology-c0.md— 人类可读的正式方法论docs/methodology-c0.json— 机器规范(有测试防止漂移)
自定义方法论只声明其覆盖项,其余部分继承参考方法论:
CCR_METHODOLOGY=/path/to/methodology.json python3 -m counterparty_credit.cli "NextEra Energy"由于每项结果都带有版本标记,自定义配置明显不是参考版本。锁定的数字是一个初始假设,会根据真实名称进行修正;重新校准就是新版本,绝不会静默重写。
局限性
这些是刻意为之并明确说明的。诚实的范围界定正是参考工具的意义所在。
不是信用评级。 基于公开数据的决策支持。无发行人沟通、无非公开信息、无评级机构方法论。
F2(流动性 / 抵押品)被排除在实时混合之外。 其 v0 现金代理指标无论信用质量如何都返回几乎相同的分数,因此没有区分度。它在方法论中有定义,但在真正的抵押品压力模型取代该代理指标之前被排除在外。
F3 需要市场数据源。 没有 Tiingo 令牌,或对于没有干净价格数据的名称,F3 会被剔除,其权重重新分配。
F4 覆盖固定的 27 个名称范围,涵盖北美能源发行人。范围之外的名称在评分时不包含业务组合因子,而不是猜测。
F5 依赖固定词汇表。 它检测以 upgrade / downgrade 表述的评级行动(要求评级机构上下文)以及一组信用事件;它会漏掉以其他动词表述的评级行动,且标题情绪分析较为粗糙。
覆盖率可能使用现金支付代理指标。 一些大型申报人未标记利息费用概念;对于这些申报人,覆盖率根据已支付的现金利息计算,这排除了资本化利息。来源行会按名称标记这一点。
时点公开数据。 数字以最新申报文件为准;过期的申报文件会被标记,而不是静默使用。
目录结构
src/counterparty_credit/
schema.py # locked I/O contract (HealthResult)
methodology.py # config object — reference default + worksheet loader
resolve.py # name/ticker → CIK + ticker (SEC company_tickers.json)
edgar.py # XBRL companyfacts → financials (recency-aware tag selection)
ratios.py # leverage / coverage / liquidity
market.py # daily prices → price + annualized vol (Tiingo)
dtd.py # naive-Merton distance-to-default
news.py # recent headlines (Google News RSS)
scoring.py # F1, F3, F5 scorers
f4_business_mix.py # F4 business-mix lookup over the universe
universe.json # 27-name classification universe
score.py # orchestration → weighted composite → HealthResult
server.py # MCP tool
cli.py # one-command live scoring
tests/免责声明
Counterparty Credit 根据公开数据生成决策支持信息。它不是信用评级,不是投资建议,也不隶属于任何评级机构或其所评分的发行人。输出均有来源,并供人工审阅。
Available Tools
1 toolcounterparty.healthA
Assess the credit health of a public energy company from public data.
Use this when asked how financially sound or risky an energy counterparty is — a regulated utility, merchant generator/IPP, midstream operator, or power/gas marketer. Accepts a company name or ticker.
Returns a 0-100 health score and descriptive band (Strong/Stable/Watch/Stressed/ Distressed), a factor-by-factor breakdown with the public source behind each factor, a plain-language summary, the methodology version, and an as-of date. This is transparent decision-support, not a credit rating.
Raises rather than guessing when the company cannot be resolved or its public data cannot be retrieved. A score is only ever returned when it was actually computed.
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| band | Yes | Descriptive band derived from the score |
| name | Yes | The query as the caller sent it |
| as_of | Yes | As-of date for the underlying data (YYYY-MM-DD) |
| score | Yes | Composite 0–100 health score |
| ticker | No | Equity ticker, if resolved |
| factors | Yes | Factor-by-factor breakdown, each independently sourced |
| summary | Yes | Plain-language read a desk could act on |
| disclaimer | No | Non-negotiable framing — this is not a rating. |
| resolved_name | Yes | Canonical entity name after resolution |
| methodology_version | Yes | Versioned methodology id, e.g. 'tenor-0.1.0-stub' |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure, and it does so thoroughly. It explains the return contents (health score, band, factor breakdown, sources, summary, methodology version, as-of date), frames the output as 'transparent decision-support, not a credit rating,' and explicitly states it 'raises rather than guessing' when resolution or data retrieval fails.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the main action, immediately followed by usage context, output details, and an explicit failure behavior. Every sentence contributes necessary information without redundancy, and the structure makes it easy for an agent to quickly determine purpose and call behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's single parameter, no annotations, no siblings, and an output schema that can carry return structure, the description covers all key contextual needs: input type, applicable domain, output semantics, methodological transparency, and error behavior. An agent has enough information to invoke the tool correctly and interpret its result.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema only provides a required string property 'name' with 0% description coverage, so the description must compensate. It does by adding that the tool 'Accepts a company name or ticker.' This is meaningful semantic guidance for the single parameter, though slightly more detail about accepted formats would push it higher.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description starts with a specific verb and resource: 'Assess the credit health of a public energy company from public data.' It further clarifies the exact scope by listing company types (regulated utility, merchant generator/IPP, midstream operator, marketer) and the accepted inputs (company name or ticker). Even without siblings, the purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states when to use the tool: 'Use this when asked how financially sound or risky an energy counterparty is.' It gives clear context and enumerates the applicable counterparty types, but it does not explicitly state when not to use it or name alternatives. Since there are no sibling tools, this is a clear and sufficient usage guideline.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.0- First observed
counterparty.health
TDQS
Scored across 1 tool
With only one tool, there is no possibility of confusion or overlap with other tools. The tool's purpose is clearly defined and unique within this server.
A single tool name naturally presents no inconsistencies. The dotted notation 'counterparty.health' is descriptive and suggests a clear action/domain pattern.
One tool feels thin for a server, even when narrowly scoped. The functionality is focused, but a server with a single tool offers little flexibility or breadth for an agent.
The tool covers the core domain of assessing counterparty credit health thoroughly, returning scores, factors, sources, and methodology. It lacks supplementary operations like historical comparisons or bulk screening, but these are not essential for the stated purpose.
Maintenance
Related MCP Connectors
Independent trust scores, tool surfaces and change history for MCP servers.
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
Scores any MCP server before you trust it: free quick check, full paid report, 2-5 way compare.
Remote MCP server to enrich company profiles with structured B2B data and confidence scores.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for Axonn, enabling access to US energy regulatory filings, real-time ISO prices, and market data.MIT
- FlicenseNot gradedqualityCmaintenanceAn MCP server that exposes Moody's Pulse (Cortera) trade-credit data with grounded knowledge-base context, enabling search, report retrieval, and explanation of metrics and use cases.-
- FlicenseNot gradedqualityBmaintenanceMCP server that exposes the credit scoring model's deterministic tools (probability of default, SHAP explanations, typicality check, financial ratios) to AI agents, enabling natural language credit risk assessment.-
- AlicenseNot gradedqualityCmaintenanceProvides complete credit dossiers for individuals or companies, including registration data, risk score, and pending issues, via a hosted MCP server with a single read-only tool.MIT