MCP server for CNINFO A-share announcement download, parsing and search
Project description
AgentLadle MCP CNINFO
English | ไธญๆ
๐จ๐ณ China A-Share Annual Reports โ Cloud-hosted MCP for Shanghai & Shenzhen listed companies. Read more | Get API Key
A MCP (Model Context Protocol) server that provides tools for discovering, downloading, parsing, and searching China A-share announcements from CNINFO (ๅทจๆฝฎ่ต่ฎฏ็ฝ).
It enables AI assistants (Claude, Cursor, etc.) to access CNINFO announcement data through 6 structured tools โ from discovering available announcements to keyword-searching within their pages.
Scope (v0.1): Announcements only. Periodic reports (ๅนดๆฅ / ๅๅนดๆฅ / ไธๅญฃๆฅ / ไธๅญฃๆฅ) are out of scope.
Features
- 6 MCP tools for CNINFO announcement data: state-driven retrieval (search directly, fallback to download/parse only when needed)
- PDF document parsing using PyMuPDF โ physical page extraction into page-split JSON
- Local keyword search with TF + position-boost scoring, zero external search dependencies
- Idempotent โ already-downloaded/parsed files are automatically skipped
- Zero-config install โ one line to add to your MCP client, no clone or manual setup needed
- Pure Python, cross-platform (Windows / macOS / Linux)
Prerequisites
- Python 3.10+ โ Download Python
- uv โ Install uv
Note: After installing uv, restart your terminal and MCP client (e.g. Cherry Studio) to ensure the
uvcommand is recognized.
Quick Start
Add to your MCP client configuration (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"mcp-cninfo": {
"command": "uvx",
"args": ["agentladle-mcp-cninfo"]
}
}
}
That's it. uvx will automatically download the package and its dependencies from PyPI โ no clone, no manual install, no path configuration.
Alternative: pip install
If you prefer managing the environment yourself:
pip install agentladle-mcp-cninfo
Then configure:
{
"mcpServers": {
"mcp-cninfo": {
"command": "agentladle-mcp-cninfo"
}
}
}
Alternative: Run from source (local development)
Clone the repository and run directly:
git clone https://github.com/agentladle/mcp-cninfo.git
Then configure your MCP client:
{
"mcpServers": {
"mcp-cninfo": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-cninfo", "agentladle-mcp-cninfo"]
}
}
}
Replace /path/to/mcp-cninfo with the actual path to the cloned repository.
Data Flow
CNINFO API Local Files (~/.agentladle/mcp-cninfo/data/)
โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
szse_stock.json โโโ companies.json (stock_codeโorgId mapping)
โ
hisAnnouncement/query โโโ pdf/{LOCAL_KEY}/ (Tool 2: primary PDF/HTML + manifest)
โ
PyMuPDF parsing โโโ json/*.json (Tool 3: parse, page-split)
โ
Local TF search โโโ search results (Tool 4: keyword search)
Page range read โโโ page content (Tool 5: read pages)
Tools
| # | Tool | Description |
|---|---|---|
| 1 | list_cninfo_announcements |
Discover available CNINFO announcements for a company |
| 2 | download_cninfo_announcement |
Download announcement PDF (HTML fallback); idempotent |
| 3 | parse_cninfo_announcement |
Parse PDF/HTML into page-split JSON using PyMuPDF |
| 4 | keyword_search |
Full-text keyword search with TF relevance scoring |
| 5 | get_announcement_pages |
Read announcement content by page number range |
| 6 | lookup_stock_code |
Diagnostic: look up stock_codeโorgId mapping when resolution fails |
Tool 1: list_cninfo_announcements
List available CNINFO announcements for a company. Use this tool ONLY when the exact date/title is unspecified by the user, or when a download attempt fails due to an ambiguous match. Default categories exclude periodic reports (ๅนดๆฅ / ๅๅนดๆฅ / ไธๅญฃๆฅ / ไธๅญฃๆฅ).
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_code |
string | โ | 6-digit stock code, e.g. "000001" |
category |
string | โ | Category key, short code, or Chinese label, e.g. "่ฃไบไผ", "DSH", "category_dshgg_szsh". Omit to list default announcement categories |
start_date |
string | โ | Start date YYYY-MM-DD |
end_date |
string | โ | End date YYYY-MM-DD |
title_keyword |
string | โ | Title keyword filter |
limit |
int | โ | Max announcements to return, default 10, max 50 |
Tool 2: download_cninfo_announcement
Download a specific CNINFO announcement from static.cninfo.com.cn. Prefer local_key from list_cninfo_announcements when available. Idempotent.
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_code |
string | โ | 6-digit stock code, e.g. "000001" |
announce_date |
string | โ | Announce date YYYY-MM-DD (optional if local_key provided) |
title_keyword |
string | โ | Title substring to disambiguate same-day announcements |
category |
string | โ | Optional category filter |
announcement_id |
string | โ | CNINFO announcement id if known |
local_key |
string | โ | Exact local bundle key from list results |
Tool 3: parse_cninfo_announcement
Parse a downloaded announcement PDF/HTML into page-split JSON. Uses PyMuPDF for PDF physical-page text extraction.
| Parameter | Type | Required | Description |
|---|---|---|---|
local_key |
string | โ | Bundle key returned by list/download, e.g. "000001_DSH_2026-07-02_8b1ad607" |
Tool 4: keyword_search
Full-text keyword search across all pages. Results ranked by TF + position-boost score.
| Parameter | Type | Required | Description |
|---|---|---|---|
local_key |
string | โ | Bundle key |
keywords |
string[] | โ | 1โ5 search keywords |
match_mode |
string | โ | "ANY" (default, any keyword matches) / "ALL" (all must match) |
max_results |
int | โ | Max results to return, default 5, max 50 |
Tool 5: get_announcement_pages
Read full page content by page number range.
| Parameter | Type | Required | Description |
|---|---|---|---|
local_key |
string | โ | Bundle key |
start_page |
int | โ | Start page number (1-based) |
page_count |
int | โ | Number of pages to return, default 3, max 5 |
Tool 6: lookup_stock_code
Diagnostic tool: look up stock_codeโorgId mapping. Use only when download_cninfo_announcement / list_cninfo_announcements returns Stock code not found. Bypasses the session failed-code cache.
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_code |
string | โ | 6-digit stock code, e.g. "000001" |
refresh |
bool | โ | Force re-download of szse_stock.json from CNINFO (default: false) |
Configuration
On first run, a default config file is created at ~/.agentladle/mcp-cninfo/config.yaml:
paths:
data_dir: "~/.agentladle/mcp-cninfo/data"
pdf_dir: "~/.agentladle/mcp-cninfo/data/pdf"
json_dir: "~/.agentladle/mcp-cninfo/data/json"
download:
delay_between_requests: 0.3
min_file_size: 500
list_page_size: 30
list_max_pages: 5
company:
cache_ttl_days: 7
Data Directory Structure
~/.agentladle/mcp-cninfo/
โโโ config.yaml # Configuration (auto-created)
โโโ data/
โโโ companies.json # stock_codeโorgId mapping (auto-downloaded & cached)
โโโ pdf/ # Downloaded announcement bundles
โ โโโ 000001_DSH_2026-07-02_8b1ad607/
โ โ โโโ primary.pdf
โ โ โโโ manifest.json
โ โโโ ...
โโโ json/ # Parsed page-split JSON
โโโ 000001_DSH_2026-07-02_8b1ad607.json
โโโ ...
File naming convention: {STOCK_CODE}_{CAT_SHORT}_{ANNOUNCE_DATE}_{ID_HASH}
Example Usage
The tools are designed with an EAFP (Easier to Ask for Forgiveness than Permission) approach. AI assistants should attempt to retrieve data directly and rely on errors to trigger downloads.
Scenario A: File already exists locally (Shortest Path)
User: "Search 000001 board resolution for ๅ่ดญ"
1. keyword_search(local_key="000001_DSH_2026-07-02_8b1ad607", keywords=["ๅ่ดญ", "ๅณ่ฎฎ"])
โ Returns page snippets matching the keywords immediately.
Scenario B: File missing (Fallback triggered)
User: "What did Ping An Bank announce in its latest board notice?"
1. list_cninfo_announcements(stock_code="000001", category="่ฃไบไผ", limit=3)
โ Returns local_key / announce_date / title.
2. keyword_search(local_key="...", keywords=["่ฃไบไผ", "ๅณ่ฎฎ"])
โ Error: File not found.
3. download_cninfo_announcement(stock_code="000001", local_key="...")
โ Downloads PDF to ~/.agentladle/mcp-cninfo/data/pdf/
4. parse_cninfo_announcement(local_key="...")
โ Parses into JSON.
5. keyword_search(local_key="...", keywords=["่ฃไบไผ", "ๅณ่ฎฎ"])
โ Retries search and returns data.
Tech Stack
| Component | Choice | Purpose |
|---|---|---|
| MCP Framework | mcp (FastMCP) |
MCP server with stdio transport |
| HTTP Client | httpx |
CNINFO API requests & file downloads |
| PDF Parsing | pymupdf + beautifulsoup4 |
PDF page text extraction; HTML fallback |
| Search | Python built-in | TF + position-boost scoring |
| Config | pyyaml |
YAML configuration file |
Project Structure
src/mcp_cninfo/
โโโ __init__.py
โโโ server.py # MCP Server entry point
โโโ config.py # Config loading (~/.agentladle/mcp-cninfo/config.yaml, singleton cached)
โโโ models.py # Data models
โโโ categories.py # Announcement category whitelist / blacklist
โโโ response.py # Unified JSON responses
โโโ instances.py # Service singletons
โโโ tools/
โ โโโ list_announcements.py # Tool 1: list_cninfo_announcements
โ โโโ download.py # Tool 2: download_cninfo_announcement
โ โโโ parse.py # Tool 3: parse_cninfo_announcement
โ โโโ search.py # Tool 4: keyword_search
โ โโโ page.py # Tool 5: get_announcement_pages
โ โโโ lookup.py # Tool 6: lookup_stock_code
โโโ services/
โโโ company.py # CNINFO szse_stock.json + stock_codeโorgId
โโโ downloader.py # CNINFO query + PDF download
โโโ parser.py # PDF/HTMLโJSON parsing (PyMuPDF)
โโโ searcher.py # Local JSON search + TF scoring
โโโ keys.py # local_key helpers
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentladle_mcp_cninfo-0.1.1.tar.gz.
File metadata
- Download URL: agentladle_mcp_cninfo-0.1.1.tar.gz
- Upload date:
- Size: 96.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17fe9be098162273bd5c66ae2665435488b52bc1d09d48c1f42721df232dbe9a
|
|
| MD5 |
68e9073fe0db0d3c913c69772eec8a1a
|
|
| BLAKE2b-256 |
45f8606ed31cc676d46e47a6fd2592886270769143dc5dac831f97dfd0a88e98
|
File details
Details for the file agentladle_mcp_cninfo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentladle_mcp_cninfo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd8d6ce88472164044f21fcd288ecdda732725f697ed9c901148b3bc270a7991
|
|
| MD5 |
f2497070c8ad5e510b08abe273cb803d
|
|
| BLAKE2b-256 |
cd0282c7d0e1ef60dfc8936377918000276e31d37282e0a7c18adbe76d863b39
|