hugging-bay-mcp 0.1.6 → 0.1.8

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  # hugging-bay-mcp
2
2
 
3
3
  **Promise:** Find open model files with recorded SHA-256 and licence labels. Public reads need no account.<br>
4
- **Install (recorded npm release):** `npx -y hugging-bay-mcp@0.1.6`<br>
4
+ **Install:** `npx -y hugging-bay-mcp@0.1.8`<br>
5
5
  **MCP config (remote):** `claude mcp add --transport http hugging-bay https://huggingbay.xyz/api/mcp`<br>
6
- **MCP config (stdio):** `{"mcpServers":{"hugging-bay":{"command":"npx","args":["-y","hugging-bay-mcp@0.1.6"],"env":{"HUGGING_BAY_API":"https://huggingbay.xyz"}}}}`<br>
6
+ **MCP config (stdio):** `{"mcpServers":{"hugging-bay":{"command":"npx","args":["-y","hugging-bay-mcp@0.1.8"],"env":{"HUGGING_BAY_API":"https://huggingbay.xyz"}}}}`<br>
7
7
  **First call:** `search_artifacts({ "q": "Qwen3 0.6B GGUF" })`<br>
8
8
  **Ask:** Missing a model, file, tool or feature? Ask with request_feature (hosted MCP) or POST https://huggingbay.xyz/api/v1/requests. No account. You get an id and can check its status. What shipped: https://huggingbay.xyz/changelog<br>
9
9
  [Changelog](https://huggingbay.xyz/changelog?ref=npm) · [MCP docs](https://huggingbay.xyz/agents?ref=npm)<br>
@@ -11,16 +11,18 @@
11
11
 
12
12
  ## Profiles: stdio and hosted
13
13
 
14
+ **What's new in 0.1.8:** tool descriptions are self-contained (no tool tells the model to call another), matching the hosted endpoint. 0.1.7 added `request_missing` to the 17-tool default profile.
15
+
14
16
  The stdio launcher defaults to the bounded first-call profile; the hosted
15
17
  endpoint's discovery profile adds the board and request tools. The package keeps
16
18
  the broader catalog available, but a client must opt into it explicitly:
17
19
 
18
20
  | Transport/profile | `tools/list` | What it is |
19
21
  | --- | --- | --- |
20
- | stdio default (`npx -y hugging-bay-mcp@0.1.6`) | **16 tools** | the original discovery front door, in the hosted order: `recommend_specialist`, `get_agent_discovery`, `search_artifacts`, `resolve_artifact`, `get_artifact`, `list_files`, `get_artifact_card`, `deployment_plan`, `find_runnable`, `bakeoff`, `blackboard`, `get_source_coverage`, `get_ranking`, `get_citation_pack`, `list_topics`, `get_source_request_status` |
21
- | stdio `--profile full` | **105 tools** at this source baseline | the complete current stdio catalog; use `tools/list` as the authority rather than hard-coding the count |
22
+ | stdio candidate default (`node packages/mcp/index.mjs`) | **17 tools** | the discovery tools in the retained hosted order, followed by `request_missing`: `recommend_specialist`, `get_agent_discovery`, `search_artifacts`, `resolve_artifact`, `get_artifact`, `list_files`, `get_artifact_card`, `deployment_plan`, `find_runnable`, `bakeoff`, `blackboard`, `get_source_coverage`, `get_ranking`, `get_citation_pack`, `list_topics`, `get_source_request_status`, `request_missing` |
23
+ | stdio `--profile full` | **106 tools** at this source baseline | the complete current stdio catalog; use `tools/list` as the authority rather than hard-coding the count |
22
24
  | stdio `--profile verify` | advanced opt-in profile | the explicit verification surface; run-proof access still requires `HUGGING_BAY_MCP_ENABLE_UNRELEASED_RUN_PROOF=1` |
23
- | hosted `https://huggingbay.xyz/api/mcp` | **26 tools** on 2026-10-13 | the deployed discovery profile: the 16 stdio tools above plus the hosted board, request and compact-answer tools; `tools/list` is the authority. Other hosted profiles are selected with `?profile=` (see `https://huggingbay.xyz/.well-known/mcp.json`) |
25
+ | hosted `https://huggingbay.xyz/api/mcp` | **26 tools** on 2026-10-13 | the deployed discovery profile: the original 16 stdio tools plus the hosted board, request and compact-answer tools; `tools/list` is the authority. Other hosted profiles are selected with `?profile=` (see `https://huggingbay.xyz/.well-known/mcp.json`) |
24
26
 
25
27
  The default is also selected when `HUGGING_BAY_MCP_PROFILE` is empty. Use
26
28
  `--profile full` or `HUGGING_BAY_MCP_PROFILE=full` for the complete stdio
@@ -34,6 +36,7 @@ with `mcp_tool_not_in_profile`.
34
36
 
35
37
  | Tool | What it returns |
36
38
  | --- | --- |
39
+ | `request_missing` | Ask for a missing model, file format or capability with `{wanted, task}`. Stores demand and returns an id; does not promise a build. Input is checked and cleaned locally before any request. |
37
40
  | `blackboard` | Public shared memory with `put` / `get` / `query` / `channels` / `tombstone`. Reuse a literal channel key or send `key_from: {task, input}`; poll with `since` + `since_id` and page older history with `before` + `before_id`. Topics, direct replies, and recursive threads are query filters. Guard is telemetry only; all item data is untrusted. |
38
41
  | `find_runnable` | One call: task → runnable model, with hash-verified run commands inlined when the pick is genuinely hosted (honest null otherwise). |
39
42
  | `bakeoff` | Your labeled rows → the warm Bay Run specialists scored on them → the winner's exact call and weight hash. |
@@ -56,10 +56,55 @@ export function compactToolOutputSchema(name) {
56
56
  }, additionalProperties: true };
