Skip to main content

fd-open-data-mcp

An open-data ontology MCP: a semantic concept layer over multi-datasource financial/economic data. You ask for data in concepts + entities (e.g. "price.close for Moutai", "GDP for China"); the system resolves the concept to physical columns across datasources, ranks candidate sources by quality + accessibility, fetches from the best one (with failover), caches by concept, and refreshes on a per-concept frequency.

It consumes the finddata fd-* datasource registries and fd-entities-indicators read-only and adds the unifying layers on top.

Architecture

CONSUMED (read-only)                  ADDED by fd-open-data-mcp
 fd-akshare/yfinance/world/             concept_bindings   (column -> concept)
 cn-report/cn-gov registries            entity_source_identifiers (per-source id)
 fd-entities-indicators                 source_rankings    (quality × access × freshness)
   indicator_defs (926 concepts)        semantic_observations (read-through cache)
   countries/cities/symbols/sw_industries   fetch_log / schedules / executions
        │
   TRANSFORMERS: import_catalog, consume_concepts, propose_bindings,
                 seed_entity_identifiers, generate_refresh_schedules
        │
   RUNTIME: read() -> cache hit? : dispatch (ranked, failover) -> cache -> log

Six capabilities (see openspec/changes/add-fd-open-data-mcp/specs/): open-data-catalog, semantic-layer, entity-identity, source-ranking, concept-fetch, scheduled-refresh.

Install

cd /Users/chengsishi/finddata/fd-open-data-mcp
uv sync                  # base install
uv sync --extra data     # + akshare / yfinance / world_bank_data (for real fetches)

The DB path defaults to fd_open_data_mcp/metadata/daas.db; override with FD_OPEN_DATA_MCP_DATABASE_URL. FINDDATA_ROOT (default: the parent finddata/ dir) locates the fd-* providers. EDGAR_IDENTITY (an email) is required by the SEC before any edgar fetch - the runner refuses to call anonymously if it is unset.

Quickstart

# 1. create the ontology tables
fd-open-data-mcp migrate

# 2. import the catalogs (akshare 673, yfinance 12, cn-gov 11, cn-report 44, edgar 6, ...)
fd-open-data-mcp import-catalog
# or one provider:  fd-open-data-mcp import-catalog akshare

# 3. consume the 926 indicator_defs as concepts + propose column->concept bindings
fd-open-data-mcp consume-concepts
fd-open-data-mcp propose-bindings

# 4. seed per-source entity identifiers (akshare/yfinance for stocks, worldbank for countries)
fd-open-data-mcp seed-entities

# 5. generate per-concept refresh schedules from indicator_defs.frequency
fd-open-data-mcp generate-schedules

# 6. read data by concept + entity (read-through cache + ranked dispatch + failover)
fd-open-data-mcp read --concept-id 234 --entity-type stock --entity-id 1 --date 2024-07-26

MCP server

fd-open-data-mcp serve          # FastMCP, stdio transport

16 tools: import_catalog, consume_concepts, propose_bindings, list_concepts, list_bindings, review_bindings, confirm_binding, seed_entity_identifiers, resolve_entity, add_entity_identifier, rank_sources, read, fetch, generate_refresh_schedules, list_schedules, run_schedule.

Tests

uv run --with pytest pytest -q

Design notes / v1 limitations

  • Propose-and-confirm: column->concept bindings carry confidence + provenance; below-threshold bindings are withheld from dispatch (review queue). A real fetch promotes a binding to sample-confirmed.
  • Ranking is per (source × concept), self-tuning from fetch_log (bounded so one failure can't remove a source).
  • Conflict policy: one cached value per (concept, entity, date) with source_used attached; values are never merged across sources.
  • LLM provider for meaning-enrichment / cross-language concept mapping is an open question (design.md); v1 uses a rule table + semantic_type hints.
  • _build_params / _extract_value in the fetch runner are best-effort; a production runner refines per-function date-format / payload-shape quirks.

See openspec/changes/add-fd-open-data-mcp/ for the full spec.


Usage Examples

Query NBS GDP Data

from fd_open_data_mcp.fetch.runner import run_upstream

result = run_upstream(
    source='nbs-gdp', 
    command='get_gdp_quarterly',
    params={'start_year': 2020}
)
print(result.head())

Query Steel Industry Production

result = run_upstream(
    source='cisa-industry',
    command='get_steel_production',
    params={}
)
print(result.head())

Query Metal Futures Pricing

result = run_upstream(
    source='shfe-metal-futures',
    command='get_metal_pricing',
    params={}
)
print(result.head())

CLI Usage

# List all data sources
fd-open-data-mcp list-sources

# Read specific data
fd-open-data-mcp read \
  --source nbs-gdp \
  --function get_gdp_quarterly \
  --params '{"start_year": 2020}'

MCP Server Mode

uv run fd-open-data-mcp serve
# Then connect from Claude/Codex/etc.

Rate Limits & Best Practices

Recommended Refresh Intervals

Data Source Type Refresh Interval Notes
GDP/Macro Weekly Stable data, updates quarterly/monthly
Industry Stats Daily Can change frequently
Futures Prices Hourly during market hours Volatile pricing
Fund Statistics Monthly Updates monthly
Market Indices Real-time High volatility

API Rate Limiting

  • Government APIs: Respect 10 requests/minute default limits
  • Exchange APIs: Follow exchange-specific rate policies
  • Third-party Data: Check individual terms of service
  • Recommendation: Implement exponential backoff on 429 errors

Caching Strategy

All fetch results are automatically cached based on data frequency:

  • High-frequency data (futures): Cache for 1 hour
  • Medium-frequency data (industry stats): Cache for 24 hours
  • Low-frequency data (GDP, annual reports): Cache for 1 week

Use fd-open-data-mcp read to check cache status.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fd_open_data_mcp-0.2.0.tar.gz (79.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fd_open_data_mcp-0.2.0-py3-none-any.whl (83.6 kB view details)

Uploaded Python 3

File details

Details for the file fd_open_data_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: fd_open_data_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 79.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fd_open_data_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9fecfd8128eb19446a03b8dc886e0d47577184526f14b99b1d0c192da803d808
MD5 370587b556c41738147a5963adb84bdf
BLAKE2b-256 92d74550ffb767a7732e7c58f2ab0f1443448828f2a5443bf59c81644ee380c5

See more details on using hashes here.

File details

Details for the file fd_open_data_mcp-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fd_open_data_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b40cf9b814fd7ce1bba8d82be3fb4bbfc7f036926a4e3c3bc2d6dd61732655cb
MD5 ad3d36d2d32a41fafd37002ba5a236a9
BLAKE2b-256 4692dff4ed8b22f61e9dc9ff906e691a86017b2ca66e672abce21fcccedc224b

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page