ai-supply-mcp 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.mjs +18 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-supply-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "bin": { "ai-supply-mcp": "./server.mjs" },
6
6
  "description": "MCP server for ai-supply.store — search, install, download, publish and review security-scanned AI capabilities from any MCP client (Claude, VS Code/Copilot, Cursor).",
package/server.mjs CHANGED
@@ -18,10 +18,10 @@ import { apiUrl, authHeaders, qs } from "./lib.mjs";
18
18
 
19
19
  const BASE = process.env.AIM_BASE_URL || "https://ai-supply.store";
20
20
  const API_KEY = process.env.AIM_API_KEY;
21
- if (!API_KEY) {
22
- console.error("AIM_API_KEY is required. Create one at /dashboard/api-keys.");
23
- process.exit(1);
24
- }
21
+ // Don't exit when the key is missing — start anyway so the client lists the tools,
22
+ // and return a clear setup hint from each call (silent exit = confusing "0 tools").
23
+ const NO_KEY_MSG =
24
+ "No API key configured. Set the AIM_API_KEY environment variable for the ai-supply MCP server and reload — create one (the 'read' scope is enough to browse) at https://ai-supply.store/dashboard/api-keys";
25
25
 
26
26
  let TOKEN = API_KEY; // falls back to the raw key if session minting fails
27
27
 
@@ -42,6 +42,7 @@ async function mintSession() {
42
42
  }
43
43
 
44
44
  async function call(method, path, body) {
45
+ if (!API_KEY) return { ok: false, status: 401, data: { error: NO_KEY_MSG } };
45
46
  const res = await fetch(apiUrl(BASE, path), {
46
47
  method,
47
48
  headers: authHeaders(TOKEN, body !== undefined),
@@ -54,6 +55,13 @@ async function call(method, path, body) {
54
55
  } catch {
55
56
  data = { raw: text };
56
57
  }
58
+ if (res.status === 401) {
59
+ data = {
60
+ error:
61
+ "ai-supply rejected the API key (401). Check AIM_API_KEY or create a fresh one at https://ai-supply.store/dashboard/api-keys",
62
+ detail: data,
63
+ };
64
+ }
57
65
  return { ok: res.ok, status: res.status, data };
58
66
  }
59
67
 
@@ -64,7 +72,7 @@ function result(r) {
64
72
  };
65
73
  }
66
74
 
67
- const server = new McpServer({ name: "ai-supply", version: "1.0.0" });
75
+ const server = new McpServer({ name: "ai-supply", version: "1.0.1" });
68
76
 
69
77
  const reg = (name, description, shape, handler) =>
70
78
  server.registerTool(name, { description, inputSchema: shape }, handler);
@@ -190,6 +198,9 @@ reg("my_revenue", "Aggregate (mock) revenue for your listings.", {}, async () =>
190
198
  result(await call("GET", "/api/v1/me/revenue")),
191
199
  );
192
200
 
193
- await mintSession();
201
+ if (API_KEY) await mintSession();
194
202
  await server.connect(new StdioServerTransport());
195
- console.error(`ai-supply MCP server connected (base: ${BASE})`);
203
+ console.error(
204
+ `ai-supply MCP server connected (base: ${BASE})` +
205
+ (API_KEY ? "" : " — WARNING: AIM_API_KEY not set; tools will return a setup hint until you configure it."),
206
+ );