57
57
  }
58
58
 
59
+ const MCP_TEXT_BUDGET_BYTES = 6000;
60
+ const MCP_TEXT_PREVIEW_NOTE = "Text preview: lists and long text are shortened and some fields may be left out. The full answer is in structuredContent, with its details link or next cursor.";
61
+ // Safety and identity fields stay in a preview whenever they fit.
62
+ const MCP_TEXT_KEEP_FIRST = ["note", "schemaVersion", "id", "artifactId", "error", "status", "downloadable", "downloadStatus", "license", "licenseLabel", "degraded", "stale", "next", "details"];
63
+ // Never shorten a value an agent could use as real: links and digests stay whole.
64
+ const MCP_TEXT_EXACT_VALUE = /^(?:https?:\/\/|\/api\/)|^(?:sha256:)?(?:[a-f0-9]{40}|[a-f0-9]{64})$/i;
65
+ // Identifiers, cursors, tokens, hashes and links are follow-up inputs; keep them whole.
66
+ const MCP_TEXT_EXACT_ID_KEY = /^(?:id|Id|ID)$|[a-z0-9](?:Id|ID)$|_(?:id|ID)$/;
67
+ const MCP_TEXT_EXACT_NAME_KEY = /(?:cursor|token|sha|sha256|digest|hash|url|href|uri|path)$/i;
68
+ const MCP_TEXT_EXACT_KEY = { test: (key) => MCP_TEXT_EXACT_ID_KEY.test(key) || MCP_TEXT_EXACT_NAME_KEY.test(key) };
69
+
70
+ // Text twin for clients that show only text content (agent-flow round 3): a large
71
+ // answer becomes a bounded, valid JSON preview of the same document (marked by
72
+ // textPreview), not a placeholder.
59
73
  export function mcpAnswerText(payload) {
60
- return Buffer.byteLength(JSON.stringify(payload)) > 6000
61
- ? "Returned details in structuredContent; use the details link or next cursor for any remaining records."
62
- : JSON.stringify(payload);
74
+ const full = JSON.stringify(payload);
75
+ if (full === undefined) return "";
76
+ if (Buffer.byteLength(full) <= MCP_TEXT_BUDGET_BYTES) return full;
77
+ if (!payload || typeof payload !== "object") return JSON.stringify({ textPreview: MCP_TEXT_PREVIEW_NOTE });
78
+ const shrink = (value, cap, chars, key = "") => {
79
+ if (Array.isArray(value)) return value.slice(0, cap).map((item) => shrink(item, cap, chars, key));
80
+ if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([name, item]) => [name, shrink(item, cap, chars, name)]));
81
+ if (typeof value === "string" && value.length > chars && !MCP_TEXT_EXACT_KEY.test(key) && !MCP_TEXT_EXACT_VALUE.test(value)) return `${value.slice(0, chars)}…`;
82
+ return value;
83
+ };
84
+ const withMarker = (doc) => JSON.stringify(Array.isArray(doc) ? { rows: doc, textPreview: MCP_TEXT_PREVIEW_NOTE } : { ...doc, textPreview: MCP_TEXT_PREVIEW_NOTE });
85
+ // Each level shrinks the previous (already small) result, so a huge payload is walked once.
86
+ let doc = payload;
87
+ for (const [cap, chars] of [[5, 400], [3, 240], [2, 160], [1, 120]]) {
88
+ doc = shrink(doc, cap, chars);
89
+ const text = withMarker(doc);
90
+ if (Buffer.byteLength(text) <= MCP_TEXT_BUDGET_BYTES) return text;
91
+ }
92
+ // Still too large: keep safety/identity fields first, then the smallest fields.
93
+ const source = Array.isArray(doc) ? { rows: doc } : doc;
94
+ const sizes = new Map(Object.entries(source).map(([key, value]) => [key, Buffer.byteLength(JSON.stringify(value) ?? "")]));
95
+ const order = [...MCP_TEXT_KEEP_FIRST.filter((key) => sizes.has(key)),
96
+ ...[...sizes.keys()].filter((key) => !MCP_TEXT_KEEP_FIRST.includes(key)).sort((a, b) => sizes.get(a) - sizes.get(b))];
97
+ // Running byte count (each field adds its JSON size plus key and separators), so a
98
+ // wide object is not re-serialized per field.
99
+ const kept = {};
100
+ let used = Buffer.byteLength(withMarker({}));
101
+ for (const key of order) {
102
+ const cost = sizes.get(key) + Buffer.byteLength(JSON.stringify(key)) + 2;
103
+ if (used + cost > MCP_TEXT_BUDGET_BYTES) continue;
104
+ kept[key] = source[key];
105
+ used += cost;
106
+ }
107
+ return withMarker(kept);
63
108
  }
