Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(flags): expose is_remote_configuration in MCP tools (#56368)

Muskan Agarwal0b207a579ca4
diff --git a/products/feature_flags/backend/api/feature_flag.py b/products/feature_flags/backend/api/feature_flag.py
index aa3cf71fda53..de0a1c1f126c 100644
--- a/products/feature_flags/backend/api/feature_flag.py
+++ b/products/feature_flags/backend/api/feature_flag.py
@@ -636,6 +636,11 @@ class FeatureFlagCreateRequestSchemaSerializer(serializers.Serializer):
required=False,
help_text="Evaluation contexts that control where this flag evaluates at runtime.",
)
+ is_remote_configuration = serializers.BooleanField(
+ required=False,
+ allow_null=True,
+ help_text="Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.",
+ )
class FeatureFlagPartialUpdateRequestSchemaSerializer(serializers.Serializer):
@@ -657,6 +662,11 @@ class FeatureFlagPartialUpdateRequestSchemaSerializer(serializers.Serializer):
required=False,
help_text="Evaluation contexts that control where this flag evaluates at runtime.",
)
+ is_remote_configuration = serializers.BooleanField(
+ required=False,
+ allow_null=True,
+ help_text="Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.",
+ )
class FeatureFlagSerializer(
diff --git a/products/feature_flags/backend/api/test/test_feature_flag.py b/products/feature_flags/backend/api/test/test_feature_flag.py
index 6217bbf9abac..e91fde0dfb09 100644
--- a/products/feature_flags/backend/api/test/test_feature_flag.py
+++ b/products/feature_flags/backend/api/test/test_feature_flag.py
@@ -1095,6 +1095,54 @@ class TestFeatureFlag(APIBaseTest, ClickhouseTestMixin):
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertIn("remote configuration", response.json()["detail"])
+ @patch("products.feature_flags.backend.api.feature_flag.report_user_action")
+ def test_update_flag_to_remote_config_persists(self, mock_report_user_action):
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/feature_flags/",
+ {
+ "key": "toggle-to-remote-config",
+ "name": "Toggle To Remote Config",
+ "filters": {"groups": [{"rollout_percentage": 100}]},
+ },
+ format="json",
+ )
+ self.assertEqual(response.status_code, status.HTTP_201_CREATED)
+ flag_id = response.json()["id"]
+ self.assertFalse(response.json()["is_remote_configuration"])
+
+ response = self.client.patch(
+ f"/api/projects/{self.team.id}/feature_flags/{flag_id}/",
+ {"is_remote_configuration": True},
+ format="json",
+ )
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ self.assertTrue(response.json()["is_remote_configuration"])
+ self.assertTrue(FeatureFlag.objects.get(id=flag_id).is_remote_configuration)
+
+ @patch("products.feature_flags.backend.api.feature_flag.report_user_action")
+ def test_update_remote_config_flag_to_non_remote_without_encryption_succeeds(self, mock_report_user_action):
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/feature_flags/",
+ {
+ "key": "rc-unencrypted",
+ "name": "RC Unencrypted",
+ "is_remote_configuration": True,
+ "filters": {"groups": [{"rollout_percentage": 100}], "payloads": {"true": '"data"'}},
+ },
+ format="json",
+ )
+ self.assertEqual(response.status_code, status.HTTP_201_CREATED)
+ flag_id = response.json()["id"]
+
+ response = self.client.patch(
+ f"/api/projects/{self.team.id}/feature_flags/{flag_id}/",
+ {"is_remote_configuration": False},
+ format="json",
+ )
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ self.assertFalse(response.json()["is_remote_configuration"])
+ self.assertFalse(FeatureFlag.objects.get(id=flag_id).is_remote_configuration)
+
@patch("products.feature_flags.backend.api.feature_flag.report_user_action")
def test_create_feature_flag_with_analytics_dashboards(self, mock_report_user_action):
dashboard = Dashboard.objects.create(team=self.team, name="private dashboard", created_by=self.user)
diff --git a/products/feature_flags/frontend/generated/api.schemas.ts b/products/feature_flags/frontend/generated/api.schemas.ts
index 63ee4dc889d0..6790d283294a 100644
--- a/products/feature_flags/frontend/generated/api.schemas.ts
+++ b/products/feature_flags/frontend/generated/api.schemas.ts
@@ -672,6 +672,11 @@ export interface FeatureFlagCreateRequestSchemaApi {
tags?: string[]
/** Evaluation contexts that control where this flag evaluates at runtime. */
evaluation_contexts?: string[]
+ /**
+ * Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.
+ * @nullable
+ */
+ is_remote_configuration?: boolean | null
}
export interface PatchedFeatureFlagPartialUpdateRequestSchemaApi {
@@ -687,6 +692,11 @@ export interface PatchedFeatureFlagPartialUpdateRequestSchemaApi {
tags?: string[]
/** Evaluation contexts that control where this flag evaluates at runtime. */
evaluation_contexts?: string[]
+ /**
+ * Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.
+ * @nullable
+ */
+ is_remote_configuration?: boolean | null
}
export interface ChangeApi {
diff --git a/products/feature_flags/frontend/generated/api.zod.ts b/products/feature_flags/frontend/generated/api.zod.ts
index 4bf9e83b660d..77577c3833c2 100644
--- a/products/feature_flags/frontend/generated/api.zod.ts
+++ b/products/feature_flags/frontend/generated/api.zod.ts
@@ -332,6 +332,12 @@ export const FeatureFlagsCreateBody = /* @__PURE__ */ zod.object({
.array(zod.string())
.optional()
.describe('Evaluation contexts that control where this flag evaluates at runtime.'),
+ is_remote_configuration: zod
+ .boolean()
+ .nullish()
+ .describe(
+ 'Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.'
+ ),
})
/**
@@ -713,6 +719,12 @@ export const FeatureFlagsPartialUpdateBody = /* @__PURE__ */ zod.object({
.array(zod.string())
.optional()
.describe('Evaluation contexts that control where this flag evaluates at runtime.'),
+ is_remote_configuration: zod
+ .boolean()
+ .nullish()
+ .describe(
+ 'Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.'
+ ),
})
/**
diff --git a/products/feature_flags/mcp/tools.yaml b/products/feature_flags/mcp/tools.yaml
index 27e6e82c5b3e..14250577953b 100644
--- a/products/feature_flags/mcp/tools.yaml
+++ b/products/feature_flags/mcp/tools.yaml
@@ -41,6 +41,13 @@ tools:
- active
- tags
- evaluation_contexts
+ - is_remote_configuration
+ param_overrides:
+ is_remote_configuration:
+ description:
+ Whether this flag delivers a payload instead of gating a feature (Remote Config mode). When true, set the
+ delivered payload through the `filters` param under `filters.payloads.true` as a JSON-encoded
+ string. There is no dedicated payload parameter.
delete-feature-flag:
operation: feature_flags_destroy
enabled: true
@@ -406,6 +413,12 @@ tools:
- active
- tags
- evaluation_contexts
+ - is_remote_configuration
param_overrides:
id:
cast: string-int
+ is_remote_configuration:
+ description:
+ Whether this flag delivers a payload instead of gating a feature (Remote Config mode). When true, set the
+ delivered payload through the `filters` param under `filters.payloads.true` as a JSON-encoded
+ string. There is no dedicated payload parameter.
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 1af43cf9ddf5..5a822b54bc88 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -18265,6 +18265,11 @@ export namespace Schemas {
tags?: string[];
/** Evaluation contexts that control where this flag evaluates at runtime. */
evaluation_contexts?: string[];
+ /**
+ * Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.
+ * @nullable
+ */
+ is_remote_configuration?: boolean | null;
}
export interface FeatureFlagStatusResponse {
@@ -29922,6 +29927,11 @@ export namespace Schemas {
tags?: string[];
/** Evaluation contexts that control where this flag evaluates at runtime. */
evaluation_contexts?: string[];
+ /**
+ * Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.
+ * @nullable
+ */
+ is_remote_configuration?: boolean | null;
}
export interface PatchedFileSystem {
diff --git a/services/mcp/src/generated/feature_flags/api.ts b/services/mcp/src/generated/feature_flags/api.ts
index 05f92913ecd9..851a490b5b0c 100644
--- a/services/mcp/src/generated/feature_flags/api.ts
+++ b/services/mcp/src/generated/feature_flags/api.ts
@@ -384,6 +384,12 @@ export const FeatureFlagsCreateBody = /* @__PURE__ */ zod.object({
.array(zod.string())
.optional()
.describe('Evaluation contexts that control where this flag evaluates at runtime.'),
+ is_remote_configuration: zod
+ .boolean()
+ .nullish()
+ .describe(
+ 'Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.'
+ ),
})
/**
@@ -708,6 +714,12 @@ export const FeatureFlagsPartialUpdateBody = /* @__PURE__ */ zod.object({
.array(zod.string())
.optional()
.describe('Evaluation contexts that control where this flag evaluates at runtime.'),
+ is_remote_configuration: zod
+ .boolean()
+ .nullish()
+ .describe(
+ 'Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.'
+ ),
})
/**
diff --git a/services/mcp/src/tools/generated/feature_flags.ts b/services/mcp/src/tools/generated/feature_flags.ts
index 99444dd1ad33..97c34e0952ea 100644
--- a/services/mcp/src/tools/generated/feature_flags.ts
+++ b/services/mcp/src/tools/generated/feature_flags.ts
@@ -35,7 +35,11 @@ import { castStringToInt } from '@/tools/cast-helpers'
import { withPostHogUrl, pickResponseFields, type WithPostHogUrl } from '@/tools/tool-utils'
import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'
-const CreateFeatureFlagSchema = FeatureFlagsCreateBody
+const CreateFeatureFlagSchema = FeatureFlagsCreateBody.extend({
+ is_remote_configuration: FeatureFlagsCreateBody.shape['is_remote_configuration'].describe(
+ 'Whether this flag delivers a payload instead of gating a feature (Remote Config mode). When true, set the delivered payload through the `filters` param under `filters.payloads.true` as a JSON-encoded string. There is no dedicated payload parameter.'
+ ),
+})
const createFeatureFlag = (): ToolBase<typeof CreateFeatureFlagSchema, WithPostHogUrl<Schemas.FeatureFlag>> => ({
name: 'create-feature-flag',
@@ -61,6 +65,9 @@ const createFeatureFlag = (): ToolBase<typeof CreateFeatureFlagSchema, WithPostH
if (params.evaluation_contexts !== undefined) {
body['evaluation_contexts'] = params.evaluation_contexts
}
+ if (params.is_remote_configuration !== undefined) {
+ body['is_remote_configuration'] = params.is_remote_configuration
+ }
const result = await context.api.request<Schemas.FeatureFlag>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/feature_flags/`,
@@ -588,7 +595,12 @@ const scheduledChangesUpdate = (): ToolBase<typeof ScheduledChangesUpdateSchema,
const UpdateFeatureFlagSchema = FeatureFlagsPartialUpdateParams.omit({ project_id: true })
.extend(FeatureFlagsPartialUpdateBody.shape)
- .extend({ id: z.preprocess(castStringToInt, FeatureFlagsPartialUpdateParams.shape['id']) })
+ .extend({
+ id: z.preprocess(castStringToInt, FeatureFlagsPartialUpdateParams.shape['id']),
+ is_remote_configuration: FeatureFlagsPartialUpdateBody.shape['is_remote_configuration'].describe(
+ 'Whether this flag delivers a payload instead of gating a feature (Remote Config mode). When true, set the delivered payload through the `filters` param under `filters.payloads.true` as a JSON-encoded string. There is no dedicated payload parameter.'
+ ),
+ })
const updateFeatureFlag = (): ToolBase<typeof UpdateFeatureFlagSchema, WithPostHogUrl<Schemas.FeatureFlag>> => ({
name: 'update-feature-flag',
@@ -614,6 +626,9 @@ const updateFeatureFlag = (): ToolBase<typeof UpdateFeatureFlagSchema, WithPostH
if (params.evaluation_contexts !== undefined) {
body['evaluation_contexts'] = params.evaluation_contexts
}
+ if (params.is_remote_configuration !== undefined) {
+ body['is_remote_configuration'] = params.is_remote_configuration
+ }
const result = await context.api.request<Schemas.FeatureFlag>({
method: 'PATCH',
path: `/api/projects/${encodeURIComponent(String(projectId))}/feature_flags/${encodeURIComponent(String(params.id))}/`,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/create-feature-flag.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/create-feature-flag.json
index 299a253bdde7..2f60119682c2 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/create-feature-flag.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/create-feature-flag.json
@@ -476,6 +476,17 @@
},
"type": "object"
},
+ "is_remote_configuration": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Whether this flag delivers a payload instead of gating a feature (Remote Config mode). When true, set the delivered payload through the `filters` param under `filters.payloads.true` as a JSON-encoded string. There is no dedicated payload parameter."
+ },
"key": {
"description": "Feature flag key.",
"type": "string"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/update-feature-flag.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/update-feature-flag.json
index c71dca32ea2b..0de8a0eb7160 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/update-feature-flag.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/update-feature-flag.json
@@ -480,6 +480,17 @@
"description": "A unique integer value identifying this feature flag.",
"type": "number"
},
+ "is_remote_configuration": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Whether this flag delivers a payload instead of gating a feature (Remote Config mode). When true, set the delivered payload through the `filters` param under `filters.payloads.true` as a JSON-encoded string. There is no dedicated payload parameter."
+ },
"key": {
"description": "Feature flag key.",
"type": "string"