@cyanheads/secedgar-mcp-server 0.1.9

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.
Files changed (61) hide show
  1. package/Dockerfile +99 -0
  2. package/LICENSE +190 -0
  3. package/README.md +260 -0
  4. package/dist/config/server-config.d.ts +14 -0
  5. package/dist/config/server-config.d.ts.map +1 -0
  6. package/dist/config/server-config.js +33 -0
  7. package/dist/config/server-config.js.map +1 -0
  8. package/dist/index.d.ts +7 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +30 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/mcp-server/prompts/definitions/company-analysis.prompt.d.ts +10 -0
  13. package/dist/mcp-server/prompts/definitions/company-analysis.prompt.d.ts.map +1 -0
  14. package/dist/mcp-server/prompts/definitions/company-analysis.prompt.js +43 -0
  15. package/dist/mcp-server/prompts/definitions/company-analysis.prompt.js.map +1 -0
  16. package/dist/mcp-server/resources/definitions/concepts.resource.d.ts +9 -0
  17. package/dist/mcp-server/resources/definitions/concepts.resource.d.ts.map +1 -0
  18. package/dist/mcp-server/resources/definitions/concepts.resource.js +77 -0
  19. package/dist/mcp-server/resources/definitions/concepts.resource.js.map +1 -0
  20. package/dist/mcp-server/resources/definitions/filing-types.resource.d.ts +8 -0
  21. package/dist/mcp-server/resources/definitions/filing-types.resource.d.ts.map +1 -0
  22. package/dist/mcp-server/resources/definitions/filing-types.resource.js +94 -0
  23. package/dist/mcp-server/resources/definitions/filing-types.resource.js.map +1 -0
  24. package/dist/mcp-server/tools/definitions/company-search.tool.d.ts +31 -0
  25. package/dist/mcp-server/tools/definitions/company-search.tool.d.ts.map +1 -0
  26. package/dist/mcp-server/tools/definitions/company-search.tool.js +129 -0
  27. package/dist/mcp-server/tools/definitions/company-search.tool.js.map +1 -0
  28. package/dist/mcp-server/tools/definitions/compare-metric.tool.d.ts +37 -0
  29. package/dist/mcp-server/tools/definitions/compare-metric.tool.d.ts.map +1 -0
  30. package/dist/mcp-server/tools/definitions/compare-metric.tool.js +128 -0
  31. package/dist/mcp-server/tools/definitions/compare-metric.tool.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts +29 -0
  33. package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/get-filing.tool.js +157 -0
  35. package/dist/mcp-server/tools/definitions/get-filing.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts +40 -0
  37. package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/get-financials.tool.js +191 -0
  39. package/dist/mcp-server/tools/definitions/get-financials.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts +29 -0
  41. package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/search-filings.tool.js +179 -0
  43. package/dist/mcp-server/tools/definitions/search-filings.tool.js.map +1 -0
  44. package/dist/services/edgar/concept-map.d.ts +13 -0
  45. package/dist/services/edgar/concept-map.d.ts.map +1 -0
  46. package/dist/services/edgar/concept-map.js +109 -0
  47. package/dist/services/edgar/concept-map.js.map +1 -0
  48. package/dist/services/edgar/edgar-api-service.d.ts +47 -0
  49. package/dist/services/edgar/edgar-api-service.d.ts.map +1 -0
  50. package/dist/services/edgar/edgar-api-service.js +213 -0
  51. package/dist/services/edgar/edgar-api-service.js.map +1 -0
  52. package/dist/services/edgar/filing-to-text.d.ts +11 -0
  53. package/dist/services/edgar/filing-to-text.d.ts.map +1 -0
  54. package/dist/services/edgar/filing-to-text.js +38 -0
  55. package/dist/services/edgar/filing-to-text.js.map +1 -0
  56. package/dist/services/edgar/types.d.ts +152 -0
  57. package/dist/services/edgar/types.d.ts.map +1 -0
  58. package/dist/services/edgar/types.js +6 -0
  59. package/dist/services/edgar/types.js.map +1 -0
  60. package/package.json +75 -0
  61. package/server.json +91 -0
