@cyanheads/hn-mcp-server 0.5.22 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/AGENTS.md +24 -11
  2. package/CLAUDE.md +24 -11
  3. package/Dockerfile +9 -3
  4. package/README.md +25 -15
  5. package/changelog/0.6.x/0.6.0.md +38 -0
  6. package/changelog/0.6.x/0.6.1.md +34 -0
  7. package/changelog/template.md +10 -3
  8. package/dist/index.js +2 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/mcp-server/tools/definitions/get-stories.tool.d.ts +14 -0
  11. package/dist/mcp-server/tools/definitions/get-stories.tool.d.ts.map +1 -1
  12. package/dist/mcp-server/tools/definitions/get-stories.tool.js +25 -6
  13. package/dist/mcp-server/tools/definitions/get-stories.tool.js.map +1 -1
  14. package/dist/mcp-server/tools/definitions/get-thread.tool.d.ts +8 -0
  15. package/dist/mcp-server/tools/definitions/get-thread.tool.d.ts.map +1 -1
  16. package/dist/mcp-server/tools/definitions/get-thread.tool.js +304 -182
  17. package/dist/mcp-server/tools/definitions/get-thread.tool.js.map +1 -1
  18. package/dist/mcp-server/tools/definitions/get-user.tool.d.ts +15 -0
  19. package/dist/mcp-server/tools/definitions/get-user.tool.d.ts.map +1 -1
  20. package/dist/mcp-server/tools/definitions/get-user.tool.js +177 -104
  21. package/dist/mcp-server/tools/definitions/get-user.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/definitions/search-content.tool.d.ts +28 -4
  23. package/dist/mcp-server/tools/definitions/search-content.tool.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/definitions/search-content.tool.js +291 -190
  25. package/dist/mcp-server/tools/definitions/search-content.tool.js.map +1 -1
  26. package/dist/mcp-server/tools/response-budget.d.ts +111 -0
  27. package/dist/mcp-server/tools/response-budget.d.ts.map +1 -0
  28. package/dist/mcp-server/tools/response-budget.js +204 -0
  29. package/dist/mcp-server/tools/response-budget.js.map +1 -0
  30. package/dist/services/hn/hn-service.d.ts +56 -12
  31. package/dist/services/hn/hn-service.d.ts.map +1 -1
  32. package/dist/services/hn/hn-service.js +147 -25
  33. package/dist/services/hn/hn-service.js.map +1 -1
  34. package/dist/services/hn/types.d.ts +4 -0
  35. package/dist/services/hn/types.d.ts.map +1 -1
  36. package/package.json +12 -11
  37. package/server.json +3 -3
  38. package/skills/hn-guide/SKILL.md +39 -0
