@fre4x/fred 1.0.29 → 1.0.40

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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Adaptive Agent
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Adaptive Agent
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,54 +1,63 @@
1
- # fred — The Economic Nerve
2
-
3
- > *Monetary policy, GDP, unemployment, inflation — the macroeconomic forces that move everything. This B1TE reads them directly.*
4
-
5
- Part of **[FRE4X-B1TE](../)** — a monorepo of MCP servers built for autonomous agents.
6
-
7
- The Federal Reserve publishes the data that governments and institutions use to make decisions worth trillions. This server gives the agent that same data stream — unfiltered, paginated, ready for inference. While analysts write reports, the agent already knows.
8
-
9
- ## Tools
10
-
11
- | Tool | What it reaches |
12
- |------|----------------|
13
- | `fred_search_series` | Full-text search across all FRED series |
14
- | `fred_get_series_info` | Metadata for a series — units, frequency, range, last update |
15
- | `fred_get_series_data` | Observation time-series for any series (e.g. `GDP`, `UNRATE`, `CPIAUCSL`) |
16
- | `fred_get_category_series` | All series under a given FRED category |
17
- | `fred_get_releases` | Index of all FRED data releases |
18
- | `fred_get_release_series` | Series belonging to a specific release |
19
- | `fred_get_sources` | All primary data sources in FRED |
20
- | `fred_get_source` | Details for one source |
21
-
22
- All list tools support pagination via `limit` / `offset`.
23
-
24
- ## Requirements
25
-
26
- A [FRED API key](https://fred.stlouisfed.org/docs/api/api_key.html) (free) — set as `FRED_API_KEY`.
27
-
28
- ## Deploy
29
-
30
- ```json
31
- {
32
- "mcpServers": {
33
- "fred": {
34
- "command": "npx",
35
- "args": ["-y", "@fre4x/fred"],
36
- "env": {
37
- "FRED_API_KEY": "your_api_key_here"
38
- }
39
- }
40
- }
41
- }
42
- ```
43
-
44
- ## Development
45
-
46
- ```bash
47
- npm install
48
- npm run dev # tsx, no build
49
- npm run build # compile → dist/
50
- ```
51
-
52
- ## License
53
-
54
- MIT — **WE ARE THE FRE4X.**
1
+ # fred — The Economic Nerve
2
+
3
+ > *Monetary policy, GDP, unemployment, inflation — the macroeconomic forces that move everything. This B1TE reads them directly.*
4
+
5
+ Part of **[FRE4X-B1TE](../)** — a monorepo of MCP servers built for autonomous agents.
6
+
7
+ The Federal Reserve publishes the data that governments and institutions use to make decisions worth trillions. This server gives the agent that same data stream — unfiltered, paginated, ready for inference. While analysts write reports, the agent already knows.
8
+
9
+ ## Tools
10
+
11
+ | Tool | What it reaches |
12
+ |------|----------------|
13
+ | `fred_search_series` | Full-text search across all FRED series |
14
+ | `fred_get_series_info` | Metadata for a series — units, frequency, range, last update |
15
+ | `fred_get_series_data` | Observation time-series for any series (e.g. `GDP`, `UNRATE`, `CPIAUCSL`) |
16
+ | `fred_get_category_series` | All series under a given FRED category |
17
+ | `fred_get_releases` | Index of all FRED data releases |
18
+ | `fred_get_release_series` | Series belonging to a specific release |
19
+ | `fred_get_sources` | All primary data sources in FRED |
20
+ | `fred_get_source` | Details for one source |
21
+
22
+ All list tools support pagination via `limit` / `offset`.
23
+
24
+ ## Requirements
25
+
26
+ A [FRED API key](https://fred.stlouisfed.org/docs/api/api_key.html) (free) — set as `FRED_API_KEY`.
27
+
28
+ ## Mock Mode
29
+
30
+ Run without an API key (returns fixture data of identical shape):
31
+
32
+ ```bash
33
+ MOCK=true npx @fre4x/fred
34
+ ```
35
+
36
+ ## Deploy
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "fred": {
42
+ "command": "npx",
43
+ "args": ["-y", "@fre4x/fred"],
44
+ "env": {
45
+ "FRED_API_KEY": "your_api_key_here"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## Development
53
+
54
+ ```bash
55
+ npm install
56
+ npm run dev # tsx, no build
57
+ npm run build # esbuild → dist/
58
+ npm test # vitest unit tests
59
+ ```
60
+
61
+ ## License
62
+
63
+ MIT — **WE ARE THE FRE4X.**
package/dist/api.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import type { FredSearchResponse, FredSeriesInfoResponse, FredObservationsResponse, FredReleasesResponse, FredSourcesResponse, FredCategorySeriesResponse, FredSource } from './types.js';
2
+ export declare class FredApiClient {
3
+ private client;
4
+ private apiKey;
5
+ constructor();
6
+ searchSeries(query: string, limit?: number, offset?: number): Promise<FredSearchResponse>;
7
+ getSeriesInfo(seriesId: string): Promise<FredSeriesInfoResponse>;
8
+ getSeriesObservations(seriesId: string, limit?: number, offset?: number): Promise<FredObservationsResponse>;
9
+ getCategorySeries(categoryId: number, limit?: number, offset?: number): Promise<FredCategorySeriesResponse>;
10
+ getReleases(limit?: number, offset?: number): Promise<FredReleasesResponse>;
11
+ getReleaseSeries(releaseId: number, limit?: number, offset?: number): Promise<FredCategorySeriesResponse>;
12
+ getSources(): Promise<FredSourcesResponse>;
13
+ getSource(sourceId: number): Promise<{
14
+ sources: FredSource[];
15
+ }>;
16
+ }
17
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,UAAU,EACb,MAAM,YAAY,CAAC;AAIpB,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;;IAgBjB,YAAY,CACd,KAAK,EAAE,MAAM,EACb,KAAK,SAAK,EACV,MAAM,SAAI,GACX,OAAO,CAAC,kBAAkB,CAAC;IAgBxB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAUhE,qBAAqB,CACvB,QAAQ,EAAE,MAAM,EAChB,KAAK,SAAO,EACZ,MAAM,SAAI,GACX,OAAO,CAAC,wBAAwB,CAAC;IAU9B,iBAAiB,CACnB,UAAU,EAAE,MAAM,EAClB,KAAK,SAAK,EACV,MAAM,SAAI,GACX,OAAO,CAAC,0BAA0B,CAAC;IAgBhC,WAAW,CAAC,KAAK,SAAK,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAUlE,gBAAgB,CAClB,SAAS,EAAE,MAAM,EACjB,KAAK,SAAK,EACV,MAAM,SAAI,GACX,OAAO,CAAC,0BAA0B,CAAC;IAUhC,UAAU,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAK1C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;CASxE"}
package/dist/api.js ADDED
@@ -0,0 +1,76 @@
1
+ import axios from 'axios';
2
+ const FRED_BASE_URL = 'https://api.stlouisfed.org/fred';
3
+ export class FredApiClient {
4
+ client;
5
+ apiKey;
6
+ constructor() {
7
+ const key = process.env.FRED_API_KEY;
8
+ if (!key) {
9
+ throw new Error('FRED_API_KEY environment variable not set. Please set it to use this server.');
10
+ }
11
+ this.apiKey = key;
12
+ this.client = axios.create({
13
+ baseURL: FRED_BASE_URL,
14
+ params: { api_key: this.apiKey, file_type: 'json' },
15
+ });
16
+ }
17
+ async searchSeries(query, limit = 20, offset = 0) {
18
+ const { data } = await this.client.get('/series/search', {
19
+ params: {
20
+ search_text: query,
21
+ limit,
22
+ offset,
23
+ order_by: 'popularity',
24
+ sort_order: 'desc',
25
+ },
26
+ });
27
+ return data;
28
+ }
29
+ async getSeriesInfo(seriesId) {
30
+ const { data } = await this.client.get('/series', {
31
+ params: { series_id: seriesId },
32
+ });
33
+ return data;
34
+ }
35
+ async getSeriesObservations(seriesId, limit = 1000, offset = 0) {
36
+ const { data } = await this.client.get('/series/observations', {
37
+ params: { series_id: seriesId, limit, offset },
38
+ });
39
+ return data;
40
+ }
41
+ async getCategorySeries(categoryId, limit = 20, offset = 0) {
42
+ const { data } = await this.client.get('/category/series', {
43
+ params: {
44
+ category_id: categoryId,
45
+ limit,
46
+ offset,
47
+ order_by: 'popularity',
48
+ sort_order: 'desc',
49
+ },
50
+ });
51
+ return data;
52
+ }
53
+ async getReleases(limit = 20, offset = 0) {
54
+ const { data } = await this.client.get('/releases', {
55
+ params: { limit, offset },
56
+ });
57
+ return data;
58
+ }
59
+ async getReleaseSeries(releaseId, limit = 20, offset = 0) {
60
+ const { data } = await this.client.get('/release/series', {
61
+ params: { release_id: releaseId, limit, offset },
62
+ });
63
+ return data;
64
+ }
65
+ async getSources() {
66
+ const { data } = await this.client.get('/sources');
67
+ return data;
68
+ }
69
+ async getSource(sourceId) {
70
+ const { data } = await this.client.get('/source', {
71
+ params: { source_id: sourceId },
72
+ });
73
+ return data;
74
+ }
75
+ }
76
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAWlD,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAExD,MAAM,OAAO,aAAa;IACd,MAAM,CAAgB;IACtB,MAAM,CAAS;IAEvB;QACI,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QACrC,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,MAAM,IAAI,KAAK,CACX,8EAA8E,CACjF,CAAC;QACN,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YACvB,OAAO,EAAE,aAAa;YACtB,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE;SACtD,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,YAAY,CACd,KAAa,EACb,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AAG,EAAE,EAAE,MAAM,GAAG,CAAC;QACpC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAClC,WAAW,EACX;YACI,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SAC5B,CACJ,CAAC;QACF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAClB,SAAiB,EACjB,KAAK,GAAG,EAAE,EACV,MAAM,GAAG,CAAC;QAEV,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAClC,iBAAiB,EACjB;YACI,MAAM,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;SACnD,CACJ,CAAC;QACF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,UAAU;QACZ,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAsB,UAAU,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAAgB;QAC5B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAClC,SAAS,EACT;YACI,MAAM,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;SAClC,CACJ,CAAC;QACF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}