@allratestoday/mcp-server 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AllRatesToday
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,111 @@
1
+ # AllRatesToday MCP Server
2
+
3
+ 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 financial news from [AllRatesToday](https://allratestoday.com).
4
+
5
+ Ask your assistant things like:
6
+
7
+ - *"What's the current USD to EUR rate?"*
8
+ - *"Show me the GBP/JPY rate over the last 30 days."*
9
+ - *"Convert 250 USD into CAD using a real rate."*
10
+ - *"List every supported currency."*
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm install -g @allratestoday/mcp-server
16
+ ```
17
+
18
+ Or run without installing via `npx @allratestoday/mcp-server`.
19
+
20
+ ## Quick setup
21
+
22
+ ### Claude Code
23
+
24
+ ```bash
25
+ claude mcp add allratestoday -- npx -y @allratestoday/mcp-server
26
+ ```
27
+
28
+ Then set your API key:
29
+
30
+ ```bash
31
+ claude mcp env allratestoday ALLRATES_API_KEY=art_live_xxxxx
32
+ ```
33
+
34
+ ### Cursor
35
+
36
+ Edit `~/.cursor/mcp.json` (or your project `.cursor/mcp.json`):
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "allratestoday": {
42
+ "command": "npx",
43
+ "args": ["-y", "@allratestoday/mcp-server"],
44
+ "env": {
45
+ "ALLRATES_API_KEY": "art_live_xxxxx"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Claude Desktop
53
+
54
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "allratestoday": {
60
+ "command": "npx",
61
+ "args": ["-y", "@allratestoday/mcp-server"],
62
+ "env": {
63
+ "ALLRATES_API_KEY": "art_live_xxxxx"
64
+ }
65
+ }
66
+ }
67
+ }
68
+ ```
69
+
70
+ Restart the app after editing.
71
+
72
+ ## Get an API key
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`.
77
+
78
+ The free plan includes 300 requests/month. Paid plans start at €4.99/mo.
79
+
80
+ ## Tools exposed
81
+
82
+ | Tool | API key | Description |
83
+ |---|---|---|
84
+ | `get_exchange_rate` | no | Current mid-market rate between two currencies. |
85
+ | `get_historical_rates` | no | 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. |
88
+ | `get_financial_news` | no | Latest financial news from major sources. |
89
+
90
+ Public endpoints work without a key — set `ALLRATES_API_KEY` only if you want higher limits or to use the authenticated endpoint.
91
+
92
+ ## Environment variables
93
+
94
+ | Variable | Default | Purpose |
95
+ |---|---|---|
96
+ | `ALLRATES_API_KEY` | *(unset)* | Your AllRatesToday API key. Required for `get_rates_authenticated`. |
97
+ | `ALLRATES_BASE_URL` | `https://allratestoday.com/api` | Override for self-hosted or staging environments. |
98
+
99
+ ## Development
100
+
101
+ ```bash
102
+ git clone https://github.com/cahthuranag/mcp-server.git
103
+ cd mcp-server
104
+ npm install
105
+ npm run build
106
+ node dist/index.js # server runs on stdio — hit Ctrl+C to exit
107
+ ```
108
+
109
+ ## License
110
+
111
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,63 @@
1
+ export interface ClientOptions {
2
+ apiKey?: string;
3
+ baseUrl?: string;
4
+ fetchImpl?: typeof fetch;
5
+ }
6
+ export declare class AllRatesTodayError extends Error {
7
+ readonly status?: number | undefined;
8
+ readonly body?: unknown | undefined;
9
+ constructor(message: string, status?: number | undefined, body?: unknown | undefined);
10
+ }
11
+ export declare class AllRatesTodayClient {
12
+ private readonly apiKey?;
13
+ private readonly baseUrl;
14
+ private readonly fetchImpl;
15
+ constructor(options?: ClientOptions);
16
+ private request;
17
+ getRate(source: string, target: string): Promise<{
18
+ rate: number;
19
+ source: string;
20
+ }>;
21
+ getHistoricalRates(source: string, target: string, period?: '1d' | '7d' | '30d' | '1y'): Promise<{
22
+ source: string;
23
+ target: string;
24
+ period: string;
25
+ source_api?: string;
26
+ data: {
27
+ date: string;
28
+ rate: number;
29
+ timestamp: number;
30
+ }[];
31
+ }>;
32
+ getAuthenticatedRates(params: {
33
+ source?: string;
34
+ target?: string;
35
+ time?: string;
36
+ group?: 'hour' | 'day' | 'week' | 'month';
37
+ }): Promise<{
38
+ rate: number;
39
+ source: string;
40
+ target: string;
41
+ time: string;
42
+ }[]>;
43
+ listSymbols(): Promise<{
44
+ currencies: {
45
+ code: string;
46
+ name: string;
47
+ symbol: string;
48
+ }[];
49
+ count: number;
50
+ }>;
51
+ getNews(): Promise<{
52
+ status: string;
53
+ totalResults: number;
54
+ articles: {
55
+ title: string;
56
+ description?: string;
57
+ url: string;
58
+ image?: string;
59
+ publishedAt?: string;
60
+ source?: string;
61
+ }[];
62
+ }>;
63
+ }
package/dist/client.js ADDED
@@ -0,0 +1,73 @@
1
+ const DEFAULT_BASE_URL = 'https://allratestoday.com/api';
2
+ const USER_AGENT = `allratestoday-mcp/0.1.0`;
3
+ export class AllRatesTodayError extends Error {
4
+ status;
5
+ body;
6
+ constructor(message, status, body) {
7
+ super(message);
8
+ this.status = status;
9
+ this.body = body;
10
+ this.name = 'AllRatesTodayError';
11
+ }
12
+ }
13
+ export class AllRatesTodayClient {
14
+ apiKey;
15
+ baseUrl;
16
+ fetchImpl;
17
+ constructor(options = {}) {
18
+ this.apiKey = options.apiKey;
19
+ this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
20
+ this.fetchImpl = options.fetchImpl ?? fetch;
21
+ }
22
+ async request(path, query, requireAuth = false) {
23
+ const url = new URL(this.baseUrl + path);
24
+ for (const [key, value] of Object.entries(query)) {
25
+ if (value !== undefined && value !== '')
26
+ url.searchParams.set(key, value);
27
+ }
28
+ const headers = {
29
+ 'Accept': 'application/json',
30
+ 'User-Agent': USER_AGENT,
31
+ };
32
+ if (requireAuth) {
33
+ if (!this.apiKey) {
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}`;
40
+ }
41
+ const res = await this.fetchImpl(url.toString(), { method: 'GET', headers });
42
+ const text = await res.text();
43
+ let body;
44
+ try {
45
+ body = text ? JSON.parse(text) : null;
46
+ }
47
+ catch {
48
+ body = text;
49
+ }
50
+ if (!res.ok) {
51
+ const msg = (body && typeof body === 'object' && 'error' in body && typeof body.error === 'string'
52
+ ? body.error
53
+ : `HTTP ${res.status}`);
54
+ throw new AllRatesTodayError(msg, res.status, body);
55
+ }
56
+ return body;
57
+ }
58
+ getRate(source, target) {
59
+ return this.request('/rate', { source, target });
60
+ }
61
+ getHistoricalRates(source, target, period = '7d') {
62
+ return this.request('/historical-rates', { source, target, period });
63
+ }
64
+ getAuthenticatedRates(params) {
65
+ return this.request('/v1/rates', params, true);
66
+ }
67
+ listSymbols() {
68
+ return this.request('/v1/symbols', {});
69
+ }
70
+ getNews() {
71
+ return this.request('/news', {});
72
+ }
73
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,135 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
+ import { AllRatesTodayClient, AllRatesTodayError } from './client.js';
6
+ const CCY = {
7
+ type: 'string',
8
+ description: 'ISO 4217 currency code (e.g. USD, EUR, GBP).',
9
+ minLength: 3,
10
+ maxLength: 3,
11
+ };
12
+ const tools = [
13
+ {
14
+ name: 'get_exchange_rate',
15
+ description: 'Get the current mid-market exchange rate between two currencies. Returns a single rate number. No API key required.',
16
+ inputSchema: {
17
+ type: 'object',
18
+ additionalProperties: false,
19
+ properties: {
20
+ source: CCY,
21
+ target: CCY,
22
+ },
23
+ required: ['source', 'target'],
24
+ },
25
+ },
26
+ {
27
+ name: 'get_historical_rates',
28
+ description: 'Get historical exchange-rate data points for a currency pair over a period. Periods: 1d (hourly), 7d (daily), 30d (daily), 1y (weekly). No API key required.',
29
+ inputSchema: {
30
+ type: 'object',
31
+ additionalProperties: false,
32
+ properties: {
33
+ source: CCY,
34
+ target: CCY,
35
+ period: {
36
+ type: 'string',
37
+ enum: ['1d', '7d', '30d', '1y'],
38
+ default: '7d',
39
+ description: 'Time period to fetch history for.',
40
+ },
41
+ },
42
+ required: ['source', 'target'],
43
+ },
44
+ },
45
+ {
46
+ name: 'get_rates_authenticated',
47
+ description: 'Get rates with higher limits and multi-target support. Requires an AllRatesToday API key (ALLRATES_API_KEY). Supports comma-separated targets like "EUR,GBP,JPY".',
48
+ inputSchema: {
49
+ type: 'object',
50
+ additionalProperties: false,
51
+ properties: {
52
+ source: CCY,
53
+ target: {
54
+ type: 'string',
55
+ description: 'One or more target codes, comma-separated.',
56
+ },
57
+ time: {
58
+ type: 'string',
59
+ format: 'date-time',
60
+ description: 'Optional historical ISO 8601 timestamp.',
61
+ },
62
+ group: {
63
+ type: 'string',
64
+ enum: ['hour', 'day', 'week', 'month'],
65
+ description: 'Optional grouping window.',
66
+ },
67
+ },
68
+ required: ['source', 'target'],
69
+ },
70
+ },
71
+ {
72
+ name: 'list_currencies',
73
+ description: 'List all supported currencies with code, name, and symbol. No API key required. Cached 24h upstream.',
74
+ inputSchema: { type: 'object', additionalProperties: false, properties: {} },
75
+ },
76
+ {
77
+ name: 'get_financial_news',
78
+ description: 'Get the latest financial and currency-market news from Bloomberg, Investing.com, and Google News. No API key required.',
79
+ inputSchema: { type: 'object', additionalProperties: false, properties: {} },
80
+ },
81
+ ];
82
+ function text(s) {
83
+ const out = typeof s === 'string' ? s : JSON.stringify(s, null, 2);
84
+ return { content: [{ type: 'text', text: out }] };
85
+ }
86
+ async function main() {
87
+ const client = new AllRatesTodayClient({
88
+ apiKey: process.env.ALLRATES_API_KEY,
89
+ baseUrl: process.env.ALLRATES_BASE_URL,
90
+ });
91
+ const server = new Server({ name: 'allratestoday-mcp', version: '0.1.0' }, { capabilities: { tools: {} } });
92
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
93
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
94
+ const { name, arguments: args = {} } = req.params;
95
+ try {
96
+ switch (name) {
97
+ case 'get_exchange_rate': {
98
+ const { source, target } = args;
99
+ return text(await client.getRate(source, target));
100
+ }
101
+ case 'get_historical_rates': {
102
+ const { source, target, period = '7d' } = args;
103
+ return text(await client.getHistoricalRates(source, target, period));
104
+ }
105
+ case 'get_rates_authenticated': {
106
+ return text(await client.getAuthenticatedRates(args));
107
+ }
108
+ case 'list_currencies': {
109
+ return text(await client.listSymbols());
110
+ }
111
+ case 'get_financial_news': {
112
+ return text(await client.getNews());
113
+ }
114
+ default:
115
+ return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
116
+ }
117
+ }
118
+ catch (err) {
119
+ const message = err instanceof AllRatesTodayError
120
+ ? `AllRatesToday error${err.status ? ` (${err.status})` : ''}: ${err.message}`
121
+ : err instanceof Error
122
+ ? err.message
123
+ : String(err);
124
+ return { content: [{ type: 'text', text: message }], isError: true };
125
+ }
126
+ });
127
+ const transport = new StdioServerTransport();
128
+ await server.connect(transport);
129
+ // Keep process alive; stdio transport handles shutdown.
130
+ }
131
+ main().catch((err) => {
132
+ // eslint-disable-next-line no-console
133
+ console.error('Fatal:', err);
134
+ process.exit(1);
135
+ });
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@allratestoday/mcp-server",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for AllRatesToday — let AI coding tools (Claude Code, Cursor, Claude Desktop) fetch real-time and historical currency exchange rates.",
5
+ "keywords": [
6
+ "mcp",
7
+ "model-context-protocol",
8
+ "claude",
9
+ "cursor",
10
+ "currency",
11
+ "exchange-rate",
12
+ "forex",
13
+ "allratestoday"
14
+ ],
15
+ "license": "MIT",
16
+ "homepage": "https://allratestoday.com",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/cahthuranag/mcp-server.git"
20
+ },
21
+ "bugs": "https://github.com/cahthuranag/mcp-server/issues",
22
+ "type": "module",
23
+ "main": "dist/index.js",
24
+ "bin": {
25
+ "allratestoday-mcp": "dist/index.js"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "prepublishOnly": "npm run build",
38
+ "start": "node dist/index.js",
39
+ "dev": "tsc --watch"
40
+ },
41
+ "dependencies": {
42
+ "@modelcontextprotocol/sdk": "^1.0.4",
43
+ "zod": "^3.23.8"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^20.14.0",
47
+ "typescript": "^5.5.0"
48
+ }
49
+ }