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(signals): enable every team MCP server by default when creating a scout (#90312)

Chris Volzer5eced53555ab
diff --git a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
index cd09635bd5c2..2f7352e143f6 100644
--- a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
@@ -1,4 +1,4 @@
-import { MOCK_TEAM_ID } from 'lib/api.mock'
+import { MOCK_DEFAULT_USER, MOCK_TEAM_ID } from 'lib/api.mock'
import { expectLogic } from 'kea-test-utils'
@@ -6,8 +6,13 @@ import { ApiError } from 'lib/api-error'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
+import type {
+ MCPServiceAccountApi,
+ MCPServiceAccountServerApi,
+} from 'products/mcp_store/frontend/generated/api.schemas'
import { signalsScoutCreate } from 'products/signals/frontend/generated/api'
import type { SignalScoutCreateResponseApi } from 'products/signals/frontend/generated/api.schemas'
@@ -56,6 +61,41 @@ const CREATED_SCOUT: SignalScoutCreateResponseApi = {
},
}
+function teamServer(id: string, name: string): MCPServiceAccountServerApi {
+ return {
+ id,
+ shared_by: {
+ id: MOCK_DEFAULT_USER.id,
+ uuid: MOCK_DEFAULT_USER.uuid,
+ email: MOCK_DEFAULT_USER.email,
+ hedgehog_config: null,
+ },
+ scope: 'team',
+ name,
+ description: `${name} workspace`,
+ icon_key: name.toLowerCase(),
+ icon_domain: `${name.toLowerCase()}.com`,
+ connection_state: 'ready',
+ }
+}
+
+function scoutAccountResponse(servers: MCPServiceAccountServerApi[]): [number, Record<string, unknown>] {
+ const account: MCPServiceAccountApi = {
+ id: 'scout-id',
+ name: 'scout',
+ description: 'scout agent',
+ handle: 'svc-scout',
+ agent_key: 'scout',
+ status: 'active',
+ server_ids: servers.map(({ id }) => id),
+ servers,
+ last_active_at: null,
+ created_at: '2026-07-22T00:00:00Z',
+ updated_at: '2026-07-22T00:00:00Z',
+ }
+ return [200, { count: 1, next: null, previous: null, results: [account] }]
+}
+
const setRedesignFlag = (enabled: boolean): void => {
featureFlagLogic.mount()
featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN], {
@@ -153,6 +193,34 @@ describe('scoutCreateModalLogic', () => {
expect(onClose).toHaveBeenCalledTimes(1)
})
+ it('selects every team MCP server by default, unless the opener passed its own selection', async () => {
+ useMocks({
+ get: {
+ '/api/projects/:team_id/mcp_gateway/service_accounts/': () =>
+ scoutAccountResponse([teamServer('github-id', 'GitHub'), teamServer('linear-id', 'Linear')]),
+ },
+ })
+
+ logic = scoutCreateModalLogic({ logicKey: 'default-servers', onClose })
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.scoutCreateForm.config.mcp_gateway_server_ids).toEqual(['github-id', 'linear-id'])
+ // The default selection must not mark the untouched form as changed, or the modal would block
+ // the first overlay-close click and warn of unsaved input that does not exist.
+ expect(logic.values.scoutCreateFormChanged).toBe(false)
+
+ // A caller that chose specific servers keeps that choice.
+ const prefilled = scoutCreateModalLogic({
+ logicKey: 'prefilled-servers',
+ initialValues: { config: { mcp_gateway_server_ids: ['linear-id'] } },
+ onClose,
+ })
+ prefilled.mount()
+ await expectLogic(prefilled).toFinishAllListeners()
+ expect(prefilled.values.scoutCreateForm.config.mcp_gateway_server_ids).toEqual(['linear-id'])
+ prefilled.unmount()
+ })
+
it('submits a daily run time as a project-timezone cron schedule', async () => {
mockSignalsScoutCreate.mockResolvedValue(CREATED_SCOUT)
logic = scoutCreateModalLogic({
diff --git a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts
index 9c408288c3f4..618894e315a8 100644
--- a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts
+++ b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts
@@ -1,6 +1,7 @@
-import { LogicWrapper, MakeLogicType, actions, connect, kea, key, listeners, path, props } from 'kea'
+import { LogicWrapper, MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { forms } from 'kea-forms'
import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
+import { subscriptions } from 'kea-subscriptions'
import { lemonToast } from '@posthog/lemon-ui'
@@ -9,6 +10,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { teamLogic } from 'scenes/teamLogic'
+import type { MCPServiceAccountServerApi } from 'products/mcp_store/frontend/generated/api.schemas'
import { signalsScoutCreate } from 'products/signals/frontend/generated/api'
import type {
SignalScoutConfigOptionsApi,
@@ -28,6 +30,7 @@ import {
timeToDailyCron,
} from '../utils/scoutRunsWindow'
import { MAX_SCOUT_TAG_LENGTH, MAX_SCOUT_TAGS, normalizeScoutTag } from '../utils/scoutTags'
+import { scoutMcpServersLogic } from './scoutMcpServersLogic'
type ScoutCreateConfigFormValues = Required<
Pick<
@@ -141,9 +144,11 @@ function scoutTagsError(tags: string[]): string | undefined {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface scoutCreateModalLogicValues {
featureFlags: FeatureFlagsSet // featureFlagLogic
+ teamScoutServers: MCPServiceAccountServerApi[] // scoutMcpServersLogic
currentTeamId: number | null // teamLogic
isScoutCreateFormSubmitting: boolean
isScoutCreateFormValid: boolean
+ mcpServersDefaulted: boolean
scoutCreateForm: ScoutCreateFormValues
scoutCreateFormAllErrors: Record<string, any>
scoutCreateFormChanged: boolean
@@ -158,6 +163,9 @@ export interface scoutCreateModalLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface scoutCreateModalLogicActions {
+ markMcpServersDefaulted: () => {
+ value: true
+ }
resetScoutCreateForm: (values?: ScoutCreateFormValues) => {
values?: ScoutCreateFormValues
}
@@ -218,12 +226,29 @@ export const scoutCreateModalLogic: LogicWrapper<scoutCreateModalLogicType> = ke
props({} as ScoutCreateModalLogicProps),
key((logicProps) => logicProps.logicKey),
connect(() => ({
- values: [teamLogic, ['currentTeamId'], featureFlagLogic, ['featureFlags']],
+ values: [
+ teamLogic,
+ ['currentTeamId'],
+ featureFlagLogic,
+ ['featureFlags'],
+ scoutMcpServersLogic,
+ ['teamScoutServers'],
+ ],
})),
actions({
setScoutCreateScheduleMode: (scheduleMode: string) => ({ scheduleMode }),
setScoutCreateDailyTime: (dailyTime: string) => ({ dailyTime }),
+ markMcpServersDefaulted: true,
}),
+ reducers(({ props: logicProps }) => ({
+ // A caller that passes explicit server ids opts out of the "all servers" default.
+ mcpServersDefaulted: [
+ logicProps.initialValues?.config?.mcp_gateway_server_ids !== undefined,
+ {
+ markMcpServersDefaulted: () => true,
+ },
+ ],
+ })),
forms(({ props: logicProps, actions, values }) => ({
scoutCreateForm: {
defaults: getScoutCreateFormValues(logicProps.initialValues, isInboxRedesignEnabled(values.featureFlags)),
@@ -290,6 +315,29 @@ export const scoutCreateModalLogic: LogicWrapper<scoutCreateModalLogicType> = ke
},
},
})),
+ // The team's servers load asynchronously, so the default is applied once they arrive
+ // rather than in the form defaults. Applying it once keeps a later reload from
+ // re-selecting servers the user switched off.
+ subscriptions(({ actions, values }) => ({
+ teamScoutServers: (teamScoutServers: MCPServiceAccountServerApi[]) => {
+ if (values.mcpServersDefaulted || teamScoutServers.length === 0) {
+ return
+ }
+ actions.markMcpServersDefaulted()
+ const mcpGatewayServerIds = teamScoutServers.map((server) => server.id)
+ if (values.scoutCreateFormChanged) {
+ // The user edited the form before the servers loaded, so keep the changed flag.
+ actions.setScoutCreateFormValue('config.mcp_gateway_server_ids', mcpGatewayServerIds)
+ return
+ }
+ // Apply the default through a reset so the pre-selection keeps the form pristine. A form
+ // marked changed blocks the overlay-close click and shows a false "unsaved input" warning.
+ actions.resetScoutCreateForm({
+ ...values.scoutCreateForm,
+ config: { ...values.scoutCreateForm.config, mcp_gateway_server_ids: mcpGatewayServerIds },
+ })
+ },
+ })),
listeners(({ actions, values }) => ({
setScoutCreateScheduleMode: ({ scheduleMode }) => {
if (scheduleMode === SCOUT_CUSTOM_CRON_SCHEDULE_MODE) {