@cyanheads/exchange-rates-mcp-server 0.1.1

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 (77) hide show
  1. package/AGENTS.md +392 -0
  2. package/CLAUDE.md +392 -0
  3. package/Dockerfile +105 -0
  4. package/LICENSE +201 -0
  5. package/README.md +340 -0
  6. package/changelog/0.1.x/0.1.1.md +32 -0
  7. package/changelog/template.md +127 -0
  8. package/dist/config/server-config.d.ts +13 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +27 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +31 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/prompts/definitions/index.d.ts +6 -0
  17. package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
  18. package/dist/mcp-server/prompts/definitions/index.js +6 -0
  19. package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
  20. package/dist/mcp-server/resources/definitions/fx-currencies.resource.d.ts +14 -0
  21. package/dist/mcp-server/resources/definitions/fx-currencies.resource.d.ts.map +1 -0
  22. package/dist/mcp-server/resources/definitions/fx-currencies.resource.js +43 -0
  23. package/dist/mcp-server/resources/definitions/fx-currencies.resource.js.map +1 -0
  24. package/dist/mcp-server/resources/definitions/fx-rates-latest.resource.d.ts +15 -0
  25. package/dist/mcp-server/resources/definitions/fx-rates-latest.resource.d.ts.map +1 -0
  26. package/dist/mcp-server/resources/definitions/fx-rates-latest.resource.js +61 -0
  27. package/dist/mcp-server/resources/definitions/fx-rates-latest.resource.js.map +1 -0
  28. package/dist/mcp-server/resources/definitions/index.d.ts +7 -0
  29. package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
  30. package/dist/mcp-server/resources/definitions/index.js +7 -0
  31. package/dist/mcp-server/resources/definitions/index.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/fx-convert-currency.tool.d.ts +33 -0
  33. package/dist/mcp-server/tools/definitions/fx-convert-currency.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/fx-convert-currency.tool.js +133 -0
  35. package/dist/mcp-server/tools/definitions/fx-convert-currency.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/fx-dataframe-describe.tool.d.ts +28 -0
  37. package/dist/mcp-server/tools/definitions/fx-dataframe-describe.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/fx-dataframe-describe.tool.js +105 -0
  39. package/dist/mcp-server/tools/definitions/fx-dataframe-describe.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/fx-dataframe-query.tool.d.ts +25 -0
  41. package/dist/mcp-server/tools/definitions/fx-dataframe-query.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/fx-dataframe-query.tool.js +125 -0
  43. package/dist/mcp-server/tools/definitions/fx-dataframe-query.tool.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/fx-get-rate.tool.d.ts +30 -0
  45. package/dist/mcp-server/tools/definitions/fx-get-rate.tool.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/definitions/fx-get-rate.tool.js +121 -0
  47. package/dist/mcp-server/tools/definitions/fx-get-rate.tool.js.map +1 -0
  48. package/dist/mcp-server/tools/definitions/fx-get-rates.tool.d.ts +28 -0
  49. package/dist/mcp-server/tools/definitions/fx-get-rates.tool.d.ts.map +1 -0
  50. package/dist/mcp-server/tools/definitions/fx-get-rates.tool.js +115 -0
  51. package/dist/mcp-server/tools/definitions/fx-get-rates.tool.js.map +1 -0
  52. package/dist/mcp-server/tools/definitions/fx-get-timeseries.tool.d.ts +41 -0
  53. package/dist/mcp-server/tools/definitions/fx-get-timeseries.tool.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/definitions/fx-get-timeseries.tool.js +229 -0
  55. package/dist/mcp-server/tools/definitions/fx-get-timeseries.tool.js.map +1 -0
  56. package/dist/mcp-server/tools/definitions/fx-list-currencies.tool.d.ts +14 -0
  57. package/dist/mcp-server/tools/definitions/fx-list-currencies.tool.d.ts.map +1 -0
  58. package/dist/mcp-server/tools/definitions/fx-list-currencies.tool.js +47 -0
  59. package/dist/mcp-server/tools/definitions/fx-list-currencies.tool.js.map +1 -0
  60. package/dist/mcp-server/tools/definitions/index.d.ts +12 -0
  61. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  62. package/dist/mcp-server/tools/definitions/index.js +12 -0
  63. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  64. package/dist/services/canvas/canvas-accessor.d.ts +10 -0
  65. package/dist/services/canvas/canvas-accessor.d.ts.map +1 -0
  66. package/dist/services/canvas/canvas-accessor.js +12 -0
  67. package/dist/services/canvas/canvas-accessor.js.map +1 -0
  68. package/dist/services/frankfurter/frankfurter-service.d.ts +46 -0
  69. package/dist/services/frankfurter/frankfurter-service.d.ts.map +1 -0
  70. package/dist/services/frankfurter/frankfurter-service.js +181 -0
  71. package/dist/services/frankfurter/frankfurter-service.js.map +1 -0
  72. package/dist/services/frankfurter/types.d.ts +59 -0
  73. package/dist/services/frankfurter/types.d.ts.map +1 -0
  74. package/dist/services/frankfurter/types.js +6 -0
  75. package/dist/services/frankfurter/types.js.map +1 -0
  76. package/package.json +104 -0
  77. package/server.json +127 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
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 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 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 those 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
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Casey Hand @cyanheads
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,340 @@
1
+ <div align="center">
2
+ <h1>@cyanheads/exchange-rates-mcp-server</h1>
3
+ <p><b>Convert currencies, get FX rates, and query historical ECB exchange rate data via MCP. STDIO or Streamable HTTP.</b>
4
+ <div>7 Tools • 2 Resources</div>
5
+ </p>
6
+ </div>
7
+
8
+ <div align="center">
9
+
10
+ [![Version](https://img.shields.io/badge/Version-0.1.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/exchange-rates-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/exchange-rates-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/exchange-rates-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^6.0.3-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/)
11
+
12
+ </div>
13
+
14
+ <div align="center">
15
+
16
+ [![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/exchange-rates-mcp-server/releases/latest/download/exchange-rates-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=exchange-rates-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZXhjaGFuZ2UtcmF0ZXMtbWNwLXNlcnZlciJdfQ==) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22exchange-rates-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fexchange-rates-mcp-server%22%5D%7D)
17
+
18
+ [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## Tools
25
+
26
+ Seven tools for working with ECB FX rate data — currency lookup and disambiguation, point-in-time rates and conversions, historical time-series retrieval, and SQL analytics over the DataCanvas workspace that long time-series calls produce:
27
+
28
+ | Tool | Description |
29
+ |:-----|:------------|
30
+ | `fx_list_currencies` | List all ~30 ECB-supported ISO 4217 currencies with full names. Use before converting to disambiguate "dollars" (USD vs AUD vs CAD vs HKD vs SGD). |
31
+ | `fx_get_rates` | Snapshot of all available rates for a base currency at latest or a historical date. Optional `symbols` filter for smaller responses. |
32
+ | `fx_get_rate` | Exchange rate for a single currency pair at latest or a historical date. Surfaces `date_snapped` when a weekend/holiday request returns the prior business-day rate. |
33
+ | `fx_convert_currency` | Convert an amount between any two currencies at latest or a historical rate. Cross-rates are triangulated through EUR. Returns converted amount, rate used, rate date, and whether the date was snapped. |
34
+ | `fx_get_timeseries` | Historical daily rates for a currency pair over a date range. Short ranges (≤90 days) are returned inline; long ranges spill to DataCanvas with a `canvas_id` for SQL follow-up. |
35
+ | `fx_dataframe_describe` | List DataCanvas tables and their columns from a prior `fx_get_timeseries` call. Required first step before `fx_dataframe_query`. |
36
+ | `fx_dataframe_query` | Run a read-only SQL SELECT against a DataCanvas table produced by `fx_get_timeseries`. Supports aggregations, GROUP BY, window functions, and JOINs across multiple registered tables. |
37
+
38
+ ### `fx_list_currencies`
39
+
40
+ Enumerate all supported currencies before converting or querying.
41
+
42
+ - Returns `[{ code, name }]` for all ~30 ECB-scoped currencies
43
+ - ECB coverage fluctuates as currencies enter/exit scope — always call this tool to validate user-supplied codes rather than hard-coding a list
44
+
45
+ ---
46
+
47
+ ### `fx_get_rates`
48
+
49
+ Full rates snapshot for a base currency in one call.
50
+
51
+ - Returns all available quote currencies at a given date (default: latest)
52
+ - Optional `symbols` parameter narrows the response to specific quote currencies
53
+ - Useful for seeding bulk comparison workflows or discovering what's available
54
+
55
+ ---
56
+
57
+ ### `fx_get_rate`
58
+
59
+ Point-in-time exchange rate for a single pair.
60
+
61
+ - Returns the rate, the actual rate date, and `date_snapped: true` when the API silently moved a weekend/holiday request to the prior business day
62
+ - Cross-rates (neither side EUR) are triangulated in a single API call — no extra round trip
63
+ - Use `fx_convert_currency` when you need the converted amount; use this tool when you only need the rate number
64
+
65
+ ---
66
+
67
+ ### `fx_convert_currency`
68
+
69
+ Convert an amount between any two currencies.
70
+
71
+ - Handles EUR ↔ any, any ↔ EUR, and cross-rate (USD → JPY via EUR) in one upstream call
72
+ - Returns `converted_amount`, `rate`, `rate_date`, `date_snapped`, plus `rate_type` and `source` provenance on every response
73
+ - Historical conversions supported back to 1999-01-04 (ECB launch date)
74
+
75
+ ---
76
+
77
+ ### `fx_get_timeseries` + `fx_dataframe_describe` / `fx_dataframe_query`
78
+
79
+ Historical rate series and DataCanvas SQL analytics.
80
+
81
+ `fx_get_timeseries` returns a date-keyed series (business days only — ECB publishes once per business day):
82
+
83
+ - Short ranges (≤ `FX_TIMESERIES_CANVAS_THRESHOLD_DAYS`, default 90 days) → inline `rates` map + metadata
84
+ - Long ranges → first N rows inline + `canvas_id`, `table_name`, and `truncated: true` — the full series is registered as a DuckDB-backed table
85
+
86
+ Once a `canvas_id` is in hand:
87
+
88
+ 1. **`fx_dataframe_describe`** — list the tables and columns on the canvas (required before `fx_dataframe_query`)
89
+ 2. **`fx_dataframe_query`** — run arbitrary SQL SELECT against the registered table; supports aggregations, GROUP BY, window functions, JOINs across tables from multiple `fx_get_timeseries` calls
90
+
91
+ The canvas uses a session-scoped TTL. To continue working with a prior series, call `fx_get_timeseries` again with the same parameters to obtain a fresh `canvas_id`.
92
+
93
+ ---
94
+
95
+ ## Resources and prompts
96
+
97
+ | Type | Name | Description |
98
+ |:-----|:-----|:------------|
99
+ | Resource | `fx://currencies` | All supported currencies as a stable reference document. Injectable context for clients that support resources. |
100
+ | Resource | `fx://rates/latest/{base}` | Latest rates snapshot for a base currency as a stable URI. |
101
+
102
+ All resource data is also reachable via tools. Use `fx_list_currencies` or `fx_get_rates` for programmatic access.
103
+
104
+ ---
105
+
106
+ ## Features
107
+
108
+ Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):
109
+
110
+ - Declarative tool and resource definitions — single file per primitive, framework handles registration and validation
111
+ - Unified error handling — handlers throw, framework catches, classifies, and formats
112
+ - Typed error contracts with recovery hints — `unsupported_currency`, `date_out_of_range`, `canvas_not_found`, `invalid_query`
113
+ - Pluggable auth: `none`, `jwt`, `oauth`
114
+ - Structured logging with optional OpenTelemetry tracing
115
+ - STDIO and Streamable HTTP transports
116
+
117
+ ECB FX–specific:
118
+
119
+ - Keyless access via [Frankfurter](https://www.frankfurter.dev/) — a Cloudflare-fronted ECB proxy; no API keys required
120
+ - Cross-rate triangulation: any pair works (USD → JPY fetches EUR/USD and EUR/JPY in one call, computes JPY/USD ratio)
121
+ - Weekend/holiday date semantics: `date_snapped` flag surfaces when the API returns a different date than requested
122
+ - ECB data covers ~30 major currencies from 1999-01-04 to present; `fx_list_currencies` always reflects the live set
123
+ - DataCanvas integration: `fx_get_timeseries` spills long ranges to DuckDB for aggregations and trend analysis
124
+ - Rate provenance on every response: `rate_type: "ECB reference (mid-market)"` and `source: "ECB via Frankfurter"` — explicitly mid-market, not tradeable bid/ask
125
+
126
+ Agent-friendly output:
127
+
128
+ - Rate provenance on every response — `rate_type`, `source`, `rate_date`, and `date_snapped` so agents can reason about trust and freshness
129
+ - Structured error contracts — typed `reason` fields (`unsupported_currency`, `date_out_of_range`, `invalid_query`, …) let callers branch on failure type, not string parsing
130
+ - Discriminated DataCanvas output — `canvas_id` and `truncated: true` signal when a time-series exceeds the inline limit and SQL follow-up is needed
131
+
132
+ ---
133
+
134
+ ## Getting started
135
+
136
+ No API key required — Frankfurter is keyless. Add the following to your MCP client configuration file:
137
+
138
+ ```json
139
+ {
140
+ "mcpServers": {
141
+ "exchange-rates-mcp-server": {
142
+ "type": "stdio",
143
+ "command": "bunx",
144
+ "args": ["@cyanheads/exchange-rates-mcp-server@latest"],
145
+ "env": {
146
+ "MCP_TRANSPORT_TYPE": "stdio",
147
+ "MCP_LOG_LEVEL": "info"
148
+ }
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ Or with npx (no Bun required):
155
+
156
+ ```json
157
+ {
158
+ "mcpServers": {
159
+ "exchange-rates-mcp-server": {
160
+ "type": "stdio",
161
+ "command": "npx",
162
+ "args": ["-y", "@cyanheads/exchange-rates-mcp-server@latest"],
163
+ "env": {
164
+ "MCP_TRANSPORT_TYPE": "stdio",
165
+ "MCP_LOG_LEVEL": "info"
166
+ }
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ Or with Docker:
173
+
174
+ ```json
175
+ {
176
+ "mcpServers": {
177
+ "exchange-rates-mcp-server": {
178
+ "type": "stdio",
179
+ "command": "docker",
180
+ "args": [
181
+ "run", "-i", "--rm",
182
+ "-e", "MCP_TRANSPORT_TYPE=stdio",
183
+ "ghcr.io/cyanheads/exchange-rates-mcp-server:latest"
184
+ ]
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
190
+ To enable DataCanvas for long time-series SQL analytics, add `CANVAS_PROVIDER_TYPE=duckdb`:
191
+
192
+ ```json
193
+ {
194
+ "mcpServers": {
195
+ "exchange-rates-mcp-server": {
196
+ "type": "stdio",
197
+ "command": "bunx",
198
+ "args": ["@cyanheads/exchange-rates-mcp-server@latest"],
199
+ "env": {
200
+ "MCP_TRANSPORT_TYPE": "stdio",
201
+ "CANVAS_PROVIDER_TYPE": "duckdb"
202
+ }
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ For Streamable HTTP, set the transport and start the server:
209
+
210
+ ```sh
211
+ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
212
+ # Server listens at http://localhost:3010/mcp
213
+ ```
214
+
215
+ ### Prerequisites
216
+
217
+ - [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).
218
+ - No API key — Frankfurter is free and keyless.
219
+
220
+ ### Installation
221
+
222
+ 1. **Clone the repository:**
223
+
224
+ ```sh
225
+ git clone https://github.com/cyanheads/exchange-rates-mcp-server.git
226
+ ```
227
+
228
+ 2. **Navigate into the directory:**
229
+
230
+ ```sh
231
+ cd exchange-rates-mcp-server
232
+ ```
233
+
234
+ 3. **Install dependencies:**
235
+
236
+ ```sh
237
+ bun install
238
+ ```
239
+
240
+ 4. **Configure environment:**
241
+
242
+ ```sh
243
+ cp .env.example .env
244
+ # edit .env as needed (all vars are optional — no keys required)
245
+ ```
246
+
247
+ ---
248
+
249
+ ## Configuration
250
+
251
+ All configuration is validated at startup via Zod schemas. Environment variables:
252
+
253
+ | Variable | Description | Default |
254
+ |:---------|:------------|:--------|
255
+ | `FRANKFURTER_BASE_URL` | Frankfurter API base URL. Override for local testing or a self-hosted instance. | `https://api.frankfurter.dev/v1` |
256
+ | `FX_TIMESERIES_CANVAS_THRESHOLD_DAYS` | Day range above which `fx_get_timeseries` spills to DataCanvas instead of returning inline. | `90` |
257
+ | `CANVAS_PROVIDER_TYPE` | Canvas engine. Set to `duckdb` to enable DataCanvas for `fx_get_timeseries` long-range spillover. | `none` |
258
+ | `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
259
+ | `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |
260
+ | `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
261
+ | `MCP_LOG_LEVEL` | Log level (RFC 5424: `debug`, `info`, `notice`, `warning`, `error`). | `info` |
262
+ | `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |
263
+
264
+ See [`.env.example`](./.env.example) for the full list of optional overrides including storage, session, and telemetry vars.
265
+
266
+ ---
267
+
268
+ ## Running the server
269
+
270
+ ### Local development
271
+
272
+ - **Build and run:**
273
+
274
+ ```sh
275
+ bun run rebuild
276
+ bun run start:stdio
277
+ # or
278
+ bun run start:http
279
+ ```
280
+
281
+ - **Run checks and tests:**
282
+
283
+ ```sh
284
+ bun run devcheck # Lint, format, typecheck, security, changelog sync
285
+ bun run test # Vitest test suite
286
+ bun run lint:mcp # Validate MCP definitions against spec
287
+ ```
288
+
289
+ ### Docker
290
+
291
+ ```sh
292
+ docker build -t exchange-rates-mcp-server .
293
+ docker run --rm -p 3010:3010 exchange-rates-mcp-server
294
+ ```
295
+
296
+ The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/exchange-rates-mcp-server`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them. DuckDB native binaries are pre-built in the build stage and copied to production, keeping the production image free of build tools.
297
+
298
+ ---
299
+
300
+ ## Project structure
301
+
302
+ | Directory | Purpose |
303
+ |:----------|:--------|
304
+ | `src/index.ts` | `createApp()` entry point — registers tools, resources, and canvas accessor. |
305
+ | `src/config/` | Server-specific environment variable parsing and validation with Zod. |
306
+ | `src/mcp-server/tools/` | Tool definitions (`*.tool.ts`) — `fx_*` tools. |
307
+ | `src/mcp-server/resources/` | Resource definitions — `fx://currencies` and `fx://rates/latest/{base}`. |
308
+ | `src/services/frankfurter/` | Frankfurter HTTP client, retry logic, and domain types. |
309
+ | `src/services/canvas/` | Module-level DataCanvas accessor for `fx_get_timeseries` spillover. |
310
+ | `tests/` | Unit and integration tests mirroring `src/`. |
311
+ | `docs/` | Design document and idea notes. |
312
+
313
+ ---
314
+
315
+ ## Development guide
316
+
317
+ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
318
+
319
+ - Handlers throw, framework catches — no `try/catch` in tool logic
320
+ - Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage
321
+ - Register new tools and resources via the barrels in `src/mcp-server/*/definitions/index.ts`
322
+ - Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
323
+ - ECB rates are mid-market reference rates — preserve the `rate_type` provenance in every response
324
+
325
+ ---
326
+
327
+ ## Contributing
328
+
329
+ Issues and pull requests are welcome. Run checks and tests before submitting:
330
+
331
+ ```sh
332
+ bun run devcheck
333
+ bun run test
334
+ ```
335
+
336
+ ---
337
+
338
+ ## License
339
+
340
+ Apache-2.0 — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,32 @@
1
+ ---
2
+ summary: "Initial public release — 7 tools and 2 resources over the Frankfurter ECB FX API with DataCanvas SQL support and input injection hardening"
3
+ breaking: false
4
+ security: true
5
+ ---
6
+
7
+ # 0.1.1 — 2026-06-05
8
+
9
+ Initial public release of `@cyanheads/exchange-rates-mcp-server`. Provides 7 MCP tools and 2 resources over the [Frankfurter API](https://www.frankfurter.dev/) (ECB reference foreign-exchange rates):
10
+
11
+ - **`fx_list_currencies`** — list all ~30 ECB-supported ISO 4217 currencies with full names
12
+ - **`fx_get_rates`** — snapshot of all rates for a base currency at latest or a historical date
13
+ - **`fx_get_rate`** — exchange rate for a single currency pair at latest or a historical date; surfaces `date_snapped` when a weekend/holiday request returns the prior business-day rate
14
+ - **`fx_convert_currency`** — convert an amount between any two currencies; cross-rates triangulated through EUR
15
+ - **`fx_get_timeseries`** — historical daily rates for a currency pair over a date range; ranges ≤90 days returned inline, longer ranges spill to DataCanvas with a `canvas_id` for SQL follow-up
16
+ - **`fx_dataframe_describe`** — list DataCanvas tables and columns from a prior `fx_get_timeseries` call
17
+ - **`fx_dataframe_query`** — read-only SQL SELECT against DataCanvas tables; supports aggregations, GROUP BY, window functions, and JOINs
18
+
19
+ Resources: **`fx://rates/latest/{base}`** (latest rates snapshot) and **`fx://currencies`** (stable currencies reference document).
20
+
21
+ ## Added
22
+
23
+ - **`fx_list_currencies`**, **`fx_get_rates`**, **`fx_get_rate`**, **`fx_convert_currency`**, **`fx_get_timeseries`**, **`fx_dataframe_describe`**, **`fx_dataframe_query`** — full 7-tool surface over the Frankfurter API
24
+ - **`fx://rates/latest/{base}`** resource — stable URI for latest rates snapshot per base currency
25
+ - **`fx://currencies`** resource — stable currencies reference document
26
+ - **DataCanvas support** (`CANVAS_PROVIDER_TYPE=duckdb`) — `fx_get_timeseries` spills long date ranges to named DuckDB tables for follow-up SQL
27
+ - **`Dockerfile`** — copies `node_modules` from the build stage so `@duckdb/node-api`'s pre-compiled native binary is preserved in the production image without reinstalling build tools
28
+
29
+ ## Security
30
+
31
+ - **Input injection hardening in `frankfurter-service.ts`** — added `assertCurrencyFormat()` (regex `/^[A-Za-z]{1,4}$/`) and `assertDateFormat()` (regex `/^\d{4}-\d{2}-\d{2}$/`) guards applied to all `base`, `quote`, `symbols`, `startDate`, and `endDate` inputs before they are embedded in API URLs
32
+ - **URL parameter encoding** — switched from string interpolation to `URLSearchParams` and `encodeURIComponent()` across all `FrankfurterService` methods