@awesomate/hosting-mcp 0.16.3 → 0.16.5

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/index.js CHANGED
@@ -40013,7 +40013,21 @@ async function knowledgeStatus(config3) {
40013
40013
  if (status.upgrade_required) {
40014
40014
  return { ...status, upsell: upsellPayload(config3.apiBase, status.plan) };
40015
40015
  }
40016
- return status;
40016
+ const usage = status.usage;
40017
+ if (!usage) return status;
40018
+ const annotated = {
40019
+ ...status,
40020
+ usage_glossary: {
40021
+ pages: "month-to-date hub-submitted page quota used (vs usage.included.pages) \u2014 NOT the size of the library",
40022
+ sources_total: 'sources currently in the library; kinds in usage.sources_by_kind or awesomate_knowledge_sources {action:"summary"}'
40023
+ }
40024
+ };
40025
+ if (usage.sources_total_source === "hourly_gauge") {
40026
+ annotated.note = "The live source count failed for this call: usage.sources_total / sources_failed are the last hourly gauge \u2014 possibly stale, and 0 for a library the gauge could never count. Retry before quoting them; the tenant itself is active.";
40027
+ } else if (usage.sources_total_truncated === true) {
40028
+ annotated.note = `usage.sources_total is a floor: the live count stopped at ${String(usage.sources_total)} sources (paged-count cap). The library holds at least that many \u2014 never quote it as the exact total.`;
40029
+ }
40030
+ return annotated;
40017
40031
  } catch (err) {
40018
40032
  return mapKnowledgeError(err, config3.apiBase);
40019
40033
  }
@@ -40032,10 +40046,49 @@ async function knowledgeProvision(config3) {
40032
40046
  return mapKnowledgeError(err, config3.apiBase);
40033
40047
  }
40034
40048
  }
