Skip to main content
Glama
ylin6

Unleash Feature Flag MCP Server

by ylin6

createFeatureFlag

Create a new feature flag in Unleash to control feature releases, experiments, kill switches, or operational toggles within a specified project.

Instructions

Create a new feature flag

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featureDataYes
projectIdYes

Implementation Reference

  • Core handler function that executes the tool logic: parses input, makes POST request to Unleash API to create feature flag, returns response data.
    async function createFeatureFlag( params: z.infer<typeof CreateFeatureFlagSchema> ) { const { projectId, featureData } = CreateFeatureFlagSchema.parse(params); try { const response = await axios.post( `${UNLEASH_API_URL}/api/admin/projects/${projectId}/features`, featureData, { headers: { Authorization: `Bearer ${UNLEASH_AUTH_TOKEN}`, 'Content-Type': 'application/json', }, } ); return response.data; } catch (error) { console.error('Error creating feature flag:', error); throw error; } }
  • Raw Zod input shape used for tool registration and validation of parameters: projectId and featureData structure.
    const RawCreateFeatureFlagShape = { projectId: z.string(), featureData: z.object({ name: z.string(), description: z.string().nullable(), impressionData: z.boolean().nullable(), type: z.enum([ 'experiment', 'kill-switch', 'release', 'operational', 'permission', ]), }), };
  • Full Zod schema wrapping the raw shape, used in the handler for parsing.
    const CreateFeatureFlagSchema = z.object(RawCreateFeatureFlagShape);
  • src/index.ts:41-49 (registration)
    MCP server tool registration: provides name, description, input schema, and thin wrapper that calls the handler and formats JSON response.
    server.tool( 'createFeatureFlag', 'Create a new feature flag', RawCreateFeatureFlagShape, async (args) => { const data = await createFeatureFlag(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