Skip to main content
Glama
ylin6

Unleash Feature Flag MCP Server

by ylin6

getFeatures

Retrieve feature flags for a specific project to manage and control feature rollouts programmatically.

Instructions

Retrieve features for a specific project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYes

Implementation Reference

  • Core handler function that fetches and returns the list of features for the specified projectId from the Unleash API.
    async function getFeatures(params: z.infer<typeof GetFeaturesSchema>) {
      const { projectId } = GetFeaturesSchema.parse(params);
      try {
        const response = await axios.get(
          `${UNLEASH_API_URL}/api/admin/projects/${projectId}/features`,
          {
            headers: {
              Authorization: `Bearer ${UNLEASH_AUTH_TOKEN}`,
            },
          }
        );
        return response.data;
      } catch (error) {
        console.error('Error fetching features:', error);
        throw error;
      }
  • src/index.ts:31-39 (registration)
    Registers the MCP tool named 'getFeatures' with its description, input schema (RawGetFeaturesShape), and a thin wrapper handler that invokes the core getFeatures function and formats the response as MCP content.
    server.tool(
      'getFeatures',
      'Retrieve features for a specific project',
      RawGetFeaturesShape,
      async (args) => {
        const data = await getFeatures(args);
        return { content: [{ type: 'text', text: JSON.stringify(data) }] };
      }
    );
  • Zod input schema definition for the getFeatures tool, specifying the required 'projectId' parameter. This raw shape is used directly in the MCP tool registration.
    const RawGetFeaturesShape = {
      projectId: z.string(),
    };
  • Full Zod schema for getFeatures input validation, wrapping the raw shape and used within the handler for parsing params.
    const GetFeaturesSchema = z.object(RawGetFeaturesShape);

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