nport
nport
基于 SEC 表格 N-PORT 和表格 N-CEN 构建的规范化基金持仓与服务提供商图谱,与 GLEIF LEI 注册表关联,通过 MCP 提供给代理。
设计:docs/design.md。 关于源数据的经验笔记:docs/data-notes.md。
状态:仅摄取层。 原始层和 Parquet 层端到端落地;dbt 转换、MCP 服务器和 Terraform 尚未构建。
快速开始
uv sync
export SEC_USER_AGENT="Your Name your@email.com" # the SEC throttles anonymous traffic
uv run nport-ingest periods nport # what quarters are published upstream
uv run nport-ingest all # N-PORT + N-CEN + GLEIF, latest available
uv run nport-ingest status # what is landed, from the manifests落地全部三个源需要几分钟,并在 ./data 下写入约 1 GB。要落地单个源或更早的季度:
uv run nport-ingest land nport --period 2026q1
uv run nport-ingest land ncen --raw-only # skip Parquet conversion
uv run nport-ingest land gleif --force # re-download and re-convertRelated MCP server: civicgraph-mcp
存储
NPORT_DATA_ROOT 控制所有内容的存放位置,是本地迭代与在 ECS 中运行之间的唯一区别:
export NPORT_DATA_ROOT=./data # default
export NPORT_DATA_ROOT=s3://my-bucket/nport # needs the `s3` extra: uv sync --extra s3布局,依据 docs/design.md 第 2 节:
{root}/raw/{source}/{period}/{archive}.zip original bytes, immutable
{root}/parquet/{table}/period={period}/data.parquet zstd, all columns VARCHAR
{root}/parquet/_manifest/{source}/period={period}/
manifest.json source URL, raw SHA-256, per-table row counts
schema.json column names, types, descriptions and PKs, from the
CSVW sidecar the SEC ships inside each archive除非传入 --force,否则重新运行已落地的期间是空操作,这使得任务可以安全地从计划中重试。如果 SEC 以相同文件名重新发布某个季度,运行会警告字节数发生变化,而不是静默提供过期数据。
摄取层中的设计决策
每个 Parquet 列都是 VARCHAR。 类型定义属于 dbt staging/。源数据中充满了会破坏类型推断的值——日期如 28-FEB-2026、数字如 -.0091723714,以及出现在数字列中的 N/A——因此这里的推断要么失败,要么静默强制转换,而且会把业务逻辑放在必须从原始字节保持可复现的那一层。
下载 URL 是发现的,而非构造的。 大多数 SEC 归档遵循 {period}_{source}.zip 模式,但几个 N-CEN 季度在重新发布后以 2025q1_ncen_0.zip 形式提供。索引页面会被抓取以获取 href,并以常规模式作为回退。
归档自身的模式元数据会被提取。 两个 SEC ZIP 都包含一个 CSVW *_metadata.json,声明了每个表的主键、列类型和列描述。这是 transform/ 中粒度断言的权威输入,因此它被写出为 schema.json,而不是留在 ZIP 中。
布局
src/nport/ingest/ fetch -> validate -> land as Parquet
sources/ one module per upstream source
convert.py ZIP of delimited text -> Parquet, via DuckDB
land.py orchestration and manifests
storage.py URI addressing over fsspec (local or S3)
transform/ dbt project (dbt-duckdb) [not built]
src/nport/server/ FastMCP server [not built]
evals/ scored question set [not built]
infra/ Terraform [not built]开发
uv run ruff check src/ && uv run ruff format src/
uv run pytestThis server cannot be deployed
Maintenance
Related MCP Connectors
Family Office Knowledge Graph: read-only MCP door over the public record. Agentic KG Holdings.
MCP server for nonprofit financials via ProPublica: IRS Form 990 data for 1.8M+ nonprofits.
MCP server for VC pitch-deck scoring, thesis-fit matching, and deal-flow management.
Knowledge coverage map and health score. Ingest docs into a governed knowledge graph via MCP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA 'Server of Servers' architecture that aggregates domain-specific financial data capabilities into a single governed interface. It enables users to access fund performance tools like returns, benchmark comparisons, and risk-adjusted metrics through a unified MCP-compliant gateway.-
- AlicenseAqualityDmaintenanceA money-in-politics knowledge graph, as an MCP server. It links entities across federal campaign donations, lobbying disclosures, and government contracts.7MIT
- AlicenseAqualityBmaintenanceAn MCP server that wraps SEC EDGAR APIs to provide company financial data, screening metrics, and disclosure signals for investment diligence, with every figure traced to its source filing.8MIT
- AlicenseNot gradedqualityBmaintenanceMCP server that reconstructs hedge-fund/superinvestor portfolios from SEC EDGAR 13F filings, offering tools to query fund holdings, consensus activity, and quarter-over-quarter changes through a read-only API.4AGPL 3.0