Skip to main content
Glama
flipt-io

Flipt MCP Server

Official
by flipt-io

get_flag

Retrieve the state of a specific feature flag using namespace and flag keys. Enables real-time flag evaluation via the Flipt MCP Server for AI-driven decision-making.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flagKeyYes
namespaceKeyYes

Implementation Reference

  • Primary handler, schema, and registration for the MCP 'get_flag' tool. Calls FliptClient.getFlag and returns formatted response.
    server.tool( 'get_flag', { namespaceKey: z.string().min(1), flagKey: z.string().min(1), }, async args => { try { const flag = await fliptClient.getFlag(args.namespaceKey, args.flagKey); return { content: [ { type: 'text', text: JSON.stringify(flag, null, 2), }, ], _meta: { uri: `flipt://namespaces/${args.namespaceKey}/flags/${args.flagKey}`, }, }; } catch (error: any) { console.error(`Error getting flag ${args.flagKey} in namespace ${args.namespaceKey}:`, error); return { content: [ { type: 'text', text: `Failed to get flag: ${error.message}`, }, ], isError: true, }; } } );
  • FliptClient helper method that wraps the generated FlagsServiceApi.getFlag to retrieve a specific flag.
    async getFlag(namespaceKey: string, key: string) { try { const response = await this.flagsApi.getFlag(namespaceKey, key); return response; } catch (error) { console.error(`Error getting flag ${key} in namespace ${namespaceKey}:`, error); throw error; } }
  • Resource handler for flags that uses FliptClient.getFlag, potentially related to tool responses.
    async handleFlag(uri: URL, { namespaceKey, flagKey }: { namespaceKey: string; flagKey: string }) { console.log('Handling flag resource:', uri.toString()); try { const flag = await this.fliptClient.getFlag(namespaceKey, flagKey); return { contents: [ { uri: `flipt://namespaces/${namespaceKey}/flags/${flag.key}`, text: flag.name, }, ], }; } catch (error) { console.error('Error handling flag resource:', error); throw 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/flipt-io/mcp-server-flipt'

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