Skip to content

[需求] 财报数据MCP服务 #162

Description

@xingren23

需求:通过 MCP 协议(Model Context Protocol)把 dayu 的财报读取工具暴露给外部 Agent 系统(OpenCode、Codex、Claude-Code 等),使外部 Agent 能直接查询已下载到本地 workspace 的财报文档。

背景:大禹 Agent 针对 LLM 可喂性的设计

## LLM 可喂性(LLM Consumability)框架

### 核心定义

> **LLM 可喂性** = LLM agent 通过 tool 调用获取的文档数据,能否**准确、高效、无歧义**地支撑金融分析任务。

评估的不是「文档是否完整」,而是「agent 是否能用」。

本框架适用于所有 SEC 表单(10-K、10-Q、20-F、6-K、8-K、SC 13G、DEF 14A),**六维**评估逻辑与表单类型无关,仅指标阈值按表单差异调参。

详见:https://github.com/noho/dayu-agent/blob/main/docs/llm_consumability.md

财报下载后,通过预处理(dayu-cli process 命令)将财报进行拆分,不同form-type的文档适配不同的 processor,并通过read_sections 将分片内容提供给 Agent,这对 Agent 能够 准确、高效、无歧义地进行财报分析提供了上下文。

设计考虑:

  1. MCP 工具调用是无状态的(每次调用独立、无 session/run 概念),这与 dayu 的LLM in the loop 架构有本质差异。
  2. MCP 模块是 dayu 的最低依赖暴露面,仅依赖 dayu.fins.* 和 dayu.engine.processors.*,不再受 UI -> Service -> Host -> Agent 约束
  3. 为本机 Agent 系统(OpenCode、Codex、Claude-Code)提供MCP服务,暂不考虑多租户
  4. 支持 Agent 财报读取,不支持财报下载、上传、预处理等长任务(Ingestion能力)

相关能力:

工具 必填参数 可选参数 对应 service 方法
list_documents ticker document_types, fiscal_years, fiscal_periods service.list_documents()
get_document_sections ticker, document_id service.get_document_sections()
read_section ticker, document_id, ref service.read_section()
search_document ticker, document_id query/queries(互斥), within_section_ref, mode service.search_document()
list_tables ticker, document_id financial_only, within_section_ref service.list_tables()
get_table ticker, document_id, table_ref service.get_table()
get_page_content ticker, document_id, page_no(≥1) service.get_page_content()
get_financial_statement ticker, document_id, statement_type service.get_financial_statement()
query_xbrl_facts ticker, document_id concepts, statement_type, period_end, fiscal_year, fiscal_period, min_value, max_value service.query_xbrl_facts()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions