@mafdet/mcp 1.4.40 → 1.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/dist/client.js CHANGED
@@ -29,27 +29,28 @@ export async function getJson(options) {
29
29
  signal: controller.signal,
30
30
  redirect: "error",
31
31
  });
32
+ if (!response.ok)
33
+ throw mapStatus(response.status);
34
+ const contentType = response.headers.get("content-type") ?? "";
35
+ if (!contentType.includes("application/json")) {
36
+ throw new MafdetClientError("bad_response", "Mafdet AI returned an unexpected (non-JSON) response");
37
+ }
38
+ const text = await readBounded(response);
39
+ try {
40
+ return JSON.parse(text);
41
+ }
42
+ catch {
43
+ throw new MafdetClientError("bad_response", "Mafdet AI returned malformed JSON");
44
+ }
32
45
  }
33
46
  catch (error) {
47
+ if (error instanceof MafdetClientError)
48
+ throw error;
34
49
  throw new MafdetClientError("network", `could not reach Mafdet AI (${describeNetworkError(error)})`);
35
50
  }
36
51
  finally {
37
52
  clearTimeout(timer);
38
53
  }
39
- if (!response.ok) {
40
- throw mapStatus(response.status);
41
- }
42
- const contentType = response.headers.get("content-type") ?? "";
43
- if (!contentType.includes("application/json")) {
44
- throw new MafdetClientError("bad_response", "Mafdet AI returned an unexpected (non-JSON) response");
45
- }
46
- const text = await readBounded(response);
47
- try {
48
- return JSON.parse(text);
49
- }
50
- catch {
51
- throw new MafdetClientError("bad_response", "Mafdet AI returned malformed JSON");
52
- }
53
54
  }
54
55
  function buildUrl(baseUrl, path, query) {
55
56
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ export function buildServer(config = loadConfig()) {
15
15
  const server = new McpServer({ name: "mafdet-mcp", version });
16
16
  server.registerTool("list_models", {
17
17
  title: "List Mafdet AI models",
18
- description: "List the models available on Mafdet AI with provider, tier, and per-1M-token pricing. No API key required.",
18
+ description: "List the models available on Mafdet AI with provider, tier, and pricing by modality and unit (tokens, images, seconds). No API key required.",
19
19
  inputSchema: {
20
20
  provider: z.string().min(1).max(40).optional(),
21
21
  tier: z.string().min(1).max(40).optional(),
package/dist/tools.js CHANGED
@@ -50,6 +50,9 @@ export async function listModels(config, args = {}) {
50
50
  .filter((m) => !tier || String(m.accessTier).toLowerCase() === tier)
51
51
  .map((m) => ({
52
52
  model_id: m.modelId,
53
+ price_dimensions: Array.isArray(m.priceDimensions)
54
+ ? m.priceDimensions
55
+ : [],
53
56
  display_name: m.displayName,
54
57
  description: typeof m.description === "string" ? m.description : "",
55
58
  provider: m.provider,
@@ -81,7 +84,13 @@ export async function listModels(config, args = {}) {
81
84
  `${stage ? ` [${stage[1].toLowerCase()}]` : ""}` +
82
85
  `${m.trial ? " [trial]" : ""}${m.deprecated ? " [deprecated]" : ""}` +
83
86
  `${m.output_modalities.includes("IMAGE") ? " [image-out]" : ""}` +
84
- ` — in ${money(m.input_per_1m_micro_usd)}/1M, out ${money(m.output_per_1m_micro_usd)}/1M, ctx ${m.context_length}` +
87
+ ` — ${m.price_dimensions.length
88
+ ? m.price_dimensions
89
+ .map((p) => `${p.dimension.toLowerCase().replaceAll("_", " ")}: ${money(p.sellPriceMicroUsd)}/${p.unit}`)
90
+ .join(", ")
91
+ : m.api_surface === "CHAT_COMPLETIONS"
92
+ ? `in ${money(m.input_per_1m_micro_usd)}/1M, out ${money(m.output_per_1m_micro_usd)}/1M`
93
+ : "pricing unavailable; see model documentation"}, ctx ${m.context_length}` +
85
94
  `${m.description ? ` — ${m.description.replace(/[\r\n]+/g, " ")}` : ""}`);
86
95
  });
87
96
  return ok(`Mafdet AI models (${models.length}):\n${lines.join("\n")}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mafdet/mcp",
3
- "version": "1.4.40",
3
+ "version": "1.5.1",
4
4
  "description": "Mafdet AI MCP server — read-only account tools (models, balance, usage, subscription, docs) for Claude Code, Cursor, Codex, OpenCode, and Claude Desktop.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,15 +33,9 @@
33
33
  "dist",
34
34
  "README.md"
35
35
  ],
36
- "scripts": {
37
- "build": "tsc -p tsconfig.json",
38
- "lint": "prettier --check \"src/**/*.ts\" \"test/**/*.mjs\" package.json tsconfig.json",
39
- "test": "pnpm run build && node --test \"test/**/*.test.mjs\"",
40
- "typecheck": "tsc --noEmit -p tsconfig.json"
41
- },
42
36
  "dependencies": {
43
- "@modelcontextprotocol/sdk": "^1.29.0",
44
- "zod": "^4.4.3"
37
+ "@modelcontextprotocol/sdk": "^1.32.2",
38
+ "zod": "^4.6.7"
45
39
  },
46
40
  "devDependencies": {
47
41
  "@types/node": "^20.19.0",
@@ -49,5 +43,11 @@
49
43
  },
50
44
  "engines": {
51
45
  "node": ">=20"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc -p tsconfig.json",
49
+ "lint": "prettier --check \"src/**/*.ts\" \"test/**/*.mjs\" package.json tsconfig.json",
50
+ "test": "pnpm run build && node --test \"test/**/*.test.mjs\"",
51
+ "typecheck": "tsc --noEmit -p tsconfig.json"
52
52
  }
53
- }
53
+ }