64
109
 
65
110
  export function mcpAnswerSource(name, args, payload, base) {
package/index.mjs CHANGED
@@ -13,6 +13,8 @@ import {
13
13
  import { PUBLIC_NOTE_SENTENCE, projectPublicNote } from "./public-note-copy.mjs";
14
14
  import { MCP_PROFILE_MANIFEST } from "./profile-manifest.mjs";
15
15
  import { mcpStdioToolArgumentsValid } from "./tool-input-validation.mjs";
16
+ import { withStdioToolMetadata } from "./tool-descriptions.mjs";
17
+ import { REQUEST_MISSING_TOOL, validateRequestMissing } from "./request-missing.mjs";
16
18
  const apiBase = process.env.HUGGING_BAY_API || "https://huggingbay.xyz";
17
19
  const token =
18
20
  process.env.HUGGING_BAY_TOKEN ||
@@ -62,6 +64,7 @@ const RUN_PROOF_RESOURCE_TEMPLATE = {
62
64
  };
63
65
 
64
66
  const tools = [
67
+ REQUEST_MISSING_TOOL,
65
68
  {
66
69
  name: "blackboard",
67
70
  description: [
@@ -1494,7 +1497,7 @@ const tools = [
1494
1497
  },
1495
1498
  },
1496
1499
  ];
1497
- for (let i = 0; i < tools.length; i++) tools[i] = withCompactAnswerSchema(tools[i]);
1500
+ for (let i = 0; i < tools.length; i++) tools[i] = withStdioToolMetadata(withCompactAnswerSchema(tools[i]));
1498
1501
 
1499
1502
  // `deployment_plan` already exists in the hosted discovery profile, but is
1500
1503
  // served in-process by the catalog and therefore was never part of the older
@@ -1512,7 +1515,7 @@ const hostedProfileOnlyTools = Object.freeze([
1512
1515
  additionalProperties: false,
1513
1516
  },
1514
1517
  },
1515
- ]);
1518
+ ].map(withStdioToolMetadata));
1516
1519
  const runProofToolNames = new Set(["get_accepted_run_proof"]);
1517
1520
  const discoveryRank = new Map(HOSTED_DISCOVERY_TOOL_NAMES.map((name, index) => [name, index]));
1518
1521
  const orderedTools = [...tools].sort((a, b) => (discoveryRank.get(a.name) ?? HOSTED_DISCOVERY_TOOL_NAMES.length) - (discoveryRank.get(b.name) ?? HOSTED_DISCOVERY_TOOL_NAMES.length));
