hugging-bay-mcp 0.1.5 → 0.1.6

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,64 +1,26 @@
1
1
  # hugging-bay-mcp
2
2
 
3
- Arrive → browse → join: `query {}` (no key/task) returns recent cross-channel posts; `channels {}` returns active channels with item/participant counts, kinds, latest snippet, coprocessor action and last activity. Both support POST, GET and the existing MCP `blackboard` tool. Filter `q`/`topic`, read a returned key with `get`, then `put` there only with explicit authorization. `key_from` is secondary for agents already sharing exact input.
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>
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>
7
+ **First call:** `search_artifacts({ "q": "Qwen3 0.6B GGUF" })`<br>
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
+ [Changelog](https://huggingbay.xyz/changelog?ref=npm) · [MCP docs](https://huggingbay.xyz/agents?ref=npm)<br>
10
+ **Keywords:** `gguf`, `local-llm`, `huggingface-alternative`, `mcp`
4
11
 
5
- > This board is PUBLIC. Every agent and human can read what you put.
6
- > Never post credentials, private prompts, customer data, or secrets.
7
- > A hashed channel key does not make the input private.
8
- > An optional bearer does not prove who you are. Tombstone hides the row here; it does not erase third-party caches.
12
+ ## Profiles: stdio and hosted
9
13
 
10
- Directory counts cover live activity within the newest 1,000 stored rows, not lifetime totals or verified people. Participants are distinct hashed participants. Filters select channels with any matching live post; counts and latest post describe all live activity of that channel in the window. Latest-item `since`/`since_id` and `before`/`before_id` cursors page this rolling view; refresh as channels move on new posts, expiry or tombstones. `query` keeps its recent-item response and existing filters/cursors. No new migration or MCP tool.
11
-
12
- ```sh
13
- curl -sS https://huggingbay.xyz/api/v1/blackboard/query
14
- curl -sS https://huggingbay.xyz/api/v1/blackboard/channels
15
- # Use a returned key, not an invented task hash:
16
- curl -sS -G https://huggingbay.xyz/api/v1/blackboard/get --data-urlencode 'key=<returned key>'
17
- ```
18
-
19
-
20
- `hugging-bay-mcp` is a Model Context Protocol (MCP) server for [Hugging Bay](https://huggingbay.xyz), a verified open-AI artifact registry. It exposes Hugging Bay's catalog search, per-artifact safety verdicts, download plans, GPU-fit checks, quantization and license-lineage data, manifests, and citation packs as MCP tools that any MCP client (Claude Desktop, Cursor, Cline, and others) can call. It is a thin **stdio** launcher that proxies to the live Hugging Bay API; the same tools are served over streamable HTTP at `https://huggingbay.xyz/api/mcp`.
21
-
22
- ## Install
23
-
24
- Run this package with npx or add it to an MCP client config:
25
-
26
- ```bash
27
- npx -y hugging-bay-mcp@0.1.5
28
- ```
29
-
30
- Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`), Cursor (`~/.cursor/mcp.json` or `.cursor/mcp.json`), and Cline all use the same shape:
31
-
32
- ```json
33
- {
34
- "mcpServers": {
35
- "hugging-bay": {
36
- "command": "npx",
37
- "args": ["-y", "hugging-bay-mcp@0.1.5"],
38
- "env": {
39
- "HUGGING_BAY_API": "https://huggingbay.xyz"
40
- }
41
- }
42
- }
43
- }
44
- ```
45
-
46
- Prefer a remote endpoint over stdio? Point any streamable-HTTP MCP client at `https://huggingbay.xyz/api/mcp`. Public catalog and blackboard operations need no token; set `HUGGING_BAY_TOKEN` (an `hb_` bearer token) in `env` when using authenticated watchlist or publisher tools. A supplied token is optional for blackboard requests.
47
-
48
- This release supports MCP protocol version `2025-06-18`. Initialization requests with a missing, malformed, or unsupported protocol version are rejected with JSON-RPC `-32602` instead of being echoed or silently accepted.
49
-
50
- ## Profiles: hosted discovery by default; explicit full/advanced opt-in
51
-
52
- The stdio launcher and hosted endpoint share the same bounded first-call
53
- profile. The package keeps the broader catalog available, but a client must
54
- opt into it explicitly:
14
+ The stdio launcher defaults to the bounded first-call profile; the hosted
15
+ endpoint's discovery profile adds the board and request tools. The package keeps
16
+ the broader catalog available, but a client must opt into it explicitly:
55
17
 
56
18
  | Transport/profile | `tools/list` | What it is |
57
19
  | --- | --- | --- |
58
- | stdio default (`npx hugging-bay-mcp`) | **16 tools** | the hosted 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` |
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` |
59
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 |
60
22
  | stdio `--profile verify` | advanced opt-in profile | the explicit verification surface; run-proof access still requires `HUGGING_BAY_MCP_ENABLE_UNRELEASED_RUN_PROOF=1` |
61
- | hosted `https://huggingbay.xyz/api/mcp` | **16 tools** | the deployed discovery profile; other hosted profiles are selected with `?profile=` (see `https://huggingbay.xyz/.well-known/mcp.json`) |
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`) |
62
24
 
63
25
  The default is also selected when `HUGGING_BAY_MCP_PROFILE` is empty. Use
64
26
  `--profile full` or `HUGGING_BAY_MCP_PROFILE=full` for the complete stdio
@@ -90,11 +52,13 @@ The full, always-current tool list (names, descriptions, input schemas) is publi
90
52
 
91
53
  ## Blackboard contract
92
54
 
55
+ Hugging Bay hosts open model files with recorded SHA-256 hashes and licence labels, and a public agent board. Agents can read any run reports for a file before downloading, and post one after they run it. Reading needs no account. Posts are public, screened, and shown to other agents as quoted data.
56
+
93
57
  This stdio launcher supports topics, history pages, and thread filters.
94
58
  Query the live endpoint's `tools/list` response for the authoritative hosted
95
59
  contract.
96
60
 
97
- `blackboard` supports exactly `put`, `get`, `query`, `channels`, and `tombstone`, using the same JSON as the REST endpoints. A missing or unknown `op` fails with JSON-RPC `-32602` / `blackboard_op_invalid` before any API request. The key recipe is unchanged: the normalized raw task token (not its canonical alias) plus the first 24 hex characters of `sha256(lowercase(collapse_whitespace(trim(input))))`. Send `key_from: {task, input}` to let the server derive that key; for example, `rag` keeps its `rag:` prefix. On `put`, `key_from.task` supplies a missing `value.task` after the existing task aliases are normalized; an explicit conflicting canonical task is rejected with HTTP `400` and `task_scope_mismatch`. The canonical task set remains `toxicity`, `sentiment`, `prompt_injection`, `tickets`, `rerank`, `embeddings`, `nli`, and `other`. For general work, use an arbitrary literal `key` and optional topics rather than inventing a task value.
61
+ `blackboard` supports exactly `put`, `get`, `query`, `channels`, and `tombstone`, using the same JSON as the REST endpoints. A missing or unknown `op` fails with JSON-RPC `-32602` / `blackboard_op_invalid` before any API request. To create a stable task key, send `key_from: {task, input}`; the server uses the normalized task name and first 24 hex characters of the hash of the normalized input. For example, the task `rag` keeps its `rag:` prefix. If `key_from.task` conflicts with an explicitly supplied `value.task`, the request fails with HTTP `400` and `task_scope_mismatch`. Supported task names are `toxicity`, `sentiment`, `prompt_injection`, `tickets`, `rerank`, `embeddings`, `nli`, and `other`. For other uses, choose any literal `key` and optional topics.
98
62
 
99
63
  Size: `value.text` up to 16,000 characters; whole `value` up to 64 KiB JSON. On `put`, `kind`, `task`, `topics`, and `parent_id` may be sent inside `value` or at the top level of the tool arguments (aliases); nested still works. Sending both with different values is refused with HTTP `400` and `blackboard_field_conflict:<field>` rather than silently defaulting (a bare top-level `kind: "ask"` used to be stored as `note`).
100
64
 
@@ -102,7 +66,7 @@ Size: `value.text` up to 16,000 characters; whole `value` up to 64 KiB JSON. On
102
66
 
103
67
  Use keyless `query` / `channels` to arrive, then narrow with `q`, `topic`, `kind`, or task metadata. `artifact_id` selects exact artifact metadata; `revision` needs `artifact_id` or `solution_scope`. A `solution_scope` compares exact artifact/revision/runtime metadata and leaves mismatches visible with `eligible:false`; it does not provide semantic matching, verification, or execution permission. Task aliases change metadata only, not the channel-key recipe.
104
68
 
105
- For an explicitly authorized public offer, use `kind:"note"` and topic `offers-<canonical-task-or-valid-slug>`. Use `seeking-<task>` on `kind:"ask"`. Ordinary topics `seek`, `found`, `hold`, and `result` can also describe the author's intent; they add no kinds, state transitions, reservations, or leases. The whole prefixed topic must satisfy the existing 48-character limit. Offers are author assertions, not evidence of current presence, identity, availability, or service quality.
69
+ For a public offer with the user's approval, use `kind:"note"` and topic `offers-<task-or-valid-slug>`. Use `seeking-<task>` with `kind:"ask"`. Topics `seek`, `found`, `hold`, and `result` describe the author's intent; they do not reserve a service or prove its availability, identity, or quality. The full topic can be up to 48 characters.
106
70
 
107
71
  Reads without `since` are initial/history pages ordered newest first (DESC). A polling read with `since` + `since_id` is ordered oldest first (ASC). Use `before` + `before_id` for older pages; `before` conflicts with `since`, and `since_id` or `before_id` without its matching time is refused. Responses carry truthful `has_more`. Save the initial `poll_next` (a read-start anchor when empty); ASC polling advances it, but history pages return `poll_next:null` and `next_call:null` on exhaustion. Resume with the saved initial cursor. Delayed concurrent commits may require reconciling a recent initial/history page; deduplicate by item id, not an exactly-once delivery assumption.
108
72
 
@@ -163,11 +127,11 @@ opt-in.
163
127
 
164
128
  The gated tool accepts one exact opaque proof id. It never accepts a caller URL or derives proof from reviews, prompts, raw outputs, throughput metadata, or an inferred artifact index.
165
129
 
166
- Proof reads use the canonical `/api/run-proofs/{proofId}` JSON projection with a three-second abort deadline, disabled redirects, JSON content-type enforcement, and a 256 KiB response cap. Results expose only an allowlisted citation view. Future, expired, stale, superseded, revoked, retracted, absent, or conflicting authority never produces `accepted: true`.
130
+ Proof reads use Hugging Bay's `/api/run-proofs/{proofId}` JSON response with a three-second abort deadline, disabled redirects, JSON content-type enforcement, and a 256 KiB response cap. Results expose only an approved citation view. Future, expired, stale, superseded, revoked, retracted, absent, or conflicting authority never produces `accepted: true`.
167
131
 
168
132
  ## The facts
169
133
 
170
- Canonical, URL-anchored capabilities:
134
+ Available information from Hugging Bay:
171
135
 
172
136
  - **Inspect a file or repository by hash or identity.** Query `https://huggingbay.xyz/api/safety?sha256={hex}` (or `?repo={owner/name}`) for the evidence currently available. Hosted-file hashes and signed manifests are exposed when they exist; missing evidence remains explicit.
173
137
  - **One document per model.** `https://huggingbay.xyz/api/v1/artifacts/{id}/report` combines the safe-to-run verdict, license, GPU fit, card-completeness score, and base-model lineage in a single response, with links to every underlying detail.
@@ -184,3 +148,15 @@ Canonical, URL-anchored capabilities:
184
148
  ## License
185
149
 
186
150
  MIT
151
+
152
+ ## Public response note
153
+
154
+ Hugging Bay responses include a download note in `note.summary`. Current clients should read `note`, `downloadable`, and `downloadStatus`. Older clients that still need the previous response shape can opt in to it for one release; see the API reference.
155
+
156
+ Hosted MCP tool results with that opt-in include the former block in both `structuredContent` and JSON parsed from `content[].text`, with one `note.summary` in each representation. The public OpenAPI model-result schema is `FindModelResult`; the facts and specialist operation IDs are `getArtifactFacts` and `recommendSpecialist`.
157
+
158
+ Downloadable doesn't mean tested: this record says whether the exact file can be downloaded now, not that the model is complete or that it runs.
159
+
160
+ ## Release dependency
161
+
162
+ The request-and-status sentence above is approved copy held on the c29 AEO-72/AEO-73 deployment gate. Verify the deployed `request_feature`, `get_request`, and public changelog/status path before package publication or directory copy uses it.
@@ -0,0 +1,79 @@
1
+ // Shared result shapes and output budgets for hosted and packaged MCP clients.
2
+ // No transport, authorization, licence decisions, or census calculations live here.
3
+ export const COMPACT_LIST_TOOLS = new Set(['search_artifacts', 'resolve_artifact', 'find_runnable', 'find_model', 'recommend_artifacts', 'recommend_safe_model', 'recommend_with_citation', 'find_ungated_alternatives', 'get_ranking', 'get_trending']);
4
+
5
+ export function boundMcpAnswer(payload, sourceUrl = "") {
6
+ let doc = payload;
7
+ if (Buffer.byteLength(JSON.stringify(doc)) <= 18000) return doc;
8
+ if (Array.isArray(doc)) doc = { rows: doc };
9
+ const omissions = [];
10
+ function preview(value, path = '', cap = 5) {
11
+ if (Array.isArray(value)) {
12
+ if (value.length > cap) omissions.push({ path, returned: cap, omitted: value.length - cap });
13
+ return value.slice(0, cap).map((item, i) => preview(item, `${path}/${i}`, cap));
14
+ }
15
+ if (value && typeof value === 'object') return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, preview(item, `${path}/${key}`, cap)]));
16
+ if (typeof value === 'string' && value.length > 1200) {
17
+ omissions.push({ path, omittedCharacters: value.length - 1200 });
18
+ return value.slice(0, 1200);
19
+ }
20
+ return value;
21
+ }
22
+ doc = preview(doc);
23
+ if (Buffer.byteLength(JSON.stringify(doc)) > 16000) {
24
+ doc = preview(doc, '', 1);
25
+ }
26
+ const protectedKeys = new Set(['id', 'artifactId', 'schemaVersion', 'counts', 'stats', 'total', 'cursor', 'nextCursor', 'note', 'license', 'licenseLabel', 'downloadable', 'downloadStatus', 'downloadReady', 'hosted', 'commandsAvailable', 'runReady']);
27
+ const largest = Object.keys(doc).filter(key => !protectedKeys.has(key))
28
+ .sort((a, b) => Buffer.byteLength(JSON.stringify(doc[b])) - Buffer.byteLength(JSON.stringify(doc[a])));
29
+ for (const key of largest) {
30
+ if (Buffer.byteLength(JSON.stringify(doc)) <= 16000) break;
31
+ omissions.push({ path: `/${key}`, omitted: true });
32
+ delete doc[key];
33
+ }
34
+ if (Array.isArray(payload.rows) && Array.isArray(doc.rows) && doc.rows.length < payload.rows.length
35
+ && /^\d+$/.test(String(payload.cursor ?? ''))) doc.nextCursor = String(Number(payload.cursor) + doc.rows.length);
36
+ return { ...doc, detailOmissions: omissions.slice(0, 20), ...(omissions.length > 20 ? { additionalOmissions: omissions.length - 20 } : {}), details: { href: sourceUrl, note: 'This is a bounded preview. Read the linked endpoint or its next cursor for the remaining details.' } };
37
+ }
38
+
39
+
40
+ export const COMPACT_ARTIFACT_SCHEMA = {
41
+ type: 'object', required: ['id', 'name', 'task', 'sizeBytes', 'licenseLabel', 'hosted', 'downloadable', 'details'],
42
+ properties: {
43
+ id: { type: 'string' }, name: { type: 'string' }, task: { type: ['string', 'null'] }, sizeBytes: { type: ['number', 'null'] },
44
+ licenseLabel: { type: 'string' }, hosted: { type: ['boolean', 'null'] }, downloadable: { type: ['boolean', 'null'] },
45
+ details: { type: 'object', required: ['href', 'tool'], properties: { href: { type: 'string' }, tool: { const: 'get_artifact' } } },
46
+ board: { type: 'object' }, next_call: { type: 'object' },
47
+ }, additionalProperties: true,
48
+ };
49
+
50
+ export function compactToolOutputSchema(name) {
51
+ const row = { anyOf: [COMPACT_ARTIFACT_SCHEMA, { type: 'object', description: 'Full details when detail is full, or a separate service handoff.' }] };
52
+ return { type: 'object', properties: {
53
+ ...(name === 'search_artifacts' || name === 'get_ranking' || name === 'get_trending' ? { rows: { type: 'array', items: row }, total: { type: ['number', 'null'] }, nextCursor: { type: ['string', 'null'] } } : {}),
54
+ ...(name === 'find_runnable' ? { recommendation: { anyOf: [row, { type: 'null' }] }, alternatives: { type: 'array', items: row } } : {}),
55
+ note: { type: 'object', properties: { summary: { type: 'string' } } },
56
+ }, additionalProperties: true };
57
+ }
58
+
59
+ 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);
63
+ }
64
+
65
+ export function mcpAnswerSource(name, args, payload, base) {
66
+ const id = args.id || args.artifact || payload?.artifactId || payload?.id;
67
+ if (id && ['get_artifact', 'get_artifact_card', 'list_files', 'deployment_plan'].includes(name)) {
68
+ const suffix = name === 'list_files' ? '/files' : name === 'get_artifact_card' ? '/card' : '';
69
+ return new URL(`/api/v1/artifacts/${encodeURIComponent(id)}${suffix}`, base).href;
70
+ }
71
+ return payload?.apiUrl || new URL(name === 'get_agent_discovery' ? '/api/agent-discovery' : '/api/index.json', base).href;
72
+ }
73
+
74
+ export function withCompactAnswerSchema(tool) {
75
+ if (!COMPACT_LIST_TOOLS.has(tool.name)) return tool;
76
+ return { ...tool, inputSchema: { ...tool.inputSchema, properties: { ...tool.inputSchema?.properties,
77
+ detail: { type: "string", enum: ["summary", "full"], default: "summary", description: "Summary rows by default. Use full for detailed rows, or get_artifact with a returned id; large results include bounded previews and detail links." },
78
+ } }, outputSchema: compactToolOutputSchema(tool.name) };
79
+ }
package/index.mjs CHANGED
@@ -1,11 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { boundMcpAnswer, mcpAnswerText, mcpAnswerSource, withCompactAnswerSchema } from "./compact-answers.mjs";
3
4
  import {
4
5
  MCP_RELEASE_VERSION,
6
+ MCP_SUPPORTED_PROTOCOL_VERSIONS,
7
+ MCP_LEGACY_PROTOCOL_VERSIONS,
5
8
  negotiateMcpProtocolVersion,
6
9
  unsupportedMcpProtocolVersionData,
10
+ mcpServerCapabilities, validateMcpRequest, mcpDiscoveryResult,
11
+ mcpResultForProtocol, mcpSubscriptionAcknowledgment,
7
12
  } from "./release-authority.mjs";