40049
+ function describeSourcePage(page) {
40050
+ if (!Array.isArray(page.sources)) return page;
40051
+ const kinds = {};
40052
+ for (const s of page.sources) {
40053
+ const k = typeof s.kind === "string" ? s.kind : "unknown";
40054
+ kinds[k] = (kinds[k] ?? 0) + 1;
40055
+ }
40056
+ const hasMore = typeof page.next_cursor === "string" && page.next_cursor.length > 0;
40057
+ return {
40058
+ ...page,
40059
+ page: { returned: page.sources.length, kinds_on_this_page: kinds, has_more: hasMore },
40060
+ ...hasMore ? {
40061
+ note: 'This is ONE page of the most recently ingested sources, not the whole library \u2014 do not summarise the knowledge base from it. Pass cursor=next_cursor to continue (limit up to 200). For the total, use awesomate_knowledge_status \u2192 usage.sources_total (sources_total_truncated:true means "at least that many").'
40062
+ } : {}
40063
+ };
40064
+ }
40035
40065
  async function knowledgeSources(config3, args) {
40036
40066
  try {
40037
40067
  if (args.action === "list") {
40038
- return await hubGet(config3, "/api/knowledge/sources");
40068
+ const q = new URLSearchParams();
40069
+ if (args.cursor) q.set("cursor", args.cursor);
40070
+ if (args.limit !== void 0) q.set("limit", String(args.limit));
40071
+ const qs = q.toString();
40072
+ const page = await hubGet(config3, `/api/knowledge/sources${qs ? `?${qs}` : ""}`);
40073
+ return describeSourcePage(page);
40074
+ }
40075
+ if (args.action === "summary") {
40076
+ try {
40077
+ const s = await hubGet(config3, "/api/knowledge/sources/summary");
40078
+ return {
40079
+ ...s,
40080
+ note: "Exact whole-library counts. by_kind is what the knowledge base answers from; the paged list is only for browsing individual sources."
40081
+ };
40082
+ } catch (err) {
40083
+ if (err instanceof HubApiError && err.status === 404) {
40084
+ return {
40085
+ available: false,
40086
+ reason: "summary_unavailable",
40087
+ note: "The knowledge platform predates the sources summary. Use awesomate_knowledge_status \u2192 usage.sources_total for the total and page the list (cursor) to see kinds."
40088
+ };
40089
+ }
40090
+ throw err;
40091
+ }
40039
40092
  }
40040
40093
  if (args.action === "jobs") {
40041
40094
  const q = args.status ? `?status=${encodeURIComponent(args.status)}` : "";
@@ -40125,7 +40178,8 @@ async function knowledgeAsk(config3, args) {
40125
40178
  { accept: "application/json" }
40126
40179
  );
40127
40180
  if (raw && typeof raw === "object") {
40128
- return renderAnswer(raw, "");
40181
+ const envelope = raw;
40182
+ return renderAnswer(envelope, typeof envelope.answer === "string" ? envelope.answer : "");
40129
40183
  }
40130
40184
  const events = parseSse(String(raw ?? ""));
40131
40185
  let streamedAnswer = "";
@@ -41006,20 +41060,22 @@ server.registerTool(
41006
41060
  server.registerTool(
41007
41061
  "awesomate_knowledge_sources",
41008
41062
  {
41009
- description: "The knowledge base's content sources. action 'list' \u2014 current sources (live metadata). 'jobs' \u2014 ingest job statuses (optional status filter: queued|running|succeeded|failed). 'add' \u2014 ingest a public page {url} or a whole site {sitemap, since?}; ALWAYS get explicit approval first (ingest costs money and counts against quota), and for local FILES send the user to the hub's Knowledge \u2192 Sources upload page \u2014 this tool cannot carry file bytes. A pack_required response means the allowance is exhausted: NOTHING was purchased \u2014 present the pack price (1 credit = $100) and let the user buy from the hub if they want it. 'remove' {sourceId} \u2014 deletes the source AND its indexed content; explicit approval required.",
41063
+ description: "The knowledge base's content sources. action 'list' \u2014 ONE page of sources, most recently ingested first (default 50, max 200 via limit): read `page.has_more`/`next_cursor` and pass cursor to continue \u2014 a page is never the whole library. 'summary' \u2014 exact whole-library counts {total, by_kind, chunks, indexed_chunks, failed_sources}: use THIS to say what the knowledge base contains. 'jobs' \u2014 ingest job statuses (optional status filter: queued|running|succeeded|failed). 'add' \u2014 ingest a public page {url} or a whole site {sitemap, since?}; ALWAYS get explicit approval first (ingest costs money and counts against quota), and for local FILES send the user to the hub's Knowledge \u2192 Sources upload page \u2014 this tool cannot carry file bytes. A pack_required response means the allowance is exhausted: NOTHING was purchased \u2014 present the pack price (1 credit = $100) and let the user buy from the hub if they want it. 'remove' {sourceId} \u2014 deletes the source AND its indexed content; explicit approval required.",
41010
41064
  inputSchema: {
41011
- action: external_exports.enum(["list", "add", "remove", "jobs"]),
41065
+ action: external_exports.enum(["list", "summary", "add", "remove", "jobs"]),
41012
41066
  url: external_exports.string().url().optional().describe("add: one public page / blog post / YouTube link"),
41013
41067
  sitemap: external_exports.string().url().optional().describe("add: sitemap.xml URL \u2014 ingests every listed page"),
41014
41068
  since: external_exports.string().optional().describe("add+sitemap only: skip entries with lastmod older than this ISO date"),
41015
41069
  sourceId: external_exports.string().optional().describe("remove only"),
41016
- status: external_exports.string().optional().describe("jobs only: queued|running|succeeded|failed")
41070
+ status: external_exports.string().optional().describe("jobs only: queued|running|succeeded|failed"),
41071
+ cursor: external_exports.string().max(512).optional().describe("list only: next_cursor from the previous page"),
41072
+ limit: external_exports.number().int().min(1).max(200).optional().describe("list only: page size (default 50, max 200)")
41017
41073
  }
41018
41074
  },
41019
- async ({ action, url, sitemap, since, sourceId, status }) => {
41075
+ async ({ action, url, sitemap, since, sourceId, status, cursor, limit }) => {
41020
41076
  try {
41021
41077
  return knowledgeResult(
41022
- await knowledgeSources(requireConfig(), { action, url, sitemap, since, sourceId, status })
41078
+ await knowledgeSources(requireConfig(), { action, url, sitemap, since, sourceId, status, cursor, limit })
41023
41079
  );
41024
41080
  } catch (err) {
41025
41081
  return knowledgeError(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomate/hosting-mcp",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
4
4
  "description": "Awesomate MCP server \u2014 lets Claude manage your Awesomate WordPress hosting, plan, limits, n8n automations, and build Node/static apps + databases",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -36,9 +36,14 @@ platform's answer beats anything you remember.
36
36
  content is indexed in Sydney, deletable any time), wait, re-check.
37
37
  - `tenant: null` or `status: 'provisioning'` → not enabled yet /
38
38
  still building; `usage` → month-to-date vs `usage.included` quota.
39
- 3. Only then design: what content exists, what's already ingested
40
- (`awesomate_knowledge_sources {action:'list'}`), what the user wants the
41
- bot to answer.
39
+ 3. Only then design: what content exists, what's already ingested, what the
40
+ user wants the bot to answer. For "what's ingested" use
41
+ `awesomate_knowledge_sources {action:'summary'}` (exact `total` +
42
+ `by_kind`; falls back to `status.usage.sources_total`, a floor when
43
+ `sources_total_truncated:true`). `{action:'list'}` returns ONE page —
44
+ the most recently ingested first (default 50, `limit` up to 200) — read
45
+ `page.kinds_on_this_page` / `page.has_more` and follow `next_cursor`;
46
+ never describe the library from a single page.
42
47
 
43
48
  ## 1. Tools
44
49