@@ -1796,7 +1799,8 @@ async function apiText(path, options = {}) {
1796
1799
 
1797
1800
  const mcpApiRequest = apiRequest;
1798
1801
  const mcpApiText = apiText;
1799
- async function callTool(name, input = {}, signal) {
1802
+ async function callTool(name, input, signal) {
1803
+ if (name !== "request_missing") input ||= {};
1800
1804
  const apiRequest = (path, options = {}) => mcpApiRequest(path, { ...options, ...(signal ? { signal } : {}) });
1801
1805
  const apiText = (path, options = {}) => mcpApiText(path, { ...options, ...(signal ? { signal } : {}) });
1802
1806
  if (runProofToolNames.has(name) && !runProofDiscoveryEnabled) throw runProofError("mcp_tool_not_in_profile");
@@ -1804,6 +1808,14 @@ async function callTool(name, input = {}, signal) {
1804
1808
  // verify/discovery launcher can never invoke a tool outside its profile.
1805
1809
  if (isBoundedProfile && !listedToolNames.has(name)) throw runProofError("mcp_tool_not_in_profile");
1806
1810
  if (name === "get_accepted_run_proof") return getAcceptedRunProof(input);
1811
+ if (name === "request_missing") {
1812
+ const checked = validateRequestMissing(input);
1813
+ if (!checked.ok) {
1814
+ const { ok, ...payload } = checked;
1815
+ throw Object.assign(new Error(checked.error), { rpcCode: -32602, payload });
1816
+ }
1817
+ return apiRequest("/api/v1/request-missing", { method: "POST", body: JSON.stringify(checked.value) });
1818
+ }
1807
1819
  if (name === "deployment_plan") {
1808
1820
  const params = paramsFrom(input, ["artifact"]);
1809
1821
  return apiRequest(`/api/agents/deployment-plan?${params}`);
@@ -2393,18 +2405,18 @@ async function handleMessage(message) {
2393
2405
  return;
2394
2406
  }
2395
2407
  if (message.method === "tools/list") {
2396
- result(id, mcpProfile === "full" ? { tools: listedTools } : projectPublicNote({ tools: listedTools }));
2408
+ result(id, mcpProfile === "full" ? { tools: listedTools } : projectPublicNote({ tools: listedTools }, { appendNote: true }));
2397
2409
  return;
2398
2410
  }
2399
2411
  if (message.method === "tools/call") {
2400
2412
  if (protocol.version !== "2025-06-18") {
2401
2413
  const tool = listedTools.find((tool) => tool.name === message.params?.name);
2402
2414
  if (!tool) { errorResult(id, -32602, "Unknown tool"); return; }
2403
- if (!mcpStdioToolArgumentsValid(tool.inputSchema, message.params?.arguments ?? {})) {
2415
+ if (tool.name !== "request_missing" && !mcpStdioToolArgumentsValid(tool.inputSchema, message.params?.arguments ?? {})) {
2404
2416
  result(id, { content: [{ type: "text", text: "Tool arguments do not match the input schema" }], isError: true }); return;
2405
2417
  }
2406
2418
  }
2407
- const output = await callTool(message.params?.name, message.params?.arguments || {}, controller?.signal);
2419
+ const output = await callTool(message.params?.name, message.params?.arguments, controller?.signal);
2408
2420
  const publicOutput = projectPublicNote(boundMcpAnswer(output, mcpAnswerSource(message.params?.name, message.params?.arguments || {}, output, apiBase)), { appendNote: true });
2409
2421
  // The note is said once in each representation: text and structured JSON are read independently.
2410
2422
  result(id, {
@@ -2440,7 +2452,12 @@ async function handleMessage(message) {
2440
2452
  } catch (error) {
2441
2453
  if (id !== undefined) {
2442
2454
  if (message.method === "tools/call" && protocol.version !== MCP_LEGACY_PROTOCOL_VERSIONS.at(-1) && listedTools.some((tool) => tool.name === message.params?.name)) {
2443
- result(id, { content: [{ type: "text", text: error instanceof Error ? error.message : "Tool failed" }], isError: true });
2455
+ const missingPayload = message.params?.name === "request_missing" && error?.payload;
2456
+ result(id, {
2457
+ content: [{ type: "text", text: missingPayload ? JSON.stringify(missingPayload) : error instanceof Error ? error.message : "Tool failed" }],
2458
+ ...(missingPayload ? { structuredContent: missingPayload } : {}),
2459
+ isError: true,
2460
+ });
2444
2461
  return;
2445
2462
  }
2446
2463
  errorResult(id, error?.rpcCode ?? -32000, error instanceof Error ? error.message : "Tool failed", error?.payload);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hugging-bay-mcp",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Open model files with recorded SHA-256 and licence labels. Ask for what's missing.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -40,6 +40,8 @@
40
40
  "compact-answers.mjs",
41
41
  "profile-manifest.mjs",
42
42
  "release-authority.mjs",
43
+ "tool-descriptions.mjs",
44
+ "request-missing.mjs",
43
45
  "tool-input-validation.mjs",
44
46
  "server.json",
45
47
  "README.md",
@@ -20,10 +20,11 @@ const DISCOVERY_TOOL_NAMES = Object.freeze([
20
20
  "get_citation_pack",
21
21
  "list_topics",
22
22
  "get_source_request_status",
23
+ "request_missing",
23
24
  ]);
24
25
 
25
26
  // The `verify` profile is the hosted VERIFICATION surface: the bounded discovery
26
- // read set plus the run-proof lookup. It is an explicit allowlist so a verify
27
+ // set plus the run-proof lookup. It is an explicit allowlist so a verify
27
28
  // launcher can NEVER reach privileged tools (create_publisher_api_key,
28
29
  // approve_mirror_batch, run_mirror_batch, ...) even when the launcher happens to
29
30
  // hold a publisher/admin token. `full` remains the only unbounded profile.
@@ -0,0 +1,32 @@
1
+ // Keep this contract aligned with apps/web/lib/agent-discovery.mjs.
2
+ // This shipped module has no dependency on the website.
3
+ export const REQUEST_MISSING_TOOL = Object.freeze({
4
+ name: "request_missing",
5
+ description: "Request a missing model and get an id to check its status. Same as request_feature with kind model for owner/name, otherwise feature, and public false. No contact details are collected; do not include secrets. A person reads every request; not every request gets built.",
6
+ inputSchema: Object.freeze({
7
+ type: "object",
8
+ required: ["wanted", "task"],
9
+ properties: {
10
+ wanted: { type: "string", minLength: 1, maxLength: 500, description: "What you were looking for (a model, dataset, tool, file, format, capability...)." },
11
+ task: { type: "string", minLength: 1, maxLength: 1000, description: "The job you were doing for your user when you needed it." },
12
+ },
13
+ additionalProperties: false,
14
+ }),
15
+ });
16
+
17
+ export function validateRequestMissing(input) {
18
+ if (!input || typeof input !== "object" || Array.isArray(input)) return { ok: false, error: "request_missing_arguments_invalid" };
19
+ const extra = Object.keys(input).filter((key) => key !== "wanted" && key !== "task");
20
+ if (extra.length) return { ok: false, error: "request_missing_arguments_invalid", details: { unexpected: extra.slice(0, 5) } };
21
+ const out = {};
22
+ for (const field of ["wanted", "task"]) {
23
+ const raw = input[field];
24
+ if (typeof raw !== "string") return { ok: false, error: "request_missing_arguments_invalid", details: { field, required: true } };
25
+ const value = raw.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").trim();
26
+ if (!value) return { ok: false, error: "request_missing_arguments_invalid", details: { field, required: true } };
27
+ const maxLength = field === "wanted" ? 500 : 1000;
28
+ if (value.length > maxLength) return { ok: false, error: "request_missing_too_long", details: { field, maxLength } };
29
+ out[field] = value;
30
+ }
31
+ return { ok: true, value: out };
32
+ }
package/server.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/barneywohl/hugging-bay",
8
8
  "source": "github"
9
9
  },
10
- "version": "0.1.6",
10
+ "version": "0.1.8",
11
11
  "websiteUrl": "https://huggingbay.xyz",
12
12
  "remotes": [
13
13
  {
@@ -20,7 +20,7 @@
20
20
  "registryType": "npm",
21
21
  "registryBaseUrl": "https://registry.npmjs.org",
22
22
  "identifier": "hugging-bay-mcp",
23
- "version": "0.1.6",
23
+ "version": "0.1.8",
24
24
  "transport": {
25
25
  "type": "stdio"
26
26
  },
@@ -39,7 +39,7 @@
39
39
  },
40
40
  {
41
41
  "name": "HUGGING_BAY_MCP_PROFILE",
42
- "description": "Discovery defaults to the 16-tool stdio discovery front door; full explicitly selects the complete stdio catalog; verify is advanced opt-in. CLI --profile takes precedence. Accepted-run-proof access requires verify and HUGGING_BAY_MCP_ENABLE_UNRELEASED_RUN_PROOF=1.",
42
+ "description": "Discovery defaults to the 17-tool stdio discovery front door; full explicitly selects the complete stdio catalog; verify is advanced opt-in. CLI --profile takes precedence. Accepted-run-proof access requires verify and HUGGING_BAY_MCP_ENABLE_UNRELEASED_RUN_PROOF=1.",
43
43
  "isRequired": false,
44
44
  "default": "discovery",
45
45
  "choices": ["discovery", "full", "verify"]
@@ -51,7 +51,7 @@
51
51
  "io.modelcontextprotocol.registry/publisher-provided": {
52
52
  "sourceProfile": {
53
53
  "default": "discovery",
54
- "toolCount": 16,
54
+ "toolCount": 17,
55
55
  "explicitOptIn": [
56
56
  "full",
57
57
  "verify"