@growthbook/mcp 1.3.0 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growthbook/mcp",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "MCP Server for interacting with GrowthBook",
5
5
  "access": "public",
6
6
  "homepage": "https://github.com/growthbook/growthbook-mcp",
@@ -13,12 +13,31 @@ export function registerSearchTools({ server }) {
13
13
  }, async ({ query }) => {
14
14
  const hits = await searchGrowthBookDocs(query);
15
15
  return {
16
- content: hits.slice(0, 5).map((hit) => ({
17
- type: "text",
18
- text: hit.title
19
- ? `${hit.title}: ${hit.url}`
20
- : hit.url || JSON.stringify(hit),
21
- })),
16
+ content: hits.slice(0, 5).map((hit) => {
17
+ // Algolia typically returns content in various fields
18
+ const content = hit.content ||
19
+ hit.text ||
20
+ hit._snippetResult?.content?.value ||
21
+ hit._highlightResult?.content?.value;
22
+ const snippet = hit._snippetResult?.content?.value ||
23
+ hit._highlightResult?.content?.value;
24
+ const title = hit.title || hit.hierarchy?.lvl0 || hit.hierarchy?.lvl1;
25
+ const url = hit.url || hit.anchor;
26
+ let text = "";
27
+ if (title) {
28
+ text += `**${title}**\n`;
29
+ }
30
+ if (url) {
31
+ text += `URL: ${url}\n`;
32
+ }
33
+ if (snippet || content) {
34
+ text += `\n${snippet || content}`;
35
+ }
36
+ return {
37
+ type: "text",
38
+ text: text || JSON.stringify(hit),
39
+ };
40
+ }),
22
41
  };
23
42
  });
24
43
  }
package/server/utils.js CHANGED
@@ -159,7 +159,12 @@ export async function searchGrowthBookDocs(query) {
159
159
  "X-Algolia-Application-Id": APPLICATION_ID,
160
160
  "Content-Type": "application/json",
161
161
  },
162
- body: JSON.stringify({ query }),
162
+ body: JSON.stringify({
163
+ query,
164
+ attributesToSnippet: ["content:20", "text:20"],
165
+ snippetEllipsisText: "...",
166
+ hitsPerPage: 5,
167
+ }),
163
168
  });
164
169
  await handleResNotOk(response);
165
170
  const data = await response.json();