@papyruslabsai/seshat-mcp 0.12.2 → 0.12.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/dist/index.js +9 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -412,16 +412,15 @@ function getCloudUrl(path) {
|
|
|
412
412
|
async function main() {
|
|
413
413
|
const server = new Server({
|
|
414
414
|
name: 'seshat-mcp-cloud-proxy',
|
|
415
|
-
version: '0.12.
|
|
415
|
+
version: '0.12.3',
|
|
416
416
|
}, {
|
|
417
417
|
capabilities: { tools: {} },
|
|
418
418
|
});
|
|
419
|
-
// ─── #3: Dynamic ListTools
|
|
419
|
+
// ─── #3: Dynamic ListTools — only expose tools the user can access ──
|
|
420
420
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
421
421
|
const apiKey = process.env.SESHAT_API_KEY;
|
|
422
422
|
let userTier = 'cartographer';
|
|
423
|
-
|
|
424
|
-
// Attempt to fetch account status from the cloud for tier-aware descriptions
|
|
423
|
+
// Fetch account status to determine which tools to expose
|
|
425
424
|
if (apiKey) {
|
|
426
425
|
try {
|
|
427
426
|
const res = await fetch(getCloudUrl('/api/mcp/account'), {
|
|
@@ -431,27 +430,20 @@ async function main() {
|
|
|
431
430
|
if (res.ok) {
|
|
432
431
|
const account = await res.json();
|
|
433
432
|
userTier = account.tier || 'cartographer';
|
|
434
|
-
credits = account.credits || 0;
|
|
435
433
|
}
|
|
436
434
|
}
|
|
437
435
|
catch {
|
|
438
|
-
// If
|
|
436
|
+
// If unavailable, default to cartographer (free tier tools only)
|
|
439
437
|
}
|
|
440
438
|
}
|
|
441
|
-
|
|
439
|
+
// Only return tools the user's tier can actually use
|
|
440
|
+
const visibleTools = TOOLS.filter((tool) => {
|
|
442
441
|
const requiredTier = TOOL_TIERS[tool.name];
|
|
443
442
|
if (!requiredTier)
|
|
444
|
-
return
|
|
445
|
-
|
|
446
|
-
if (hasAccess)
|
|
447
|
-
return tool;
|
|
448
|
-
// Annotate locked tools with tier requirement
|
|
449
|
-
return {
|
|
450
|
-
...tool,
|
|
451
|
-
description: `[LOCKED — requires ${TIER_LABELS[requiredTier]}] ${tool.description}`,
|
|
452
|
-
};
|
|
443
|
+
return true; // get_account_status — always visible
|
|
444
|
+
return tierAtLeast(userTier, requiredTier);
|
|
453
445
|
});
|
|
454
|
-
return { tools:
|
|
446
|
+
return { tools: visibleTools };
|
|
455
447
|
});
|
|
456
448
|
// ─── CallTool handler with #1 (_meta piggyback) and #2 (get_account_status) ──
|
|
457
449
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
package/package.json
CHANGED