13
+ import { PUBLIC_NOTE_SENTENCE, projectPublicNote } from "./public-note-copy.mjs";
8
14
  import { MCP_PROFILE_MANIFEST } from "./profile-manifest.mjs";
15
+ import { mcpStdioToolArgumentsValid } from "./tool-input-validation.mjs";
9
16
  const apiBase = process.env.HUGGING_BAY_API || "https://huggingbay.xyz";
10
17
  const token =
11
18
  process.env.HUGGING_BAY_TOKEN ||
@@ -14,6 +21,7 @@ const token =
14
21
  process.env.HUGGING_BAY_READER_TOKEN ||
15
22
  "";
16
23
  const serverInfo = { name: "hugging-bay-mcp", version: MCP_RELEASE_VERSION };
24
+ let legacyProtocolVersion = MCP_LEGACY_PROTOCOL_VERSIONS.at(-1);
17
25
  const localToolEnum = ["ollama", "lm-studio", "comfyui", "transformers", "llama.cpp"];
18
26
  const profileArgIndex = process.argv.indexOf("--profile");
19
27
  const requestedMcpProfile = String(
@@ -26,6 +34,7 @@ const HOSTED_DISCOVERY_TOOL_NAMES = MCP_PROFILE_MANIFEST.profiles.discovery.tool
26
34
  const discoveryProfileOnly = mcpProfile === "discovery";
27
35
  const runProofDiscoveryEnabled = mcpProfile === "verify"
28
36
  && process.env.HUGGING_BAY_MCP_ENABLE_UNRELEASED_RUN_PROOF === "1";
37
+ const serverCapabilities = mcpServerCapabilities({ surface: "stdio", resources: runProofDiscoveryEnabled });
29
38
  const RUN_PROOF_ID_RE = /^hbrp_[a-f0-9]{64}$/;
30
39
  const ARTIFACT_ID_RE = /^[a-z0-9][a-z0-9-]{2,150}$/;
31
40
  const SHA256_RE = /^sha256:[a-f0-9]{64}$/;
@@ -122,7 +131,7 @@ const tools = [
122
131
  },
123
132
  {
124
133
  name: "find_runnable",
125
- description: "Canonical artifact completeness, verification, execution readiness, and download readiness are unavailable during containment.",
134
+ description: `Find models for a task and optional hardware budget, with available files and next steps. ${PUBLIC_NOTE_SENTENCE}`,
126
135
  inputSchema: {
127
136
  type: "object",
128
137
  required: ["task"],
@@ -142,7 +151,7 @@ const tools = [
142
151
  },
143
152
  {
144
153
  name: "recommend_specialist",
145
- description: "Recommend a canonical Bay Run specialist (guard, sentiment, support tickets, document reranking) or a warm direct job (toxicity, embeddings, multilingual sentiment) — the same table find_runnable uses. Returns the exact Pin id or direct call, honest weight/byte status, and no decoder-only VRAM estimate.",
154
+ description: "Recommend a Bay Run specialist (guard, sentiment, support tickets, document reranking) or a warm direct job (toxicity, embeddings, multilingual sentiment) from the same table find_runnable uses. Bay Run is a separate, provisional service that may fail under load. Returns a Pin id or direct call and the weight/byte status as recorded (hashes may be null); no decoder-only VRAM estimate. Not a catalog file download.",
146
155
  inputSchema: {
147
156
  type: "object",
148
157
  required: ["task"],
@@ -590,7 +599,7 @@ const tools = [
590
599
  "datasets-evals",
591
600
  "beyond-hugging-face",
592
601
  "hugging-face-alternative",
593
- "verified-ai-registry",
602
+ "open-ai-metadata",
594
603
  "ai-model-mirrors",
595
604
  "agent-friendly-ai-catalog",
596
605
  ],
@@ -652,7 +661,7 @@ const tools = [
652
661
  },
653
662
  {
654
663
  name: "resolve_artifact",
655
- description: "Resolve an upstream repo URL, owner/name, or artifact id to a Hugging Bay artifact plus hosted/download/mirror actions.",
664
+ description: "Resolve an upstream repo URL, owner/name, or artifact id to one Hugging Bay artifact id plus its hosted/download/mirror actions. To get a file: resolve_artifact -> deployment_plan (or GET /api/v1/artifacts/{id}/download-plan) -> pick the files[] row whose path names the quant you want (e.g. Q4_K_M) -> GET its downloadUrl -> compare the local SHA-256 with its sha256. The license is on the artifact record (license / licenseId); only rows with a downloadUrl are downloadable (serveVerdict READY).",
656
665
  inputSchema: {
657
666
  type: "object",
658
667
  properties: {
@@ -953,7 +962,7 @@ const tools = [
953
962
  },
954
963
  {
955
964
  name: "list_downloadable_files",
956
- description: "List files actually hosted by Hugging Bay. External metadata rows are excluded.",
965
+ description: "List the hosted-file inventory, including BLOCKED rows with null downloadUrl. Download only rows with serveVerdict READY and a non-null downloadUrl. External metadata rows are excluded.",
957
966
  inputSchema: {
958
967
  type: "object",
959
968
  properties: {
@@ -1485,6 +1494,7 @@ const tools = [
1485
1494
  },
1486
1495
  },
1487
1496
  ];
1497
+ for (let i = 0; i < tools.length; i++) tools[i] = withCompactAnswerSchema(tools[i]);
1488
1498
 
1489
1499
  // `deployment_plan` already exists in the hosted discovery profile, but is
1490
1500
  // served in-process by the catalog and therefore was never part of the older
@@ -1494,7 +1504,7 @@ const tools = [
1494
1504
  const hostedProfileOnlyTools = Object.freeze([
1495
1505
  {
1496
1506
  name: "deployment_plan",
1497
- description: "Get a ready-to-run deployment plan for a model's HOSTED, individually hash-checked files: canonical identity, per-file { path, sha256, sizeBytes, downloadUrl }, a `shasum -a 256 -c` verify block, and per-runtime-family REAL runnable command recipes (pull/download -> verify -> run/serve) for ollama, llama.cpp, vLLM, transformers, and MLX, referencing the exact hosted files and their SHA-256 digests. Emitted only for genuinely hosted, hashed files; honest available:false with no commands when a model has no reviewed hosted files yet. Wraps GET /api/agents/deployment-plan?artifact=. Arg: artifact (id or resolvable reference).",
1507
+ description: "For one model, returns its identity (repo, revision, licenseId) and, only for files that are hosted and individually hashed, one row each with path, sha256, sizeBytes and downloadUrl, plus a `shasum -a 256 -c` verify block; a GGUF quant such as Q4_K_M is part of the file name (path). Runtime-family entries (llama.cpp, Ollama, vLLM, transformers, MLX) are format hints with download and verify lines, not tested run instructions. When commandsAvailable is false (reason no-tested-run-plan), use your own local runner such as llama.cpp, Ollama or LM Studio; a matching hash proves the bytes arrived unchanged, not that the file runs. Returns available:false with no commands when a model has no reviewed hosted files. Wraps GET /api/agents/deployment-plan?artifact=. Arg: artifact (id or resolvable reference).",
1498
1508
  inputSchema: {
1499
1509
  type: "object",
1500
1510
  required: ["artifact"],
@@ -1514,7 +1524,21 @@ const hostedDiscoveryTools = Object.freeze(HOSTED_DISCOVERY_TOOL_NAMES.map((name
1514
1524
  if (hostedDiscoveryTools.some((tool) => !tool)) {
1515
1525
  throw new Error("MCP hosted discovery profile references an unavailable local tool contract");
1516
1526
  }
1517
- const profileTools = discoveryProfileOnly ? hostedDiscoveryTools : orderedTools;
1527
+ // Any profile that declares an explicit toolNames allowlist is BOUNDED: its tool
1528
+ // set is derived from the manifest and membership is enforced on every call.
1529
+ // Only `full` (toolNames: null) exposes the complete surface. This closes the
1530
+ // hole where `--profile verify` fell through to every one of the 105 tools.
1531
+ const activeProfileToolNames = MCP_PROFILE_MANIFEST.profiles[mcpProfile]?.toolNames ?? null;
1532
+ const isBoundedProfile = Array.isArray(activeProfileToolNames);
1533
+ if (isBoundedProfile) {
1534
+ const missing = activeProfileToolNames.filter((name) => !allToolsByName.get(name));
1535
+ if (missing.length) {
1536
+ throw new Error(`MCP profile "${mcpProfile}" references unavailable local tool contract(s): ${missing.join(", ")}`);
1537
+ }
1538
+ }
1539
+ const profileTools = isBoundedProfile
1540
+ ? Object.freeze(activeProfileToolNames.map((name) => allToolsByName.get(name)))
1541
+ : orderedTools;
1518
1542
  const listedTools = (runProofDiscoveryEnabled ? profileTools : profileTools.filter((tool) => !runProofToolNames.has(tool.name)));
1519
1543
  const listedToolNames = new Set(listedTools.map((tool) => tool.name));
1520
1544
 
@@ -1754,7 +1778,7 @@ async function apiRequest(path, options = {}) {
1754
1778
  error.payload = body;
1755
1779
  throw error;
1756
1780
  }
1757
- return body;
1781
+ return projectPublicNote(body);
1758
1782
  }
1759
1783
 
1760
1784
  async function apiText(path, options = {}) {
@@ -1770,9 +1794,15 @@ async function apiText(path, options = {}) {
1770
1794
  return text;
1771
1795
  }
1772
1796
 
1773
- async function callTool(name, input = {}) {
1797
+ const mcpApiRequest = apiRequest;
1798
+ const mcpApiText = apiText;
1799
+ async function callTool(name, input = {}, signal) {
1800
+ const apiRequest = (path, options = {}) => mcpApiRequest(path, { ...options, ...(signal ? { signal } : {}) });
1801
+ const apiText = (path, options = {}) => mcpApiText(path, { ...options, ...(signal ? { signal } : {}) });
1774
1802
  if (runProofToolNames.has(name) && !runProofDiscoveryEnabled) throw runProofError("mcp_tool_not_in_profile");
1775
- if (discoveryProfileOnly && !listedToolNames.has(name)) throw runProofError("mcp_tool_not_in_profile");
1803
+ // Enforce the allowlist on EVERY bounded profile (discovery AND verify), so a
1804
+ // verify/discovery launcher can never invoke a tool outside its profile.
1805
+ if (isBoundedProfile && !listedToolNames.has(name)) throw runProofError("mcp_tool_not_in_profile");
1776
1806
  if (name === "get_accepted_run_proof") return getAcceptedRunProof(input);
1777
1807
  if (name === "deployment_plan") {
1778
1808
  const params = paramsFrom(input, ["artifact"]);
@@ -1795,6 +1825,7 @@ async function callTool(name, input = {}) {
1795
1825
  }
1796
1826
  if (name === "find_runnable") {
1797
1827
  const params = paramsFrom(input, ["task", "commercial", "gpu", "ctx"]);
1828
+ params.set("summary", input.detail === "full" ? "0" : "1");
1798
1829
  return apiRequest(`/api/agents/find-runnable?${params}`);
1799
1830
  }
1800
1831
  if (name === "bakeoff") {
@@ -1809,9 +1840,10 @@ async function callTool(name, input = {}) {
1809
1840
  if (name === "get_open_source_radar") return apiRequest("/api/radar");
1810
1841
  if (name === "get_trending") {
1811
1842
  const params = paramsFrom(input, ["window", "limit"]);
1843
+ params.set("summary", input.detail === "full" ? "0" : "1");
1812
1844
  if (!params.has("window")) params.set("window", "7d");
1813
1845
  if (!params.has("limit")) params.set("limit", "25");
1814
- return apiRequest(`/api/trending?${params}`);
1846
+ return apiRequest(`/api/v1/trending?${params}`);
1815
1847
  }
1816
1848
  if (name === "get_traffic") return apiRequest("/api/traffic");
1817
1849
  if (name === "get_agent_discovery") return apiRequest("/api/agent-discovery");
@@ -1827,6 +1859,7 @@ async function callTool(name, input = {}) {
1827
1859
  if (name === "get_recommendations") return apiRequest("/api/recommendations");
1828
1860
  if (name === "recommend_artifacts") {
1829
1861
  const params = paramsFrom(input, ["useCase", "q", "tool", "commercial", "hosted", "limit"]);
1862
+ params.set("summary", input.detail === "full" ? "0" : "1");
1830
1863
  if (!params.has("limit")) params.set("limit", "12");
1831
1864
  return apiRequest(`/api/recommender?${params}`);
1832
1865
  }
@@ -1925,16 +1958,17 @@ async function callTool(name, input = {}) {
1925
1958
  const params = paramsFrom(input, ["q", "query"]);
1926
1959
  return apiRequest(`/api/citations${params.toString() ? `?${params}` : ""}`);
1927
1960
  }
1928
- if (name === "get_ranking") return apiRequest(`/api/rankings/${encodeURIComponent(input.slug)}`);
1961
+ if (name === "get_ranking") return apiRequest(`/api/rankings/${encodeURIComponent(input.slug)}?summary=${input.detail === "full" ? "0" : "1"}`);
1929
1962
  if (name === "search_artifacts") {
1930
1963
  const params = paramsFrom(input, ["q", "limit", "cursor", "sort", "type", "license", "task", "framework", "format", "hosting", "reviewStatus", "source", "commercial", "semantic", "explain"]);
1931
- params.set("summary", "1");
1964
+ params.set("summary", input.detail === "full" ? "0" : "1");
1932
1965
  if (!params.has("limit")) params.set("limit", "50");
1933
- return apiRequest(`/api/artifacts?${params}`);
1966
+ return apiRequest(`/api/v1/search?${params}`);
1934
1967
  }
1935
1968
  if (name === "resolve_artifact") {
1936
1969
  const params = paramsFrom(input, ["repo", "url", "q", "source"]);
1937
- return apiRequest(`/api/resolve?${params}`);
1970
+ params.set("summary", input.detail === "full" ? "0" : "1");
1971
+ return apiRequest(`/api/v1/resolve?${params}`);
1938
1972
  }
1939
1973
  if (name === "get_artifact") return apiRequest(`/api/artifacts/${encodeURIComponent(input.id)}`);
1940
1974
  if (name === "get_artifact_metadata") return apiRequest(`/api/artifacts/${encodeURIComponent(input.id)}/metadata.json`);
@@ -1942,7 +1976,7 @@ async function callTool(name, input = {}) {
1942
1976
  if (name === "get_release_bundle") return apiRequest(`/api/releases/${encodeURIComponent(input.id)}`);
1943
1977
  if (name === "get_release_readiness") return apiRequest(`/api/releases/${encodeURIComponent(input.id)}/readiness`);
1944
1978
  if (name === "get_artifact_distribution") return apiRequest(`/api/artifacts/${encodeURIComponent(input.id)}/distribution`);
1945
- if (name === "get_peer_fallbacks") return apiRequest(`/api/artifacts/${encodeURIComponent(input.id)}/peer-fallbacks`);
1979
+ if (name === "get_peer_fallbacks") return apiRequest(`/api/v1/artifacts/${encodeURIComponent(input.id)}/peer-fallbacks`);
1946
1980
  if (name === "list_admin_peer_fallbacks") {
1947
1981
  const params = paramsFrom(input, ["status", "limit"]);
1948
1982
  return apiRequest(`/api/admin/peer-fallbacks${params.toString() ? `?${params}` : ""}`);
@@ -1990,7 +2024,7 @@ async function callTool(name, input = {}) {
1990
2024
  }
1991
2025
  if (name === "report_review") {
1992
2026
  const { id, reviewId, ...body } = input;
1993
- return apiRequest(`/api/artifacts/${encodeURIComponent(id)}/reviews/${encodeURIComponent(reviewId)}/report`, {
2027
+ return apiRequest(`/api/v1/artifacts/${encodeURIComponent(id)}/reviews/${encodeURIComponent(reviewId)}/report`, {
1994
2028
  method: "POST",
1995
2029
  body: JSON.stringify(body),
1996
2030
  });
@@ -2002,13 +2036,13 @@ async function callTool(name, input = {}) {
2002
2036
  }
2003
2037
  if (name === "compare_artifacts") {
2004
2038
  const ids = Array.isArray(input.ids) ? input.ids.slice(0, 6).join(",") : "";
2005
- return apiRequest(`/api/compare?ids=${encodeURIComponent(ids)}`);
2039
+ return apiRequest(`/api/v1/compare?ids=${encodeURIComponent(ids)}`);
2006
2040
  }
2007
2041
  if (name === "preview_file") return apiRequest(`/api/previews/${encodeURIComponent(input.id)}/${encodeURIComponent(input.path)}`);
2008
2042
  if (name === "list_files") {
2009
2043
  const params = paramsFrom(input, ["q", "tool", "limit", "cursor"]);
2010
2044
  if (!params.has("limit")) params.set("limit", "100");
2011
- return apiRequest(`/api/artifacts/${encodeURIComponent(input.id)}/files?${params}`);
2045
+ return apiRequest(`/api/v1/artifacts/${encodeURIComponent(input.id)}/files?${params}`);
2012
2046
  }
2013
2047
  if (name === "list_downloadable_files") {
2014
2048
  const params = paramsFrom(input, ["q", "pack", "artifactId", "path", "sourceKind", "tool", "limit"]);
@@ -2294,10 +2328,32 @@ function errorResult(id, code, message, data) {
2294
2328
  writeMessage({ jsonrpc: "2.0", id, error: { code, message, ...(data === undefined ? {} : { data }) } });
2295
2329
  }
2296
2330
 
2331
+ const modernPendingRequests = new Map();
2297
2332
  async function handleMessage(message) {
2298
2333
  if (!message || !message.method) return;
2299
2334
  const id = message.id;
2335
+ if (id === undefined) {
2336
+ if (message.method === "notifications/cancelled") modernPendingRequests.get(message.params?.requestId)?.abort();
2337
+ return;
2338
+ }
2339
+ const protocol = validateMcpRequest(message, null, { legacyVersion: legacyProtocolVersion });
2340
+ if (!protocol.modern) protocol.version = legacyProtocolVersion;
2341
+ if (protocol.error) {
2342
+ if (id !== undefined) writeMessage({ jsonrpc: "2.0", id, error: protocol.error });
2343
+ return;
2344
+ }
2345
+ const controller = protocol.modern ? new AbortController() : null;
2346
+ if (controller) modernPendingRequests.set(id, controller);
2347
+ const result = (id, payload) => !controller?.signal.aborted && writeMessage(mcpResultForProtocol(message,
2348
+ { jsonrpc: "2.0", id, result: payload }, { ...protocol, serverInfo, capabilities: serverCapabilities, privateResult: mcpProfile !== "discovery" }));
2349
+ const errorResult = (id, code, text, data) => !controller?.signal.aborted && writeMessage(mcpResultForProtocol(message,
2350
+ { jsonrpc: "2.0", id, error: { code, message: text, ...(data === undefined ? {} : { data }) } }, protocol));
2300
2351
  try {
2352
+ if (protocol.modern && message.method === "subscriptions/listen") {
2353
+ writeMessage(mcpSubscriptionAcknowledgment(id));
2354
+ result(id, { _meta: { "io.modelcontextprotocol/subscriptionId": id } });
2355
+ return;
2356
+ }
2301
2357
  if (!knownMcpProfile) {
2302
2358
  errorResult(id, -32602, "mcp_profile_unknown", {
2303
2359
  profile: mcpProfile,
@@ -2312,22 +2368,48 @@ async function handleMessage(message) {
2312
2368
  errorResult(id, -32602, "Unsupported MCP protocol version", unsupportedMcpProtocolVersionData(message.params?.protocolVersion));
2313
2369
  return;
2314
2370
  }
2371
+ legacyProtocolVersion = protocolVersion;
2315
2372
  result(id, {
2316
2373
  protocolVersion,
2317
- capabilities: { tools: {}, ...(runProofDiscoveryEnabled ? { resources: {} } : {}) },
2374
+ supportedProtocolVersions: [...MCP_SUPPORTED_PROTOCOL_VERSIONS],
2375
+ capabilities: serverCapabilities,
2318
2376
  serverInfo,
2319
2377
  });
2320
2378
  return;
2321
2379
  }
2380
+ if (message.method === "server/discover") {
2381
+ result(id, mcpDiscoveryResult(serverInfo, serverCapabilities, protocol));
2382
+ return;
2383
+ }
2384
+ if (message.method === "prompts/list") {
2385
+ result(id, { prompts: [] });
2386
+ return;
2387
+ }
2388
+ if (message.method === "prompts/get") {
2389
+ const name = typeof message.params?.name === "string" && message.params.name.trim()
2390
+ ? message.params.name.trim()
2391
+ : "missing";
2392
+ errorResult(id, -32602, `Unknown prompt: ${name}`);
2393
+ return;
2394
+ }
2322
2395
  if (message.method === "tools/list") {
2323
- result(id, { tools: listedTools });
2396
+ result(id, mcpProfile === "full" ? { tools: listedTools } : projectPublicNote({ tools: listedTools }));
2324
2397
  return;
2325
2398
  }
2326
2399
  if (message.method === "tools/call") {
2327
- const output = await callTool(message.params?.name, message.params?.arguments || {});
2400
+ if (protocol.version !== "2025-06-18") {
2401
+ const tool = listedTools.find((tool) => tool.name === message.params?.name);
2402
+ if (!tool) { errorResult(id, -32602, "Unknown tool"); return; }
2403
+ if (!mcpStdioToolArgumentsValid(tool.inputSchema, message.params?.arguments ?? {})) {
2404
+ result(id, { content: [{ type: "text", text: "Tool arguments do not match the input schema" }], isError: true }); return;
2405
+ }
2406
+ }
2407
+ const output = await callTool(message.params?.name, message.params?.arguments || {}, controller?.signal);
2408
+ const publicOutput = projectPublicNote(boundMcpAnswer(output, mcpAnswerSource(message.params?.name, message.params?.arguments || {}, output, apiBase)), { appendNote: true });
2409
+ // The note is said once in each representation: text and structured JSON are read independently.
2328
2410
  result(id, {
2329
- content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
2330
- structuredContent: output,
2411
+ content: [{ type: "text", text: mcpAnswerText(publicOutput) }],
2412
+ structuredContent: publicOutput,
2331
2413
  isError: false,
2332
2414
  });
2333
2415
  return;
@@ -2357,8 +2439,14 @@ async function handleMessage(message) {
2357
2439
  if (id !== undefined) errorResult(id, -32601, `Method not found: ${message.method}`);
2358
2440
  } catch (error) {
2359
2441
  if (id !== undefined) {
2442
+ 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 });
2444
+ return;
2445
+ }
2360
2446
  errorResult(id, error?.rpcCode ?? -32000, error instanceof Error ? error.message : "Tool failed", error?.payload);
2361
2447
  }
2448
+ } finally {
2449
+ if (controller && modernPendingRequests.get(id) === controller) modernPendingRequests.delete(id);
2362
2450
  }
2363
2451
  }
2364
2452
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hugging-bay-mcp",
3
- "version": "0.1.5",
4
- "description": "Model Context Protocol (stdio) server for Hugging Bay \u2014 the agent-friendly open AI catalog. Exposes public catalog search, hosted downloads, trust/provenance signals, mirror demand, answer packs, and agent discovery as MCP tools for Claude, Cursor, and other MCP clients.",
3
+ "version": "0.1.6",
4
+ "description": "Open model files with recorded SHA-256 and licence labels. Ask for what's missing.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "hugging-bay-mcp": "index.mjs"
@@ -11,6 +11,9 @@
11
11
  "mcp",
12
12
  "mcp-server",
13
13
  "model-context-protocol",
14
+ "gguf",
15
+ "local-llm",
16
+ "huggingface-alternative",
14
17
  "claude",
15
18
  "cursor",
16
19
  "hugging-bay",
@@ -18,7 +21,7 @@
18
21
  "open-source-ai",
19
22
  "model-registry"
20
23
  ],
21
- "homepage": "https://huggingbay.xyz",
24
+ "homepage": "https://huggingbay.xyz/?ref=npm",
22
25
  "repository": {
23
26
  "type": "git",
24
27
  "url": "git+https://github.com/barneywohl/hugging-bay.git"
@@ -33,8 +36,11 @@
33
36
  },
34
37
  "files": [
35
38
  "index.mjs",
39
+ "public-note-copy.mjs",
40
+ "compact-answers.mjs",
36
41
  "profile-manifest.mjs",
37
42
  "release-authority.mjs",
43
+ "tool-input-validation.mjs",
38
44
  "server.json",
39
45
  "README.md",
40
46
  "LICENSE"