Skip to main content
Glama

GrowthBook MCP Server

Official
by growthbook
projects.ts1.2 kB
import { z } from "zod"; import { handleResNotOk, type BaseToolsInterface, paginationSchema, } from "../utils.js"; interface ProjectTools extends BaseToolsInterface {} /** * Tool: get_projects */ export function registerProjectTools({ server, baseApiUrl, apiKey, }: ProjectTools) { server.tool( "get_projects", "Fetches all projects from the GrowthBook API", { ...paginationSchema, }, { readOnlyHint: true, }, async ({ limit, offset }) => { const queryParams = new URLSearchParams({ limit: limit.toString(), offset: offset.toString(), }); try { const res = await fetch( `${baseApiUrl}/api/v1/projects?${queryParams.toString()}`, { headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", }, } ); await handleResNotOk(res); const data = await res.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { throw new Error(`Error fetching projects: ${error}`); } } ); }

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