@allratestoday/mcp-server 0.2.0 → 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 +24 -15
- package/dist/client.js +7 -12
- package/dist/index.js +23 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# AllRatesToday MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English | [简体中文](./README-zh-CN.md)
|
|
4
|
+
|
|
5
|
+
MCP server that gives AI coding tools — **Claude Code**, **Cursor**, **Claude Desktop**, and any other Model Context Protocol client — real-time currency exchange rates, historical data, and multi-currency lookups from [AllRatesToday](https://allratestoday.com).
|
|
4
6
|
|
|
5
7
|
Ask your assistant things like:
|
|
6
8
|
|
|
@@ -9,6 +11,17 @@ Ask your assistant things like:
|
|
|
9
11
|
- *"Convert 250 USD into CAD using a real rate."*
|
|
10
12
|
- *"List every supported currency."*
|
|
11
13
|
|
|
14
|
+
## Get an API key first (required)
|
|
15
|
+
|
|
16
|
+
The MCP server needs an AllRatesToday API key to start. **The free plan is enough** — 300 requests/month, no card required.
|
|
17
|
+
|
|
18
|
+
1. Register at [allratestoday.com/register](https://allratestoday.com/register) — takes 30 seconds
|
|
19
|
+
2. Verify your email
|
|
20
|
+
3. Copy your key from the dashboard — it looks like `art_live_xxxxx`
|
|
21
|
+
4. Set it as `ALLRATES_API_KEY` in your MCP client config (examples below)
|
|
22
|
+
|
|
23
|
+
The server will refuse to start without a key and print registration instructions in the console.
|
|
24
|
+
|
|
12
25
|
## Install
|
|
13
26
|
|
|
14
27
|
```bash
|
|
@@ -69,30 +82,26 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) o
|
|
|
69
82
|
|
|
70
83
|
Restart the app after editing.
|
|
71
84
|
|
|
72
|
-
##
|
|
73
|
-
|
|
74
|
-
1. Register at [allratestoday.com/register](https://allratestoday.com/register).
|
|
75
|
-
2. Verify your email.
|
|
76
|
-
3. Copy your key from the dashboard — it looks like `art_live_xxxxx`.
|
|
85
|
+
## Plans
|
|
77
86
|
|
|
78
|
-
The free plan includes 300 requests/month. Paid plans start at €4.99/mo.
|
|
87
|
+
The free plan includes 300 requests/month. Paid plans start at €4.99/mo for higher limits and historical data going back years. See [allratestoday.com/pricing](https://allratestoday.com/pricing).
|
|
79
88
|
|
|
80
89
|
## Tools exposed
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
|---|---|---|
|
|
84
|
-
| `get_exchange_rate` | no | Current mid-market rate between two currencies. |
|
|
85
|
-
| `get_historical_rates` | yes | Historical data points over `1d`, `7d`, `30d`, or `1y`. |
|
|
86
|
-
| `get_rates_authenticated` | yes | Multi-target rates and higher limits. |
|
|
87
|
-
| `list_currencies` | no | All supported currencies with codes, names, symbols. |
|
|
91
|
+
All four tools require an `ALLRATES_API_KEY`.
|
|
88
92
|
|
|
89
|
-
|
|
93
|
+
| Tool | Description |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `get_exchange_rate` | Current mid-market rate between two currencies. |
|
|
96
|
+
| `get_historical_rates` | Historical data points over `1d`, `7d`, `30d`, or `1y`. |
|
|
97
|
+
| `get_rates_authenticated` | Multi-target rates and higher limits. |
|
|
98
|
+
| `list_currencies` | All supported currencies with codes, names, symbols. |
|
|
90
99
|
|
|
91
100
|
## Environment variables
|
|
92
101
|
|
|
93
102
|
| Variable | Default | Purpose |
|
|
94
103
|
|---|---|---|
|
|
95
|
-
| `ALLRATES_API_KEY` | *(
|
|
104
|
+
| `ALLRATES_API_KEY` | *(required)* | Your AllRatesToday API key. Server will not start without it. |
|
|
96
105
|
| `ALLRATES_BASE_URL` | `https://allratestoday.com/api` | Override for self-hosted or staging environments. |
|
|
97
106
|
|
|
98
107
|
## Development
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const DEFAULT_BASE_URL = 'https://allratestoday.com/api';
|
|
2
|
-
const USER_AGENT = `allratestoday-mcp/0.
|
|
2
|
+
const USER_AGENT = `allratestoday-mcp/0.3.1`;
|
|
3
3
|
export class AllRatesTodayError extends Error {
|
|
4
4
|
status;
|
|
5
5
|
body;
|
|
@@ -19,7 +19,7 @@ export class AllRatesTodayClient {
|
|
|
19
19
|
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
20
20
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
21
21
|
}
|
|
22
|
-
async request(path, query
|
|
22
|
+
async request(path, query) {
|
|
23
23
|
const url = new URL(this.baseUrl + path);
|
|
24
24
|
for (const [key, value] of Object.entries(query)) {
|
|
25
25
|
if (value !== undefined && value !== '')
|
|
@@ -29,15 +29,10 @@ export class AllRatesTodayClient {
|
|
|
29
29
|
'Accept': 'application/json',
|
|
30
30
|
'User-Agent': USER_AGENT,
|
|
31
31
|
};
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
throw new AllRatesTodayError('This endpoint requires an API key. Set ALLRATES_API_KEY or pass apiKey in the MCP config.');
|
|
35
|
-
}
|
|
36
|
-
headers['Authorization'] = `Bearer ${this.apiKey}`;
|
|
37
|
-
}
|
|
38
|
-
else if (this.apiKey) {
|
|
39
|
-
headers['Authorization'] = `Bearer ${this.apiKey}`;
|
|
32
|
+
if (!this.apiKey) {
|
|
33
|
+
throw new AllRatesTodayError('AllRatesToday API key is required. Sign up free at https://allratestoday.com/register to get a key, then set ALLRATES_API_KEY in your MCP config.');
|
|
40
34
|
}
|
|
35
|
+
headers['Authorization'] = `Bearer ${this.apiKey}`;
|
|
41
36
|
const res = await this.fetchImpl(url.toString(), { method: 'GET', headers });
|
|
42
37
|
const text = await res.text();
|
|
43
38
|
let body;
|
|
@@ -59,10 +54,10 @@ export class AllRatesTodayClient {
|
|
|
59
54
|
return this.request('/rate', { source, target });
|
|
60
55
|
}
|
|
61
56
|
getHistoricalRates(source, target, period = '7d') {
|
|
62
|
-
return this.request('/historical-rates', { source, target, period }
|
|
57
|
+
return this.request('/historical-rates', { source, target, period });
|
|
63
58
|
}
|
|
64
59
|
getAuthenticatedRates(params) {
|
|
65
|
-
return this.request('/v1/rates', params
|
|
60
|
+
return this.request('/v1/rates', params);
|
|
66
61
|
}
|
|
67
62
|
listSymbols() {
|
|
68
63
|
return this.request('/v1/symbols', {});
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const CCY = {
|
|
|
12
12
|
const tools = [
|
|
13
13
|
{
|
|
14
14
|
name: 'get_exchange_rate',
|
|
15
|
-
description: 'Get the current mid-market exchange rate between two currencies. Returns a single rate number.
|
|
15
|
+
description: 'Get the current mid-market exchange rate between two currencies. Returns a single rate number. Requires a free AllRatesToday API key (ALLRATES_API_KEY) — sign up at https://allratestoday.com/register.',
|
|
16
16
|
inputSchema: {
|
|
17
17
|
type: 'object',
|
|
18
18
|
additionalProperties: false,
|
|
@@ -70,7 +70,7 @@ const tools = [
|
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
name: 'list_currencies',
|
|
73
|
-
description: 'List all supported currencies with code, name, and symbol.
|
|
73
|
+
description: 'List all supported currencies with code, name, and symbol. Requires a free AllRatesToday API key (ALLRATES_API_KEY) — sign up at https://allratestoday.com/register. Cached 24h upstream.',
|
|
74
74
|
inputSchema: { type: 'object', additionalProperties: false, properties: {} },
|
|
75
75
|
},
|
|
76
76
|
];
|
|
@@ -79,11 +79,30 @@ function text(s) {
|
|
|
79
79
|
return { content: [{ type: 'text', text: out }] };
|
|
80
80
|
}
|
|
81
81
|
async function main() {
|
|
82
|
+
const apiKey = process.env.ALLRATES_API_KEY;
|
|
83
|
+
if (!apiKey) {
|
|
84
|
+
console.error([
|
|
85
|
+
'',
|
|
86
|
+
' AllRatesToday MCP server requires an API key.',
|
|
87
|
+
'',
|
|
88
|
+
' 1. Sign up free at https://allratestoday.com/register (300 requests/month, no card required)',
|
|
89
|
+
' 2. Copy your API key from the dashboard',
|
|
90
|
+
' 3. Set ALLRATES_API_KEY in your MCP client config:',
|
|
91
|
+
'',
|
|
92
|
+
' "allratestoday": {',
|
|
93
|
+
' "command": "npx",',
|
|
94
|
+
' "args": ["-y", "@allratestoday/mcp-server"],',
|
|
95
|
+
' "env": { "ALLRATES_API_KEY": "art_live_..." }',
|
|
96
|
+
' }',
|
|
97
|
+
'',
|
|
98
|
+
].join('\n'));
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
82
101
|
const client = new AllRatesTodayClient({
|
|
83
|
-
apiKey
|
|
102
|
+
apiKey,
|
|
84
103
|
baseUrl: process.env.ALLRATES_BASE_URL,
|
|
85
104
|
});
|
|
86
|
-
const server = new Server({ name: 'allratestoday-mcp', version: '0.
|
|
105
|
+
const server = new Server({ name: 'allratestoday-mcp', version: '0.3.1' }, { capabilities: { tools: {} } });
|
|
87
106
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
|
|
88
107
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
89
108
|
const { name, arguments: args = {} } = req.params;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allratestoday/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"mcpName": "io.github.cahthuranag/mcp-server",
|
|
5
5
|
"description": "MCP server for AllRatesToday — let AI coding tools (Claude Code, Cursor, Claude Desktop) fetch real-time and historical currency exchange rates.",
|
|
6
6
|
"keywords": [
|