datasinking 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datasinking
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Python client for DataSinking — full-text Asian financial reports (China, Korea, Japan) as Markdown.
5
5
  Author: DataSinking
6
6
  License: MIT
@@ -22,7 +22,10 @@ Dynamic: license-file
22
22
 
23
23
  # DataSinking
24
24
 
25
+ <!-- mcp-name: io.github.heubme2020/datasinking -->
26
+
25
27
  [![PyPI version](https://img.shields.io/pypi/v/datasinking.svg)](https://pypi.org/project/datasinking/)
28
+ [![MCP server](https://img.shields.io/badge/MCP-server-blue)](https://github.com/heubme2020/datasinking#mcp-server)
26
29
 
27
30
  **Full-text financial reports across Asia, as clean Markdown.**
28
31
 
@@ -35,6 +38,20 @@ YAML frontmatter, preserved headings, paragraphs and tables.
35
38
 
36
39
  ---
37
40
 
41
+ ## MCP server
42
+
43
+ Ship DataSinking to any AI agent (Claude Desktop / Cursor / Codex / Windsurf) as an
44
+ [MCP](https://modelcontextprotocol.io) server — 6 tools: list exchanges, list stocks,
45
+ list reports, fetch a report, list sections, fetch one section (token-friendly for RAG).
46
+
47
+ ```bash
48
+ pip install "datasinking[mcp]"
49
+ datasinking-mcp # requires DATASINK_API_KEY (free at https://datasink.ing)
50
+ ```
51
+
52
+ Or add to your client with `command: datasinking-mcp`. A remote streamable-HTTP endpoint
53
+ is also live at `https://api.datasink.ing/mcp`. See [`mcp-server.md`](mcp-server.md).
54
+
38
55
  ## What this repo is
39
56
 
40
57
  Examples, research and tutorials showing how to work with financial report data, including reproducing the presentation styles found in financial-report research papers.
@@ -1,6 +1,9 @@
1
1
  # DataSinking
2
2
 
3
+ <!-- mcp-name: io.github.heubme2020/datasinking -->
4
+
3
5
  [![PyPI version](https://img.shields.io/pypi/v/datasinking.svg)](https://pypi.org/project/datasinking/)
6
+ [![MCP server](https://img.shields.io/badge/MCP-server-blue)](https://github.com/heubme2020/datasinking#mcp-server)
4
7
 
5
8
  **Full-text financial reports across Asia, as clean Markdown.**
6
9
 
@@ -13,6 +16,20 @@ YAML frontmatter, preserved headings, paragraphs and tables.
13
16
 
14
17
  ---
15
18
 
19
+ ## MCP server
20
+
21
+ Ship DataSinking to any AI agent (Claude Desktop / Cursor / Codex / Windsurf) as an
22
+ [MCP](https://modelcontextprotocol.io) server — 6 tools: list exchanges, list stocks,
23
+ list reports, fetch a report, list sections, fetch one section (token-friendly for RAG).
24
+
25
+ ```bash
26
+ pip install "datasinking[mcp]"
27
+ datasinking-mcp # requires DATASINK_API_KEY (free at https://datasink.ing)
28
+ ```
29
+
30
+ Or add to your client with `command: datasinking-mcp`. A remote streamable-HTTP endpoint
31
+ is also live at `https://api.datasink.ing/mcp`. See [`mcp-server.md`](mcp-server.md).
32
+
16
33
  ## What this repo is
17
34
 
18
35
  Examples, research and tutorials showing how to work with financial report data, including reproducing the presentation styles found in financial-report research papers.
@@ -130,3 +130,14 @@ class DataSinking:
130
130
  d = self._get("/documents", dict(params, size=limit, order="desc"))
131
131
  ids = [it["id"] for it in d["items"]]
132
132
  return self._batch_content(ids)
133
+
134
+ def list_sections(self, doc_id):
135
+ """列出报告的章节标题 -> list[str](供 get_section 用)"""
136
+ return self._get(f"/documents/{doc_id}/sections")["sections"]
137
+
138
+ def get_section(self, doc_id, section):
139
+ """只取报告的某一章(省 token,适合 RAG)-> dict,含 content 和 section
140
+
141
+ section: 章节标题关键词,如 "管理层讨论与分析" / "财务报告" / "MD&A"
142
+ """
143
+ return self._get(f"/documents/{doc_id}", {"section": section})
@@ -34,10 +34,15 @@ API_KEY = os.environ.get("DATASINK_API_KEY", "")
34
34
 
35
35
  mcp = FastMCP(
36
36
  "DataSinking",
37
+ title="DataSinking — Full-text Asian Financial Reports",
38
+ description="Full-text Asian financial reports (China, Korea, Japan) as clean Markdown via API, with chapter-level access for RAG and AI agents.",
39
+ version="0.2.2",
37
40
  instructions=(
38
- "DataSinking 提供亚洲(中国/韩国/日本)上市公司财报的全文 Markdown。"
39
- "symbol FMP 风格:600519.SS(茅台)、005930.KS(三星)、7203.T(丰田)。"
40
- "要省 token 时用 get_section 只取某一章(如 MD&A),而不是 get_report 拿整篇。"
41
+ "DataSinking serves full-text financial reports (annual / semi-annual / quarterly) "
42
+ "from China, Korea and Japan as clean Markdown, ready for LLM reading and RAG. "
43
+ "Use FMP-style symbols: 600519.SS (Kweichow Moutai), 005930.KS (Samsung Electronics), "
44
+ "7203.T (Toyota). To save tokens, prefer get_section to pull one chapter (e.g. MD&A) "
45
+ "instead of get_report for the whole document."
41
46
  ),
42
47
  )
43
48
 
@@ -45,7 +50,9 @@ mcp = FastMCP(
45
50
  def _get(path: str, params: Optional[dict] = None) -> dict:
46
51
  """Call the DataSinking API, carrying the API key automatically."""
47
52
  if not API_KEY:
48
- raise RuntimeError("缺少 DATASINK_API_KEY 环境变量(去 datasink.ing 免费拿一个)")
53
+ raise RuntimeError(
54
+ "Missing DATASINK_API_KEY environment variable (get a free key at https://datasink.ing)"
55
+ )
49
56
  p = dict(params or {})
50
57
  p["apikey"] = API_KEY
51
58
  r = requests.get(f"{BASE_URL}{path}", params=p, timeout=90)
@@ -55,17 +62,21 @@ def _get(path: str, params: Optional[dict] = None) -> dict:
55
62
 
56
63
  @mcp.tool()
57
64
  def list_exchanges() -> list:
58
- """列出 DataSinking 覆盖的交易所代码(sse/szse/bj/ksc/koe/knx/jpx)。"""
65
+ """List the exchanges DataSinking covers and their report counts.
66
+
67
+ Returns exchange codes (sse / szse / bj / ksc / koe / knx / jpx) with the number
68
+ of reports available per exchange. Call this first to discover coverage.
69
+ """
59
70
  return _get("/exchanges").get("exchanges", [])
60
71
 
61
72
 
62
73
  @mcp.tool()
63
74
  def list_stocks(exchange: str, limit: int = 20) -> dict:
64
- """列出某交易所的股票(含每家公司的报告数)。
75
+ """List stocks on an exchange, including the report count per company.
65
76
 
66
77
  Args:
67
- exchange: 交易所代码,如 sse / szse / ksc / koe / jpx
68
- limit: 返回前 N 家(默认 20,防止列表过长)
78
+ exchange: Exchange code, e.g. sse / szse / bj / ksc / koe / knx / jpx
79
+ limit: Return the first N companies (default 20) to keep responses short.
69
80
  """
70
81
  data = _get("/stocks", {"exchange": exchange})
71
82
  return {"exchange": exchange, "total": data.get("total", 0), "items": data.get("items", [])[:limit]}
@@ -73,39 +84,43 @@ def list_stocks(exchange: str, limit: int = 20) -> dict:
73
84
 
74
85
  @mcp.tool()
75
86
  def list_reports(symbol: str, doc_type: str = "annual", size: int = 10) -> dict:
76
- """列出某公司的报告(元数据,不含正文)。
87
+ """List a company's reports — metadata only (id, title, period), no body text.
77
88
 
78
89
  Args:
79
- symbol: FMP 风格代码,如 600519.SS / 005930.KS / 7203.T
90
+ symbol: FMP-style symbol, e.g. 600519.SS / 005930.KS / 7203.T
80
91
  doc_type: annual / semiannual / q1 / q3
81
- size: 返回条数(默认 10
92
+ size: Number of reports to return (default 10).
82
93
  """
83
94
  return _get("/documents", {"symbol": symbol, "doc_type": doc_type, "size": size})
84
95
 
85
96
 
86
97
  @mcp.tool()
87
98
  def get_report(document_id: int) -> dict:
88
- """获取单篇报告的全文(元数据 + Markdown 正文)。
99
+ """Fetch a single report's full text (metadata + Markdown body).
89
100
 
90
101
  Args:
91
- document_id: 报告 ID,从 list_reports items[].id
102
+ document_id: Report id, from list_reports items[].id
92
103
  """
93
104
  return _get(f"/documents/{document_id}")
94
105
 
95
106
 
96
107
  @mcp.tool()
97
108
  def list_sections(document_id: int) -> dict:
98
- """列出某报告的所有章节标题(供 get_section 用)。"""
109
+ """List every section heading in a report (feed the headings to get_section).
110
+
111
+ Args:
112
+ document_id: Report id
113
+ """
99
114
  return _get(f"/documents/{document_id}/sections")
100
115
 
101
116
 
102
117
  @mcp.tool()
103
118
  def get_section(document_id: int, section: str) -> dict:
104
- """只取报告的某一章(省 token,适合 RAG)。
119
+ """Fetch only one section of a report by keyword — cheaper than get_report for RAG.
105
120
 
106
121
  Args:
107
- document_id: 报告 ID
108
- section: 章节标题的关键词,如 "管理层讨论与分析" / "MD&A" / "财务报告"
122
+ document_id: Report id
123
+ section: Heading keyword, e.g. "management discussion" / "MD&A" / "financial statements" / "notes"
109
124
  """
110
125
  return _get(f"/documents/{document_id}", {"section": section})
111
126
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datasinking
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Python client for DataSinking — full-text Asian financial reports (China, Korea, Japan) as Markdown.
5
5
  Author: DataSinking
6
6
  License: MIT
@@ -22,7 +22,10 @@ Dynamic: license-file
22
22
 
23
23
  # DataSinking
24
24
 
25
+ <!-- mcp-name: io.github.heubme2020/datasinking -->
26
+
25
27
  [![PyPI version](https://img.shields.io/pypi/v/datasinking.svg)](https://pypi.org/project/datasinking/)
28
+ [![MCP server](https://img.shields.io/badge/MCP-server-blue)](https://github.com/heubme2020/datasinking#mcp-server)
26
29
 
27
30
  **Full-text financial reports across Asia, as clean Markdown.**
28
31
 
@@ -35,6 +38,20 @@ YAML frontmatter, preserved headings, paragraphs and tables.
35
38
 
36
39
  ---
37
40
 
41
+ ## MCP server
42
+
43
+ Ship DataSinking to any AI agent (Claude Desktop / Cursor / Codex / Windsurf) as an
44
+ [MCP](https://modelcontextprotocol.io) server — 6 tools: list exchanges, list stocks,
45
+ list reports, fetch a report, list sections, fetch one section (token-friendly for RAG).
46
+
47
+ ```bash
48
+ pip install "datasinking[mcp]"
49
+ datasinking-mcp # requires DATASINK_API_KEY (free at https://datasink.ing)
50
+ ```
51
+
52
+ Or add to your client with `command: datasinking-mcp`. A remote streamable-HTTP endpoint
53
+ is also live at `https://api.datasink.ing/mcp`. See [`mcp-server.md`](mcp-server.md).
54
+
38
55
  ## What this repo is
39
56
 
40
57
  Examples, research and tutorials showing how to work with financial report data, including reproducing the presentation styles found in financial-report research papers.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "datasinking"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "Python client for DataSinking — full-text Asian financial reports (China, Korea, Japan) as Markdown."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
File without changes
File without changes