@pipeworx/mcp-frankfurter 0.1.0
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 +21 -0
- package/README.md +55 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +270 -0
- package/tsconfig.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pipeworx
|
|
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
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# mcp-frankfurter
|
|
2
|
+
|
|
3
|
+
Frankfurter MCP — wraps Frankfurter API (api.frankfurter.dev)
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 965+ live data sources.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"mcpServers": {
|
|
19
|
+
"frankfurter": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/frankfurter/mcp"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or connect to the full Pipeworx gateway for access to all 965+ data sources:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"pipeworx": {
|
|
32
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Using with ask_pipeworx
|
|
39
|
+
|
|
40
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
ask_pipeworx({ question: "your question about Frankfurter data" })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
47
|
+
|
|
48
|
+
## More
|
|
49
|
+
|
|
50
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
51
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-frankfurter",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Frankfurter MCP — wraps Frankfurter API (api.frankfurter.dev)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "frankfurter"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-frankfurter"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.7.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pipeworx-io/frankfurter",
|
|
4
|
+
"title": "Frankfurter",
|
|
5
|
+
"description": "Frankfurter MCP — wraps Frankfurter API (api.frankfurter.dev)",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/frankfurter",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-frankfurter",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/frankfurter/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
interface McpToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface McpToolExport {
|
|
12
|
+
tools: McpToolDefinition[];
|
|
13
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
meter?: { credits: number };
|
|
15
|
+
cost?: Record<string, unknown>;
|
|
16
|
+
provider?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Frankfurter MCP — wraps Frankfurter API (api.frankfurter.dev)
|
|
21
|
+
*
|
|
22
|
+
* Free, no authentication required. Foreign exchange rates published by the ECB.
|
|
23
|
+
*
|
|
24
|
+
* Tools:
|
|
25
|
+
* - get_latest: get latest exchange rates
|
|
26
|
+
* - get_historical: get exchange rates for a specific date
|
|
27
|
+
* - get_timeseries: get exchange rates over a date range
|
|
28
|
+
* - list_currencies: list all supported currencies
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const BASE_URL = 'https://api.frankfurter.dev';
|
|
33
|
+
|
|
34
|
+
// Crypto codes the router LLM may pass — Frankfurter is fiat-only (ECB
|
|
35
|
+
// reference rates), so we reject these upfront with a pointer to the
|
|
36
|
+
// crypto pack instead of letting Frankfurter return a generic 404.
|
|
37
|
+
const CRYPTO_CODES = new Set([
|
|
38
|
+
'BTC', 'ETH', 'USDT', 'USDC', 'BNB', 'XRP', 'SOL', 'ADA', 'DOGE', 'TRX',
|
|
39
|
+
'AVAX', 'DOT', 'MATIC', 'SHIB', 'LINK', 'BCH', 'LTC', 'NEAR', 'XMR', 'XLM',
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
function validateCurrency(code: string | undefined, fieldName: string): void {
|
|
43
|
+
if (!code) return;
|
|
44
|
+
const upper = code.trim().toUpperCase();
|
|
45
|
+
if (CRYPTO_CODES.has(upper)) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
`Frankfurter is fiat-only (ECB reference rates). ${fieldName}="${code}" is a crypto asset. For crypto prices use the crypto pack: get_crypto_price({coin_id: "${upper.toLowerCase()}"}) or get_exchange_rate({from: "USD", to: "${upper}"}).`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
if (!/^[A-Z]{3}$/.test(upper)) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Invalid currency code "${code}" for ${fieldName}. Frankfurter expects ISO 4217 3-letter codes like USD, EUR, GBP, JPY. Use list_currencies to see all 30+ supported codes.`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function validateSymbols(symbols: string | undefined): void {
|
|
58
|
+
if (!symbols) return;
|
|
59
|
+
for (const s of symbols.split(',')) {
|
|
60
|
+
validateCurrency(s.trim(), 'symbols');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function apiGet(path: string, params?: Record<string, string>): Promise<unknown> {
|
|
65
|
+
const url = new URL(`${BASE_URL}${path}`);
|
|
66
|
+
if (params) {
|
|
67
|
+
for (const [k, v] of Object.entries(params)) {
|
|
68
|
+
url.searchParams.set(k, v);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const res = await fetch(url.toString(), {
|
|
73
|
+
headers: { Accept: 'application/json' },
|
|
74
|
+
});
|
|
75
|
+
if (!res.ok) {
|
|
76
|
+
if (res.status === 404) {
|
|
77
|
+
// 404 typically means a bad currency code, a date outside ECB's range
|
|
78
|
+
// (pre-1999), or an invalid path. Surface the path so the agent can
|
|
79
|
+
// see what was attempted.
|
|
80
|
+
throw new Error(
|
|
81
|
+
`Frankfurter API 404 for path "${path}" — usually means an unknown currency code or a date Frankfurter doesn't cover (ECB rates start 1999-01-04). Use list_currencies for the supported set; for crypto use the crypto pack.`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
throw new Error(`Frankfurter API error: ${res.status}`);
|
|
85
|
+
}
|
|
86
|
+
return res.json();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const tools: McpToolExport['tools'] = [
|
|
90
|
+
{
|
|
91
|
+
name: 'get_latest',
|
|
92
|
+
description:
|
|
93
|
+
'Get the latest foreign exchange (FX) rates from the ECB. PREFER OVER WEB SEARCH for "convert CHF to INR", "USD to EUR rate", "what is the exchange rate of X to Y", "currency conversion". Returns rates relative to a base currency for any supported pair (CHF, INR, USD, EUR, GBP, JPY, and ~30 more — see list_currencies). To convert CHF→INR call get_latest(base: "CHF", symbols: "INR"). Example: get_latest(base: "USD", symbols: "EUR,GBP,JPY").',
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: 'object',
|
|
96
|
+
properties: {
|
|
97
|
+
base: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
description: 'Base currency code (default "EUR"). Example: "USD", "GBP"',
|
|
100
|
+
},
|
|
101
|
+
symbols: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
description: 'Comma-separated target currency codes (e.g., "USD,GBP,JPY"). Omit for all currencies.',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'get_historical',
|
|
110
|
+
description:
|
|
111
|
+
'Get exchange rates for a specific historical date. ECB rates available from 1999-01-04 onward. Example: get_historical(date: "2024-01-15", base: "USD").',
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
date: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
description: 'Date in YYYY-MM-DD format (e.g., "2024-01-15")',
|
|
118
|
+
},
|
|
119
|
+
base: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
description: 'Base currency code (default "EUR")',
|
|
122
|
+
},
|
|
123
|
+
symbols: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
description: 'Comma-separated target currency codes (e.g., "USD,GBP")',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
required: ['date'],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'get_timeseries',
|
|
133
|
+
description:
|
|
134
|
+
'Get exchange rates over a date range for trend analysis. Returns daily rates between start and end dates. Example: get_timeseries(start_date: "2024-01-01", end_date: "2024-03-31", base: "USD", symbols: "EUR").',
|
|
135
|
+
inputSchema: {
|
|
136
|
+
type: 'object',
|
|
137
|
+
properties: {
|
|
138
|
+
start_date: {
|
|
139
|
+
type: 'string',
|
|
140
|
+
description: 'Start date in YYYY-MM-DD format',
|
|
141
|
+
},
|
|
142
|
+
end_date: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
description: 'End date in YYYY-MM-DD format',
|
|
145
|
+
},
|
|
146
|
+
base: {
|
|
147
|
+
type: 'string',
|
|
148
|
+
description: 'Base currency code (default "EUR")',
|
|
149
|
+
},
|
|
150
|
+
symbols: {
|
|
151
|
+
type: 'string',
|
|
152
|
+
description: 'Comma-separated target currency codes (e.g., "USD,GBP")',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
required: ['start_date', 'end_date'],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'list_currencies',
|
|
160
|
+
description:
|
|
161
|
+
'List all currencies supported by the Frankfurter API (ECB reference rates). Returns currency codes and full names.',
|
|
162
|
+
inputSchema: {
|
|
163
|
+
type: 'object',
|
|
164
|
+
properties: {},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
// LLMs naturally call exchange-rate tools with `from`/`to` instead of
|
|
170
|
+
// `base`/`symbols`. Map both to the same internal args so we don't
|
|
171
|
+
// silently ignore the wrong-named version.
|
|
172
|
+
function normalizeArgs(args: Record<string, unknown>): { base?: string; symbols?: string } {
|
|
173
|
+
return {
|
|
174
|
+
base: (args.base as string | undefined) ?? (args.from as string | undefined),
|
|
175
|
+
symbols: (args.symbols as string | undefined) ?? (args.to as string | undefined),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
180
|
+
const { base, symbols } = normalizeArgs(args);
|
|
181
|
+
validateCurrency(base, 'base');
|
|
182
|
+
validateSymbols(symbols);
|
|
183
|
+
switch (name) {
|
|
184
|
+
case 'get_latest':
|
|
185
|
+
return getLatest(base, symbols);
|
|
186
|
+
case 'get_historical':
|
|
187
|
+
return getHistorical(args.date as string, base, symbols);
|
|
188
|
+
case 'get_timeseries':
|
|
189
|
+
return getTimeseries(
|
|
190
|
+
args.start_date as string,
|
|
191
|
+
args.end_date as string,
|
|
192
|
+
base,
|
|
193
|
+
symbols,
|
|
194
|
+
);
|
|
195
|
+
case 'list_currencies':
|
|
196
|
+
return listCurrencies();
|
|
197
|
+
default:
|
|
198
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async function getLatest(base?: string, symbols?: string) {
|
|
203
|
+
const params: Record<string, string> = {};
|
|
204
|
+
if (base) params['base'] = base;
|
|
205
|
+
if (symbols) params['symbols'] = symbols;
|
|
206
|
+
|
|
207
|
+
const data = (await apiGet('/v1/latest', params)) as {
|
|
208
|
+
base: string;
|
|
209
|
+
date: string;
|
|
210
|
+
rates: Record<string, number>;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
return {
|
|
214
|
+
base: data.base,
|
|
215
|
+
date: data.date,
|
|
216
|
+
rates: data.rates,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async function getHistorical(date: string, base?: string, symbols?: string) {
|
|
221
|
+
if (!date || !/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
222
|
+
throw new Error('get_historical requires `date` in YYYY-MM-DD format (e.g. "2024-01-15"). ECB rates available from 1999-01-04 onward.');
|
|
223
|
+
}
|
|
224
|
+
const params: Record<string, string> = {};
|
|
225
|
+
if (base) params['base'] = base;
|
|
226
|
+
if (symbols) params['symbols'] = symbols;
|
|
227
|
+
|
|
228
|
+
const data = (await apiGet(`/v1/${date}`, params)) as {
|
|
229
|
+
base: string;
|
|
230
|
+
date: string;
|
|
231
|
+
rates: Record<string, number>;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
return {
|
|
235
|
+
base: data.base,
|
|
236
|
+
date: data.date,
|
|
237
|
+
rates: data.rates,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async function getTimeseries(startDate: string, endDate: string, base?: string, symbols?: string) {
|
|
242
|
+
const params: Record<string, string> = {};
|
|
243
|
+
if (base) params['base'] = base;
|
|
244
|
+
if (symbols) params['symbols'] = symbols;
|
|
245
|
+
|
|
246
|
+
const data = (await apiGet(`/v1/${startDate}..${endDate}`, params)) as {
|
|
247
|
+
base: string;
|
|
248
|
+
start_date: string;
|
|
249
|
+
end_date: string;
|
|
250
|
+
rates: Record<string, Record<string, number>>;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
return {
|
|
254
|
+
base: data.base,
|
|
255
|
+
start_date: data.start_date,
|
|
256
|
+
end_date: data.end_date,
|
|
257
|
+
rates: data.rates,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
async function listCurrencies() {
|
|
262
|
+
const data = (await apiGet('/v1/currencies')) as Record<string, string>;
|
|
263
|
+
|
|
264
|
+
return {
|
|
265
|
+
count: Object.keys(data).length,
|
|
266
|
+
currencies: Object.entries(data).map(([code, name]) => ({ code, name })),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|