hugging-bay-mcp 0.1.7 → 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,12 +11,7 @@
11
11
 
12
12
  ## Profiles: stdio and hosted
13
13
 
14
- **Source candidate:** `0.1.7` is not published on npm. Install commands above
15
- remain pinned to the recorded `0.1.6` publication. Inspect this candidate with
16
- `node packages/mcp/index.mjs` from the repository root.
17
-
18
- **What's new in 0.1.7:** `request_missing` joins the 17-tool default profile,
19
- and stdio tool descriptions match the hosted wording.
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.
20
15
 
21
16
  The stdio launcher defaults to the bounded first-call profile; the hosted
22
17
  endpoint's discovery profile adds the board and request tools. The package keeps
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hugging-bay-mcp",
3
- "version": "0.1.7",
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": {
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.7",
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.7",
23
+ "version": "0.1.8",
24
24
  "transport": {
25
25
  "type": "stdio"
26
26
  },
@@ -2,7 +2,7 @@
2
2
  export const STDIO_TOOL_METADATA = {
3
3
  "request_missing": {
4
4
  "title": "Request missing",
5
- "description": "A model, file format or capability is not on Hugging Bay: record it privately (counts only) and get a request id and status URL. Use it for a missing model or file format, even without searching first. Example: {\"wanted\":\"Qwen/model\",\"task\":\"chat\"}. Stores demand; does not start a download or promise a build.",
5
+ "description": "A model, file format or capability is not on Hugging Bay: record it privately (counts only) and get a request id and status URL. Use when a model or file format is missing and a private request receipt is needed. Example: {\"wanted\":\"Qwen/model\",\"task\":\"chat\"}. Stores demand; does not start a download or promise a build.",
6
6
  "annotations": {
7
7
  "title": "Request missing",
8
8
  "readOnlyHint": false,
@@ -48,7 +48,7 @@ export const STDIO_TOOL_METADATA = {
48
48
  },
49
49
  "find_runnable": {
50
50
  "title": "Find runnable",
51
- "description": "Pick models for a task that fit a hardware budget (e.g. 8gb-laptop, 24gb-gpu), optionally commercial-use only; returns ranked ids with licence labels and hosted-file plans. Use it when the user states RAM or VRAM; for plain keyword search use search_artifacts. Example: {\"task\":\"chat\",\"gpu\":\"rtx3060-12\"}. A download is not a tested run; omitted hardware leaves fit unknown. No match? Call request_missing.",
51
+ "description": "Pick models for a task that fit a hardware budget (e.g. 8gb-laptop), optionally commercial-use only, with licences and hosted-file plans. Use when the user states RAM or VRAM and needs model recommendations, not fine-tuning. Example: {\"task\":\"chat\",\"gpu\":\"rtx3060-12\"}. A download is not a tested run; omitted hardware leaves fit unknown.",
52
52
  "annotations": {
53
53
  "title": "Find runnable",
54
54
  "readOnlyHint": true,
@@ -61,12 +61,12 @@ export const STDIO_TOOL_METADATA = {
61
61
  "[\"properties\",\"commercial\"]": "True to require recorded permission for commercial use.",
62
62
  "[\"properties\",\"gpu\"]": "gpu; value for this operation.",
63
63
  "[\"properties\",\"ctx\"]": "Requested context length in tokens.",
64
- "[\"properties\",\"detail\"]": "Summary rows by default. Use full for detailed rows, or get_artifact with a returned id; large results include bounded previews and detail links."
64
+ "[\"properties\",\"detail\"]": "Summary rows by default; full returns detailed rows. Large results include bounded previews and detail links."
65
65
  }
66
66
  },
67
67
  "bakeoff": {
68
68
  "title": "Bakeoff",
69
- "description": "Score Bay Run hosted specialists on your own labelled examples and return provisional scores, failures and a suggested next call. Use when you need to submit this change. Example: {\"task\":\"sentiment\",\"examples\":[{\"input\":\"Great\",\"label\":\"positive\"}]}. Sends examples to Bay Run; use only authorized data. Results cover these examples only.",
69
+ "description": "Score Bay Run hosted specialists on your own labelled examples and return provisional scores and failures. Use when you need to submit this change. Example: {\"task\":\"sentiment\",\"examples\":[{\"input\":\"Great\",\"label\":\"positive\"}]}. Sends examples to Bay Run; authorized data is required. Results cover these examples only.",
70
70
  "annotations": {
71
71
  "title": "Bakeoff",
72
72
  "readOnlyHint": false,
@@ -81,7 +81,7 @@ export const STDIO_TOOL_METADATA = {
81
81
  },
82
82
  "recommend_specialist": {
83
83
  "title": "Recommend specialist",
84
- "description": "Bay Run is Hugging Bay's separate hosted inference API (no local model). Find the Bay Run specialist for a job such as sentiment, classification or entity extraction. Use it when the user wants a hosted API instead of running a model locally. Example: {\"task\":\"sentiment\"}. Bay Run is a separate provisional service that may fail under load; hashes may be unknown.",
84
+ "description": "Bay Run is Hugging Bay's separate hosted inference API (no local model). Find the Bay Run specialist for a job such as sentiment, classification or entity extraction. Use when the user wants a hosted API instead of running a model locally. Example: {\"task\":\"sentiment\"}. Bay Run is a separate provisional service that may fail under load; hashes may be unknown.",
85
85
  "annotations": {
86
86
  "title": "Recommend specialist",
87
87
  "readOnlyHint": true,
@@ -144,7 +144,7 @@ export const STDIO_TOOL_METADATA = {
144
144
  "schemaDescriptions": {
145
145
  "[\"properties\",\"window\"]": "window; value for this operation.",
146
146
  "[\"properties\",\"limit\"]": "Maximum number of returned rows; use the stated bounds.",
147
- "[\"properties\",\"detail\"]": "Summary rows by default. Use full for detailed rows, or get_artifact with a returned id; large results include bounded previews and detail links."
147
+ "[\"properties\",\"detail\"]": "Summary rows by default; full returns detailed rows. Large results include bounded previews and detail links."
148
148
  }
149
149
  },
150
150
  "get_traffic": {
@@ -161,7 +161,7 @@ export const STDIO_TOOL_METADATA = {
161
161
  },
162
162
  "get_agent_discovery": {
163
163
  "title": "Get agent discovery",
164
- "description": "Start here if you are new: every public API, MCP, catalog and evidence entry point, with auth needs and rate limits, in one response. Use when you need these records. Example: {}. Reads records; does not change files.",
164
+ "description": "Public API, MCP, catalog and evidence entry points, with auth needs and rate limits, in one response. Use when you need these records. Example: {}. Reads records; does not change files.",
165
165
  "annotations": {
166
166
  "title": "Get agent discovery",
167
167
  "readOnlyHint": true,
@@ -267,7 +267,7 @@ export const STDIO_TOOL_METADATA = {
267
267
  "[\"properties\",\"commercial\"]": "True to require recorded permission for commercial use.",
268
268
  "[\"properties\",\"hosted\"]": "hosted; true to enable, false to disable.",
269
269
  "[\"properties\",\"limit\"]": "Maximum number of returned rows; use the stated bounds.",
270
- "[\"properties\",\"detail\"]": "Summary rows by default. Use full for detailed rows, or get_artifact with a returned id; large results include bounded previews and detail links."
270
+ "[\"properties\",\"detail\"]": "Summary rows by default; full returns detailed rows. Large results include bounded previews and detail links."
271
271
  }
272
272
  },
273
273
  "get_agent_tasks": {
@@ -641,7 +641,7 @@ export const STDIO_TOOL_METADATA = {
641
641
  },
642
642
  "get_ranking": {
643
643
  "title": "Get ranking",
644
- "description": "One curated ranking as JSON by slug, so you do not scrape ranking HTML. GET /api/rankings lists every slug; common ones are top-open-models, top-open-source-llms and new-open-source. Example: {\"slug\":\"top-open-models\"}. Reads records; does not change files.",
644
+ "description": "One curated ranking as JSON by slug, with model records and ranking metadata. Use when you want a ranked list by slug (e.g. top-open-models, new-open-source). Example: {\"slug\":\"top-open-models\"}. Reads records; does not change files.",
645
645
  "annotations": {
646
646
  "title": "Get ranking",
647
647
  "readOnlyHint": true,
@@ -651,12 +651,12 @@ export const STDIO_TOOL_METADATA = {
651
651
  },
652
652
  "schemaDescriptions": {
653
653
  "[\"properties\",\"slug\"]": "Topic, pack or ranking name from its list.",
654
- "[\"properties\",\"detail\"]": "Summary rows by default. Use full for detailed rows, or get_artifact with a returned id; large results include bounded previews and detail links."
654
+ "[\"properties\",\"detail\"]": "Summary rows by default; full returns detailed rows. Large results include bounded previews and detail links."
655
655
  }
656
656
  },
657
657
  "search_artifacts": {
658
658
  "title": "Search artifacts",
659
- "description": "Keyword search over model and dataset records, with task, licence, size and format filters, when you have no exact name; returns ids and short summaries. For hardware-fit picks use find_runnable; for one known repo use resolve_artifact. Example: {\"q\":\"embedding\",\"limit\":5}. Reads records; does not change files. No match? Call request_missing.",
659
+ "description": "Keyword search over model and dataset records, with task, licence, size and format filters, when you have no exact name; returns ids and short summaries. Use when you need keyword or filtered catalog results without an exact model name. Example: {\"q\":\"embedding\",\"limit\":5}. Reads records; does not change files.",
660
660
  "annotations": {
661
661
  "title": "Search artifacts",
662
662
  "readOnlyHint": true,
@@ -680,12 +680,12 @@ export const STDIO_TOOL_METADATA = {
680
680
  "[\"properties\",\"commercial\"]": "True to require recorded permission for commercial use.",
681
681
  "[\"properties\",\"semantic\"]": "semantic; value for this operation.",
682
682
  "[\"properties\",\"explain\"]": "explain; value for this operation.",
683
- "[\"properties\",\"detail\"]": "Summary rows by default. Use full for detailed rows, or get_artifact with a returned id; large results include bounded previews and detail links."
683
+ "[\"properties\",\"detail\"]": "Summary rows by default; full returns detailed rows. Large results include bounded previews and detail links."
684
684
  }
685
685
  },
686
686
  "resolve_artifact": {
687
687
  "title": "Resolve artifact",
688
- "description": "Turn a Hugging Face or ModelScope owner/name, repo URL or model name into its Hugging Bay id (hf-model-owner-name) and say whether it is hosted. Call first when you only have an upstream name or URL; skip it when you already have a Hugging Bay id. Example: {\"repo\":\"Qwen/Qwen3-0.6B-GGUF\"}. Reads records; does not change files. No match? Call request_missing.",
688
+ "description": "Turn a Hugging Face or ModelScope owner/name, repo URL or model name into its Hugging Bay id (hf-model-owner-name) and say whether it is hosted. Use when you have an upstream name or URL rather than a Hugging Bay id. Example: {\"repo\":\"Qwen/Qwen3-0.6B-GGUF\"}. Reads records; does not change files.",
689
689
  "annotations": {
690
690
  "title": "Resolve artifact",
691
691
  "readOnlyHint": true,
@@ -698,12 +698,12 @@ export const STDIO_TOOL_METADATA = {
698
698
  "[\"properties\",\"url\"]": "url; value for this operation.",
699
699
  "[\"properties\",\"q\"]": "Text to search for.",
700
700
  "[\"properties\",\"source\"]": "Source provider name.",
701
- "[\"properties\",\"detail\"]": "Summary rows by default. Use full for detailed rows, or get_artifact with a returned id; large results include bounded previews and detail links."
701
+ "[\"properties\",\"detail\"]": "Summary rows by default; full returns detailed rows. Large results include bounded previews and detail links."
702
702
  }
703
703
  },
704
704
  "get_artifact": {
705
705
  "title": "Get artifact",
706
- "description": "Full record for one Hugging Bay id: upstream origin and source URL, import dates, licence label, tags and hosted-file counts. For file sizes and hashes use list_files. Example: {\"id\":\"hf-model-qwen-qwen3-0-6b-gguf\"}. Reads records; does not change files.",
706
+ "description": "Full record for one Hugging Bay id: upstream origin and source URL, import dates, licence label, tags and hosted-file counts. Use when you need the provenance and full recorded metadata for one model. Example: {\"id\":\"hf-model-qwen-qwen3-0-6b-gguf\"}. Reads records; does not change files.",
707
707
  "annotations": {
708
708
  "title": "Get artifact",
709
709
  "readOnlyHint": true,
@@ -1005,7 +1005,7 @@ export const STDIO_TOOL_METADATA = {
1005
1005
  },
1006
1006
  "list_files": {
1007
1007
  "title": "List files",
1008
- "description": "Every recorded file of one Hugging Bay id: path, format (GGUF, safetensors, ONNX), size, SHA-256 and whether it is hosted here, paginated. Set tool (ollama, llama.cpp, lm-studio, transformers) for that runner's command. Example: {\"id\":\"hf-model-qwen-qwen3-0-6b-gguf\"}. Reads records; does not change files. No match? Call request_missing.",
1008
+ "description": "Every recorded file of one Hugging Bay id: path, format (GGUF, safetensors, ONNX), size, SHA-256 and whether it is hosted here, paginated. Use when you need the file inventory, optionally filtered by local runner; commands appear only with a tested run path. Example: {\"id\":\"hf-model-qwen-qwen3-0-6b-gguf\"}. Reads records; does not change files.",
1009
1009
  "annotations": {
1010
1010
  "title": "List files",
1011
1011
  "readOnlyHint": true,
@@ -1647,7 +1647,7 @@ export const STDIO_TOOL_METADATA = {
1647
1647
  },
1648
1648
  "deployment_plan": {
1649
1649
  "title": "Deployment plan",
1650
- "description": "Read deployment plan details. Use it to download or re-download. Example: {\"artifact\":\"hf-model-qwen-qwen3-0-6b-gguf\"}. A matching hash proves bytes arrived unchanged; local run steps may be unavailable.",
1650
+ "description": "Download step for one Hugging Bay id: stable download URLs (each redirects to a short-lived signed link), sizes and SHA-256 per downloadable file, and any tested local steps. Use when you need current file links and hashes for a download or re-download. Example: {\"artifact\":\"hf-model-qwen-qwen3-0-6b-gguf\"}. A matching hash proves bytes arrived unchanged; local run steps may be unavailable.",
1651
1651
  "annotations": {
1652
1652
  "title": "Deployment plan",
1653
1653
  "readOnlyHint": true,