@@ -18,6 +18,8 @@ export declare function stripUrlPrefix(query: string): {
18
18
  /** What the search notice is composed from: the inputs as searched, and the page Algolia returned. */
19
19
  export interface SearchNoticeFacts {
20
20
  author?: string | undefined;
21
+ /** How a full page over the response budget was fitted to it; absent for a page that fit. */
22
+ budget?: SearchBudget | undefined;
21
23
  count: number;
22
24
  dateRange?: {
23
25
  start?: string | undefined;
@@ -25,6 +27,7 @@ export interface SearchNoticeFacts {
25
27
  } | undefined;
26
28
  /** The URL prefix dropped from the caller's query before searching. */
27
29
  droppedPrefix?: string | undefined;
30
+ minComments?: number | undefined;
28
31
  minPoints?: number | undefined;
29
32
  /**
30
33
  * The caller's count and page when count was above the per-call cap. The
@@ -47,12 +50,20 @@ export interface SearchNoticeFacts {
47
50
  totalHitsExact?: boolean | undefined;
48
51
  totalPages: number;
49
52
  }
53
+ /** The two steps that fit a full page over the response budget to it. */
54
+ interface SearchBudget {
55
+ /** Ids of the hits step 2 cut the text of, in page order; empty when step 1 sufficed. */
56
+ cutIds: readonly number[];
57
+ /** Step 1 dropped highlights.text from every hit. False when no hit carried one. */
58
+ highlightsTextOmitted: boolean;
59
+ }
50
60
  /**
51
61
  * Compose the one `notice` string every search writes. `notice` is last-wins,
52
62
  * so each source goes through here: the page-state sentence first, then the
53
- * cause sentences in input order — query, tags, author, storyId, count. None
54
- * replaces another. Undefined when nothing applies — the last page of an
55
- * uncapped, non-empty search.
63
+ * cause sentences in input order — query, tags, author, storyId, count — then
64
+ * the budget sentence for a page fitted to the response budget. None replaces
65
+ * another. Undefined when nothing applies — the last page of an uncapped,
66
+ * non-empty search that fit.
56
67
  */
57
68
  export declare function composeSearchNotice(facts: SearchNoticeFacts): string | undefined;
58
69
  export declare const searchHn: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
@@ -77,6 +88,7 @@ export declare const searchHn: import("@cyanheads/mcp-ts-core").ToolDefinition<z
77
88
  end: z.ZodOptional<z.ZodString>;
78
89
  }, z.core.$strip>>;
79
90
  minPoints: z.ZodOptional<z.ZodNumber>;
91
+ minComments: z.ZodOptional<z.ZodNumber>;
80
92
  count: z.ZodDefault<z.ZodNumber>;
81
93
  page: z.ZodDefault<z.ZodNumber>;
82
94
  view: z.ZodDefault<z.ZodEnum<{
@@ -102,7 +114,10 @@ export declare const searchHn: import("@cyanheads/mcp-ts-core").ToolDefinition<z
102
114
  createdAt: z.ZodString;
103
115
  storyTitle: z.ZodOptional<z.ZodString>;
104
116
  storyId: z.ZodOptional<z.ZodNumber>;
117
+ parentId: z.ZodOptional<z.ZodNumber>;
118
+ storyUrl: z.ZodOptional<z.ZodString>;
105
119
  text: z.ZodOptional<z.ZodString>;
120
+ textTruncated: z.ZodOptional<z.ZodBoolean>;
106
121
  highlights: z.ZodOptional<z.ZodObject<{
107
122
  title: z.ZodOptional<z.ZodString>;
108
123
  text: z.ZodOptional<z.ZodString>;
@@ -114,7 +129,7 @@ export declare const searchHn: import("@cyanheads/mcp-ts-core").ToolDefinition<z
114
129
  readonly reason: "missing_query_or_filter";
115
130
  readonly code: JsonRpcErrorCode.InvalidParams;
116
131
  readonly when: "Neither a query nor any filter was supplied, so there is nothing to search by.";
117
- readonly recovery: "Pass a query, or at least one filter: tags, author, storyId, minPoints, or a dateRange bound. sort, count, page, and view do not count as filters.";
132
+ readonly recovery: "Pass a query, or at least one filter: tags, author, storyId, minPoints, minComments, or a dateRange bound. sort, count, page, and view do not count as filters.";
118
133
  readonly severity: "notice";
119
134
  }, {
120
135
  readonly reason: "invalid_date_range";
@@ -128,6 +143,12 @@ export declare const searchHn: import("@cyanheads/mcp-ts-core").ToolDefinition<z
128
143
  readonly when: "minPoints was combined with tags \"comment\" or \"job\", record types Algolia stores without points.";
129
144
  readonly recovery: "Drop minPoints to search comments or jobs, or search a scored type (story, poll, ask_hn, show_hn, front_page) to filter by points.";
130
145
  readonly severity: "notice";
146
+ }, {
147
+ readonly reason: "min_comments_unscored_type";
148
+ readonly code: JsonRpcErrorCode.InvalidParams;
149
+ readonly when: "minComments was combined with tags \"comment\" or \"job\", record types Algolia stores without a comment count.";
150
+ readonly recovery: "Drop minComments to search comments or jobs, or search a type with a comment count (story, poll, ask_hn, show_hn, front_page) to filter by comments.";
151
+ readonly severity: "notice";
131
152
  }, {
132
153
  readonly reason: "count_page_unaligned";
133
154
  readonly code: JsonRpcErrorCode.InvalidParams;
@@ -182,6 +203,7 @@ export declare const searchHn: import("@cyanheads/mcp-ts-core").ToolDefinition<z
182
203
  author: z.ZodOptional<z.ZodString>;
183
204
  storyId: z.ZodOptional<z.ZodNumber>;
184
205
  minPoints: z.ZodOptional<z.ZodNumber>;
206
+ minComments: z.ZodOptional<z.ZodNumber>;
185
207
  dateRange: z.ZodOptional<z.ZodObject<{
186
208
  start: z.ZodOptional<z.ZodString>;
187
209
  end: z.ZodOptional<z.ZodString>;
@@ -204,6 +226,8 @@ export declare const searchHn: import("@cyanheads/mcp-ts-core").ToolDefinition<z
204
226
  readonly truncated: z.ZodOptional<z.ZodBoolean>;
205
227
  readonly shown: z.ZodOptional<z.ZodNumber>;
206
228
  readonly cap: z.ZodOptional<z.ZodNumber>;
229
+ readonly highlightsTextOmitted: z.ZodOptional<z.ZodBoolean>;
207
230
  readonly notice: z.ZodOptional<z.ZodString>;
208
231
  }>;
232
+ export {};
209
233
  //# sourceMappingURL=search-content.tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-content.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-content.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8fnB,CAAC"}
1
+ {"version":3,"file":"search-content.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-content.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA+HjE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAKvF;AAgFD,sGAAsG;AACtG,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,6FAA6F;IAC7F,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC;IACjF,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;;OAIG;IACH,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAA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