capinaut-sec 0.1.0__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.
- capinaut_sec-0.1.0/.github/workflows/ci.yml +74 -0
- capinaut_sec-0.1.0/.gitignore +11 -0
- capinaut_sec-0.1.0/.python-version +1 -0
- capinaut_sec-0.1.0/LICENSE +202 -0
- capinaut_sec-0.1.0/PKG-INFO +179 -0
- capinaut_sec-0.1.0/README.md +157 -0
- capinaut_sec-0.1.0/SECURITY.md +22 -0
- capinaut_sec-0.1.0/conformance/live-aapl.json +4 -0
- capinaut_sec-0.1.0/conformance/live-jpm.json +4 -0
- capinaut_sec-0.1.0/conformance/replay.json +4 -0
- capinaut_sec-0.1.0/pyproject.toml +56 -0
- capinaut_sec-0.1.0/scripts/record_fixtures.py +133 -0
- capinaut_sec-0.1.0/src/capinaut_sec/__init__.py +3 -0
- capinaut_sec-0.1.0/src/capinaut_sec/__main__.py +3 -0
- capinaut_sec-0.1.0/src/capinaut_sec/app.py +135 -0
- capinaut_sec-0.1.0/src/capinaut_sec/cli.py +87 -0
- capinaut_sec-0.1.0/src/capinaut_sec/config.py +110 -0
- capinaut_sec-0.1.0/src/capinaut_sec/documents.py +658 -0
- capinaut_sec-0.1.0/src/capinaut_sec/errors.py +30 -0
- capinaut_sec-0.1.0/src/capinaut_sec/facts.py +367 -0
- capinaut_sec-0.1.0/src/capinaut_sec/filings.py +235 -0
- capinaut_sec-0.1.0/src/capinaut_sec/identifiers.py +116 -0
- capinaut_sec-0.1.0/src/capinaut_sec/issuers.py +340 -0
- capinaut_sec-0.1.0/src/capinaut_sec/paging.py +57 -0
- capinaut_sec-0.1.0/src/capinaut_sec/protocol_tools.json +4955 -0
- capinaut_sec-0.1.0/src/capinaut_sec/provenance.py +96 -0
- capinaut_sec-0.1.0/src/capinaut_sec/provider.py +69 -0
- capinaut_sec-0.1.0/src/capinaut_sec/sec.py +271 -0
- capinaut_sec-0.1.0/src/capinaut_sec/tools.py +112 -0
- capinaut_sec-0.1.0/tests/conftest.py +41 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/16d8736dabcaf2037ad4.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/4d1dc4da6054452b9f8d.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/58614811a639dc08fd39.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/587c133c2376b2e8cc5f.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/74d9a76289443d0e7bed.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/91bdab619e8f37da2f62.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/9713b83d8c7e3d48411b.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/a78edd3215b5432d3461.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/aa452bc7d838bff4989d.gz +0 -0
- capinaut_sec-0.1.0/tests/fixtures/sec/manifest.json +32 -0
- capinaut_sec-0.1.0/tests/test_cli.py +80 -0
- capinaut_sec-0.1.0/tests/test_mcp_app.py +135 -0
- capinaut_sec-0.1.0/tests/test_tools.py +514 -0
- capinaut_sec-0.1.0/tests/test_units.py +261 -0
- capinaut_sec-0.1.0/uv.lock +1915 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: astral-sh/setup-uv@v6
|
|
17
|
+
- run: uv sync --locked
|
|
18
|
+
- run: uv run ruff check .
|
|
19
|
+
- run: uv run ruff format --check .
|
|
20
|
+
|
|
21
|
+
test:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
python: ["3.11", "3.12", "3.13"]
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- uses: astral-sh/setup-uv@v6
|
|
29
|
+
with:
|
|
30
|
+
python-version: ${{ matrix.python }}
|
|
31
|
+
- run: uv sync --locked
|
|
32
|
+
# Offline: every SEC response comes from tests/fixtures/sec.
|
|
33
|
+
- run: uv run pytest -q
|
|
34
|
+
|
|
35
|
+
conformance:
|
|
36
|
+
# The protocol's conformance suite against a local server answering from the
|
|
37
|
+
# recorded SEC responses (replay mode: no request leaves the runner).
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
with:
|
|
43
|
+
repository: capinaut/protocol
|
|
44
|
+
ref: main
|
|
45
|
+
path: protocol
|
|
46
|
+
- uses: astral-sh/setup-uv@v6
|
|
47
|
+
- uses: actions/setup-node@v4
|
|
48
|
+
with:
|
|
49
|
+
node-version: "24"
|
|
50
|
+
- run: uv sync --locked
|
|
51
|
+
- name: Vendored tool definitions match the protocol's
|
|
52
|
+
run: cmp src/capinaut_sec/protocol_tools.json protocol/bundled/tools.json
|
|
53
|
+
- run: npm ci
|
|
54
|
+
working-directory: protocol/conformance
|
|
55
|
+
- name: Start capinaut-sec (replay mode)
|
|
56
|
+
env:
|
|
57
|
+
CAPINAUT_SEC_REPLAY: tests/fixtures/sec
|
|
58
|
+
CAPINAUT_SEC_CACHE_DIR: ${{ runner.temp }}/capinaut-sec-cache
|
|
59
|
+
run: |
|
|
60
|
+
# Run from the venv, not `uv run`: a background `uv run` holds uv's cache
|
|
61
|
+
# lock, and setup-uv's post-job cache prune then times out.
|
|
62
|
+
.venv/bin/capinaut-sec serve --http --port 8765 > "$RUNNER_TEMP/server.log" 2>&1 &
|
|
63
|
+
echo $! > "$RUNNER_TEMP/server.pid"
|
|
64
|
+
for _ in $(seq 1 60); do curl -fsS http://127.0.0.1:8765/healthz && exit 0; sleep 1; done
|
|
65
|
+
cat "$RUNNER_TEMP/server.log"; exit 1
|
|
66
|
+
- name: Conformance suite
|
|
67
|
+
run: node src/cli.ts "$GITHUB_WORKSPACE/conformance/replay.json"
|
|
68
|
+
working-directory: protocol/conformance
|
|
69
|
+
- name: Server log
|
|
70
|
+
if: always()
|
|
71
|
+
run: cat "$RUNNER_TEMP/server.log"
|
|
72
|
+
- name: Stop server
|
|
73
|
+
if: always()
|
|
74
|
+
run: kill "$(cat "$RUNNER_TEMP/server.pid")" 2>/dev/null || true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: capinaut-sec
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Capinaut SEC: the free reference Data Provider for US SEC EDGAR data (Capinaut Data Provider Protocol 0.1.0)
|
|
5
|
+
Project-URL: Homepage, https://github.com/capinaut/provider-sec
|
|
6
|
+
Project-URL: Protocol, https://github.com/capinaut/protocol
|
|
7
|
+
Author-email: Capinaut contributors <hello@capinaut.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: capinaut,edgar,financial-data,mcp,sec,xbrl
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Requires-Dist: edgartools<7,>=6.5.0
|
|
16
|
+
Requires-Dist: httpx>=0.27
|
|
17
|
+
Requires-Dist: jsonschema>=4.20
|
|
18
|
+
Requires-Dist: mcp<3,>=2.3.0
|
|
19
|
+
Requires-Dist: starlette>=0.40
|
|
20
|
+
Requires-Dist: uvicorn>=0.30
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Capinaut SEC
|
|
24
|
+
|
|
25
|
+
The free reference Data Provider for US SEC EDGAR data. It is an MCP server implementing the [Capinaut Data Provider Protocol](https://github.com/capinaut/protocol) 0.1.0. It serves filings, filing text and XBRL financial facts, and every result carries a `source` block that traces it to the filing on sec.gov.
|
|
26
|
+
|
|
27
|
+
- **Free, with no account.** It uses only SEC's public endpoints. You don't need an API key, and no hosted third party is involved.
|
|
28
|
+
- **Runs on your machine.** Queries go to sec.gov and nowhere else.
|
|
29
|
+
- **Built on [EdgarTools](https://github.com/dgunning/edgartools)** (MIT), which handles HTML rendering, 10-K/10-Q/8-K item detection and the throttled HTTP client.
|
|
30
|
+
|
|
31
|
+
Capinaut SEC is an independent open-source project. It is not affiliated with, endorsed by or licensed by the U.S. Securities and Exchange Commission. EDGAR® is a registered trademark of the SEC; this project uses the name only to describe where its data comes from.
|
|
32
|
+
|
|
33
|
+
Status: 0.1.0, the first implementation. Apache-2.0.
|
|
34
|
+
|
|
35
|
+
## Install and run
|
|
36
|
+
|
|
37
|
+
Requires Python 3.11 or later and [uv](https://docs.astral.sh/uv/).
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
export CAPINAUT_SEC_IDENTITY="Jane Analyst jane@example.com" # your name and email (see below)
|
|
41
|
+
|
|
42
|
+
# Once it is published on PyPI:
|
|
43
|
+
uvx capinaut-sec serve --http # http://127.0.0.1:8765/mcp
|
|
44
|
+
uvx capinaut-sec serve --stdio
|
|
45
|
+
|
|
46
|
+
# Until then, run it from git:
|
|
47
|
+
uvx --from git+https://github.com/capinaut/provider-sec capinaut-sec serve --http
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`serve --http` takes `--host` (default `127.0.0.1`) and `--port` (default `8765`). The endpoint is `POST /mcp`, using stateless Streamable HTTP with JSON responses, as the protocol requires. `GET /healthz` answers `ok`. `serve --stdio` serves the same tools over stdin/stdout.
|
|
51
|
+
|
|
52
|
+
### Your SEC identity (required)
|
|
53
|
+
|
|
54
|
+
The SEC [requires every automated client to identify itself](https://www.sec.gov/search-filings/edgar-search-assistance/accessing-edgar-data) with a name and contact email in the `User-Agent` header, and blocks clients that don't. The identity you give is the one sent, so set it to **your own** name and email:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
export CAPINAUT_SEC_IDENTITY="Jane Analyst jane@example.com"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The server refuses to start without it. The identity goes only to sec.gov, as the User-Agent of each request.
|
|
61
|
+
|
|
62
|
+
| Variable | Default | Meaning |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `CAPINAUT_SEC_IDENTITY` | none (required) | `Name email@example.com`, sent to sec.gov as User-Agent |
|
|
65
|
+
| `CAPINAUT_SEC_MAX_RPS` | `8` | Requests per second to sec.gov, 1–10 (SEC's fair-access limit is 10) |
|
|
66
|
+
| `CAPINAUT_SEC_CACHE_DIR` | user cache dir (`~/.cache/capinaut-sec` on Linux, `~/Library/Caches/capinaut-sec` on macOS, `%LOCALAPPDATA%\capinaut-sec` on Windows) | On-disk HTTP cache |
|
|
67
|
+
| `CAPINAUT_SEC_REPLAY` | unset | Testing only: answer from recorded responses in this directory and never contact sec.gov |
|
|
68
|
+
|
|
69
|
+
## Connect it
|
|
70
|
+
|
|
71
|
+
### Claude Code
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
# stdio: Claude Code starts the server
|
|
75
|
+
claude mcp add capinaut-sec --env CAPINAUT_SEC_IDENTITY="Jane Analyst jane@example.com" \
|
|
76
|
+
-- uvx capinaut-sec serve --stdio
|
|
77
|
+
|
|
78
|
+
# HTTP: you run `capinaut-sec serve --http` yourself
|
|
79
|
+
claude mcp add --transport http capinaut-sec http://127.0.0.1:8765/mcp
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Codex
|
|
83
|
+
|
|
84
|
+
In `~/.codex/config.toml`:
|
|
85
|
+
|
|
86
|
+
```toml
|
|
87
|
+
# stdio
|
|
88
|
+
[mcp_servers.capinaut-sec]
|
|
89
|
+
command = "uvx"
|
|
90
|
+
args = ["capinaut-sec", "serve", "--stdio"]
|
|
91
|
+
env = { CAPINAUT_SEC_IDENTITY = "Jane Analyst jane@example.com" }
|
|
92
|
+
|
|
93
|
+
# or HTTP, with `capinaut-sec serve --http` running
|
|
94
|
+
# [mcp_servers.capinaut-sec]
|
|
95
|
+
# url = "http://127.0.0.1:8765/mcp"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Until the package is on PyPI, use `uvx --from git+https://github.com/capinaut/provider-sec capinaut-sec …` in place of `uvx capinaut-sec …`.
|
|
99
|
+
|
|
100
|
+
## Tools
|
|
101
|
+
|
|
102
|
+
These are the eight core tools of the protocol. The provider declares no optional capabilities: it has no prices, estimates or events, so it doesn't list `get_prices`, `get_fx`, `get_estimates` or `list_events`.
|
|
103
|
+
|
|
104
|
+
| Tool | What it does on EDGAR |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `describe_provider` | One Region, `us` ("United States (SEC EDGAR)"), with the MICs XNYS, XNAS, XASE, ARCX, BATS, OTCM and TXSE. Authentication is `none`, and the privacy declaration is below. |
|
|
107
|
+
| `resolve` | Matches a ticker (with optional MIC), a company name, or a CIK against SEC's [`company_tickers_exchange.json`](https://www.sec.gov/files/company_tickers_exchange.json). CIKs with no ticker are checked against the submissions API. SEC publishes no ISINs, and LEIs only per registrant, so `isin` and `lei` match nothing. |
|
|
108
|
+
| `get_issuer` | Reads the [submissions API](https://data.sec.gov/submissions/CIK0000320193.json): name, former names, SIC as `sector`, fiscal year end, state of incorporation, country, website (when SEC has one), LEI (when filed) and Listings. |
|
|
109
|
+
| `list_filings` | Lists filings from the submissions API, newest first, including the older pages when your dates or paging reach them. `types` takes SEC form types (`10-K`, `10-Q`, `8-K`, `20-F`, `6-K` …, matched exactly, so ask for `10-K/A` separately) or the labels `annual_report`, `interim_report`, `material_event`, `proxy` and `insider_transaction`. |
|
|
110
|
+
| `read_document` | Returns the filed document as text, using EdgarTools' rendering of the HTML (`.txt` documents are served as filed). `locator` takes `char_start`/`char_end`, or a `section` such as `Item 7`, `Item 1A`, `Part I, Item 2` or `Risk Factors`, from EdgarTools' 10-K/10-Q/8-K/20-F item detection. Character offsets count Unicode code points (not UTF-16 units). Other locator keys are refused: a fact's `table`/`row`/`column` locator names XBRL data, not a spot in the text. Long text pages through `next_cursor`, and `max_chars` is capped at 50,000. The `document` block lists the detected sections with their character spans. |
|
|
111
|
+
| `search_documents` | Runs [EDGAR full-text search](https://efts.sec.gov/LATEST/search-index) on the query, optionally scoped to the issuer's CIK and `from`/`to` dates. It then fetches the matching documents and returns passages around the matches, each with its exact character span. Results come in relevance order. Each call is bounded to at most 3 documents and 3 passages per document, and further results are reached with `next_cursor`. `document_ids` searches inside the documents you give instead (and can't be combined with `issuer_id`, `from` or `to`); if one of them can't be read, the call fails rather than silently skipping a document you named. |
|
|
112
|
+
| `list_concepts` | Lists the concepts in the issuer's [companyfacts](https://data.sec.gov/api/xbrl/companyfacts/CIK0000320193.json) (`us-gaap`, `ifrs-full`, `dei`, `srt` …) with their labels, units and available period labels. |
|
|
113
|
+
| `get_facts` | Returns companyfacts values as filed. See "Facts" below. |
|
|
114
|
+
|
|
115
|
+
### Identifiers
|
|
116
|
+
|
|
117
|
+
- `issuer_id` is the zero-padded CIK, for example `0000320193`. `identifiers.provider_ids` is `{"cik": "0000320193"}`.
|
|
118
|
+
- `listing_id` is `<MIC>:<ticker>`, for example `XNAS:AAPL`. SEC's exchange names map to MICs as follows: NYSE→XNYS, Nasdaq→XNAS, NYSE American→XASE, NYSE Arca→ARCX, Cboe→BATS, OTC→OTCM, TXSE→TXSE. The trading currency is USD.
|
|
119
|
+
- `document_id` is `<CIK>/<accession number>/<file>`, for example `0000320193/0000320193-26-000026/aapl-20260926.htm`. It is the accession number plus the document inside the filing. The CIK is included because an accession number's prefix is the filer's CIK, which for documents filed by an agent is not the issuer's, so the accession number alone doesn't locate the file. `<CIK>/<accession>` without a file name opens the filing's primary document.
|
|
120
|
+
|
|
121
|
+
### Source blocks
|
|
122
|
+
|
|
123
|
+
| Field | Filing text (`read_document`, `search_documents`, `list_filings`) | XBRL fact (`get_facts`) |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| `document_id` | `<CIK>/<accession>/<file>` | The filing that first reported the fact, with its primary document when known |
|
|
126
|
+
| `url` | The sec.gov archive URL of the document | The sec.gov archive URL of that filing's primary document, or its index page |
|
|
127
|
+
| `locator` | `char_start`/`char_end` into the document's text, plus `section` (for example `Item 7`) when the span falls in a detected item | `row` = concept (`us-gaap:Revenues`), `column` = period (`2025-09-28/2026-09-26`, or the date for balances), `table` = the reporting form and fiscal period (`XBRL financial data, 10-K (fiscal 2026 FY)`), `cell` = SEC's `frame` when present (`frame CY2026`) |
|
|
128
|
+
| `filed_at` | Filing date | Filing date of the reporting filing |
|
|
129
|
+
| `period` | none | The fact's period |
|
|
130
|
+
| `dataset` | none | `sec-xbrl-companyfacts` |
|
|
131
|
+
| `as_of` | The time of the call | The time of the call |
|
|
132
|
+
| `licence` | `{name: "SEC EDGAR public data", redistribution: "allowed", url: "https://www.sec.gov/about/privacy-information#dissemination"}` | Same |
|
|
133
|
+
| `origin` | `as_filed` | `as_filed` |
|
|
134
|
+
|
|
135
|
+
Issuer data (`get_issuer`, `resolve`) cites the submissions API or the company tickers file by `url` and `dataset`. The provider computes, extracts or translates nothing, so every origin is `as_filed`.
|
|
136
|
+
|
|
137
|
+
### Facts
|
|
138
|
+
|
|
139
|
+
- Values are exactly as filed: a decimal string in the filed unit, with `scale` 0 (SEC's JSON gives whole values, not "in millions"). Values are never converted, annualised or restated. Units map as follows: ISO 4217 codes such as `USD` → `currency`, `USD/shares` → `per_share`, `shares`, `pure`, and anything else → `other` with `unit_label`.
|
|
140
|
+
- Each fact appears once. A value repeated as a comparative in later filings is reported with the source of the **earliest** filing that reported it.
|
|
141
|
+
- A later filing that reports a **different** value for the same concept, unit and period is a separate fact. This covers restatements, and also rounded figures in other forms such as a proxy statement. When a period has more than one value, each fact carries `variant` 0, 1, … in the order first filed.
|
|
142
|
+
- Period labels follow the issuer's fiscal year: `FY2026`, `Q1 2026`, `H1 2026` and `9M 2026` (cumulative), where the year is the one in which the fiscal year ends. Balances (`instant`) are labelled with their date.
|
|
143
|
+
- `period_from`/`period_to` select periods by their **end** date, so a fiscal year ending in September 2026 is in a 2026 window.
|
|
144
|
+
- companyfacts holds only entity-wide facts without dimensions, so every fact is `consolidated: true` with no `dimensions`, and `consolidated: false` matches nothing.
|
|
145
|
+
|
|
146
|
+
## Caching and rate limits
|
|
147
|
+
|
|
148
|
+
- All requests to sec.gov go through EdgarTools' shared HTTP client. Its one rate limiter covers every request (8 per second by default, never more than 10), and it sends your identity and retries transient errors.
|
|
149
|
+
- Its on-disk cache, in your cache directory, keeps archive documents indefinitely (they never change) and revalidates submissions and XBRL data after a short time.
|
|
150
|
+
- On top of that, an in-memory cache keeps parsed SEC JSON (tickers for 24 hours, submissions for 10 minutes, companyfacts for 1 hour, search results for 10 minutes), the last 96 MiB of documents, and the last 8 rendered documents. A burst of calls about one company costs about one request per resource.
|
|
151
|
+
|
|
152
|
+
## Limits
|
|
153
|
+
|
|
154
|
+
- Section detection is EdgarTools' and is best effort. When no sections are detected, read by character span.
|
|
155
|
+
- Full-text search covers what EDGAR full-text search covers (2001 onwards). Passages are found locally with a phrase-first match (plurals tolerated), so a search hit whose wording only EFTS's stemming matched may give no passage.
|
|
156
|
+
- PDFs, images and XBRL instance files can't be read as text. HTML and `.txt` documents can, including rendered XML forms such as Form 4.
|
|
157
|
+
- There are no prices, estimates or events.
|
|
158
|
+
|
|
159
|
+
## Development
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
uv sync
|
|
163
|
+
uv run pytest -q # offline: replays tests/fixtures/sec
|
|
164
|
+
uv run ruff check . && uv run ruff format --check .
|
|
165
|
+
|
|
166
|
+
# Refresh the recorded SEC responses (live, throttled, with your identity):
|
|
167
|
+
CAPINAUT_SEC_IDENTITY="Your Name you@example.com" uv run python scripts/record_fixtures.py
|
|
168
|
+
|
|
169
|
+
# Conformance suite (Node 22.18+), against a running server:
|
|
170
|
+
git clone https://github.com/capinaut/protocol && (cd protocol/conformance && npm ci)
|
|
171
|
+
CAPINAUT_SEC_REPLAY=tests/fixtures/sec uv run capinaut-sec serve --http & # or live, with your identity
|
|
172
|
+
node protocol/conformance/src/cli.ts conformance/replay.json
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`src/capinaut_sec/protocol_tools.json` is a vendored copy of the protocol's `bundled/tools.json`, and CI checks that the two match. Refresh it from the protocol repository; don't edit it here.
|
|
176
|
+
|
|
177
|
+
## Licence
|
|
178
|
+
|
|
179
|
+
The code is Apache-2.0 (see [LICENSE](LICENSE)). The data is SEC EDGAR public data: the SEC states that information on sec.gov [may be copied or further distributed without its permission](https://www.sec.gov/about/privacy-information#dissemination), and asks that the SEC be cited as the source. This project isn't affiliated with or endorsed by the SEC. See [SECURITY.md](SECURITY.md) for privacy and security.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Capinaut SEC
|
|
2
|
+
|
|
3
|
+
The free reference Data Provider for US SEC EDGAR data. It is an MCP server implementing the [Capinaut Data Provider Protocol](https://github.com/capinaut/protocol) 0.1.0. It serves filings, filing text and XBRL financial facts, and every result carries a `source` block that traces it to the filing on sec.gov.
|
|
4
|
+
|
|
5
|
+
- **Free, with no account.** It uses only SEC's public endpoints. You don't need an API key, and no hosted third party is involved.
|
|
6
|
+
- **Runs on your machine.** Queries go to sec.gov and nowhere else.
|
|
7
|
+
- **Built on [EdgarTools](https://github.com/dgunning/edgartools)** (MIT), which handles HTML rendering, 10-K/10-Q/8-K item detection and the throttled HTTP client.
|
|
8
|
+
|
|
9
|
+
Capinaut SEC is an independent open-source project. It is not affiliated with, endorsed by or licensed by the U.S. Securities and Exchange Commission. EDGAR® is a registered trademark of the SEC; this project uses the name only to describe where its data comes from.
|
|
10
|
+
|
|
11
|
+
Status: 0.1.0, the first implementation. Apache-2.0.
|
|
12
|
+
|
|
13
|
+
## Install and run
|
|
14
|
+
|
|
15
|
+
Requires Python 3.11 or later and [uv](https://docs.astral.sh/uv/).
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
export CAPINAUT_SEC_IDENTITY="Jane Analyst jane@example.com" # your name and email (see below)
|
|
19
|
+
|
|
20
|
+
# Once it is published on PyPI:
|
|
21
|
+
uvx capinaut-sec serve --http # http://127.0.0.1:8765/mcp
|
|
22
|
+
uvx capinaut-sec serve --stdio
|
|
23
|
+
|
|
24
|
+
# Until then, run it from git:
|
|
25
|
+
uvx --from git+https://github.com/capinaut/provider-sec capinaut-sec serve --http
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`serve --http` takes `--host` (default `127.0.0.1`) and `--port` (default `8765`). The endpoint is `POST /mcp`, using stateless Streamable HTTP with JSON responses, as the protocol requires. `GET /healthz` answers `ok`. `serve --stdio` serves the same tools over stdin/stdout.
|
|
29
|
+
|
|
30
|
+
### Your SEC identity (required)
|
|
31
|
+
|
|
32
|
+
The SEC [requires every automated client to identify itself](https://www.sec.gov/search-filings/edgar-search-assistance/accessing-edgar-data) with a name and contact email in the `User-Agent` header, and blocks clients that don't. The identity you give is the one sent, so set it to **your own** name and email:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
export CAPINAUT_SEC_IDENTITY="Jane Analyst jane@example.com"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The server refuses to start without it. The identity goes only to sec.gov, as the User-Agent of each request.
|
|
39
|
+
|
|
40
|
+
| Variable | Default | Meaning |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `CAPINAUT_SEC_IDENTITY` | none (required) | `Name email@example.com`, sent to sec.gov as User-Agent |
|
|
43
|
+
| `CAPINAUT_SEC_MAX_RPS` | `8` | Requests per second to sec.gov, 1–10 (SEC's fair-access limit is 10) |
|
|
44
|
+
| `CAPINAUT_SEC_CACHE_DIR` | user cache dir (`~/.cache/capinaut-sec` on Linux, `~/Library/Caches/capinaut-sec` on macOS, `%LOCALAPPDATA%\capinaut-sec` on Windows) | On-disk HTTP cache |
|
|
45
|
+
| `CAPINAUT_SEC_REPLAY` | unset | Testing only: answer from recorded responses in this directory and never contact sec.gov |
|
|
46
|
+
|
|
47
|
+
## Connect it
|
|
48
|
+
|
|
49
|
+
### Claude Code
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
# stdio: Claude Code starts the server
|
|
53
|
+
claude mcp add capinaut-sec --env CAPINAUT_SEC_IDENTITY="Jane Analyst jane@example.com" \
|
|
54
|
+
-- uvx capinaut-sec serve --stdio
|
|
55
|
+
|
|
56
|
+
# HTTP: you run `capinaut-sec serve --http` yourself
|
|
57
|
+
claude mcp add --transport http capinaut-sec http://127.0.0.1:8765/mcp
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Codex
|
|
61
|
+
|
|
62
|
+
In `~/.codex/config.toml`:
|
|
63
|
+
|
|
64
|
+
```toml
|
|
65
|
+
# stdio
|
|
66
|
+
[mcp_servers.capinaut-sec]
|
|
67
|
+
command = "uvx"
|
|
68
|
+
args = ["capinaut-sec", "serve", "--stdio"]
|
|
69
|
+
env = { CAPINAUT_SEC_IDENTITY = "Jane Analyst jane@example.com" }
|
|
70
|
+
|
|
71
|
+
# or HTTP, with `capinaut-sec serve --http` running
|
|
72
|
+
# [mcp_servers.capinaut-sec]
|
|
73
|
+
# url = "http://127.0.0.1:8765/mcp"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Until the package is on PyPI, use `uvx --from git+https://github.com/capinaut/provider-sec capinaut-sec …` in place of `uvx capinaut-sec …`.
|
|
77
|
+
|
|
78
|
+
## Tools
|
|
79
|
+
|
|
80
|
+
These are the eight core tools of the protocol. The provider declares no optional capabilities: it has no prices, estimates or events, so it doesn't list `get_prices`, `get_fx`, `get_estimates` or `list_events`.
|
|
81
|
+
|
|
82
|
+
| Tool | What it does on EDGAR |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `describe_provider` | One Region, `us` ("United States (SEC EDGAR)"), with the MICs XNYS, XNAS, XASE, ARCX, BATS, OTCM and TXSE. Authentication is `none`, and the privacy declaration is below. |
|
|
85
|
+
| `resolve` | Matches a ticker (with optional MIC), a company name, or a CIK against SEC's [`company_tickers_exchange.json`](https://www.sec.gov/files/company_tickers_exchange.json). CIKs with no ticker are checked against the submissions API. SEC publishes no ISINs, and LEIs only per registrant, so `isin` and `lei` match nothing. |
|
|
86
|
+
| `get_issuer` | Reads the [submissions API](https://data.sec.gov/submissions/CIK0000320193.json): name, former names, SIC as `sector`, fiscal year end, state of incorporation, country, website (when SEC has one), LEI (when filed) and Listings. |
|
|
87
|
+
| `list_filings` | Lists filings from the submissions API, newest first, including the older pages when your dates or paging reach them. `types` takes SEC form types (`10-K`, `10-Q`, `8-K`, `20-F`, `6-K` …, matched exactly, so ask for `10-K/A` separately) or the labels `annual_report`, `interim_report`, `material_event`, `proxy` and `insider_transaction`. |
|
|
88
|
+
| `read_document` | Returns the filed document as text, using EdgarTools' rendering of the HTML (`.txt` documents are served as filed). `locator` takes `char_start`/`char_end`, or a `section` such as `Item 7`, `Item 1A`, `Part I, Item 2` or `Risk Factors`, from EdgarTools' 10-K/10-Q/8-K/20-F item detection. Character offsets count Unicode code points (not UTF-16 units). Other locator keys are refused: a fact's `table`/`row`/`column` locator names XBRL data, not a spot in the text. Long text pages through `next_cursor`, and `max_chars` is capped at 50,000. The `document` block lists the detected sections with their character spans. |
|
|
89
|
+
| `search_documents` | Runs [EDGAR full-text search](https://efts.sec.gov/LATEST/search-index) on the query, optionally scoped to the issuer's CIK and `from`/`to` dates. It then fetches the matching documents and returns passages around the matches, each with its exact character span. Results come in relevance order. Each call is bounded to at most 3 documents and 3 passages per document, and further results are reached with `next_cursor`. `document_ids` searches inside the documents you give instead (and can't be combined with `issuer_id`, `from` or `to`); if one of them can't be read, the call fails rather than silently skipping a document you named. |
|
|
90
|
+
| `list_concepts` | Lists the concepts in the issuer's [companyfacts](https://data.sec.gov/api/xbrl/companyfacts/CIK0000320193.json) (`us-gaap`, `ifrs-full`, `dei`, `srt` …) with their labels, units and available period labels. |
|
|
91
|
+
| `get_facts` | Returns companyfacts values as filed. See "Facts" below. |
|
|
92
|
+
|
|
93
|
+
### Identifiers
|
|
94
|
+
|
|
95
|
+
- `issuer_id` is the zero-padded CIK, for example `0000320193`. `identifiers.provider_ids` is `{"cik": "0000320193"}`.
|
|
96
|
+
- `listing_id` is `<MIC>:<ticker>`, for example `XNAS:AAPL`. SEC's exchange names map to MICs as follows: NYSE→XNYS, Nasdaq→XNAS, NYSE American→XASE, NYSE Arca→ARCX, Cboe→BATS, OTC→OTCM, TXSE→TXSE. The trading currency is USD.
|
|
97
|
+
- `document_id` is `<CIK>/<accession number>/<file>`, for example `0000320193/0000320193-26-000026/aapl-20260926.htm`. It is the accession number plus the document inside the filing. The CIK is included because an accession number's prefix is the filer's CIK, which for documents filed by an agent is not the issuer's, so the accession number alone doesn't locate the file. `<CIK>/<accession>` without a file name opens the filing's primary document.
|
|
98
|
+
|
|
99
|
+
### Source blocks
|
|
100
|
+
|
|
101
|
+
| Field | Filing text (`read_document`, `search_documents`, `list_filings`) | XBRL fact (`get_facts`) |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| `document_id` | `<CIK>/<accession>/<file>` | The filing that first reported the fact, with its primary document when known |
|
|
104
|
+
| `url` | The sec.gov archive URL of the document | The sec.gov archive URL of that filing's primary document, or its index page |
|
|
105
|
+
| `locator` | `char_start`/`char_end` into the document's text, plus `section` (for example `Item 7`) when the span falls in a detected item | `row` = concept (`us-gaap:Revenues`), `column` = period (`2025-09-28/2026-09-26`, or the date for balances), `table` = the reporting form and fiscal period (`XBRL financial data, 10-K (fiscal 2026 FY)`), `cell` = SEC's `frame` when present (`frame CY2026`) |
|
|
106
|
+
| `filed_at` | Filing date | Filing date of the reporting filing |
|
|
107
|
+
| `period` | none | The fact's period |
|
|
108
|
+
| `dataset` | none | `sec-xbrl-companyfacts` |
|
|
109
|
+
| `as_of` | The time of the call | The time of the call |
|
|
110
|
+
| `licence` | `{name: "SEC EDGAR public data", redistribution: "allowed", url: "https://www.sec.gov/about/privacy-information#dissemination"}` | Same |
|
|
111
|
+
| `origin` | `as_filed` | `as_filed` |
|
|
112
|
+
|
|
113
|
+
Issuer data (`get_issuer`, `resolve`) cites the submissions API or the company tickers file by `url` and `dataset`. The provider computes, extracts or translates nothing, so every origin is `as_filed`.
|
|
114
|
+
|
|
115
|
+
### Facts
|
|
116
|
+
|
|
117
|
+
- Values are exactly as filed: a decimal string in the filed unit, with `scale` 0 (SEC's JSON gives whole values, not "in millions"). Values are never converted, annualised or restated. Units map as follows: ISO 4217 codes such as `USD` → `currency`, `USD/shares` → `per_share`, `shares`, `pure`, and anything else → `other` with `unit_label`.
|
|
118
|
+
- Each fact appears once. A value repeated as a comparative in later filings is reported with the source of the **earliest** filing that reported it.
|
|
119
|
+
- A later filing that reports a **different** value for the same concept, unit and period is a separate fact. This covers restatements, and also rounded figures in other forms such as a proxy statement. When a period has more than one value, each fact carries `variant` 0, 1, … in the order first filed.
|
|
120
|
+
- Period labels follow the issuer's fiscal year: `FY2026`, `Q1 2026`, `H1 2026` and `9M 2026` (cumulative), where the year is the one in which the fiscal year ends. Balances (`instant`) are labelled with their date.
|
|
121
|
+
- `period_from`/`period_to` select periods by their **end** date, so a fiscal year ending in September 2026 is in a 2026 window.
|
|
122
|
+
- companyfacts holds only entity-wide facts without dimensions, so every fact is `consolidated: true` with no `dimensions`, and `consolidated: false` matches nothing.
|
|
123
|
+
|
|
124
|
+
## Caching and rate limits
|
|
125
|
+
|
|
126
|
+
- All requests to sec.gov go through EdgarTools' shared HTTP client. Its one rate limiter covers every request (8 per second by default, never more than 10), and it sends your identity and retries transient errors.
|
|
127
|
+
- Its on-disk cache, in your cache directory, keeps archive documents indefinitely (they never change) and revalidates submissions and XBRL data after a short time.
|
|
128
|
+
- On top of that, an in-memory cache keeps parsed SEC JSON (tickers for 24 hours, submissions for 10 minutes, companyfacts for 1 hour, search results for 10 minutes), the last 96 MiB of documents, and the last 8 rendered documents. A burst of calls about one company costs about one request per resource.
|
|
129
|
+
|
|
130
|
+
## Limits
|
|
131
|
+
|
|
132
|
+
- Section detection is EdgarTools' and is best effort. When no sections are detected, read by character span.
|
|
133
|
+
- Full-text search covers what EDGAR full-text search covers (2001 onwards). Passages are found locally with a phrase-first match (plurals tolerated), so a search hit whose wording only EFTS's stemming matched may give no passage.
|
|
134
|
+
- PDFs, images and XBRL instance files can't be read as text. HTML and `.txt` documents can, including rendered XML forms such as Form 4.
|
|
135
|
+
- There are no prices, estimates or events.
|
|
136
|
+
|
|
137
|
+
## Development
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
uv sync
|
|
141
|
+
uv run pytest -q # offline: replays tests/fixtures/sec
|
|
142
|
+
uv run ruff check . && uv run ruff format --check .
|
|
143
|
+
|
|
144
|
+
# Refresh the recorded SEC responses (live, throttled, with your identity):
|
|
145
|
+
CAPINAUT_SEC_IDENTITY="Your Name you@example.com" uv run python scripts/record_fixtures.py
|
|
146
|
+
|
|
147
|
+
# Conformance suite (Node 22.18+), against a running server:
|
|
148
|
+
git clone https://github.com/capinaut/protocol && (cd protocol/conformance && npm ci)
|
|
149
|
+
CAPINAUT_SEC_REPLAY=tests/fixtures/sec uv run capinaut-sec serve --http & # or live, with your identity
|
|
150
|
+
node protocol/conformance/src/cli.ts conformance/replay.json
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`src/capinaut_sec/protocol_tools.json` is a vendored copy of the protocol's `bundled/tools.json`, and CI checks that the two match. Refresh it from the protocol repository; don't edit it here.
|
|
154
|
+
|
|
155
|
+
## Licence
|
|
156
|
+
|
|
157
|
+
The code is Apache-2.0 (see [LICENSE](LICENSE)). The data is SEC EDGAR public data: the SEC states that information on sec.gov [may be copied or further distributed without its permission](https://www.sec.gov/about/privacy-information#dissemination), and asks that the SEC be cited as the source. This project isn't affiliated with or endorsed by the SEC. See [SECURITY.md](SECURITY.md) for privacy and security.
|