@allratestoday/central-bank-mcp 0.2.3 → 0.3.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.
- package/README.md +5 -1
- package/dist/client.d.ts +12 -1
- package/dist/client.js +42 -0
- package/dist/index.js +24 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# Central Bank Rates MCP Server — @allratestoday/central-bank-mcp
|
|
2
2
|
|
|
3
|
+
Website: https://allratestoday.com/central-bank-rates-api/ · Hosted endpoint (no install): https://allratestoday.com/api/mcp · Docs: https://allratestoday.com/mcp/
|
|
4
|
+
|
|
3
5
|
[](https://www.npmjs.com/package/@allratestoday/central-bank-mcp)
|
|
4
6
|
[](https://www.npmjs.com/package/@allratestoday/central-bank-mcp)
|
|
5
7
|
[](./LICENSE)
|
|
6
8
|
[](https://modelcontextprotocol.io)
|
|
7
9
|
[](https://www.typescriptlang.org/)
|
|
8
10
|
|
|
9
|
-
**Give your AI assistant the official exchange rates that compliance, tax, and accounting actually require. A Model Context Protocol server that lets Claude Code, Cursor, Claude Desktop, Windsurf, and any MCP-compatible client fetch published central-bank and tax-authority rates from
|
|
11
|
+
**Give your AI assistant the official exchange rates that compliance, tax, and accounting actually require. A Model Context Protocol server that lets Claude Code, Cursor, Claude Desktop, Windsurf, and any MCP-compatible client fetch published central-bank and tax-authority rates from 121 central banks and 3 tax authorities — ECB, Fed, Bank of Japan, HMRC, US Treasury, and more — via the [AllRatesToday API](https://allratestoday.com/central-bank-rates-api/).**
|
|
10
12
|
|
|
11
13
|
After installation, your assistant can answer questions like:
|
|
12
14
|
|
|
@@ -41,6 +43,7 @@ Install it with no configuration at all and it starts, connects, and answers:
|
|
|
41
43
|
| `get_official_rate_history` | 🔑 | Same. |
|
|
42
44
|
| `compare_official_rates` | 🔑 | Same. |
|
|
43
45
|
| `get_publication_calendar` | 🔑 | Same. |
|
|
46
|
+
| `request_trial_key` | ✅ | Self-issues a 100-call, 7-day key with no account and adopts it for the session. |
|
|
44
47
|
|
|
45
48
|
The keyless path reads the open, edge-cached `/api/open/central-bank/{bank}`
|
|
46
49
|
endpoint — free to use with a visible attribution link back to allratestoday.com
|
|
@@ -146,6 +149,7 @@ Edit `claude_desktop_config.json` (Settings → Developer → Edit Config) and a
|
|
|
146
149
|
| `get_official_rate_history` | Date-by-date official series for one pair | Paid, billed ~1 call per month covered |
|
|
147
150
|
| `compare_official_rates` | One pair across every bank, with spread stats | Free (key required) |
|
|
148
151
|
| `get_publication_calendar` | Dates a bank actually published (no values) | Free (key required) |
|
|
152
|
+
| `request_trial_key` | Self-issue a 100-call, 7-day trial key (no account) and use it for the rest of the session | Keyless, 3 per IP per day |
|
|
149
153
|
|
|
150
154
|
## 🔒 Privacy
|
|
151
155
|
|
package/dist/client.d.ts
CHANGED
|
@@ -23,12 +23,23 @@ export interface CbRate {
|
|
|
23
23
|
value: number;
|
|
24
24
|
}
|
|
25
25
|
export declare class CentralBankClient {
|
|
26
|
-
private
|
|
26
|
+
private apiKey?;
|
|
27
27
|
private readonly baseUrl;
|
|
28
28
|
private readonly fetchImpl;
|
|
29
29
|
constructor(options?: ClientOptions);
|
|
30
30
|
/** True when no API key is configured: only the open endpoints are reachable. */
|
|
31
31
|
get keyless(): boolean;
|
|
32
|
+
/** Adopt a key at runtime (used after request_trial_key) so the rest of the session is keyed. */
|
|
33
|
+
setApiKey(key: string | undefined): void;
|
|
34
|
+
/**
|
|
35
|
+
* Self-issue a trial key (100 calls, 7 days, no account) and adopt it for the
|
|
36
|
+
* rest of this process. POST with a JSON body: the site rejects bodiless
|
|
37
|
+
* POSTs as cross-site form submissions.
|
|
38
|
+
*/
|
|
39
|
+
requestTrialKey(params?: {
|
|
40
|
+
agent?: string;
|
|
41
|
+
purpose?: string;
|
|
42
|
+
}): Promise<any>;
|
|
32
43
|
private request;
|
|
33
44
|
/**
|
|
34
45
|
* GET against the keyless, CORS-open, edge-cached /api/open/* surface.
|
package/dist/client.js
CHANGED
|
@@ -56,6 +56,48 @@ export class CentralBankClient {
|
|
|
56
56
|
get keyless() {
|
|
57
57
|
return !this.apiKey;
|
|
58
58
|
}
|
|
59
|
+
/** Adopt a key at runtime (used after request_trial_key) so the rest of the session is keyed. */
|
|
60
|
+
setApiKey(key) {
|
|
61
|
+
this.apiKey = key || undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Self-issue a trial key (100 calls, 7 days, no account) and adopt it for the
|
|
65
|
+
* rest of this process. POST with a JSON body: the site rejects bodiless
|
|
66
|
+
* POSTs as cross-site form submissions.
|
|
67
|
+
*/
|
|
68
|
+
async requestTrialKey(params = {}) {
|
|
69
|
+
const res = await this.fetchImpl(`${this.baseUrl}/agent/keys`, {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
headers: {
|
|
72
|
+
'Accept': 'application/json',
|
|
73
|
+
'Content-Type': 'application/json',
|
|
74
|
+
'User-Agent': `central-bank-mcp/${VERSION}`,
|
|
75
|
+
},
|
|
76
|
+
body: JSON.stringify({ agent: params.agent, purpose: params.purpose }),
|
|
77
|
+
});
|
|
78
|
+
const text = await res.text();
|
|
79
|
+
let body;
|
|
80
|
+
try {
|
|
81
|
+
body = text ? JSON.parse(text) : null;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
body = text;
|
|
85
|
+
}
|
|
86
|
+
if (!res.ok) {
|
|
87
|
+
const upstream = body && typeof body === 'object' && typeof body.error === 'string' ? body.error : undefined;
|
|
88
|
+
throw new CentralBankApiError(upstream ?? `HTTP ${res.status}`, res.status, body);
|
|
89
|
+
}
|
|
90
|
+
const key = body && typeof body === 'object' && typeof body.key === 'string' ? body.key : undefined;
|
|
91
|
+
if (key)
|
|
92
|
+
this.setApiKey(key);
|
|
93
|
+
return {
|
|
94
|
+
...(body ?? {}),
|
|
95
|
+
adopted: Boolean(key),
|
|
96
|
+
note: 'This server now uses the trial key for the rest of this session. To keep it after a restart, ' +
|
|
97
|
+
'put it in the MCP config: "env": { "ALLRATES_API_KEY": "<key>" }. For a lasting key register free ' +
|
|
98
|
+
'at https://allratestoday.com/register (300 calls) or see https://allratestoday.com/pricing.',
|
|
99
|
+
};
|
|
100
|
+
}
|
|
59
101
|
async request(path, query = {}) {
|
|
60
102
|
const url = new URL(this.baseUrl + path);
|
|
61
103
|
for (const [key, value] of Object.entries(query)) {
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ async function main() {
|
|
|
47
47
|
' Available now, no key needed:',
|
|
48
48
|
' • list_central_banks — every covered source',
|
|
49
49
|
' • get_official_rates — the latest published table (any source)',
|
|
50
|
+
' • request_trial_key — self-issue a 100-call, 7-day key without an account',
|
|
50
51
|
'',
|
|
51
52
|
' Needs a free API key (historical dates, time series, cross-bank compare,',
|
|
52
53
|
' publication calendars):',
|
|
@@ -166,6 +167,29 @@ async function main() {
|
|
|
166
167
|
return fail(err);
|
|
167
168
|
}
|
|
168
169
|
});
|
|
170
|
+
server.registerTool('request_trial_key', {
|
|
171
|
+
title: 'Request a trial API key',
|
|
172
|
+
description: 'Self-issue an AllRatesToday API key with 100 lifetime calls, valid 7 days, with no account and no email. Use it when another tool answered "needs an API key" and the user wants a dated central-bank table, a history series, a cross-bank comparison or a publication calendar right now. The key is adopted by this server for the rest of the session and returned once — tell the user to put it in the MCP config as ALLRATES_API_KEY to keep it. Capped at 3 keys per IP per day. For a lasting key, register at https://allratestoday.com/register (free, 300 calls) or see https://allratestoday.com/pricing.',
|
|
173
|
+
inputSchema: {
|
|
174
|
+
agent: z.string().max(80).optional().describe('Optional: the agent or product requesting the key.'),
|
|
175
|
+
purpose: z.string().max(200).optional().describe('Optional: one line on what the rates are for.'),
|
|
176
|
+
},
|
|
177
|
+
outputSchema: {
|
|
178
|
+
key: z.string().optional(),
|
|
179
|
+
calls: z.number().optional(),
|
|
180
|
+
expires_at: z.string().optional(),
|
|
181
|
+
adopted: z.boolean().describe('True when this server switched to the new key'),
|
|
182
|
+
note: z.string(),
|
|
183
|
+
},
|
|
184
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
185
|
+
}, async ({ agent, purpose }) => {
|
|
186
|
+
try {
|
|
187
|
+
return ok(await client.requestTrialKey({ agent, purpose }));
|
|
188
|
+
}
|
|
189
|
+
catch (err) {
|
|
190
|
+
return fail(err);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
169
193
|
const transport = new StdioServerTransport();
|
|
170
194
|
await server.connect(transport);
|
|
171
195
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allratestoday/central-bank-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"mcpName": "com.allratestoday/central-bank-mcp",
|
|
5
|
-
"description": "MCP server for official central-bank and tax-authority exchange rates — let AI tools (Claude Code, Cursor, Claude Desktop) fetch published rates from
|
|
5
|
+
"description": "MCP server for official central-bank and tax-authority exchange rates — let AI tools (Claude Code, Cursor, Claude Desktop) fetch published rates from 120+ institutions (ECB, Fed, HMRC, BOJ, ...) via the AllRatesToday API.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mcp",
|
|
8
8
|
"model-context-protocol",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dev": "tsc --watch"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
47
47
|
"zod": "^4.4.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|