nirium-mcp 0.4.0 → 0.5.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 +17 -8
- package/dist/index.js +109 -106
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# nirium-mcp
|
|
2
2
|
|
|
3
|
-
Model Context Protocol server for [Nirium](https://nirium.xyz) — exposes market data, autonomous treasury loop control, and x402/MPP paid
|
|
3
|
+
Model Context Protocol server for [Nirium](https://nirium.xyz) — exposes market data, autonomous treasury loop control, and x402/MPP paid endpoints to any MCP-compatible AI: Claude, GPT, Cursor, VS Code Copilot, and others.
|
|
4
4
|
|
|
5
5
|
Software-only. This server never holds funds — paid tools sign per-request payments from a Stellar wallet you control via `STELLAR_SECRET_KEY`.
|
|
6
6
|
|
|
@@ -31,23 +31,26 @@ No install needed — run directly with `npx`, or add to your MCP client config.
|
|
|
31
31
|
## Tools
|
|
32
32
|
|
|
33
33
|
**Free — no key required**
|
|
34
|
-
- `get_market_state` — XLM/USDC price, SDEX spread, base fee, Blend rate
|
|
34
|
+
- `get_market_state` — XLM/USDC price, SDEX spread, base fee, Blend rate, CETES rate
|
|
35
35
|
- `get_loop_status` — autonomous loop status, scan count, last AI decision
|
|
36
36
|
- `execute_demo` — dry-run a strategy via real Soroban simulation, no funds moved
|
|
37
37
|
- `get_wallet_info` — show the configured x402/MPP wallet and enabled tools
|
|
38
|
+
- `get_nodes` — list the execution nodes with live status, custody model and network
|
|
39
|
+
- `anchor_audit_record` — anchor a hash (or a small JSON record) to IPFS, get back a CID
|
|
40
|
+
- `get_reporting_summary` — settled payouts, x402/MPP receipts and anchors for a period
|
|
38
41
|
|
|
39
42
|
**Authenticated — requires `NIRIUM_API_KEY`**
|
|
40
43
|
- `start_loop` — start the autonomous scanning loop
|
|
41
44
|
- `stop_loop` — stop it
|
|
42
45
|
|
|
43
46
|
**Paid via x402 — requires a funded `STELLAR_SECRET_KEY`**
|
|
44
|
-
- `get_premium_signals` — $0.02 USDC —
|
|
45
|
-
- `get_premium_market` — $0.05 USDC —
|
|
46
|
-
- `execute_paid_strategy` — $0.25 USDC —
|
|
47
|
+
- `get_premium_signals` — $0.02 USDC — **testnet only**; signals come from the autonomous loop, which runs on testnet. They reference testnet tokens, which have no monetary value, and are not a recommendation to buy, sell or hold anything. The mainnet box returns 501 without charging.
|
|
48
|
+
- `get_premium_market` — $0.05 USDC — market state with reference rates attributed to their source, fee pressure and network conditions. Factual data, no advice.
|
|
49
|
+
- `execute_paid_strategy` — $0.25 USDC — **testnet only**; execution needs a signing key and the mainnet box holds none by design, so it returns 501 without charging.
|
|
47
50
|
|
|
48
51
|
**Paid via MPP — requires a funded `STELLAR_SECRET_KEY`**
|
|
49
|
-
- `get_mpp_signals` — $0.
|
|
50
|
-
- `get_mpp_market` — $0.
|
|
52
|
+
- `get_mpp_signals` — $0.02 USDC — same data and same testnet-only limit as `get_premium_signals`, settled via direct Soroban SAC transfer with no external facilitator
|
|
53
|
+
- `get_mpp_market` — $0.05 USDC — same as `get_premium_market`, MPP-settled
|
|
51
54
|
|
|
52
55
|
## Environment variables
|
|
53
56
|
|
|
@@ -57,7 +60,13 @@ No install needed — run directly with `npx`, or add to your MCP client config.
|
|
|
57
60
|
| `STELLAR_SECRET_KEY` | For paid tools | Funds x402 and MPP payments |
|
|
58
61
|
| `NIRIUM_API_KEY` | For `start_loop`/`stop_loop` | Agent API key from [nirium.xyz/keys](https://nirium.xyz/keys) |
|
|
59
62
|
| `STELLAR_NETWORK` | No (defaults to `testnet`) | `testnet` or `mainnet` |
|
|
60
|
-
| `SOROBAN_RPC_URL` |
|
|
63
|
+
| `SOROBAN_RPC_URL` | **Yes on mainnet** | Soroban RPC endpoint. Testnet falls back to the public one; mainnet has no open public RPC, so paid tools stay disabled until you set this. [Providers](https://developers.stellar.org/docs/data/apis/rpc/providers) |
|
|
64
|
+
|
|
65
|
+
### A note on anchoring
|
|
66
|
+
|
|
67
|
+
`anchor_audit_record` is an integrity seal — it proves a piece of data existed unchanged at a point in time. It is not notarization and carries no legal presumption of authenticity.
|
|
68
|
+
|
|
69
|
+
Anchor a **hash** of your data rather than the data itself. IPFS content cannot be deleted, so raw personal data would outlive any erasure request.
|
|
61
70
|
|
|
62
71
|
## Run from source
|
|
63
72
|
|
package/dist/index.js
CHANGED
|
@@ -4,18 +4,22 @@
|
|
|
4
4
|
// Copyright 2026 Nirium Protocol Contributors
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
// ═══════════════════════════════════════════════════════════════
|
|
7
|
-
// Nirium MCP Server v0.
|
|
7
|
+
// Nirium MCP Server v0.5.0 — x402 + MPP + node tool suite
|
|
8
8
|
// ═══════════════════════════════════════════════════════════════
|
|
9
9
|
//
|
|
10
10
|
// Exposes Nirium Protocol capabilities to any MCP-compatible AI:
|
|
11
11
|
// Claude, GPT, Codex, Cursor, VS Code Copilot, etc.
|
|
12
12
|
//
|
|
13
13
|
// Three tiers of tools:
|
|
14
|
-
// FREE — market data, loop status
|
|
14
|
+
// FREE — market data, loop status, node catalog, audit anchoring,
|
|
15
|
+
// reporting summaries (standard HTTP to agent API)
|
|
15
16
|
// PAID (x402) — premium signals via the OpenZeppelin Channels facilitator
|
|
16
17
|
// PAID (MPP) — same signals via direct Soroban SAC transfer,
|
|
17
18
|
// no external facilitator required
|
|
18
19
|
//
|
|
20
|
+
// Paid tools need STELLAR_SECRET_KEY, and on mainnet also SOROBAN_RPC_URL
|
|
21
|
+
// (Stellar publishes no open mainnet RPC). Free tools need neither.
|
|
22
|
+
//
|
|
19
23
|
// Usage (stdio transport, from source):
|
|
20
24
|
// STELLAR_SECRET_KEY=S... AGENT_API_URL=http://localhost:3001 npx tsx src/index.ts
|
|
21
25
|
//
|
|
@@ -46,17 +50,33 @@ const client_2 = require("@stellar/mpp/charge/client");
|
|
|
46
50
|
const API_URL = process.env.AGENT_API_URL || 'http://127.0.0.1:3001';
|
|
47
51
|
const STELLAR_KEY = process.env.STELLAR_SECRET_KEY || '';
|
|
48
52
|
const NIRIUM_API_KEY = process.env.NIRIUM_API_KEY || '';
|
|
49
|
-
const
|
|
53
|
+
const IS_MAINNET = process.env.STELLAR_NETWORK === 'mainnet';
|
|
54
|
+
const STELLAR_NET = (IS_MAINNET
|
|
50
55
|
? 'stellar:pubnet'
|
|
51
56
|
: stellar_2.STELLAR_TESTNET_CAIP2);
|
|
52
|
-
|
|
57
|
+
// El default de RPC solo sirve para testnet: Stellar no publica un RPC de
|
|
58
|
+
// mainnet abierto (el propio @x402/stellar lanza "mainnet requires a non-empty
|
|
59
|
+
// rpcUrl"). Sin este guard, mainnet caía al RPC de testnet con el network id de
|
|
60
|
+
// pubnet y el pago fallaba de forma confusa, con fondos reales. El RPC lo pone
|
|
61
|
+
// quien corre el server — el endpoint dedicado de Nirium lleva token y vive
|
|
62
|
+
// como secreto del backend, nunca dentro de un paquete publicado.
|
|
63
|
+
const RPC_URL = process.env.SOROBAN_RPC_URL
|
|
64
|
+
|| (IS_MAINNET ? '' : stellar_2.DEFAULT_TESTNET_RPC_URL);
|
|
65
|
+
// Sin RPC válido no se puede firmar un pago; las herramientas gratuitas siguen vivas.
|
|
66
|
+
const PAYMENTS_ENABLED = !!STELLAR_KEY && !!RPC_URL;
|
|
67
|
+
const PAYMENTS_DISABLED_REASON = PAYMENTS_ENABLED
|
|
68
|
+
? ''
|
|
69
|
+
: !STELLAR_KEY
|
|
70
|
+
? 'STELLAR_SECRET_KEY is not set — paid tools need a funded Stellar wallet.'
|
|
71
|
+
: 'STELLAR_NETWORK=mainnet requires SOROBAN_RPC_URL (Stellar publishes no open mainnet RPC). '
|
|
72
|
+
+ 'Pick a provider at https://developers.stellar.org/docs/data/apis/rpc/providers';
|
|
53
73
|
// Derive public key from secret key if available, or use explicit env var
|
|
54
74
|
const STELLAR_PUBLIC_KEY = (() => {
|
|
55
75
|
if (process.env.STELLAR_PUBLIC_KEY)
|
|
56
76
|
return process.env.STELLAR_PUBLIC_KEY;
|
|
57
77
|
if (STELLAR_KEY) {
|
|
58
78
|
try {
|
|
59
|
-
return (0, stellar_2.createEd25519Signer)(STELLAR_KEY,
|
|
79
|
+
return (0, stellar_2.createEd25519Signer)(STELLAR_KEY, STELLAR_NET).address;
|
|
60
80
|
}
|
|
61
81
|
catch {
|
|
62
82
|
return '';
|
|
@@ -77,7 +97,7 @@ const consentHeaders = () => ({
|
|
|
77
97
|
// Requires STELLAR_SECRET_KEY env var with funded testnet wallet.
|
|
78
98
|
//
|
|
79
99
|
let paidFetch = fetch;
|
|
80
|
-
if (
|
|
100
|
+
if (PAYMENTS_ENABLED) {
|
|
81
101
|
const signer = (0, stellar_2.createEd25519Signer)(STELLAR_KEY, STELLAR_NET);
|
|
82
102
|
const client = new fetch_1.x402Client()
|
|
83
103
|
.register(STELLAR_NET, new stellar_1.ExactStellarScheme(signer, { url: RPC_URL }));
|
|
@@ -85,7 +105,7 @@ if (STELLAR_KEY) {
|
|
|
85
105
|
console.error(`[Nirium MCP] x402 wallet: ${signer.address} | network: ${STELLAR_NET}`);
|
|
86
106
|
}
|
|
87
107
|
else {
|
|
88
|
-
console.error(
|
|
108
|
+
console.error(`[Nirium MCP] Paid tools disabled — ${PAYMENTS_DISABLED_REASON}`);
|
|
89
109
|
}
|
|
90
110
|
// ─── MPP Payment Client ───────────────────────────────────────
|
|
91
111
|
//
|
|
@@ -94,7 +114,7 @@ else {
|
|
|
94
114
|
// Same STELLAR_SECRET_KEY funds both x402 and MPP payments.
|
|
95
115
|
//
|
|
96
116
|
let mppFetch = fetch;
|
|
97
|
-
if (
|
|
117
|
+
if (PAYMENTS_ENABLED) {
|
|
98
118
|
const mppx = client_1.Mppx.create({
|
|
99
119
|
methods: [
|
|
100
120
|
client_2.stellar.charge({
|
|
@@ -107,12 +127,29 @@ if (STELLAR_KEY) {
|
|
|
107
127
|
console.error(`[Nirium MCP] MPP Charge enabled | network: ${STELLAR_NET}`);
|
|
108
128
|
}
|
|
109
129
|
else {
|
|
110
|
-
console.error(
|
|
130
|
+
console.error(`[Nirium MCP] MPP tools disabled — ${PAYMENTS_DISABLED_REASON}`);
|
|
111
131
|
}
|
|
112
132
|
// ─── Server ───────────────────────────────────────────────────
|
|
113
|
-
const server = new mcp_js_1.McpServer({ name: 'nirium-mcp-server', version: '0.
|
|
133
|
+
const server = new mcp_js_1.McpServer({ name: 'nirium-mcp-server', version: '0.5.0' }, { capabilities: { tools: {} } });
|
|
134
|
+
const text = (body) => ({ content: [{ type: 'text', text: typeof body === 'string' ? body : JSON.stringify(body, null, 2) }] });
|
|
135
|
+
const fail = (message) => ({ content: [{ type: 'text', text: message }], isError: true });
|
|
136
|
+
// Un pago sin wallet o sin RPC de mainnet no puede firmarse: decirlo aquí evita
|
|
137
|
+
// que el modelo reciba un 402 opaco y lo reporte como "el servidor falló".
|
|
138
|
+
const paymentsUnavailable = () => PAYMENTS_ENABLED ? null : fail(`Payment tools unavailable: ${PAYMENTS_DISABLED_REASON}`);
|
|
139
|
+
// Los nodos gratuitos comparten forma: GET/POST → JSON, error legible.
|
|
140
|
+
async function callJson(url, init, doFetch = fetch) {
|
|
141
|
+
try {
|
|
142
|
+
const res = await doFetch(url, init);
|
|
143
|
+
if (!res.ok)
|
|
144
|
+
return fail(`Error ${res.status}: ${await res.text()}`);
|
|
145
|
+
return text(await res.json());
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
return fail(`Request failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
114
151
|
// ─── FREE TOOLS ───────────────────────────────────────────────
|
|
115
|
-
server.tool('get_market_state', 'Fetch real-time market data: XLM/USDC price (CoinGecko), SDEX spread, base fee, Blend
|
|
152
|
+
server.tool('get_market_state', 'Fetch real-time market data: XLM/USDC price (CoinGecko), SDEX spread, base fee, Blend supply/borrow rate, CETES rate. Free — no API key required.', {}, async () => {
|
|
116
153
|
const res = await fetch(`${API_URL}/api/tickers`);
|
|
117
154
|
const data = await res.json();
|
|
118
155
|
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
@@ -164,79 +201,68 @@ server.tool('execute_demo', 'Dry-run a strategy via Soroban simulation — no re
|
|
|
164
201
|
// Cost: $0.02 USDC per signals call, $0.05 per market call, $0.25 per execution.
|
|
165
202
|
// Requires STELLAR_SECRET_KEY env var with funded testnet wallet.
|
|
166
203
|
//
|
|
167
|
-
server.tool('get_premium_signals', 'PAID ($0.02 USDC via x402) —
|
|
204
|
+
server.tool('get_premium_signals', 'PAID ($0.02 USDC via x402) — TESTNET ONLY: signals are produced by the autonomous loop, which runs on testnet; the mainnet box has no loop and returns 501 without charging. Signals reference testnet tokens, which have no monetary value, and are not a recommendation to buy, sell or hold anything. Requires funded Stellar wallet.', {
|
|
168
205
|
count: zod_1.z.number().optional().describe('Number of signals to fetch (default: 20, max: 100)'),
|
|
169
|
-
}, async (args) =>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (!res.ok) {
|
|
174
|
-
return { content: [{ type: 'text', text: `Error ${res.status}: ${await res.text()}` }], isError: true };
|
|
175
|
-
}
|
|
176
|
-
const data = await res.json();
|
|
177
|
-
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
178
|
-
}
|
|
179
|
-
catch (err) {
|
|
180
|
-
return { content: [{ type: 'text', text: `x402 payment failed: ${err.message}` }], isError: true };
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
server.tool('get_premium_market', 'PAID ($0.05 USDC via x402) — Enriched market state: arbitrage windows, yield ranking, fee pressure alerts, and execution recommendation. Requires funded Stellar wallet.', {}, async () => {
|
|
184
|
-
try {
|
|
185
|
-
const res = await paidFetch(`${API_URL}/api/v1/premium/market`);
|
|
186
|
-
if (!res.ok) {
|
|
187
|
-
return { content: [{ type: 'text', text: `Error ${res.status}: ${await res.text()}` }], isError: true };
|
|
188
|
-
}
|
|
189
|
-
const data = await res.json();
|
|
190
|
-
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
191
|
-
}
|
|
192
|
-
catch (err) {
|
|
193
|
-
return { content: [{ type: 'text', text: `x402 payment failed: ${err.message}` }], isError: true };
|
|
194
|
-
}
|
|
195
|
-
});
|
|
206
|
+
}, async (args) => paymentsUnavailable()
|
|
207
|
+
?? callJson(`${API_URL}/api/v1/premium/signals?count=${args.count || 20}`, undefined, paidFetch));
|
|
208
|
+
server.tool('get_premium_market', 'PAID ($0.05 USDC via x402) — Market state with reference rates attributed to their source, network fee pressure, and a description of current network conditions. Factual data only: no recommendation, no advice, no signal to act. Requires funded Stellar wallet.', {}, async () => paymentsUnavailable()
|
|
209
|
+
?? callJson(`${API_URL}/api/v1/premium/market`, undefined, paidFetch));
|
|
196
210
|
server.tool('execute_paid_strategy', 'PAID ($0.25 USDC via x402) — Execute a DeFi strategy on Stellar via Soroban. No Nirium account required — pay per execution. Requires funded Stellar wallet.', {
|
|
197
211
|
strategy: zod_1.z.string().describe('Strategy: flash-loan-arb | path-arbitrage | cross-dex | blend-yield | soroswap-swap'),
|
|
198
212
|
asset: zod_1.z.string().describe('Trading pair, e.g. XLM-USDC'),
|
|
199
213
|
params: zod_1.z.record(zod_1.z.unknown()).optional().describe('Strategy-specific parameters'),
|
|
214
|
+
}, async (args) => paymentsUnavailable()
|
|
215
|
+
?? callJson(`${API_URL}/api/v1/premium/execute`, {
|
|
216
|
+
method: 'POST',
|
|
217
|
+
headers: { 'Content-Type': 'application/json' },
|
|
218
|
+
body: JSON.stringify(args),
|
|
219
|
+
}, paidFetch));
|
|
220
|
+
server.tool('get_wallet_info', 'Show the x402 + MPP wallet address and payment configuration for this MCP session. Free.', {}, async () => text({
|
|
221
|
+
address: STELLAR_PUBLIC_KEY || null,
|
|
222
|
+
network: STELLAR_NET,
|
|
223
|
+
rpcUrl: RPC_URL || null,
|
|
224
|
+
agentApiUrl: API_URL,
|
|
225
|
+
niriumApiKeySet: !!NIRIUM_API_KEY,
|
|
226
|
+
x402Enabled: PAYMENTS_ENABLED,
|
|
227
|
+
mppEnabled: PAYMENTS_ENABLED,
|
|
228
|
+
...(PAYMENTS_ENABLED ? {} : { paymentsDisabledReason: PAYMENTS_DISABLED_REASON }),
|
|
229
|
+
freeTools: ['get_market_state', 'get_loop_status', 'execute_demo', 'get_nodes', 'anchor_audit_record', 'get_reporting_summary'],
|
|
230
|
+
authenticatedTools: ['start_loop', 'stop_loop'],
|
|
231
|
+
paidToolsX402: ['get_premium_signals', 'get_premium_market', 'execute_paid_strategy'],
|
|
232
|
+
paidToolsMpp: ['get_mpp_signals', 'get_mpp_market'],
|
|
233
|
+
}));
|
|
234
|
+
// ─── NODE CATALOG + AUDIT + REPORTING (free) ──────────────────
|
|
235
|
+
//
|
|
236
|
+
// Los nodos non-custodial que ya corren en mainnet. Ninguno mueve fondos:
|
|
237
|
+
// el catálogo es lectura, el anclaje sube un hash a IPFS y el reporting
|
|
238
|
+
// agrega recibos existentes — por eso no llevan wallet ni pago.
|
|
239
|
+
//
|
|
240
|
+
server.tool('get_nodes', 'List the Nirium execution nodes with their live status, custody model and network (testnet/mainnet). Free — reads the protocol registry.', {}, async () => callJson(`${API_URL}/api/nodes`));
|
|
241
|
+
server.tool('anchor_audit_record', 'Anchor evidence to IPFS and get back a CID (immutable integrity seal, not notarization). '
|
|
242
|
+
+ 'Pass `hash` (sha-256 hex of your own file/event) or `record` (small JSON object, max 8KB). '
|
|
243
|
+
+ 'Anchor hashes rather than raw personal data — IPFS content cannot be deleted. Free during open beta.', {
|
|
244
|
+
hash: zod_1.z.string().optional().describe('sha-256 hex (64 chars), optionally prefixed "sha-256:"'),
|
|
245
|
+
record: zod_1.z.record(zod_1.z.unknown()).optional().describe('Small JSON object to anchor verbatim (max 8KB)'),
|
|
246
|
+
txHash: zod_1.z.string().optional().describe('Related Stellar transaction hash, if any'),
|
|
247
|
+
network: zod_1.z.string().optional().describe('Network label to store with the anchor, e.g. mainnet'),
|
|
248
|
+
tag: zod_1.z.string().optional().describe('Free-form label to group anchors'),
|
|
200
249
|
}, async (args) => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
return { content: [{ type: 'text', text: `Error ${res.status}: ${await res.text()}` }], isError: true };
|
|
209
|
-
}
|
|
210
|
-
const data = await res.json();
|
|
211
|
-
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
212
|
-
}
|
|
213
|
-
catch (err) {
|
|
214
|
-
return { content: [{ type: 'text', text: `x402 payment failed: ${err.message}` }], isError: true };
|
|
215
|
-
}
|
|
250
|
+
if (!args.hash && !args.record)
|
|
251
|
+
return fail('Provide `hash` (sha-256 of your evidence) or `record` (small JSON object).');
|
|
252
|
+
return callJson(`${API_URL}/api/audit/log`, {
|
|
253
|
+
method: 'POST',
|
|
254
|
+
headers: { 'Content-Type': 'application/json', ...authHeaders() },
|
|
255
|
+
body: JSON.stringify(args),
|
|
256
|
+
});
|
|
216
257
|
});
|
|
217
|
-
server.tool('
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
text: JSON.stringify({
|
|
226
|
-
address: signer.address,
|
|
227
|
-
network: STELLAR_NET,
|
|
228
|
-
rpcUrl: RPC_URL,
|
|
229
|
-
agentApiUrl: API_URL,
|
|
230
|
-
niriumApiKeySet: !!NIRIUM_API_KEY,
|
|
231
|
-
x402Enabled: true,
|
|
232
|
-
mppEnabled: true,
|
|
233
|
-
freeTools: ['get_market_state', 'get_loop_status', 'execute_demo'],
|
|
234
|
-
authenticatedTools: ['start_loop', 'stop_loop'],
|
|
235
|
-
paidToolsX402: ['get_premium_signals', 'get_premium_market', 'execute_paid_strategy'],
|
|
236
|
-
paidToolsMpp: ['get_mpp_signals', 'get_mpp_market'],
|
|
237
|
-
}, null, 2),
|
|
238
|
-
}],
|
|
239
|
-
};
|
|
258
|
+
server.tool('get_reporting_summary', 'Institutional-format summary of settled payouts, x402/MPP payment receipts and IPFS anchors for a period. '
|
|
259
|
+
+ 'Not certified regulatory reporting — filings remain the client\'s responsibility. Free.', {
|
|
260
|
+
from: zod_1.z.string().optional().describe('ISO start date, e.g. 2026-07-01 (defaults to last 30 days)'),
|
|
261
|
+
to: zod_1.z.string().optional().describe('ISO end date'),
|
|
262
|
+
network: zod_1.z.enum(['testnet', 'mainnet']).optional().describe('Filter by network; omit for all'),
|
|
263
|
+
}, async (args) => {
|
|
264
|
+
const q = new URLSearchParams(Object.entries(args).filter(([, v]) => v !== undefined)).toString();
|
|
265
|
+
return callJson(`${API_URL}/api/reporting/summary${q ? `?${q}` : ''}`, { headers: authHeaders() });
|
|
240
266
|
});
|
|
241
267
|
// ─── PAID TOOLS (MPP) ─────────────────────────────────────────
|
|
242
268
|
//
|
|
@@ -247,40 +273,17 @@ server.tool('get_wallet_info', 'Show the x402 + MPP wallet address and payment c
|
|
|
247
273
|
// Advantage over x402: no Coinbase facilitator dependency.
|
|
248
274
|
// Both x402 and MPP tools are available — client chooses.
|
|
249
275
|
//
|
|
250
|
-
server.tool('get_mpp_signals', 'PAID ($0.
|
|
276
|
+
server.tool('get_mpp_signals', 'PAID ($0.02 USDC via MPP Charge) — TESTNET ONLY, same data as get_premium_signals, settled via direct Soroban SAC transfer with no external facilitator. Testnet tokens have no monetary value; this is not a recommendation to buy, sell or hold anything. Requires funded Stellar wallet.', {
|
|
251
277
|
count: zod_1.z.number().optional().describe('Number of signals to fetch (default: 20, max: 100)'),
|
|
252
|
-
}, async (args) =>
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (!res.ok) {
|
|
257
|
-
return { content: [{ type: 'text', text: `Error ${res.status}: ${await res.text()}` }], isError: true };
|
|
258
|
-
}
|
|
259
|
-
const data = await res.json();
|
|
260
|
-
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
261
|
-
}
|
|
262
|
-
catch (err) {
|
|
263
|
-
return { content: [{ type: 'text', text: `MPP payment failed: ${err.message}` }], isError: true };
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
server.tool('get_mpp_market', 'PAID ($0.01 USDC via MPP Charge) — Enriched market state settled via direct Soroban SAC transfer. No external facilitator. Includes arbitrage windows, yield ranking, and fee alerts. Requires funded Stellar wallet.', {}, async () => {
|
|
267
|
-
try {
|
|
268
|
-
const res = await mppFetch(`${API_URL}/api/v1/mpp/market`);
|
|
269
|
-
if (!res.ok) {
|
|
270
|
-
return { content: [{ type: 'text', text: `Error ${res.status}: ${await res.text()}` }], isError: true };
|
|
271
|
-
}
|
|
272
|
-
const data = await res.json();
|
|
273
|
-
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
274
|
-
}
|
|
275
|
-
catch (err) {
|
|
276
|
-
return { content: [{ type: 'text', text: `MPP payment failed: ${err.message}` }], isError: true };
|
|
277
|
-
}
|
|
278
|
-
});
|
|
278
|
+
}, async (args) => paymentsUnavailable()
|
|
279
|
+
?? callJson(`${API_URL}/api/v1/mpp/signals?count=${args.count || 20}`, undefined, mppFetch));
|
|
280
|
+
server.tool('get_mpp_market', 'PAID ($0.05 USDC via MPP Charge) — Market state settled via direct Soroban SAC transfer, no external facilitator. Reference rates with their source, fee pressure, and network conditions. Factual data only: no recommendation or advice. Requires funded Stellar wallet.', {}, async () => paymentsUnavailable()
|
|
281
|
+
?? callJson(`${API_URL}/api/v1/mpp/market`, undefined, mppFetch));
|
|
279
282
|
// ─── Start ────────────────────────────────────────────────────
|
|
280
283
|
async function main() {
|
|
281
284
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
282
285
|
await server.connect(transport);
|
|
283
|
-
console.error('[Nirium MCP] v0.
|
|
286
|
+
console.error('[Nirium MCP] v0.5.0 running on stdio');
|
|
284
287
|
console.error(`[Nirium MCP] Agent API: ${API_URL}`);
|
|
285
288
|
console.error(`[Nirium MCP] NIRIUM_API_KEY set: ${!!NIRIUM_API_KEY}`);
|
|
286
289
|
console.error(`[Nirium MCP] x402 enabled: ${!!STELLAR_KEY}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nirium-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Model Context Protocol server for Nirium
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "Model Context Protocol server for Nirium \u2014 exposes market data, autonomous loop control, and x402/MPP paid signals to any MCP-compatible AI (Claude, GPT, Cursor, VS Code Copilot).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"nirium-mcp": "dist/index.js"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"homepage": "https://nirium.xyz",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/nirium-protocol/nirium-sdk"
|
|
12
|
+
"url": "git+https://github.com/nirium-protocol/nirium-sdk.git"
|
|
13
13
|
},
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/nirium-protocol/nirium-sdk/issues",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
34
|
-
"@stellar/mpp": "^0.
|
|
34
|
+
"@stellar/mpp": "^0.7.1",
|
|
35
35
|
"@stellar/stellar-sdk": "^14.0.0",
|
|
36
|
-
"@x402/core": "^2.
|
|
37
|
-
"@x402/fetch": "^2.
|
|
38
|
-
"@x402/stellar": "^2.
|
|
39
|
-
"mppx": "^0.
|
|
36
|
+
"@x402/core": "^2.17.0",
|
|
37
|
+
"@x402/fetch": "^2.17.0",
|
|
38
|
+
"@x402/stellar": "^2.17.0",
|
|
39
|
+
"mppx": "^0.6.31",
|
|
40
40
|
"zod": "^3.25.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|