Skip to main content
Glama
ylin6

Unleash Feature Flag MCP Server

by ylin6

getFeatureFlag

Retrieve a specific feature flag from an Unleash project to check its status and configuration. Provide the project ID and feature ID to get current flag details.

Instructions

Retrieve a specific feature flag from a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featureIdYes
projectIdYes

Implementation Reference

  • Executes the getFeatureFlag tool by parsing parameters with GetFeatureFlagSchema, querying the Unleash API endpoint for the specific feature flag using projectId and featureId, and returning the response data or throwing an error.
    async function getFeatureFlag(params: z.infer<typeof GetFeatureFlagSchema>) { const { projectId, featureId } = GetFeatureFlagSchema.parse(params); try { const response = await axios.get( `${UNLEASH_API_URL}/api/admin/projects/${projectId}/features/${featureId}`, { headers: { Authorization: `Bearer ${UNLEASH_AUTH_TOKEN}`, }, } ); return response.data; } catch (error) { console.error('Error fetching feature flag:', error); throw error; } }
  • Raw Zod object shape defining the input parameters for getFeatureFlag: projectId and featureId as strings. Used in MCP tool registration.
    const RawGetFeatureFlagShape = { projectId: z.string(), featureId: z.string(), };
  • Full Zod schema for validating getFeatureFlag input parameters, based on the raw shape. Used in the handler function.
    const GetFeatureFlagSchema = z.object(RawGetFeatureFlagShape);
  • src/index.ts:61-69 (registration)
    Registers the getFeatureFlag tool on the MCP server with name, description, input schema (RawGetFeatureFlagShape), and an async handler that invokes the core getFeatureFlag function and formats the JSON response.
    server.tool( 'getFeatureFlag', 'Retrieve a specific feature flag from a project', RawGetFeatureFlagShape, async (args) => { const data = await getFeatureFlag(args); return { content: [{ type: 'text', text: JSON.stringify(data) }] }; } );

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/ylin6/unleash-ff-mcp-server'

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