Skip to main content
Glama

GrowthBook MCP Server

Official
by growthbook
search.ts1.57 kB
import { z } from "zod"; import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { searchGrowthBookDocs } from "../utils.js"; /** * Tool: search_growthbook_docs */ export function registerSearchTools({ server }: { server: McpServer }) { server.tool( "search_growthbook_docs", "Search the GrowthBook docs on how to use a feature", { query: z .string() .describe("The search query to look up in the GrowthBook docs."), }, { readOnlyHint: true, }, async ({ query }) => { const hits = await searchGrowthBookDocs(query); return { content: hits.slice(0, 5).map((hit: any) => { // Algolia typically returns content in various fields const content = hit.content || hit.text || hit._snippetResult?.content?.value || hit._highlightResult?.content?.value; const snippet = hit._snippetResult?.content?.value || hit._highlightResult?.content?.value; const title = hit.title || hit.hierarchy?.lvl0 || hit.hierarchy?.lvl1; const url = hit.url || hit.anchor; let text = ""; if (title) { text += `**${title}**\n`; } if (url) { text += `URL: ${url}\n`; } if (snippet || content) { text += `\n${snippet || content}`; } return { type: "text", text: text || JSON.stringify(hit), }; }), }; } ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/growthbook/growthbook-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server