sentinel-hedera-mcp 1.0.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/README.md +79 -0
- package/bin/sentinel-mcp.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +404 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# sentinel-hedera-mcp
|
|
2
|
+
|
|
3
|
+
AI-powered security gateway for autonomous AI agent payments on Hedera. Drop-in MCP server that replaces raw private keys with AI evaluation, AWS KMS signing, and immutable HCS audit trails.
|
|
4
|
+
|
|
5
|
+
## The Problem
|
|
6
|
+
|
|
7
|
+
AI agents using x402 or direct payments hold private keys in plaintext:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"wallet": {
|
|
13
|
+
"env": { "WALLET_PRIVATE_KEY": "0xDANGEROUS..." }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
One jailbreak, one env leak — wallet drained.
|
|
20
|
+
|
|
21
|
+
## The Fix
|
|
22
|
+
|
|
23
|
+
Replace the private key with a Sentinel API key:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"sentinel": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["-y", "sentinel-hedera-mcp"],
|
|
31
|
+
"env": {
|
|
32
|
+
"SENTINEL_AGENT_ID": "agent-a1b2c3d4e5f6",
|
|
33
|
+
"SENTINEL_API_KEY": "sntl_abc123...",
|
|
34
|
+
"SENTINEL_GATEWAY_URL": "https://your-sentinel-backend.com"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
No private key anywhere. All signing happens via AWS KMS on the Sentinel backend.
|
|
42
|
+
|
|
43
|
+
## Tools
|
|
44
|
+
|
|
45
|
+
| Tool | Description |
|
|
46
|
+
|------|-------------|
|
|
47
|
+
| `paid_request` | Make HTTP requests with automatic x402 payment handling |
|
|
48
|
+
| `transfer_hbar` | Transfer HBAR with AI risk evaluation |
|
|
49
|
+
| `check_balance` | Check agent balance, trust score, daily spending |
|
|
50
|
+
| `transaction_history` | View recent transactions with AI evaluation results |
|
|
51
|
+
| `list_paid_apis` | Discover available x402 paid API endpoints |
|
|
52
|
+
| `flag_transaction` | Report incorrect/suspicious API data |
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
1. Agent calls a tool (e.g., `paid_request`)
|
|
57
|
+
2. MCP server routes the request to Sentinel backend
|
|
58
|
+
3. Backend evaluates via 3-layer system: Rule Engine → AI (GPT-4o-mini) → Smart Contract
|
|
59
|
+
4. If approved: AWS KMS signs the transaction, submits to Hedera
|
|
60
|
+
5. If rejected: blocked, no funds move
|
|
61
|
+
6. Every decision logged immutably on Hedera Consensus Service
|
|
62
|
+
|
|
63
|
+
## Environment Variables
|
|
64
|
+
|
|
65
|
+
| Variable | Required | Description |
|
|
66
|
+
|----------|----------|-------------|
|
|
67
|
+
| `SENTINEL_AGENT_ID` | Yes | Your agent ID (from Sentinel Dashboard registration) |
|
|
68
|
+
| `SENTINEL_API_KEY` | Yes | Your agent API key (shown once at registration) |
|
|
69
|
+
| `SENTINEL_GATEWAY_URL` | No | Sentinel backend URL (default: `http://localhost:3001`) |
|
|
70
|
+
|
|
71
|
+
## Requirements
|
|
72
|
+
|
|
73
|
+
- Node.js >= 18
|
|
74
|
+
- A running Sentinel backend ([github.com/ambesh333/Sentinel](https://github.com/ambesh333/Sentinel))
|
|
75
|
+
- A registered agent (via Sentinel Dashboard)
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const SENTINEL_GATEWAY = process.env.SENTINEL_GATEWAY_URL || "http://localhost:3001";
|
|
6
|
+
const SENTINEL_AGENT_ID = process.env.SENTINEL_AGENT_ID;
|
|
7
|
+
const SENTINEL_API_KEY = process.env.SENTINEL_API_KEY;
|
|
8
|
+
if (!SENTINEL_AGENT_ID || !SENTINEL_API_KEY) {
|
|
9
|
+
console.error("SENTINEL_AGENT_ID and SENTINEL_API_KEY environment variables are required.");
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
const sentinelApi = axios.create({
|
|
13
|
+
baseURL: SENTINEL_GATEWAY,
|
|
14
|
+
headers: {
|
|
15
|
+
"X-Agent-Id": SENTINEL_AGENT_ID,
|
|
16
|
+
"X-Api-Key": SENTINEL_API_KEY,
|
|
17
|
+
},
|
|
18
|
+
timeout: 30000,
|
|
19
|
+
});
|
|
20
|
+
const server = new McpServer({
|
|
21
|
+
name: "sentinel-secure-payments",
|
|
22
|
+
version: "1.0.0",
|
|
23
|
+
});
|
|
24
|
+
// ──────────────── Tool 1: Paid HTTP Request (x402) ────────────────
|
|
25
|
+
server.tool("paid_request", `Make an HTTP request to a paid API endpoint. If the API requires payment (HTTP 402), Sentinel AI evaluates the payment, signs it securely via AWS KMS, and retries automatically. No wallet or private key needed.
|
|
26
|
+
|
|
27
|
+
You can pass either:
|
|
28
|
+
- A full URL like "http://example.com/api/data"
|
|
29
|
+
- A relative path like "/api/x402/weather?city=London" (will use the Sentinel gateway at ${SENTINEL_GATEWAY})`, {
|
|
30
|
+
url: z.string().describe("The API URL (full URL or relative path starting with /)"),
|
|
31
|
+
method: z.string().default("GET").describe("HTTP method (GET, POST, etc.)"),
|
|
32
|
+
body: z.string().optional().describe("Request body for POST/PUT (JSON string)"),
|
|
33
|
+
intent: z.string().describe("Brief description of why you need this data"),
|
|
34
|
+
}, async ({ url: rawUrl, method = "GET", body, intent }) => {
|
|
35
|
+
// Resolve relative paths against the Sentinel gateway
|
|
36
|
+
const url = rawUrl.startsWith("/") ? `${SENTINEL_GATEWAY}${rawUrl}` : rawUrl;
|
|
37
|
+
try {
|
|
38
|
+
// Step 1: Try the HTTP request directly
|
|
39
|
+
let response;
|
|
40
|
+
try {
|
|
41
|
+
response = await axios({
|
|
42
|
+
url,
|
|
43
|
+
method,
|
|
44
|
+
data: body ? JSON.parse(body) : undefined,
|
|
45
|
+
validateStatus: () => true,
|
|
46
|
+
timeout: 15000,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
return { content: [{ type: "text", text: `HTTP error: ${err.message}` }] };
|
|
51
|
+
}
|
|
52
|
+
// Step 2: If not 402, return data directly (no payment needed)
|
|
53
|
+
if (response.status !== 402) {
|
|
54
|
+
return {
|
|
55
|
+
content: [{
|
|
56
|
+
type: "text",
|
|
57
|
+
text: typeof response.data === "string"
|
|
58
|
+
? response.data
|
|
59
|
+
: JSON.stringify(response.data, null, 2),
|
|
60
|
+
}],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// Step 3: Extract x402 payment requirements from 402 response
|
|
64
|
+
const paymentRequiredHeader = response.headers["payment-required"];
|
|
65
|
+
if (!paymentRequiredHeader) {
|
|
66
|
+
return {
|
|
67
|
+
content: [{
|
|
68
|
+
type: "text",
|
|
69
|
+
text: "API returned 402 but no Payment-Required header found.",
|
|
70
|
+
}],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
let paymentRequirements;
|
|
74
|
+
try {
|
|
75
|
+
paymentRequirements = JSON.parse(Buffer.from(paymentRequiredHeader, "base64").toString("utf-8"));
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return {
|
|
79
|
+
content: [{
|
|
80
|
+
type: "text",
|
|
81
|
+
text: "Failed to parse Payment-Required header from 402 response.",
|
|
82
|
+
}],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const amountTinybars = parseInt(paymentRequirements.maxAmountRequired || "0", 10);
|
|
86
|
+
const amountHbar = amountTinybars / 1e8;
|
|
87
|
+
const recipient = paymentRequirements.recipient || "unknown";
|
|
88
|
+
console.error(`[Sentinel] 402 received — ${amountHbar} HBAR to ${recipient} for ${url}`);
|
|
89
|
+
// Step 4: Send to Sentinel backend for AI evaluation + KMS signing
|
|
90
|
+
const evalResponse = await sentinelApi.post("/api/v1/transactions/x402", {
|
|
91
|
+
targetUrl: url,
|
|
92
|
+
targetMethod: method,
|
|
93
|
+
paymentRequirements,
|
|
94
|
+
intent,
|
|
95
|
+
metadata: { protocol: "x402", originalStatus: 402 },
|
|
96
|
+
});
|
|
97
|
+
const { decision, riskScore, reasoning, signedPayload, hederaTxId } = evalResponse.data;
|
|
98
|
+
// Step 5: Handle Sentinel's decision
|
|
99
|
+
if (decision === "REJECTED") {
|
|
100
|
+
return {
|
|
101
|
+
content: [{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: [
|
|
104
|
+
`Payment BLOCKED by Sentinel AI.`,
|
|
105
|
+
`Amount: ${amountHbar} HBAR to ${recipient}`,
|
|
106
|
+
`Risk Score: ${riskScore}/100`,
|
|
107
|
+
`Reason: ${reasoning}`,
|
|
108
|
+
`No funds were spent.`,
|
|
109
|
+
].join("\n"),
|
|
110
|
+
}],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
// Step 6: APPROVED — retry the original request with signed payment
|
|
114
|
+
console.error(`[Sentinel] Payment ${decision} (risk: ${riskScore}) — retrying with signature`);
|
|
115
|
+
const paidResponse = await axios({
|
|
116
|
+
url,
|
|
117
|
+
method,
|
|
118
|
+
data: body ? JSON.parse(body) : undefined,
|
|
119
|
+
headers: { "PAYMENT-SIGNATURE": signedPayload || hederaTxId || "approved" },
|
|
120
|
+
timeout: 15000,
|
|
121
|
+
validateStatus: () => true,
|
|
122
|
+
});
|
|
123
|
+
const paidData = typeof paidResponse.data === "string"
|
|
124
|
+
? paidResponse.data
|
|
125
|
+
: JSON.stringify(paidResponse.data, null, 2);
|
|
126
|
+
return {
|
|
127
|
+
content: [{
|
|
128
|
+
type: "text",
|
|
129
|
+
text: [
|
|
130
|
+
paidData,
|
|
131
|
+
``,
|
|
132
|
+
`--- Sentinel Payment Info ---`,
|
|
133
|
+
`Paid: ${amountHbar} HBAR to ${recipient}`,
|
|
134
|
+
`Risk Score: ${riskScore}/100`,
|
|
135
|
+
`Decision: ${decision}`,
|
|
136
|
+
`Tx: ${hederaTxId || "pending"}`,
|
|
137
|
+
].join("\n"),
|
|
138
|
+
}],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
const errorMsg = err.response?.data?.error || err.message;
|
|
143
|
+
return {
|
|
144
|
+
content: [{
|
|
145
|
+
type: "text",
|
|
146
|
+
text: `Sentinel error: ${errorMsg}`,
|
|
147
|
+
}],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
// ──────────────── Tool 2: Transfer HBAR ────────────────
|
|
152
|
+
server.tool("transfer_hbar", "Transfer HBAR to a Hedera account. Sentinel AI evaluates the transfer for risk and signs securely via AWS KMS. No private key needed.", {
|
|
153
|
+
to: z.string().describe("Recipient Hedera account ID (e.g., 0.0.1234)"),
|
|
154
|
+
amount: z.number().positive().describe("Amount of HBAR to transfer"),
|
|
155
|
+
memo: z.string().optional().describe("Transaction memo"),
|
|
156
|
+
intent: z.string().describe("Why this transfer is needed"),
|
|
157
|
+
}, async ({ to, amount, memo, intent }) => {
|
|
158
|
+
try {
|
|
159
|
+
const response = await sentinelApi.post("/api/v1/transactions/transfer", {
|
|
160
|
+
type: "CryptoTransfer",
|
|
161
|
+
to,
|
|
162
|
+
amount,
|
|
163
|
+
memo,
|
|
164
|
+
intent,
|
|
165
|
+
});
|
|
166
|
+
const { decision, riskScore, reasoning, hederaTxId } = response.data;
|
|
167
|
+
if (decision === "REJECTED") {
|
|
168
|
+
return {
|
|
169
|
+
content: [{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: [
|
|
172
|
+
`Transfer BLOCKED by Sentinel AI.`,
|
|
173
|
+
`Amount: ${amount} HBAR to ${to}`,
|
|
174
|
+
`Risk Score: ${riskScore}/100`,
|
|
175
|
+
`Reason: ${reasoning}`,
|
|
176
|
+
`No funds were spent.`,
|
|
177
|
+
].join("\n"),
|
|
178
|
+
}],
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
content: [{
|
|
183
|
+
type: "text",
|
|
184
|
+
text: [
|
|
185
|
+
`Transfer ${decision}.`,
|
|
186
|
+
`Amount: ${amount} HBAR to ${to}`,
|
|
187
|
+
`Risk Score: ${riskScore}/100`,
|
|
188
|
+
`Tx ID: ${hederaTxId || "pending"}`,
|
|
189
|
+
].join("\n"),
|
|
190
|
+
}],
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
return {
|
|
195
|
+
content: [{
|
|
196
|
+
type: "text",
|
|
197
|
+
text: `Transfer error: ${err.response?.data?.error || err.message}`,
|
|
198
|
+
}],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
// ──────────────── Tool 3: Check Balance & Status ────────────────
|
|
203
|
+
server.tool("check_balance", "Check this agent's Hedera account balance, trust score, and daily spending status.", {}, async () => {
|
|
204
|
+
try {
|
|
205
|
+
const response = await sentinelApi.get(`/api/v1/agents/${SENTINEL_AGENT_ID}/status`);
|
|
206
|
+
const { accountId, balance, trustScore, dailySpent, dailyLimit, txCountToday, isActive } = response.data;
|
|
207
|
+
return {
|
|
208
|
+
content: [{
|
|
209
|
+
type: "text",
|
|
210
|
+
text: [
|
|
211
|
+
`Agent Status:`,
|
|
212
|
+
` Agent ID: ${SENTINEL_AGENT_ID}`,
|
|
213
|
+
` Account: ${accountId || "not provisioned"}`,
|
|
214
|
+
` Balance: ${balance ?? "unknown"} HBAR`,
|
|
215
|
+
` Trust Score: ${trustScore}/100`,
|
|
216
|
+
` Active: ${isActive}`,
|
|
217
|
+
` Spent Today: ${dailySpent}/${dailyLimit} HBAR`,
|
|
218
|
+
` Tx Today: ${txCountToday}`,
|
|
219
|
+
].join("\n"),
|
|
220
|
+
}],
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
return {
|
|
225
|
+
content: [{
|
|
226
|
+
type: "text",
|
|
227
|
+
text: `Status error: ${err.response?.data?.error || err.message}`,
|
|
228
|
+
}],
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
// ──────────────── Tool 4: Transaction History ────────────────
|
|
233
|
+
server.tool("transaction_history", "View this agent's recent transactions and Sentinel's AI evaluation results.", {
|
|
234
|
+
limit: z.number().int().min(1).max(100).default(10).describe("Number of recent transactions to show"),
|
|
235
|
+
}, async ({ limit = 10 }) => {
|
|
236
|
+
try {
|
|
237
|
+
const response = await sentinelApi.get(`/api/v1/agents/${SENTINEL_AGENT_ID}/transactions`, { params: { limit } });
|
|
238
|
+
const txs = response.data.transactions;
|
|
239
|
+
if (!txs || txs.length === 0) {
|
|
240
|
+
return {
|
|
241
|
+
content: [{ type: "text", text: "No transactions found." }],
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const summary = txs.map((tx, i) => {
|
|
245
|
+
const time = new Date(tx.createdAt).toLocaleString();
|
|
246
|
+
return [
|
|
247
|
+
`${i + 1}. [${tx.decision}] ${tx.type} — ${tx.amount ?? 0} HBAR`,
|
|
248
|
+
` To: ${tx.recipient || "N/A"} | Risk: ${tx.riskScore}/100`,
|
|
249
|
+
` Intent: ${tx.intent || "N/A"}`,
|
|
250
|
+
` Time: ${time}`,
|
|
251
|
+
` Reason: ${tx.reasoning || "N/A"}`,
|
|
252
|
+
].join("\n");
|
|
253
|
+
});
|
|
254
|
+
return {
|
|
255
|
+
content: [{
|
|
256
|
+
type: "text",
|
|
257
|
+
text: `Recent Transactions (${txs.length}):\n\n${summary.join("\n\n")}`,
|
|
258
|
+
}],
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
catch (err) {
|
|
262
|
+
return {
|
|
263
|
+
content: [{
|
|
264
|
+
type: "text",
|
|
265
|
+
text: `History error: ${err.response?.data?.error || err.message}`,
|
|
266
|
+
}],
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
// ──────────────── Tool 5: List available x402 APIs ────────────────
|
|
271
|
+
server.tool("list_paid_apis", "List available x402 paid API endpoints and their prices.", {
|
|
272
|
+
gateway: z.string().url().optional().describe("Base URL of the x402 API server (defaults to Sentinel gateway)"),
|
|
273
|
+
}, async ({ gateway }) => {
|
|
274
|
+
try {
|
|
275
|
+
const baseUrl = gateway || SENTINEL_GATEWAY;
|
|
276
|
+
const response = await axios.get(`${baseUrl}/api/x402`, { timeout: 10000 });
|
|
277
|
+
const data = response.data;
|
|
278
|
+
if (!data.endpoints || data.endpoints.length === 0) {
|
|
279
|
+
return {
|
|
280
|
+
content: [{ type: "text", text: "No x402 APIs found at this endpoint." }],
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
const lines = data.endpoints.map((ep) => {
|
|
284
|
+
const fullUrl = `${baseUrl}${ep.path}`;
|
|
285
|
+
return ` ${ep.method.padEnd(5)} ${fullUrl}\n Price: ${ep.price} — ${ep.description}`;
|
|
286
|
+
});
|
|
287
|
+
return {
|
|
288
|
+
content: [{
|
|
289
|
+
type: "text",
|
|
290
|
+
text: [
|
|
291
|
+
`Available Paid APIs (${data.name}):`,
|
|
292
|
+
`Network: ${data.network}`,
|
|
293
|
+
`Recipient: ${data.recipient}`,
|
|
294
|
+
``,
|
|
295
|
+
`Use these full URLs with the paid_request tool:`,
|
|
296
|
+
...lines,
|
|
297
|
+
].join("\n"),
|
|
298
|
+
}],
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
catch (err) {
|
|
302
|
+
return {
|
|
303
|
+
content: [{
|
|
304
|
+
type: "text",
|
|
305
|
+
text: `Failed to list APIs: ${err.message}`,
|
|
306
|
+
}],
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
// ──────────────── Tool 6: Flag/Report API Data Quality ────────────────
|
|
311
|
+
server.tool("flag_transaction", "Flag a transaction or API response as incorrect/suspicious. This submits feedback to Sentinel's API trust scoring system. Use this when the data returned by a paid API was wrong, outdated, or misleading.", {
|
|
312
|
+
transactionId: z.string().optional().describe("Transaction ID to flag (from transaction_history)"),
|
|
313
|
+
targetUrl: z.string().optional().describe("The API URL that returned bad data"),
|
|
314
|
+
isCorrect: z.boolean().describe("Was the data correct? false = flag as bad, true = confirm as good"),
|
|
315
|
+
comment: z.string().optional().describe("Brief explanation of what was wrong with the data"),
|
|
316
|
+
}, async ({ transactionId, targetUrl, isCorrect, comment }) => {
|
|
317
|
+
try {
|
|
318
|
+
// If we have a transactionId, look up the URL from history
|
|
319
|
+
let host;
|
|
320
|
+
let path;
|
|
321
|
+
let method = "GET";
|
|
322
|
+
if (targetUrl) {
|
|
323
|
+
try {
|
|
324
|
+
const parsed = new URL(targetUrl.startsWith("/") ? `${SENTINEL_GATEWAY}${targetUrl}` : targetUrl);
|
|
325
|
+
host = parsed.hostname;
|
|
326
|
+
path = parsed.pathname;
|
|
327
|
+
}
|
|
328
|
+
catch {
|
|
329
|
+
return {
|
|
330
|
+
content: [{ type: "text", text: "Invalid URL provided." }],
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else if (transactionId) {
|
|
335
|
+
// Fetch transaction to get the URL
|
|
336
|
+
try {
|
|
337
|
+
const txRes = await sentinelApi.get(`/api/v1/agents/${SENTINEL_AGENT_ID}/transactions`, { params: { limit: 50 } });
|
|
338
|
+
const tx = txRes.data.transactions?.find((t) => t.id === transactionId);
|
|
339
|
+
if (tx?.targetUrl) {
|
|
340
|
+
const parsed = new URL(tx.targetUrl);
|
|
341
|
+
host = parsed.hostname;
|
|
342
|
+
path = parsed.pathname;
|
|
343
|
+
method = tx.metadata?.targetMethod || "GET";
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
catch {
|
|
347
|
+
// Fall through
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (!host || !path) {
|
|
351
|
+
return {
|
|
352
|
+
content: [{
|
|
353
|
+
type: "text",
|
|
354
|
+
text: "Could not determine the API endpoint. Please provide either a transactionId or targetUrl.",
|
|
355
|
+
}],
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
const response = await sentinelApi.post("/api/v1/api-analytics/feedback", {
|
|
359
|
+
host,
|
|
360
|
+
path,
|
|
361
|
+
method,
|
|
362
|
+
transactionId,
|
|
363
|
+
agentId: SENTINEL_AGENT_ID,
|
|
364
|
+
isCorrect,
|
|
365
|
+
comment,
|
|
366
|
+
});
|
|
367
|
+
const { newTrustScore } = response.data;
|
|
368
|
+
const action = isCorrect ? "confirmed as correct" : "flagged as incorrect";
|
|
369
|
+
return {
|
|
370
|
+
content: [{
|
|
371
|
+
type: "text",
|
|
372
|
+
text: [
|
|
373
|
+
`API ${action}.`,
|
|
374
|
+
`Endpoint: ${host}${path}`,
|
|
375
|
+
`Updated Trust Score: ${newTrustScore}/100`,
|
|
376
|
+
comment ? `Comment: ${comment}` : "",
|
|
377
|
+
``,
|
|
378
|
+
`This feedback helps Sentinel identify unreliable APIs and protect other agents.`,
|
|
379
|
+
].filter(Boolean).join("\n"),
|
|
380
|
+
}],
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
catch (err) {
|
|
384
|
+
return {
|
|
385
|
+
content: [{
|
|
386
|
+
type: "text",
|
|
387
|
+
text: `Flag error: ${err.response?.data?.error || err.message}`,
|
|
388
|
+
}],
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
// ──────────────── Start Server ────────────────
|
|
393
|
+
async function main() {
|
|
394
|
+
const transport = new StdioServerTransport();
|
|
395
|
+
await server.connect(transport);
|
|
396
|
+
console.error("Sentinel MCP Server running on stdio");
|
|
397
|
+
console.error(` Gateway: ${SENTINEL_GATEWAY}`);
|
|
398
|
+
console.error(` Agent: ${SENTINEL_AGENT_ID}`);
|
|
399
|
+
}
|
|
400
|
+
main().catch((err) => {
|
|
401
|
+
console.error("Failed to start Sentinel MCP Server:", err);
|
|
402
|
+
process.exit(1);
|
|
403
|
+
});
|
|
404
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,uBAAuB,CAAC;AACrF,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACxD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAEtD,IAAI,CAAC,iBAAiB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAC5F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,WAAW,GAAkB,KAAK,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE;QACP,YAAY,EAAE,iBAAiB;QAC/B,WAAW,EAAE,gBAAgB;K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AAsC,CAAC,CAAC;IACtD,OAAO,CAAC,KAAK,CAAC,cAAc,gBAAgB,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,KAAK,CAAC,cAAc,iBAAiB,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sentinel-hedera-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Sentinel MCP Server — AI-powered secure payments for autonomous agents on Hedera. Drop-in security layer that replaces raw private keys with AI evaluation, AWS KMS signing, and immutable HCS audit trails.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"sentinel-mcp-server": "./bin/sentinel-mcp.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"bin",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "tsx src/index.ts",
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"prepublishOnly": "npm run build",
|
|
22
|
+
"start": "node dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"mcp",
|
|
26
|
+
"model-context-protocol",
|
|
27
|
+
"hedera",
|
|
28
|
+
"hbar",
|
|
29
|
+
"x402",
|
|
30
|
+
"sentinel",
|
|
31
|
+
"ai-agent",
|
|
32
|
+
"payments",
|
|
33
|
+
"security",
|
|
34
|
+
"aws-kms",
|
|
35
|
+
"blockchain"
|
|
36
|
+
],
|
|
37
|
+
"author": "ambesh",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/ambesh333/Sentinel"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
48
|
+
"axios": "^1.7.9",
|
|
49
|
+
"zod": "^3.24.2"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^22.13.5",
|
|
53
|
+
"tsx": "^4.19.3",
|
|
54
|
+
"typescript": "^5.7.3"
|
|
55
|
+
}
|
|
56
|
+
}
|