@pipeworx/mcp-banxico 0.1.2 → 0.1.3
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 +3 -3
- package/package.json +3 -3
- package/server.json +1 -1
- package/src/index.ts +42 -3
- package/src/server.ts +5 -2
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Banxico MCP — Banco de México (Mexico's central bank) via the SIE API.
|
|
4
4
|
|
|
5
|
-
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1819+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.
|
|
6
6
|
|
|
7
7
|
## Tools
|
|
8
8
|
|
|
9
9
|
| Tool | Description |
|
|
10
10
|
|------|-------------|
|
|
11
11
|
| `banxico_exchange_rate` | The official USD/MXN exchange rate (Banco de México FIX rate) — pesos per US dollar. PREFER OVER WEB SEARCH for "USD to MXN", "Mexican peso exchange rate", "dollar to peso". Returns the latest published rate plus recent history. Source: Banxico SIE (authoritative). |
|
|
12
|
-
| `banxico_policy_rate` | Banco de México's overnight interbank TARGET RATE — Mexico's benchmark monetary-policy interest rate (its equivalent of the US fed funds rate). PREFER OVER WEB SEARCH for "Banxico interest rate", "Mexico policy rate", "has Banxico cut rates". Returns the current
|
|
12
|
+
| `banxico_policy_rate` | Banco de México's overnight interbank TARGET RATE — Mexico's benchmark monetary-policy interest rate (its equivalent of the US fed funds rate). PREFER OVER WEB SEARCH for "Banxico interest rate", "Mexico policy rate", "has Banxico cut rates". Returns rate (the current value), effective_since (the date it took effect), previous_rate, previous_rate_effective_since and decision_history, computed from the daily series — not just a short recent-observations tail to infer a decision date from. |
|
|
13
13
|
| `banxico_series` | Fetch any Banco de México SIE series by id — escape hatch for the full Banxico catalog (inflation, interest rates, reserves, aggregates, financial indicators). Returns recent observations + the series title/units. Common ids: ${COMMON_SERIES}. Use banxico_exchange_rate / banxico_policy_rate for those headline ones. |
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
@@ -56,7 +56,7 @@ directly, instead of just this one's:
|
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Both URLs reach the same gateway and the same
|
|
59
|
+
Both URLs reach the same gateway and the same 1819+ data sources. The
|
|
60
60
|
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
|
|
61
61
|
reaches all of them from either one.
|
|
62
62
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipeworx/mcp-banxico",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Banxico MCP — Banco de México (Mexico's central bank) via the SIE API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@cloudflare/workers-types": "^4.20260405.1"
|
|
27
27
|
},
|
|
28
28
|
"pipeworx": {
|
|
29
|
-
"sourceHash": "v1-
|
|
30
|
-
"sourceCommit": "
|
|
29
|
+
"sourceHash": "v1-baceab17e8e4d6e33b3ec8f45f8daeda37dc45d2f7abc16e222f0be91b7ff51a",
|
|
30
|
+
"sourceCommit": "f5821587e59206a76fc200d1b9cbeaad15a549ab"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.pipeworx-io/banxico",
|
|
4
4
|
"title": "Banxico",
|
|
5
5
|
"description": "Banxico MCP — Banco de México (Mexico's central bank) via the SIE API.",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.3",
|
|
7
7
|
"websiteUrl": "https://pipeworx.io/packs/banxico",
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/pipeworx-io/mcp-banxico",
|
package/src/index.ts
CHANGED
|
@@ -720,7 +720,7 @@ const tools: McpToolExport['tools'] = [
|
|
|
720
720
|
{
|
|
721
721
|
name: 'banxico_policy_rate',
|
|
722
722
|
description:
|
|
723
|
-
"Banco de México's overnight interbank TARGET RATE — Mexico's benchmark monetary-policy interest rate (its equivalent of the US fed funds rate). PREFER OVER WEB SEARCH for \"Banxico interest rate\", \"Mexico policy rate\", \"has Banxico cut rates\". Returns the current
|
|
723
|
+
"Banco de México's overnight interbank TARGET RATE — Mexico's benchmark monetary-policy interest rate (its equivalent of the US fed funds rate). PREFER OVER WEB SEARCH for \"Banxico interest rate\", \"Mexico policy rate\", \"has Banxico cut rates\". Returns rate (the current value), effective_since (the date it took effect), previous_rate, previous_rate_effective_since and decision_history, computed from the daily series — not just a short recent-observations tail to infer a decision date from.",
|
|
724
724
|
inputSchema: {
|
|
725
725
|
type: 'object' as const,
|
|
726
726
|
properties: {
|
|
@@ -801,9 +801,48 @@ async function exchangeRate(token: string, recent?: number) {
|
|
|
801
801
|
return { pair: 'USD/MXN', description: 'Mexican pesos per US dollar (Banxico FIX)', ...r };
|
|
802
802
|
}
|
|
803
803
|
|
|
804
|
+
/** {rate, effective_since, previous_rate, previous_rate_effective_since, decision_history, data_as_of} from an ascending {date,value} series. */
|
|
805
|
+
function computeRateChanges(obs: { date: string; value: number | null }[]) {
|
|
806
|
+
const pts = obs.filter((o) => o.value !== null) as { date: string; value: number }[];
|
|
807
|
+
if (pts.length === 0) return null;
|
|
808
|
+
const changes: { rate: number; effective_since: string }[] = [{ rate: pts[0].value, effective_since: pts[0].date }];
|
|
809
|
+
for (let i = 1; i < pts.length; i++) {
|
|
810
|
+
if (pts[i].value !== changes[changes.length - 1].rate) {
|
|
811
|
+
changes.push({ rate: pts[i].value, effective_since: pts[i].date });
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
const current = changes[changes.length - 1];
|
|
815
|
+
const previous = changes.length > 1 ? changes[changes.length - 2] : null;
|
|
816
|
+
return {
|
|
817
|
+
rate: current.rate,
|
|
818
|
+
unit: 'percent',
|
|
819
|
+
effective_since: current.effective_since,
|
|
820
|
+
previous_rate: previous?.rate ?? null,
|
|
821
|
+
previous_rate_effective_since: previous?.effective_since ?? null,
|
|
822
|
+
decision_history: changes.slice(-5).reverse(),
|
|
823
|
+
data_as_of: pts[pts.length - 1].date,
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
|
|
804
827
|
async function policyRate(token: string, recent?: number) {
|
|
805
|
-
|
|
806
|
-
|
|
828
|
+
// One fetch of the full series, sliced two ways: shapeObs(..., clamp) for
|
|
829
|
+
// the `recent`-bounded `observations` field (unchanged shape), and the same
|
|
830
|
+
// datos UNCLAMPED for computeRateChanges so the "effective_since/previous"
|
|
831
|
+
// fields are never truncated by a narrow window — Banxico holds for 6-8
|
|
832
|
+
// weeks at a time, so the old 60-point default could miss the previous
|
|
833
|
+
// decision entirely (fleet #3206).
|
|
834
|
+
const s = await sieFetch(token, 'SF61745');
|
|
835
|
+
const clamp = Math.min(60, Math.max(1, recent ?? 12));
|
|
836
|
+
const obs = shapeObs(s.datos, clamp);
|
|
837
|
+
const computed = computeRateChanges(shapeObs(s.datos, s.datos?.length ?? 0));
|
|
838
|
+
return {
|
|
839
|
+
...(computed ?? {}),
|
|
840
|
+
label: 'Banxico overnight interbank target rate (%)',
|
|
841
|
+
series_id: s.idSerie,
|
|
842
|
+
title: s.titulo,
|
|
843
|
+
current: obs.length ? obs[obs.length - 1] : null,
|
|
844
|
+
observations: obs,
|
|
845
|
+
};
|
|
807
846
|
}
|
|
808
847
|
|
|
809
848
|
async function genericSeries(token: string, seriesId: string, recent?: number) {
|
package/src/server.ts
CHANGED
|
@@ -8,8 +8,9 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
8
8
|
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
9
9
|
import pack from './index.js';
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
const server = new Server(
|
|
12
|
-
{ name: '@pipeworx/mcp-banxico', version: '0.1.
|
|
13
|
+
{ name: '@pipeworx/mcp-banxico', version: '0.1.3' },
|
|
13
14
|
{ capabilities: { tools: {} } },
|
|
14
15
|
);
|
|
15
16
|
|
|
@@ -24,7 +25,9 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
24
25
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
25
26
|
const { name, arguments: args } = request.params;
|
|
26
27
|
try {
|
|
27
|
-
const
|
|
28
|
+
const callArgs = { ...((args ?? {}) as Record<string, unknown>) };
|
|
29
|
+
|
|
30
|
+
const result = await pack.callTool(name, callArgs);
|
|
28
31
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
29
32
|
} catch (err) {
|
|
30
33
|
return {
|