Skip to main content
Glama
growthbook

GrowthBook MCP Server

Official
by growthbook

get_sdk_connections

Retrieve SDK connections to enable apps to fetch features and experiments via a public client key. Specify project, limit, and offset for targeted results.

Instructions

Get all SDK connections, which are how GrowthBook connects to an app. Importantly, users need the key, which is a public client key that allows the app to fetch features and experiments the API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo
projectNo

Implementation Reference

  • The handler function that executes the get_sdk_connections tool logic: constructs query params with optional project filter and pagination, fetches from GrowthBook API, handles response, and returns JSON data.
    async ({ limit, offset, project }) => { try { const queryParams = new URLSearchParams({ limit: limit?.toString(), offset: offset?.toString(), }); if (project) { queryParams.append("projectId", project); } const res = await fetch( `${baseApiUrl}/api/v1/sdk-connections?${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 sdk connections: ${error}`); } }
  • Input schema using Zod: optional project ID and pagination parameters (limit, offset).
    { project: z .string() .describe("The ID of the project to filter SDK connections by") .optional(), ...paginationSchema, },
  • Direct registration of the get_sdk_connections tool on the MCP server, including description, input schema, options, and inline handler function.
    server.tool( "get_sdk_connections", "Get all SDK connections. SDK connections are how GrowthBook connects to an app. Users need the client key to fetch features and experiments from the API.", { project: z .string() .describe("The ID of the project to filter SDK connections by") .optional(), ...paginationSchema, }, { readOnlyHint: true, }, async ({ limit, offset, project }) => { try { const queryParams = new URLSearchParams({ limit: limit?.toString(), offset: offset?.toString(), }); if (project) { queryParams.append("projectId", project); } const res = await fetch( `${baseApiUrl}/api/v1/sdk-connections?${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 sdk connections: ${error}`); } } );
  • src/index.ts:75-79 (registration)
    Top-level call to registerSdkConnectionTools in the main index.ts, which registers the get_sdk_connections tool among others.
    registerSdkConnectionTools({ server, baseApiUrl, apiKey, });

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