package/Dockerfile ADDED
@@ -0,0 +1,99 @@
1
+ # ==============================================================================
2
+ # Build Stage
3
+ #
4
+ # This stage installs all dependencies (including dev), builds the TypeScript
5
+ # source code into JavaScript, and prepares the production assets.
6
+ # ==============================================================================
7
+ FROM oven/bun:1 AS build
8
+
9
+ WORKDIR /usr/src/app
10
+
11
+ # Copy dependency manifests for optimized layer caching
12
+ COPY package.json bun.lock ./
13
+
14
+ # Install all dependencies (including dev dependencies for building)
15
+ RUN bun install --frozen-lockfile
16
+
17
+ # Copy the rest of the source code
18
+ COPY . .
19
+
20
+ # Build the application
21
+ RUN bun run build
22
+
23
+
24
+ # ==============================================================================
25
+ # Production Stage
26
+ #
27
+ # This stage creates a minimal, optimized, and secure image for running the
28
+ # application. It uses a slim base image and only includes production
29
+ # dependencies and build artifacts.
30
+ # ==============================================================================
31
+ FROM oven/bun:1-slim AS production
32
+
33
+ WORKDIR /usr/src/app
34
+
35
+ # Set the environment to production for performance and to ensure only
36
+ # production dependencies are installed.
37
+ ENV NODE_ENV=production
38
+
39
+ # OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
40
+ LABEL org.opencontainers.image.title="@cyanheads/secedgar-mcp-server"
41
+ LABEL org.opencontainers.image.description="Query SEC EDGAR filings, XBRL financials, and company data through MCP. STDIO & Streamable HTTP."
42
+ LABEL org.opencontainers.image.source="https://github.com/cyanheads/secedgar-mcp-server"
43
+ LABEL org.opencontainers.image.licenses="Apache-2.0"
44
+
45
+ # Copy dependency manifests
46
+ COPY package.json bun.lock ./
47
+
48
+ # Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
49
+ # that are not needed in the final production image.
50
+ RUN bun install --production --frozen-lockfile --ignore-scripts
51
+
52
+ # Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
53
+ # These are not bundled by default to keep the base image lean. Enable at build time
54
+ # with: docker build --build-arg OTEL_ENABLED=true
55
+ ARG OTEL_ENABLED=true
56
+ RUN if [ "$OTEL_ENABLED" = "true" ]; then \
57
+ bun add @hono/otel \
58
+ @opentelemetry/instrumentation-http \
59
+ @opentelemetry/exporter-metrics-otlp-http \
60
+ @opentelemetry/exporter-trace-otlp-http \
61
+ @opentelemetry/instrumentation-pino \
62
+ @opentelemetry/resources \
63
+ @opentelemetry/sdk-metrics \
64
+ @opentelemetry/sdk-node \
65
+ @opentelemetry/sdk-trace-node \
66
+ @opentelemetry/semantic-conventions; \
67
+ fi
68
+
69
+ # Copy the compiled application code from the build stage
70
+ COPY --from=build /usr/src/app/dist ./dist
71
+
72
+ # The 'oven/bun' image already provides a non-root user named 'bun'.
73
+ # We will use this existing user for enhanced security.
74
+
75
+ # Create and set permissions for the log directory, assigning ownership to the 'bun' user.
76
+ RUN mkdir -p /var/log/secedgar-mcp-server && chown -R bun:bun /var/log/secedgar-mcp-server
77
+
78
+ # Switch to the non-root user
79
+ USER bun
80
+
81
+ # Define an argument for the port, allowing it to be overridden at build time.
82
+ # The `PORT` variable is often injected by cloud environments at runtime.
83
+ ARG PORT
84
+
85
+ # Set runtime environment variables
86
+ # Note: PORT is an automatic variable in many cloud environments (e.g., Cloud Run)
87
+ ENV MCP_HTTP_PORT=${PORT:-3010}
88
+ ENV MCP_HTTP_HOST="0.0.0.0"
89
+ ENV MCP_TRANSPORT_TYPE="http"
90
+ ENV MCP_SESSION_MODE="stateless"
91
+ ENV MCP_LOG_LEVEL="info"
92
+ ENV LOGS_DIR="/var/log/secedgar-mcp-server"
93
+ ENV MCP_FORCE_CONSOLE_LOGGING="true"
94
+
95
+ # Expose the port the server listens on
96
+ EXPOSE ${MCP_HTTP_PORT}
97
+
98
+ # The command to start the server
99
+ CMD ["bun", "run", "dist/index.js"]
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 cyanheads
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,260 @@
1
+ <div align="center">
2
+ <h1>@cyanheads/secedgar-mcp-server</h1>
3
+ <p><b>Query SEC EDGAR filings, XBRL financials, and company data through MCP. STDIO & Streamable HTTP.</b>
4
+ <div>5 Tools • 2 Resources • 1 Prompt</div>
5
+ </p>
6
+ </div>
7
+
8
+ <div align="center">
9
+
10
+ [![npm](https://img.shields.io/npm/v/@cyanheads/secedgar-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/secedgar-mcp-server) [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-259?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.27.1-green.svg?style=flat-square)](https://modelcontextprotocol.io/)
11
+
12
+ [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![TypeScript](https://img.shields.io/badge/TypeScript-^6.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.11-blueviolet.svg?style=flat-square)](https://bun.sh/)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## Tools
19
+
20
+ Five tools for querying SEC EDGAR data:
21
+
22
+ | Tool | Description |
23
+ |:---|:---|
24
+ | `secedgar_company_search` | Find companies and retrieve entity info with optional recent filings |
25
+ | `secedgar_search_filings` | Full-text search across all EDGAR filing documents since 1993 |
26
+ | `secedgar_get_filing` | Fetch a specific filing's metadata and document content |
27
+ | `secedgar_get_financials` | Get historical XBRL financial data for a company |
28
+ | `secedgar_compare_metric` | Compare a financial metric across all reporting companies |
29
+
30
+ ### `secedgar_company_search`
31
+
32
+ Entry point for most EDGAR workflows — resolve tickers, names, or CIKs to entity details.
33
+
34
+ - Supports ticker symbols (`AAPL`), company names (`Apple`), or CIK numbers (`320193`)
35
+ - Optionally includes recent filings with form type filtering
36
+ - Returns entity metadata: SIC code, exchanges, fiscal year end, state of incorporation
37
+
38
+ ---
39
+
40
+ ### `secedgar_search_filings`
41
+
42
+ Full-text search across all EDGAR filing documents since 1993.
43
+
44
+ - Exact phrases (`"material weakness"`), boolean operators (`revenue OR income`), wildcards (`account*`)
45
+ - Entity targeting within query string (`cik:320193` or `ticker:AAPL`)
46
+ - Date range filtering, form type filtering, pagination up to 10,000 results
47
+ - Returns form distribution for narrowing follow-up searches
48
+
49
+ ---
50
+
51
+ ### `secedgar_get_filing`
52
+
53
+ Fetch a specific filing's metadata and document content by accession number.
54
+
55
+ - Accepts accession numbers in dash or no-dash format
56
+ - Converts HTML filings to readable plain text
57
+ - Configurable content limit (1K–200K characters, default 50K)
58
+ - Can fetch specific exhibits by document name
59
+
60
+ ---
61
+
62
+ ### `secedgar_get_financials`
63
+
64
+ Get historical XBRL financial data for a company with friendly concept name resolution.
65
+
66
+ - Friendly names like `"revenue"`, `"net_income"`, `"eps_diluted"` auto-resolve to correct XBRL tags
67
+ - Handles historical tag changes (e.g., ASC 606 revenue recognition)
68
+ - Automatic deduplication to one value per standard calendar period
69
+ - Filter by annual, quarterly, or all periods
70
+ - See `secedgar://concepts` resource for the full mapping
71
+
72
+ ---
73
+
74
+ ### `secedgar_compare_metric`
75
+
76
+ Compare a financial metric across all reporting companies for a specific period.
77
+
78
+ - Same friendly concept names as `secedgar_get_financials`
79
+ - Supports annual (`CY2023`), quarterly (`CY2024Q2`), and instant (`CY2023Q4I`) periods
80
+ - Sorted ranking with configurable limit and direction
81
+ - Enriches results with ticker symbols where available
82
+
83
+ ## Resources
84
+
85
+ | URI | Description |
86
+ |:---|:---|
87
+ | `secedgar://concepts` | Common XBRL financial concepts grouped by statement, mapping friendly names to XBRL tags |
88
+ | `secedgar://filing-types` | Common SEC filing types with descriptions, cadence, and use cases |
89
+
90
+ ## Prompts
91
+
92
+ | Prompt | Description |
93
+ |:---|:---|
94
+ | `secedgar_company_analysis` | Guides a structured analysis of a public company's SEC filings: identify recent filings, extract financial trends, surface risk factors, and note material events |
95
+
96
+ ## Features
97
+
98
+ Built on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core):
99
+
100
+ - Declarative tool definitions — single file per tool, framework handles registration and validation
101
+ - Structured output schemas with automatic formatting for human-readable display
102
+ - Unified error handling across all tools
103
+ - Pluggable auth (`none`, `jwt`, `oauth`)
104
+ - Structured logging with request-scoped context
105
+ - Runs locally (stdio/HTTP) from the same codebase
106
+
107
+ SEC EDGAR–specific:
108
+
109
+ - Rate-limited HTTP client respecting SEC's 10 req/s limit with automatic inter-request delay
110
+ - CIK resolution from tickers, company names, or raw CIK numbers with local caching
111
+ - Friendly XBRL concept name mapping with historical tag change handling
112
+ - HTML-to-text conversion for filing documents via `html-to-text`
113
+ - No API keys required — SEC EDGAR is a free, public API
114
+
115
+ ## Getting started
116
+
117
+ ### MCP client configuration
118
+
119
+ Add the following to your MCP client configuration file.
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "secedgar": {
125
+ "type": "stdio",
126
+ "command": "bunx",
127
+ "args": ["@cyanheads/secedgar-mcp-server@latest"],
128
+ "env": {
129
+ "EDGAR_USER_AGENT": "YourAppName your-email@example.com",
130
+ "MCP_TRANSPORT_TYPE": "stdio"
131
+ }
132
+ }
133
+ }
134
+ }
135
+ ```
136
+
137
+ Or with npx (no Bun required):
138
+
139
+ ```json
140
+ {
141
+ "mcpServers": {
142
+ "secedgar": {
143
+ "type": "stdio",
144
+ "command": "npx",
145
+ "args": ["-y", "@cyanheads/secedgar-mcp-server@latest"],
146
+ "env": {
147
+ "EDGAR_USER_AGENT": "YourAppName your-email@example.com",
148
+ "MCP_TRANSPORT_TYPE": "stdio"
149
+ }
150
+ }
151
+ }
152
+ }
153
+ ```
154
+
155
+ For Streamable HTTP, set the transport and start the server:
156
+
157
+ ```sh
158
+ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
159
+ # Server listens at http://localhost:3010/mcp
160
+ ```
161
+
162
+ ### Prerequisites
163
+
164
+ - [Bun v1.3.0](https://bun.sh/) or higher.
165
+
166
+ ### Installation
167
+
168
+ 1. **Clone the repository:**
169
+
170
+ ```sh
171
+ git clone https://github.com/cyanheads/secedgar-mcp-server.git
172
+ ```
173
+
174
+ 2. **Navigate into the directory:**
175
+
176
+ ```sh
177
+ cd secedgar-mcp-server
178
+ ```
179
+
180
+ 3. **Install dependencies:**
181
+
182
+ ```sh
183
+ bun install
184
+ ```
185
+
186
+ 4. **Build:**
187
+
188
+ ```sh
189
+ bun run build
190
+ ```
191
+
192
+ ## Configuration
193
+
194
+ All configuration is validated at startup via Zod schemas in `src/config/server-config.ts`. Key environment variables:
195
+
196
+ | Variable | Description | Default |
197
+ |:---|:---|:---|
198
+ | `EDGAR_USER_AGENT` | **Required.** User-Agent header for SEC compliance. Format: `"AppName contact@email.com"`. SEC blocks IPs without a valid User-Agent. | — |
199
+ | `EDGAR_RATE_LIMIT_RPS` | Max requests/second to SEC APIs. Do not exceed 10. | `10` |
200
+ | `EDGAR_TICKER_CACHE_TTL` | Seconds to cache the company tickers lookup file. | `3600` |
201
+ | `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http` | `stdio` |
202
+ | `MCP_HTTP_PORT` | HTTP server port | `3010` |
203
+ | `MCP_AUTH_MODE` | Authentication: `none`, `jwt`, or `oauth` | `none` |
204
+ | `MCP_LOG_LEVEL` | Log level (`debug`, `info`, `warning`, `error`, etc.) | `info` |
205
+
206
+ ## Running the server
207
+
208
+ ### Local development
209
+
210
+ - **Build and run the production version:**
211
+
212
+ ```sh
213
+ bun run rebuild
214
+ bun run start:http # or start:stdio
215
+ ```
216
+
217
+ - **Run checks and tests:**
218
+ ```sh
219
+ bun run devcheck # Lints, formats, type-checks
220
+ bun run test # Runs test suite
221
+ ```
222
+
223
+ ### Docker
224
+
225
+ ```sh
226
+ docker build -t secedgar-mcp-server .
227
+ docker run -e EDGAR_USER_AGENT="MyApp my@email.com" -p 3010:3010 secedgar-mcp-server
228
+ ```
229
+
230
+ ## Project structure
231
+
232
+ | Directory | Purpose |
233
+ |:---|:---|
234
+ | `src/mcp-server/tools/definitions/` | Tool definitions (`*.tool.ts`). Five SEC EDGAR tools. |
235
+ | `src/mcp-server/resources/definitions/` | Resource definitions. XBRL concepts and filing types. |
236
+ | `src/mcp-server/prompts/definitions/` | Prompt definitions. Company analysis prompt. |
237
+ | `src/services/edgar/` | SEC EDGAR API client, XBRL concept mapping, HTML-to-text conversion. |
238
+ | `src/config/` | Server-specific environment variable parsing and validation with Zod. |
239
+ | `tests/` | Unit and integration tests, mirroring the `src/` structure. |
240
+
241
+ ## Development guide
242
+
243
+ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
244
+
245
+ - Handlers throw, framework catches — no `try/catch` in tool logic
246
+ - Use `ctx.log` for logging, `ctx.state` for storage
247
+ - Register new tools and resources in the `createApp()` arrays
248
+
249
+ ## Contributing
250
+
251
+ Issues and pull requests are welcome. Run checks and tests before submitting:
252
+
253
+ ```sh
254
+ bun run devcheck
255
+ bun run test
256
+ ```
257
+
258
+ ## License
259
+
260
+ This project is licensed under the Apache 2.0 License. See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @fileoverview Server-specific configuration for SEC EDGAR API access.
3
+ * @module config/server-config
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ declare const ServerConfigSchema: z.ZodObject<{
7
+ userAgent: z.ZodString;
8
+ rateLimitRps: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
9
+ tickerCacheTtl: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
10
+ }, z.core.$strip>;
11
+ export type ServerConfig = z.infer<typeof ServerConfigSchema>;
12
+ export declare function getServerConfig(): ServerConfig;
13
+ export {};
14
+ //# sourceMappingURL=server-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C,QAAA,MAAM,kBAAkB;;;;iBAiBtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,wBAAgB,eAAe,IAAI,YAAY,CAO9C"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @fileoverview Server-specific configuration for SEC EDGAR API access.
3
+ * @module config/server-config
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ const ServerConfigSchema = z.object({
7
+ userAgent: z
8
+ .string()
9
+ .describe('User-Agent header for SEC compliance. Format: "AppName contact@email.com"'),
10
+ rateLimitRps: z.coerce
11
+ .number()
12
+ .int()
13
+ .min(1)
14
+ .max(10)
15
+ .default(10)
16
+ .describe('Max requests/second to SEC APIs'),
17
+ tickerCacheTtl: z.coerce
18
+ .number()
19
+ .int()
20
+ .min(60)
21
+ .default(3600)
22
+ .describe('Seconds to cache company_tickers.json'),
23
+ });
24
+ let _config;
25
+ export function getServerConfig() {
26
+ _config ??= ServerConfigSchema.parse({
27
+ userAgent: process.env.EDGAR_USER_AGENT,
28
+ rateLimitRps: process.env.EDGAR_RATE_LIMIT_RPS,
29
+ tickerCacheTtl: process.env.EDGAR_TICKER_CACHE_TTL,
30
+ });
31
+ return _config;
32
+ }
33
+ //# sourceMappingURL=server-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,CAAC,2EAA2E,CAAC;IACxF,YAAY,EAAE,CAAC,CAAC,MAAM;SACnB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CAAC,iCAAiC,CAAC;IAC9C,cAAc,EAAE,CAAC,CAAC,MAAM;SACrB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,EAAE,CAAC;SACP,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,uCAAuC,CAAC;CACrD,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,kBAAkB,CAAC,KAAK,CAAC;QACnC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;QACvC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;QAC9C,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB;KACnD,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @fileoverview secedgar-mcp-server MCP server entry point.
4
+ * @module index
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG"}
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @fileoverview secedgar-mcp-server MCP server entry point.
4
+ * @module index
5
+ */
6
+ import { createApp } from '@cyanheads/mcp-ts-core';
7
+ import { companyAnalysisPrompt } from './mcp-server/prompts/definitions/company-analysis.prompt.js';
8
+ import { conceptsResource } from './mcp-server/resources/definitions/concepts.resource.js';
9
+ import { filingTypesResource } from './mcp-server/resources/definitions/filing-types.resource.js';
10
+ import { companySearchTool } from './mcp-server/tools/definitions/company-search.tool.js';
11
+ import { compareMetricTool } from './mcp-server/tools/definitions/compare-metric.tool.js';
12
+ import { getFilingTool } from './mcp-server/tools/definitions/get-filing.tool.js';
13
+ import { getFinancialsTool } from './mcp-server/tools/definitions/get-financials.tool.js';
14
+ import { searchFilingsTool } from './mcp-server/tools/definitions/search-filings.tool.js';
15
+ import { initEdgarApiService } from './services/edgar/edgar-api-service.js';
16
+ await createApp({
17
+ tools: [
18
+ companySearchTool,
19
+ searchFilingsTool,
20
+ getFilingTool,
21
+ getFinancialsTool,
22
+ compareMetricTool,
23
+ ],
24
+ resources: [conceptsResource, filingTypesResource],
25
+ prompts: [companyAnalysisPrompt],
26
+ setup() {
27
+ initEdgarApiService();
28
+ },
29
+ });
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,yDAAyD,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,SAAS,CAAC;IACd,KAAK,EAAE;QACL,iBAAiB;QACjB,iBAAiB;QACjB,aAAa;QACb,iBAAiB;QACjB,iBAAiB;KAClB;IACD,SAAS,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;IAClD,OAAO,EAAE,CAAC,qBAAqB,CAAC;IAChC,KAAK;QACH,mBAAmB,EAAE,CAAC;IACxB,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @fileoverview Prompt template for structured analysis of a public company's SEC filings.
3
+ * @module mcp-server/prompts/definitions/company-analysis
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ export declare const companyAnalysisPrompt: import("@cyanheads/mcp-ts-core").PromptDefinition<z.ZodObject<{
7
+ company: z.ZodString;
8
+ focus_areas: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>>;
10
+ //# sourceMappingURL=company-analysis.prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"company-analysis.prompt.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/company-analysis.prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,eAAO,MAAM,qBAAqB;;;kBAwChC,CAAC"}